@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;
  --stage: #06090f;
  --stage-ink: #edf5ff;
  --stage-panel: rgba(10, 16, 26, 0.76);
  --center-glow: rgba(57, 184, 255, 0.42);
  --grid-line: rgba(255, 255, 255, 0.12);
}

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;
  --stage: #edf6fb;
  --stage-ink: #09232f;
  --stage-panel: rgba(255, 255, 255, 0.78);
  --center-glow: rgba(57, 184, 255, 0.24);
  --grid-line: rgba(9, 35, 47, 0.12);
}

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

* {
  box-sizing: border-box;
}

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

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

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

button,
select,
input,
textarea {
  border-radius: 18px;
}

button {
  border: 1px solid var(--line);
  padding: 1rem 1.35rem;
  cursor: pointer;
  font-weight: 800;
  font-size: 1.02rem;
  letter-spacing: 0.01em;
  transition: transform 140ms ease, opacity 140ms ease, background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

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

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

.primary {
  background: var(--go);
  color: #ffffff;
  border-color: transparent;
}

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

.danger {
  background: var(--red);
  color: #ffffff;
  border-color: transparent;
}

.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;
}

.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);
}

.hero-topbar,
.section-heading,
.summary-panel,
.button-row,
.exercise-topbar {
  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,
.metric span,
.scale-label {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1,
h2,
p {
  margin: 0;
}

h1,
h2 {
  line-height: 0.95;
  letter-spacing: -0.04em;
}

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

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;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: none;
}

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

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

.hero-action {
  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 {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.32);
}

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

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

.setup-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.2rem;
}

.span-2 {
  grid-column: span 2;
}

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

.field input,
.field select,
textarea {
  width: 100%;
  padding: 1rem;
  color: var(--ink);
  background: var(--panel-strong);
  border: 1px solid var(--line);
  font-size: 1.05rem;
  font-weight: 600;
}

.range-card,
.metric,
.rating-grid button,
.linear-scale,
.summary-panel {
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

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

.range-card input {
  width: 100%;
  accent-color: var(--blue);
}

.range-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.7rem;
  color: var(--muted);
}

.range-meta strong {
  color: var(--blue);
  font-size: 1.15rem;
}

.summary-panel {
  margin-top: 1.2rem;
  padding: 1rem 1.1rem;
  border-radius: 22px;
}

.summary-copy,
.countdown-summary {
  color: var(--muted);
  line-height: 1.6;
}

.setup-actions {
  align-items: stretch;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.setup-actions button {
  min-width: 180px;
}

#start-session {
  min-width: 240px;
  padding-inline: 1.8rem;
  font-size: 1.08rem;
  box-shadow: 0 18px 34px rgba(25, 196, 74, 0.22);
  order: -1;
}

.home-button {
  min-width: 110px;
  padding-inline: 1.2rem;
  white-space: nowrap;
}

.countdown-screen.active {
  display: grid;
  min-height: calc(100vh - 2rem);
  place-items: center;
}

.countdown-shell {
  text-align: center;
}

.countdown-label {
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  color: var(--muted);
}

.countdown-number {
  font-size: clamp(6rem, 24vw, 12rem);
  font-weight: 900;
  line-height: 0.9;
  margin: 0.25rem 0 0.8rem;
  color: var(--yellow);
}

body.session-mode .app-shell {
  width: 100%;
  max-width: none;
  padding: 0;
}

.exercise-screen.active {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  background: var(--stage);
  color: var(--stage-ink);
}

.exercise-topbar {
  padding: 1rem;
  background: var(--stage-panel);
  backdrop-filter: blur(16px);
  position: relative;
  z-index: 2;
}

.metric {
  padding: 0.85rem 1rem;
  border-radius: 20px;
  color: var(--ink);
}

.metric strong {
  display: block;
  font-size: 1.1rem;
}

.exercise-actions {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.exercise-stage {
  position: relative;
  flex: 1;
  overflow: hidden;
  background:
    radial-gradient(circle at center, var(--center-glow) 0, transparent 22%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent);
}

.background-overlay {
  position: absolute;
  inset: -20%;
  opacity: 0;
  background-image:
    linear-gradient(to right, transparent 0 48%, var(--grid-line) 48% 52%, transparent 52% 100%),
    linear-gradient(to bottom, transparent 0 48%, var(--grid-line) 48% 52%, transparent 52% 100%);
  background-size: 220px 220px;
  transition: opacity 220ms ease;
}

.exercise-stage.bg-horizontal .background-overlay,
.exercise-stage.bg-vertical .background-overlay,
.exercise-stage.bg-combination .background-overlay {
  opacity: 1;
}

.exercise-stage.bg-horizontal .background-overlay {
  animation: slide-horizontal 6s linear infinite;
}

.exercise-stage.bg-vertical .background-overlay {
  animation: slide-vertical 6s linear infinite;
}

.exercise-stage.bg-combination .background-overlay {
  animation: slide-combo 7s linear infinite;
}

.center-target,
.side-target {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
}

.center-target {
  left: 50%;
  width: 128px;
  height: 128px;
}

.center-ring,
.center-core {
  position: absolute;
  inset: 50%;
  transform: translate(-50%, -50%);
  border-radius: 999px;
}

.ring-outer {
  width: 128px;
  height: 128px;
  border: 3px solid rgba(255, 255, 255, 0.22);
}

.ring-middle {
  width: 92px;
  height: 92px;
  border: 3px solid rgba(255, 255, 255, 0.48);
}

.ring-pulse {
  width: 64px;
  height: 64px;
  border: 4px solid var(--blue);
  box-shadow: 0 0 0 0 rgba(57, 184, 255, 0.35);
  animation: pulse-ring 1.4s ease-out infinite;
}

.center-core {
  width: 24px;
  height: 24px;
  background: var(--blue);
  box-shadow: 0 0 30px rgba(57, 184, 255, 0.7);
}

.side-target {
  min-width: 86px;
  min-height: 86px;
  padding: 1rem 1.15rem;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.98);
  color: #041620;
  border: 4px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.32);
  opacity: 1;
  transition: opacity 120ms ease, transform 120ms ease;
}

.side-target.hidden {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.92);
}

.side-target.is-left {
  left: 18%;
}

.side-target.is-right {
  left: 82%;
}

.side-target.simple-round {
  min-width: 94px;
  min-height: 94px;
  padding: 0;
  border-radius: 999px;
  box-shadow:
    0 0 0 6px rgba(255, 255, 255, 0.18),
    0 18px 42px rgba(0, 0, 0, 0.4);
}

.side-target.alphabetical-letters,
.side-target.randomized-letters {
  min-width: 104px;
  min-height: 104px;
  font-size: 3rem;
  font-weight: 900;
}

.side-target.random-color {
  min-width: 112px;
  min-height: 112px;
  border-radius: 999px;
  padding: 0;
}

.side-target.randomized-words {
  min-width: 170px;
  min-height: 88px;
  padding-inline: 1.5rem;
  font-size: 1.65rem;
  font-weight: 900;
  letter-spacing: 0.01em;
}

.side-target-content {
  line-height: 1;
}

.exercise-footer {
  padding: 1rem 1.25rem 1.25rem;
  background: var(--stage-panel);
  backdrop-filter: blur(16px);
  display: grid;
  gap: 0.35rem;
  text-align: center;
  position: relative;
  z-index: 2;
}

.exercise-footer p:first-child {
  font-size: clamp(1rem, 2.6vw, 1.2rem);
  font-weight: 700;
}

.exercise-footer p:last-child {
  color: rgba(237, 245, 255, 0.72);
}

body[data-theme="light"] .exercise-footer p:last-child {
  color: rgba(9, 35, 47, 0.68);
}

.post-card {
  margin-top: 0;
}

.post-card .button-row {
  margin-top: 1.5rem;
  padding-top: 0.35rem;
}

.rating-scale {
  margin-top: 1rem;
  display: grid;
  gap: 1rem;
}

.rating-grid {
  display: grid;
  grid-template-columns: repeat(11, minmax(0, 1fr));
  gap: 0.6rem;
}

.rating-grid button {
  min-height: 74px;
  min-width: 0;
  padding: 0.75rem 0.25rem;
  border-radius: 22px;
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--ink);
}

.rating-grid button.selected {
  background: var(--blue);
  border-color: transparent;
  color: var(--card-ink);
}

.linear-scale {
  margin: 1rem 0 1.2rem;
  padding: 0.8rem 1rem;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--muted);
  font-weight: 800;
}

.scale-bar {
  flex: 1;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #5cff95 0%, #ffe44d 50%, #ef476f 100%);
}

textarea {
  min-height: 190px;
  resize: vertical;
}

@keyframes pulse-ring {
  0% {
    transform: translate(-50%, -50%) scale(0.94);
    box-shadow: 0 0 0 0 rgba(57, 184, 255, 0.38);
  }
  70% {
    transform: translate(-50%, -50%) scale(1.08);
    box-shadow: 0 0 0 24px rgba(57, 184, 255, 0);
  }
  100% {
    transform: translate(-50%, -50%) scale(0.94);
    box-shadow: 0 0 0 0 rgba(57, 184, 255, 0);
  }
}

@keyframes slide-horizontal {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-140px);
  }
}

@keyframes slide-vertical {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-140px);
  }
}

@keyframes slide-combo {
  from {
    transform: translate(0, 0);
  }
  to {
    transform: translate(-140px, -140px);
  }
}

@media (max-width: 980px) {
  .hero-topbar,
  .section-heading,
  .summary-panel,
  .exercise-topbar,
  .button-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-actions,
  .exercise-actions,
  .setup-actions {
    width: 100%;
    justify-content: stretch;
  }

  .hero-action,
  .exercise-actions button,
  .setup-actions button,
  .button-row button {
    width: 100%;
  }

  .setup-grid {
    grid-template-columns: 1fr 1fr;
  }

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

  .side-target.is-left {
    left: 20%;
  }

  .side-target.is-right {
    left: 80%;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100%, calc(100% - 1rem));
  }

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

  .setup-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }

  .exercise-topbar {
    padding-bottom: 0.5rem;
  }

  .metric {
    width: 100%;
  }

  .center-target {
    width: 108px;
    height: 108px;
  }

  .ring-outer {
    width: 108px;
    height: 108px;
  }

  .ring-middle {
    width: 76px;
    height: 76px;
  }

  .ring-pulse {
    width: 52px;
    height: 52px;
  }

  .side-target.is-left {
    left: 18%;
  }

  .side-target.is-right {
    left: 82%;
  }

  .side-target.randomized-words {
    min-width: 132px;
    font-size: 1.2rem;
  }

  .rating-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.7rem;
  }

  .rating-grid button {
    min-height: 68px;
    font-size: 1.55rem;
  }
}
