:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #5d6974;
  --line: #dfe7ea;
  --paper: #f7f3e8;
  --surface: #fffdf7;
  --white: #ffffff;
  --green: #17765f;
  --green-soft: #dff2e9;
  --blue: #2c6f9e;
  --blue-soft: #e5f0f7;
  --coral: #e56d5e;
  --coral-soft: #fbe7df;
  --amber: #e5aa32;
  --shadow: 0 18px 60px rgba(23, 33, 43, 0.1);
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(90deg, rgba(23, 118, 95, 0.14) 0 12px, transparent 12px),
    var(--paper);
  color: var(--ink);
}

button {
  font: inherit;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 42px 0;
  display: grid;
  align-items: center;
}

.hidden {
  display: none !important;
}

.hero,
.diagnosis,
.result,
.tracker {
  width: 100%;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 44px;
  align-items: center;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--green);
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(2.55rem, 8vw, 5.25rem);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 2.65rem);
  line-height: 1.1;
  letter-spacing: 0;
}

h3 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.45;
}

.lead {
  max-width: 670px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.85;
}

.hero__actions {
  margin-top: 34px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 0 20px;
  font-weight: 800;
  cursor: pointer;
}

.primary-button {
  background: var(--green);
  color: var(--white);
  box-shadow: 0 12px 24px rgba(23, 118, 95, 0.22);
}

.secondary-button {
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--line);
}

.ghost-button {
  background: transparent;
  color: var(--muted);
}

.summary-panel,
.question-card,
.result-grid article,
.cta-panel,
.tracker-panel,
.insight-grid article,
.stat-card,
.coach-panel,
.goal-progress-card,
.premium-preview,
.backup-panel,
.diagnosis-history-panel,
.goal-lock-panel,
.modal__panel {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.summary-panel {
  padding: 24px;
  display: grid;
  gap: 16px;
}

.summary-panel div {
  min-height: 96px;
  border-left: 6px solid var(--green);
  padding: 14px 0 12px 18px;
  background: var(--surface);
}

.summary-panel div:nth-child(2) {
  border-left-color: var(--blue);
}

.summary-panel div:nth-child(3) {
  border-left-color: var(--coral);
}

.summary-panel__number {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.summary-panel p {
  margin: 8px 0 0;
  font-weight: 800;
  line-height: 1.5;
}

.progress {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 30px;
  align-items: end;
  margin-bottom: 24px;
}

.progress__track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5ecee;
}

.progress__track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--green);
  transition: width 180ms ease;
}

.question-card {
  min-height: 430px;
  padding: 34px;
}

.question-card__category {
  display: inline-flex;
  margin: 0 0 20px;
  padding: 7px 12px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 0.86rem;
  font-weight: 800;
}

.question-card h3 {
  max-width: 850px;
  font-size: clamp(1.45rem, 4vw, 2.35rem);
  line-height: 1.25;
}

.choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 34px;
}

.choice-button {
  min-height: 74px;
  border: 1px solid var(--line);
  border-left: 6px solid var(--blue);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  padding: 16px 18px;
  text-align: left;
  cursor: pointer;
}

.choice-button strong {
  display: block;
  margin-bottom: 4px;
  font-size: 1rem;
}

.choice-button span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.choice-button:hover,
.choice-button:focus-visible {
  outline: 3px solid rgba(44, 111, 158, 0.18);
  border-color: var(--blue);
}

.navigation {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
}

.result__header {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 24px;
  align-items: start;
  margin-top: 8px;
}

.result__header p {
  max-width: 760px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.75;
}

.score-badge {
  min-height: 150px;
  padding: 22px;
  background: var(--green-soft);
  color: var(--green);
  text-align: center;
}

.score-badge span,
.score-badge strong {
  display: block;
}

.score-badge span {
  font-size: 0.84rem;
  font-weight: 800;
}

.score-badge strong {
  margin-top: 10px;
  font-size: 2.4rem;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 34px;
}

.result-grid article {
  min-height: 230px;
  padding: 26px;
}

.result-grid h3,
.cta-panel h3 {
  color: var(--ink);
  font-size: 1.3rem;
}

ul {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

li {
  position: relative;
  margin-top: 12px;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.65;
}

li::before {
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 7px;
  height: 7px;
  background: var(--green);
  content: "";
}

.cta-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: center;
  margin-top: 18px;
  padding: 24px 26px;
  border-left: 6px solid var(--coral);
}

.cta-panel p,
.note {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.note {
  max-width: 900px;
  font-size: 0.9rem;
}

.tracker-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: start;
  margin-bottom: 22px;
}

.tracker-header p:not(.eyebrow) {
  max-width: 760px;
  margin: 16px 0 0;
  color: var(--muted);
  line-height: 1.75;
}

.tracker-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.tab-button {
  min-width: 112px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.tab-button.active {
  border-color: var(--green);
  background: var(--green);
  color: var(--white);
}

.tab-button--urge {
  border-color: rgba(229, 109, 94, 0.35);
  background: var(--coral-soft);
  color: #b94e43;
}

.tab-button--urge.active {
  border-color: var(--coral);
  background: var(--coral);
  color: var(--white);
}

.tracker-panel {
  padding: 24px;
}

.coach-panel {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
  padding: 20px;
  border-left: 6px solid var(--green);
}

.coach-face {
  position: relative;
  width: 70px;
  height: 70px;
  border-radius: 22px;
  background: var(--green);
  box-shadow: inset 0 -10px 0 rgba(0, 0, 0, 0.08);
}

.coach-face::before,
.coach-face::after {
  position: absolute;
  top: 25px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--white);
  content: "";
}

.coach-face::before {
  left: 21px;
}

.coach-face::after {
  right: 21px;
}

.coach-face span {
  position: absolute;
  left: 22px;
  bottom: 19px;
  width: 26px;
  height: 12px;
  border-bottom: 4px solid var(--white);
  border-radius: 0 0 999px 999px;
}

.coach-name {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 0.86rem;
  font-weight: 800;
}

.coach-panel h3 {
  font-size: clamp(1.25rem, 3vw, 1.8rem);
}

.coach-panel p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.stat-card {
  min-height: 124px;
  padding: 20px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.stat-card strong {
  display: block;
  margin-top: 16px;
  color: var(--green);
  font-size: clamp(1.55rem, 4vw, 2.2rem);
  line-height: 1.05;
}

.goal-progress-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.goal-progress-card {
  padding: 18px;
}

.goal-progress-card__top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.goal-progress-card span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.goal-progress-card strong {
  color: var(--ink);
  font-size: 1rem;
}

.goal-progress-card p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.meter {
  height: 10px;
  overflow: hidden;
  margin-top: 14px;
  border-radius: 999px;
  background: #e8eef0;
}

.meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 180ms ease;
}

.meter span.warning {
  background: var(--amber);
}

.meter span.danger {
  background: var(--coral);
}

.premium-preview {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  margin-top: 14px;
  padding: 20px;
  border-left: 6px solid var(--blue);
}

.premium-preview__label {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.premium-preview h3 {
  font-size: clamp(1.1rem, 3vw, 1.45rem);
}

.premium-preview p:not(.premium-preview__label) {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.premium-preview__items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  max-width: 360px;
}

.premium-preview__items span {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 0.86rem;
  font-weight: 800;
  padding: 0 12px;
}

.backup-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  margin-top: 14px;
  padding: 20px;
  border-left: 6px solid var(--amber);
}

.backup-panel__label {
  margin: 0 0 6px;
  color: #9a6a14;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.backup-panel p:not(.backup-panel__label) {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.backup-panel__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.insight-grid article {
  min-height: 260px;
  padding: 24px;
}

.diagnosis-history-panel {
  margin-top: 18px;
  padding: 24px;
}

.diagnosis-history-panel__header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: start;
}

.diagnosis-history-panel p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.entry-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.empty-state {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.entry-card {
  border-left: 6px solid var(--green);
  background: var(--surface);
  padding: 14px 16px;
}

.entry-card.urge {
  border-left-color: var(--coral);
}

.entry-card.diagnosis-entry {
  border-left-color: var(--blue);
}

.entry-card__top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.entry-card strong {
  display: block;
  color: var(--ink);
}

.entry-card span,
.entry-card p {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.entry-card p {
  margin: 8px 0 0;
}

.entry-card button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.log-form {
  display: grid;
  gap: 18px;
}

.goal-lock-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
  padding: 18px;
  border-left: 6px solid var(--amber);
}

.goal-lock-panel p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.goals-locked input,
.goals-locked select,
.goals-locked textarea {
  background: #eef2f3;
  color: #909aa3;
  cursor: not-allowed;
}

.goals-locked .weekday-options label {
  background: #eef2f3;
  color: #909aa3;
}

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

label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  font: inherit;
  font-weight: 500;
}

input,
select {
  min-height: 48px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  padding: 12px;
  line-height: 1.6;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(44, 111, 158, 0.16);
}

input:disabled {
  background: #eef2f3;
  color: #909aa3;
  cursor: not-allowed;
}

.weekday-options {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.weekday-options label {
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--muted);
}

.weekday-options input {
  width: auto;
  min-height: auto;
  margin: 0 6px 0 0;
}

.range-control {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  padding: 0 14px;
}

.range-control input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  min-height: auto;
  border: 0;
  margin: 0 9px;
  padding: 0;
  background: transparent;
}

.range-control input[type="range"]:focus {
  outline: none;
}

.range-control input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: var(--green-soft);
}

.range-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border: 3px solid var(--white);
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 1px rgba(23, 118, 95, 0.25);
}

.range-control input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: var(--green-soft);
}

.range-control input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 3px solid var(--white);
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 1px rgba(23, 118, 95, 0.25);
}

.range-control:focus-within {
  border-color: var(--blue);
  outline: 3px solid rgba(44, 111, 158, 0.16);
}

.range-value {
  flex: 0 0 52px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 33, 43, 0.28);
}

.modal__panel {
  width: min(520px, 100%);
  padding: 28px;
  background: var(--surface);
}

.modal__panel p:not(.eyebrow) {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.modal__actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.policy-page {
  align-items: start;
}

.policy-section {
  margin-top: 28px;
}

.policy-section h2 {
  font-size: 1.35rem;
}

.policy-section p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.8;
}

.secondary-link {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  font-weight: 800;
  padding: 0 20px;
  text-decoration: none;
}

@media (max-width: 780px) {
  body {
    background:
      linear-gradient(90deg, rgba(23, 118, 95, 0.16) 0 8px, transparent 8px),
      var(--paper);
  }

  .app-shell {
    width: min(100% - 28px, 560px);
    padding: 28px 0;
    align-items: start;
  }

  .hero,
  .progress,
  .result__header,
  .result-grid,
  .cta-panel,
  .tracker-header,
  .stat-grid,
  .insight-grid,
  .goal-progress-grid,
  .premium-preview,
  .backup-panel,
  .diagnosis-history-panel__header,
  .goal-lock-panel,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .coach-panel {
    grid-template-columns: 1fr;
  }

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

  .premium-preview__items {
    justify-content: flex-start;
  }

  .backup-panel__actions {
    justify-content: flex-start;
  }

  .summary-panel {
    margin-top: 8px;
    padding: 16px;
  }

  .progress {
    gap: 16px;
  }

  .question-card {
    min-height: auto;
    padding: 24px 18px;
  }

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

  .navigation,
  .cta-panel {
    align-items: stretch;
  }

  .navigation {
    flex-direction: column;
  }

  .primary-button,
  .secondary-button,
  .ghost-button {
    width: 100%;
  }

  .modal__actions {
    flex-direction: column;
  }

  .tracker-panel {
    padding: 18px;
  }

  .score-badge {
    min-height: 112px;
  }
}
