:root {
  color-scheme: light;
  --paper: #f6f2e9;
  --surface: #fffdf8;
  --ink: #202824;
  --muted: #66706b;
  --line: #d9ded7;
  --forest: #24594b;
  --forest-dark: #173f35;
  --mint: #cde6d8;
  --lime: #ddec8d;
  --peach: #f5c7a9;
  --blue: #cfe2ee;
  --danger: #9f3f35;
  --shadow: 0 24px 70px rgba(34, 61, 50, 0.11);
  --radius-lg: 32px;
  --radius-md: 20px;
  --radius-sm: 12px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(221, 236, 141, 0.34), transparent 28rem),
    radial-gradient(circle at 90% 92%, rgba(207, 226, 238, 0.45), transparent 30rem),
    var(--paper);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid #83aa9b;
  outline-offset: 3px;
}

.topbar {
  width: min(1120px, calc(100% - 40px));
  min-height: 76px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand,
.text-button,
.icon-button {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: white;
  background: var(--forest);
  font-size: 0.95rem;
}

.text-button {
  padding: 10px 4px;
  color: var(--forest-dark);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 4px;
}

.text-button:hover {
  text-decoration-color: currentColor;
}

.app-shell {
  width: min(1120px, calc(100% - 40px));
  margin: 16px auto 72px;
}

.timer-active .topbar {
  display: none;
}

.timer-active .app-shell {
  margin-top: 20px;
}

.panel {
  padding: clamp(28px, 5vw, 64px);
  border: 1px solid rgba(36, 89, 75, 0.12);
  border-radius: var(--radius-lg);
  background: rgba(255, 253, 248, 0.91);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero {
  min-height: min(680px, calc(100vh - 150px));
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(260px, 0.7fr);
  align-items: center;
  gap: clamp(32px, 6vw, 88px);
}

.hero::after {
  content: "";
  position: absolute;
  right: -90px;
  bottom: -90px;
  width: 330px;
  height: 330px;
  border-radius: 46% 54% 61% 39% / 37% 38% 62% 63%;
  background: var(--mint);
  z-index: -1;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--forest);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 800px;
  margin-bottom: 20px;
  font-size: clamp(2.45rem, 6vw, 5.4rem);
  line-height: 0.98;
  letter-spacing: -0.06em;
}

h2 {
  font-size: clamp(1.55rem, 3vw, 2.35rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

h3 {
  margin-bottom: 6px;
  font-size: 1rem;
}

.lead {
  max-width: 680px;
  margin-bottom: 30px;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  line-height: 1.62;
}

.primary-button,
.secondary-button,
.danger-button,
.answer-card {
  min-height: 54px;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 14px 22px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease;
}

.primary-button {
  color: white;
  background: var(--forest);
  box-shadow: 0 10px 24px rgba(36, 89, 75, 0.22);
}

.primary-button:hover,
.secondary-button:hover,
.danger-button:hover,
.answer-card:hover {
  transform: translateY(-2px);
}

.primary-button:hover {
  background: var(--forest-dark);
}

.secondary-button,
.danger-button {
  background: transparent;
  border-color: var(--line);
}

.secondary-button:hover {
  border-color: var(--forest);
  background: rgba(205, 230, 216, 0.35);
}

.danger-button {
  color: var(--danger);
  border-color: rgba(159, 63, 53, 0.3);
}

.hero-note {
  padding: 26px;
  border-radius: var(--radius-md);
  background: var(--forest);
  color: white;
  transform: rotate(2deg);
}

.hero-note p {
  margin: 0;
  font-size: clamp(1.2rem, 3vw, 1.75rem);
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.hero-note small {
  display: block;
  margin-top: 22px;
  color: var(--mint);
}

.question-panel {
  width: min(820px, 100%);
  min-height: 610px;
  margin: 0 auto;
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 42px;
}

.progress-track {
  height: 8px;
  flex: 1;
  overflow: hidden;
  border-radius: 999px;
  background: #e8e7df;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--forest);
  transition: width 250ms ease;
}

.progress-label {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 750;
  white-space: nowrap;
}

.question-heading {
  margin-bottom: 26px;
}

.question-heading p {
  color: var(--muted);
  line-height: 1.55;
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.answer-card {
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: var(--radius-sm);
  border-color: var(--line);
  background: var(--surface);
  text-align: left;
}

.answer-card.selected {
  border-color: var(--forest);
  background: var(--mint);
  box-shadow: inset 0 0 0 1px var(--forest);
}

.answer-check {
  width: 23px;
  height: 23px;
  flex: 0 0 23px;
  display: grid;
  place-items: center;
  border: 1.5px solid #aab4ae;
  border-radius: 7px;
  font-size: 0.8rem;
}

.selected .answer-check {
  color: white;
  border-color: var(--forest);
  background: var(--forest);
}

.question-actions,
.mission-actions,
.history-actions,
.timer-actions,
.feedback-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 30px;
}

.question-actions .primary-button {
  margin-left: auto;
}

.mission-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(360px, 1.1fr);
  gap: clamp(28px, 5vw, 68px);
}

.mission-kicker {
  display: inline-flex;
  margin-bottom: 18px;
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--lime);
  color: #3b471a;
  font-size: 0.8rem;
  font-weight: 850;
}

.mission-title {
  font-size: clamp(2.4rem, 5vw, 4.5rem);
}

.mission-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 30px 0;
}

.meta-card {
  min-height: 90px;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: #f1efe7;
}

.meta-card span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.exercise-list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: exercise;
}

.exercise-list li {
  position: relative;
  min-height: 70px;
  padding: 14px 12px 14px 58px;
  border-bottom: 1px solid var(--line);
  counter-increment: exercise;
}

.exercise-list li::before {
  content: counter(exercise, decimal-leading-zero);
  position: absolute;
  left: 8px;
  top: 16px;
  color: var(--forest);
  font-size: 0.82rem;
  font-weight: 850;
}

.exercise-list p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.timer-screen {
  width: min(980px, 100%);
  min-height: calc(100vh - 150px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.timer-screen.work {
  background: var(--forest-dark);
  color: white;
}

.timer-screen.rest {
  background: #dbe9e3;
}

.timer-screen.countdown {
  background: #f5d6c3;
}

.timer-topline {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: clamp(26px, 6vh, 64px);
  color: inherit;
  opacity: 0.78;
  font-size: 0.9rem;
  font-weight: 750;
}

.phase-label {
  margin-bottom: 4px;
  color: inherit;
  opacity: 0.78;
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.timer-exercise {
  max-width: 800px;
  margin-bottom: 4px;
  font-size: clamp(2rem, 5vw, 4.7rem);
}

.timer-digits {
  margin: 12px 0;
  font-size: clamp(7rem, 25vw, 15rem);
  font-weight: 850;
  line-height: 0.85;
  letter-spacing: -0.09em;
  font-variant-numeric: tabular-nums;
}

.timer-next {
  min-height: 44px;
  margin: 8px 0 0;
  color: inherit;
  opacity: 0.75;
}

.timer-actions {
  justify-content: center;
}

.work .secondary-button,
.work .danger-button {
  color: white;
  border-color: rgba(255, 255, 255, 0.35);
}

.centered-state {
  min-height: 560px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.completion-mark {
  width: 86px;
  height: 86px;
  display: grid;
  place-items: center;
  margin-bottom: 24px;
  border-radius: 28px;
  background: var(--lime);
  color: var(--forest-dark);
  font-size: 2.6rem;
  font-weight: 900;
  transform: rotate(-4deg);
}

.feedback-actions {
  justify-content: center;
  margin-top: 16px;
}

.history-header {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  align-items: end;
  margin-bottom: 34px;
}

.history-header h1 {
  margin-bottom: 0;
  font-size: clamp(2.3rem, 5vw, 4rem);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 36px;
}

.stat-card {
  padding: 20px;
  border-radius: var(--radius-md);
  background: #eff1e9;
}

.stat-card strong {
  display: block;
  margin-bottom: 5px;
  font-size: 2rem;
}

.stat-card span {
  color: var(--muted);
  font-size: 0.86rem;
}

.history-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 20px 4px;
  border-bottom: 1px solid var(--line);
}

.history-item p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.status-pill {
  align-self: center;
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--mint);
  color: var(--forest-dark);
  font-size: 0.75rem;
  font-weight: 850;
}

.status-pill.early {
  background: #eee4dc;
  color: #765447;
}

.empty-state {
  padding: 54px 20px;
  border: 1px dashed #bbc4bd;
  border-radius: var(--radius-md);
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 20;
  max-width: calc(100% - 32px);
  transform: translateX(-50%);
  border-radius: 999px;
  padding: 12px 18px;
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow);
  font-weight: 750;
  animation: toast-in 180ms ease-out;
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
}

@media (max-width: 760px) {
  .topbar,
  .app-shell {
    width: min(100% - 24px, 1120px);
  }

  .topbar {
    min-height: 66px;
  }

  .app-shell {
    margin-top: 8px;
    margin-bottom: 32px;
  }

  .panel {
    padding: 24px;
    border-radius: 24px;
  }

  .hero,
  .mission-layout {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: calc(100vh - 96px);
  }

  .hero-note {
    transform: none;
  }

  .answer-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .answer-card {
    min-height: 60px;
  }

  .question-panel {
    min-height: calc(100vh - 98px);
  }

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

  .history-header {
    align-items: start;
    flex-direction: column;
  }

  .timer-screen {
    min-height: calc(100vh - 98px);
  }

  .timer-actions > button {
    flex: 1 1 130px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
