:root {
  --bg: #111111;
  --bg-2: #151a17;
  --card: #1e1e1e;
  --card-2: #222722;
  --text: #ffffff;
  --muted: #afafaf;
  --accent: #4caf50;
  --accent-2: #2e7d32;
  --line: #2b312d;
  --glow: rgba(76, 175, 80, 0.18);
}

[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background:
    radial-gradient(1200px 700px at 10% -20%, #223128 0%, transparent 55%),
    radial-gradient(1000px 500px at 90% -15%, #19211d 0%, transparent 58%),
    linear-gradient(165deg, var(--bg-2) 0%, var(--bg) 50%, #0d0d0d 100%);
}

.app {
  width: min(480px, 100%);
  margin: 0 auto;
  min-height: 100svh;
  padding: calc(14px + env(safe-area-inset-top)) 14px calc(20px + env(safe-area-inset-bottom));
  animation: fade-in 350ms ease;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

h1 {
  margin: 0;
  font-size: clamp(1.65rem, 4.3vw, 2rem);
  letter-spacing: 0.01em;
}

.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(140deg, #1d261f 0%, #151715 62%, #131313 100%);
  border: 1px solid #2f3832;
}

.hero::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  right: -48px;
  top: -60px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(76, 175, 80, 0.3) 0%, rgba(76, 175, 80, 0) 70%);
  pointer-events: none;
}

.hero.slim {
  padding-bottom: 12px;
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: #9fc5a2;
}

.hero-sub {
  margin: 8px 0 0;
  color: #c8c8c8;
  font-size: 0.95rem;
}

.card {
  background: linear-gradient(145deg, var(--card-2) 0%, var(--card) 70%);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
}

.card.lift {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.26), 0 0 0 1px rgba(76, 175, 80, 0.06) inset;
}

label,
p,
.label {
  color: var(--muted);
  font-size: 14px;
}

.section-title-row {
  margin-top: 12px;
}

select,
input,
button {
  width: 100%;
  min-height: 44px;
  background: #101210;
  color: var(--text);
  border: 1px solid #333b35;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 16px;
}

select:focus,
input:focus,
button:focus {
  outline: none;
  border-color: #5bb95f;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

button,
.link-btn {
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}

button:active,
.link-btn:active {
  transform: translateY(1px);
}

button.accent {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 10px 20px var(--glow);
}

button.secondary {
  background: linear-gradient(135deg, #263329 0%, #1f2a21 100%);
  border-color: #38553b;
}

button.ghost {
  background: #111311;
  border-color: #323832;
}

.actions {
  display: grid;
  gap: 9px;
}

.status {
  margin: 8px 0 0;
  min-height: 20px;
  text-align: center;
  color: #b7b7b7;
  font-size: 0.92rem;
}

.days-list {
  display: grid;
  gap: 8px;
}

.day-item {
  text-align: left;
  position: relative;
  background: linear-gradient(145deg, #121612, #0f1110);
  border-color: #313a33;
  overflow: hidden;
}

.day-item::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: transparent;
}

.day-item.completed {
  border-color: #4f8e52;
}

.day-item.completed::before {
  background: #4caf50;
}

.day-item.locked {
  opacity: 0.48;
}

.day-item.selected {
  border-color: #67c06a;
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.settings {
  display: grid;
  gap: 8px;
}

.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #131713;
  border: 1px solid #303730;
  border-radius: 12px;
  padding: 8px 10px;
}

.toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.big {
  margin-top: 10px;
  text-align: center;
  font-size: 1.6rem;
  font-weight: 700;
}

.exercise-title {
  text-align: center;
  font-size: 1.3rem;
  min-height: 1.5em;
}

.timer {
  text-align: center;
  font-size: clamp(2.8rem, 13vw, 4.1rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 8px;
  min-height: 1.2em;
}

.img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  overflow: hidden;
  background: #131513;
  border: 1px solid #2d352f;
}

.img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.img-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(4, 5, 4, 0.5);
  z-index: 1;
  font-size: 0.9rem;
}

.img-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--card-2);
  z-index: 1;
  font-size: 1.4rem;
  font-weight: 600;
  text-align: center;
  padding: 24px;
}

.progress-text {
  margin: 11px 0 8px;
  text-align: center;
  color: #b6b6b6;
}

.progress-track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: #2a302b;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #4caf50, #7dcb7f);
  transition: width 200ms linear;
}

.prestart {
  text-align: center;
}

.finish {
  border-color: #3f6341;
  background: linear-gradient(145deg, #1f2a20 0%, #1a1f1a 100%);
}

.link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  text-decoration: none;
  color: var(--text);
  background: #101210;
  border: 1px solid #333b35;
  border-radius: 12px;
  padding: 10px 12px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.tab-btn.active {
  border-color: #4f8e52;
  background: linear-gradient(135deg, #2a3a2d, #1f2a21);
}

.admin-grid {
  display: grid;
  gap: 12px;
}

.admin form {
  display: grid;
  gap: 8px;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 10px 0;
}

.item-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.item-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  background: #131713;
  border: 1px solid #303730;
  border-radius: 12px;
  padding: 8px;
}

.item-row.drop-target {
  border-color: #67c06a;
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

@media (min-width: 760px) {
  .admin-grid {
    grid-template-columns: 1fr 1fr;
  }

  .inline-form {
    grid-template-columns: 1fr 180px auto;
  }
}
