@import url("https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible+Next:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #050505;
  --panel: #111111;
  --panel-strong: #1b1b1b;
  --ink: #f4f4ef;
  --muted: #afb3ad;
  --line: #272727;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  --blue: #39b8ff;
  --mint: #5cff95;
  --yellow: #ffe44d;
  --red: #d71920;
  --go: #19c44a;
  --card-ink: #071014;
}

body[data-theme="light"] {
  --bg: #eef4f4;
  --panel: #ffffff;
  --panel-strong: #f4f7f7;
  --ink: #0f2026;
  --muted: #5f7076;
  --line: #d9e1e3;
  --shadow: 0 16px 34px rgba(15, 32, 38, 0.08);
  --card-ink: #071014;
}

body[data-theme="light"] .countdown-number {
  color: #000000;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Atkinson Hyperlegible Next", "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

a,
button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 2.5rem;
}

.site-footer {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.95rem;
  color: var(--muted);
  padding: 0.5rem 0 0;
  line-height: 1.5;
}

.hero {
  margin-bottom: 1rem;
}

.hero.hidden {
  display: none;
}

.hero-topbar,
.section-heading,
.documentation-actions,
.session-topbar,
.button-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand-mark {
  width: 82px;
  height: 82px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  text-decoration: none;
}

.brand-mark img {
  width: 72%;
  height: 72%;
  object-fit: contain;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.eyebrow,
.step-label,
.set-chip,
.metric span,
.doc-stat span {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow {
  color: #8f948c;
}

.step-label,
.set-chip,
.metric span,
.doc-stat span {
  color: var(--muted);
}

.hero h1,
.section-heading h2 {
  margin: 0;
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
}

.section-heading h2 {
  font-size: clamp(1.5rem, 4vw, 2.4rem);
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.theme-dock {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
}

.theme-icon {
  width: 42px;
  height: 42px;
  min-height: 42px;
  min-width: 42px;
  flex: 0 0 42px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: none;
  transition: background-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.theme-icon:hover {
  transform: translateY(-1px);
}

.theme-icon.is-active {
  background: var(--blue);
  color: var(--card-ink);
}

.hero-action,
button {
  min-height: 62px;
  border-radius: 20px;
  border: 1px solid var(--line);
  padding: 0.95rem 1.35rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}

.hero-action:hover,
button:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.32);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
  box-shadow: none;
}

.primary {
  background: var(--blue);
  color: var(--card-ink);
  border-color: transparent;
}

#start-button,
#restart-button {
  background: var(--go);
  color: #ffffff;
  border-color: transparent;
}

#end-set-button,
#generate-early-button {
  background: var(--red);
  color: #ffffff;
  border-color: transparent;
}

.secondary {
  background: var(--panel-strong);
  color: var(--ink);
}

.hero-action.primary {
  background: var(--blue);
  color: var(--card-ink);
  border-color: transparent;
}

.hero-action.secondary {
  background: var(--panel-strong);
  color: var(--ink);
}

.hero-strip {
  margin-top: 14px;
  min-height: 66px;
  padding: 18px 20px;
  border-radius: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 700;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 1.35rem;
  box-shadow: var(--shadow);
}

.grid {
  display: grid;
  gap: 1rem;
  margin: 1rem 0;
}

.two-up {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.three-up {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.four-up {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.five-up {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 0.5rem;
  font-weight: 700;
}

.field span,
.toggle-title,
.summary-card span {
  font-size: 0.95rem;
}

select,
textarea,
.range-wrap,
.toggle-card,
.summary-card,
.metric,
.doc-stat,
.rating-button,
.linear-scale {
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

select,
textarea {
  width: 100%;
  color: var(--ink);
  padding: 1rem;
  border-radius: 20px;
}

.range-wrap,
.toggle-card,
.summary-card {
  border-radius: 24px;
}

.range-wrap {
  padding: 1rem;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--blue);
}

.range-wrap strong {
  display: block;
  margin-top: 0.55rem;
  font-size: 1.22rem;
  color: var(--blue);
}

.toggle-card {
  padding: 1rem 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.toggle-card p,
.summary-card p,
.countdown-summary,
.session-instructions p,
.rating-visual p {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.toggle-card input {
  width: 1.5rem;
  height: 1.5rem;
  accent-color: var(--mint);
}

.summary-card {
  padding: 1rem 1.1rem;
}

.center {
  justify-content: center;
}

.countdown-screen {
  text-align: center;
  min-height: 65vh;
  display: none;
  place-items: center;
}

.countdown-screen.active {
  display: grid;
}

.countdown-number {
  font-size: clamp(6rem, 18vw, 12rem);
  line-height: 0.9;
  color: var(--yellow);
  font-weight: 800;
}

.exercise-screen {
  min-height: 82vh;
  display: none;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.2rem;
}

.exercise-screen.active {
  display: flex;
}

.session-topbar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 0.8rem 1rem;
}

.metric,
.doc-stat {
  padding: 0.6rem 0.95rem;
  border-radius: 18px;
  display: grid;
}

.metric strong,
.doc-stat strong {
  font-size: 1.25rem;
}

.target-stage {
  flex: 1;
  min-height: 420px;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  border-radius: 36px;
  background: #0a0a0a;
  border: 1px solid #1b1b1b;
}

body[data-theme="light"] .target-stage {
  background: #f4f8f8;
  border-color: #dbe3e5;
}

body[data-theme="light"] .target-stage::before {
  background:
    linear-gradient(rgba(15, 32, 38, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 32, 38, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
}

.target-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}

.focus-target {
  position: relative;
  width: 240px;
  height: 240px;
  will-change: transform;
}

.target-ring,
.target-center {
  position: absolute;
  inset: 0;
  margin: auto;
  border-radius: 999px;
}

.ring-outer {
  width: 240px;
  height: 240px;
  border: 8px solid rgba(57, 184, 255, 0.25);
}

.ring-middle {
  width: 140px;
  height: 140px;
  border: 10px solid rgba(92, 255, 149, 0.5);
}

.ring-inner {
  width: 56px;
  height: 56px;
  background: #ffffff;
  border: 8px solid var(--blue);
  box-shadow: 0 0 0 20px rgba(57, 184, 255, 0.12);
}

.target-center {
  width: 18px;
  height: 18px;
  background: var(--red);
  box-shadow: 0 0 0 10px rgba(255, 107, 87, 0.15);
}

.ring-inner,
.target-center {
  transition: transform 100ms ease-out, box-shadow 100ms ease-out;
  transform-origin: center;
}

.ring-inner.is-pulsing {
  animation: metronomePulseRing 220ms ease-out;
}

.target-center.is-pulsing {
  animation: metronomePulseCenter 220ms ease-out;
}

@keyframes metronomePulseRing {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 20px rgba(57, 184, 255, 0.12);
  }
  40% {
    transform: scale(1.12);
    box-shadow: 0 0 0 28px rgba(57, 184, 255, 0.2);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 20px rgba(57, 184, 255, 0.12);
  }
}

@keyframes metronomePulseCenter {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 10px rgba(255, 107, 87, 0.15);
  }
  40% {
    transform: scale(1.2);
    box-shadow: 0 0 0 16px rgba(255, 107, 87, 0.22);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 10px rgba(255, 107, 87, 0.15);
  }
}

.session-instructions {
  text-align: center;
}

#instruction-line {
  font-size: clamp(1.2rem, 3vw, 2rem);
  color: var(--ink);
}

#meta-line {
  color: var(--muted);
}

.rating-visual {
  text-align: center;
  margin: 1rem 0;
}

.selected-rating {
  font-size: clamp(2.6rem, 8vw, 5rem);
  line-height: 1;
  color: var(--yellow);
  font-weight: 800;
}

.rating-grid {
  display: grid;
  grid-template-columns: repeat(11, minmax(76px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.rating-button {
  min-height: 96px;
  padding: 0.9rem 0.5rem;
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 900;
  color: var(--ink);
  box-shadow: none;
}

.rating-button.selected {
  background: var(--blue);
  color: var(--card-ink);
  border-color: transparent;
  transform: translateY(-2px);
}

.linear-scale {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 22px;
  margin-bottom: 0.75rem;
}

.scale-bar {
  height: 10px;
  border-radius: 999px;
  flex: 1;
  background: linear-gradient(90deg, var(--mint) 0%, var(--yellow) 50%, var(--red) 100%);
}

textarea {
  min-height: 360px;
  margin-top: 1rem;
  resize: vertical;
  line-height: 1.55;
}

@media (max-width: 900px) {
  .hero-topbar,
  .section-heading,
  .documentation-actions,
  .button-row,
  .session-topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .brand-block {
    width: 100%;
  }

  .hero-actions {
    width: 100%;
  }

  .theme-dock {
    width: 100%;
    justify-content: center;
  }

  .hero-action,
  button {
    width: 100%;
  }

  .two-up,
  .three-up,
  .four-up,
  .five-up,
  .rating-grid {
    grid-template-columns: 1fr;
  }

  .rating-grid {
    gap: 0.85rem;
  }

  .target-stage {
    min-height: 320px;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 1rem, 1100px);
    padding-top: 1rem;
  }

  .card {
    border-radius: 24px;
    padding: 1rem;
  }

  .brand-block {
    align-items: flex-start;
  }

  .brand-mark {
    width: 72px;
    height: 72px;
  }
}
