:root {
  --navy: #0b2f4f;
  --blue: #1769e0;
  --blue-soft: #edf5ff;
  --green: #167a55;
  --green-soft: #e9f8f1;
  --amber: #b66c00;
  --amber-soft: #fff7e7;
  --rose-soft: #fff0f2;
  --ink: #17324d;
  --muted: #5c7188;
  --line: #cfdeeb;
  --paper: #fff;
  --page: #f2f7fb;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 85% 8%, rgba(23, 105, 224, 0.08), transparent 28rem),
    var(--page);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
}

button,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 3px solid #ffbd38;
  outline-offset: 3px;
}

.edu-topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 8px clamp(16px, 4vw, 58px);
  color: #fff;
  background: linear-gradient(110deg, var(--navy), #061f3d);
}

.edu-brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  color: #fff;
  font-weight: 900;
  text-decoration: none;
}

.edu-logo {
  flex: 0 0 auto;
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 8px;
  background: #fff;
}

.edu-logo img {
  width: 168px;
  height: auto;
  display: block;
}

.edu-close {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 8px 12px;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 9px;
  font-size: 13px;
  font-weight: 850;
  text-decoration: none;
}

.edu-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(22px, 4vw, 46px) 0 40px;
}

.edu-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  align-items: end;
  gap: 2rem;
  margin-bottom: 1.3rem;
}

.edu-eyebrow,
.lesson-heading p {
  margin: 0 0 0.35rem;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.edu-hero h1 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(32px, 4.5vw, 52px);
  line-height: 1.15;
  letter-spacing: -0.04em;
}

.edu-hero > div > p:last-child {
  max-width: 720px;
  margin: 0.8rem 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.edu-progress {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
}

.edu-progress > span {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--navy);
  font-size: 13px;
  font-weight: 900;
  text-align: right;
}

.edu-progress > div {
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: #e5edf5;
}

.edu-progress i {
  display: block;
  width: 16.666%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), #55a8ff);
  transition: width 220ms ease;
}

.lesson-card {
  min-height: 610px;
  padding: clamp(20px, 4vw, 38px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 0 18px 50px rgba(11, 47, 79, 0.09);
}

.lesson {
  display: none;
  animation: lesson-in 220ms ease;
}

.lesson.active {
  display: block;
}

@keyframes lesson-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
}

.lesson-heading {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
}

.lesson-number {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  color: #fff;
  border-radius: 16px;
  background: var(--blue);
  font-size: 18px;
  font-weight: 950;
}

.lesson-heading h2 {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--navy);
  font-size: clamp(25px, 3.5vw, 38px);
  line-height: 1.25;
  letter-spacing: -0.03em;
}

.lesson-lead {
  margin: 1rem 0 1.25rem;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.75;
}

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

.balance-card {
  min-width: 0;
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 15px;
  background: var(--blue-soft);
}

.balance-card.risk {
  background: #eef5fd;
}

.balance-card.warm {
  background: var(--amber-soft);
}

.balance-card.soft {
  background: var(--rose-soft);
}

.balance-card h3 {
  margin: 0 0 3px;
  color: var(--navy);
  font-size: 16px;
}

.balance-card label {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  color: #405970;
  font-size: 13px;
  line-height: 1.5;
}

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

.balance-card .other-option {
  align-items: center;
}

.balance-card .other-option > span {
  font-weight: 750;
}

.balance-card .other-input {
  grid-column: 2;
  width: 100%;
  min-width: 0;
  padding: 9px 11px;
  color: var(--ink);
  border: 1.5px solid #8da8c1;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.95);
  font-size: 13px;
  line-height: 1.4;
}

.balance-card .other-input::placeholder {
  color: #71869a;
}

.balance-card .other-input[hidden] {
  display: none;
}

.reflection {
  margin: 1rem 0 0;
  padding: 0.8rem 1rem;
  color: #29664d;
  border-left: 4px solid var(--green);
  border-radius: 0 10px 10px 0;
  background: var(--green-soft);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.55;
}

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

.trigger-grid button,
.recovery-grid button {
  min-width: 0;
  padding: 15px;
  color: var(--ink);
  border: 2px solid var(--line);
  border-radius: 15px;
  background: #fbfdff;
  cursor: pointer;
}

.trigger-grid button {
  min-height: 112px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 4px 12px;
  text-align: left;
}

.trigger-grid button.selected,
.recovery-grid button.selected {
  color: #155f42;
  border-color: var(--green);
  background: var(--green-soft);
}

.trigger-grid span {
  grid-row: 1 / 3;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: #fff;
  border-radius: 50%;
  background: var(--blue);
  font-size: 18px;
  font-weight: 950;
}

.trigger-grid b {
  overflow-wrap: anywhere;
  color: var(--navy);
  font-size: 14px;
}

.trigger-grid small {
  color: var(--muted);
  line-height: 1.4;
}

.map-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 1.4rem;
}

.map-grid label {
  min-width: 0;
  display: grid;
  gap: 9px;
  padding: 16px;
  border-radius: 15px;
  background: var(--blue-soft);
}

.map-grid label:nth-child(2) {
  background: var(--green-soft);
}

.map-grid label:nth-child(3) {
  background: var(--amber-soft);
}

.map-grid label > span {
  color: var(--navy);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.5;
}

.map-grid textarea {
  width: 100%;
  min-width: 0;
  resize: vertical;
  padding: 12px;
  color: var(--ink);
  border: 1.5px solid #9db6cf;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  line-height: 1.55;
}

.privacy-callout {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 1rem;
  padding: 12px 14px;
  color: var(--muted);
  border-radius: 11px;
  background: #f1f5f8;
  font-size: 12px;
}

.privacy-callout b {
  color: var(--navy);
}

.cycle-explainer {
  display: grid;
  gap: 8px;
  margin-top: 1.35rem;
  padding: 18px 20px;
  border-left: 5px solid var(--blue);
  border-radius: 0 15px 15px 0;
  background: var(--blue-soft);
}

.cycle-explainer-label {
  color: var(--navy);
  font-size: 15px;
  font-weight: 950;
}

.cycle-explainer p {
  max-width: 960px;
  margin: 0;
  color: #48647c;
  font-size: 14px;
  line-height: 1.75;
}

.cycle-explainer p:last-child {
  color: var(--navy);
  font-weight: 850;
}

.cycle {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 28px minmax(150px, 1fr) 28px minmax(150px, 1fr) 28px minmax(150px, 1fr);
  align-items: stretch;
  gap: 8px;
  margin-top: 1.15rem;
}

.cycle > div {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 15px;
  border: 1px solid #f0d8a8;
  border-radius: 14px;
  background: var(--amber-soft);
}

.cycle > div:nth-of-type(even) {
  border-color: #efd4d9;
  background: var(--rose-soft);
}

.cycle span {
  flex: 0 0 auto;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: #fff;
  border-radius: 9px;
  background: var(--amber);
  font-weight: 950;
}

.cycle-step > div {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.cycle-step-action {
  box-shadow: inset 0 0 0 1px rgba(182, 108, 0, 0.18);
}

.cycle b {
  overflow-wrap: anywhere;
  color: var(--navy);
  font-size: 14px;
}

.cycle small {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.cycle > i {
  align-self: center;
  color: var(--blue);
  font-size: 22px;
  font-style: normal;
  font-weight: 900;
}

.automatic-band {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding: 10px 14px;
  color: #72501f;
  border: 1px dashed #d9ad63;
  border-radius: 12px;
  background: #fffaf0;
  font-size: 13px;
  line-height: 1.55;
}

.automatic-band b {
  flex: 0 0 auto;
  padding: 4px 9px;
  color: #fff;
  border-radius: 99px;
  background: var(--amber);
  font-size: 12px;
}

.choice-callout {
  display: grid;
  grid-template-columns: 95px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  margin-top: 1.5rem;
  padding: 20px;
  color: #1c6042;
  border: 1px solid #94c8b0;
  border-radius: 16px;
  background: var(--green-soft);
}

.choice-callout > span {
  display: grid;
  min-height: 70px;
  place-items: center;
  color: #fff;
  border-radius: 13px;
  background: var(--green);
  font-weight: 950;
}

.choice-callout h3,
.choice-callout p {
  margin: 0;
}

.choice-callout h3 {
  color: var(--navy);
  font-size: 18px;
}

.choice-callout p {
  margin-top: 5px;
  color: #496b5a;
  line-height: 1.6;
}

.sober-list {
  display: grid;
  gap: 9px;
  margin: 1.3rem 0;
  padding: 0;
  list-style: none;
}

.sober-list li {
  min-width: 0;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 13px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fbfdff;
}

.sober-list li > b {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #fff;
  border-radius: 50%;
  background: var(--blue);
  font-size: 18px;
}

.sober-list strong {
  color: var(--navy);
  font-size: 14px;
}

.sober-list p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.breath-button {
  width: 100%;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: #fff;
  border: 0;
  border-radius: 15px;
  background: linear-gradient(110deg, var(--navy), var(--blue));
  cursor: pointer;
}

.breath-button span {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
}

.breath-button.running span {
  animation: breathe 8s ease-in-out infinite;
}

@keyframes breathe {
  0%,
  100% {
    transform: scale(0.75);
  }
  50% {
    transform: scale(1.5);
  }
}

.recovery-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
  margin: 1.2rem 0;
}

.recovery-grid button {
  min-height: 78px;
  padding: 11px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.video-panel {
  min-width: 0;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid #e4bc63;
  border-radius: 14px;
  background: var(--amber-soft);
}

.video-panel > span {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: #fff;
  border-radius: 50%;
  background: var(--amber);
}

.video-panel small,
.video-panel strong,
.video-panel p {
  display: block;
}

.video-panel small {
  color: #806117;
  font-size: 11px;
  font-weight: 800;
}

.video-panel strong {
  margin-top: 2px;
  overflow-wrap: anywhere;
  color: var(--navy);
}

.video-panel p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.video-panel a {
  flex: 0 0 auto;
  padding: 10px 13px;
  color: #fff;
  border-radius: 9px;
  background: var(--amber);
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.finish-panel {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: start;
  gap: 14px;
  margin-top: 12px;
  padding: 17px 18px;
  color: #1c6042;
  border: 1px solid #a7d5bf;
  border-radius: 14px;
  background: var(--green-soft);
}

.today-marker {
  display: grid;
  min-height: 50px;
  place-items: center;
  color: #fff;
  border-radius: 12px;
  background: var(--green);
  font-size: 13px;
  font-weight: 950;
}

.today-commitment {
  min-width: 0;
}

.finish-panel b {
  display: block;
  overflow-wrap: anywhere;
  color: var(--navy);
  font-size: 16px;
  line-height: 1.45;
}

.finish-panel p {
  margin: 5px 0;
  color: #496b5a;
  font-size: 13px;
  line-height: 1.6;
}

.finish-panel strong {
  display: block;
  color: #146447;
  font-size: 13px;
  line-height: 1.5;
}

.lesson-nav {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) 140px;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

.lesson-nav > button {
  min-height: 46px;
  padding: 10px 16px;
  color: var(--blue);
  border: 2px solid var(--blue);
  border-radius: 11px;
  background: #fff;
  font-weight: 900;
  cursor: pointer;
}

.lesson-nav > button.next {
  color: #fff;
  background: var(--blue);
}

.lesson-nav > button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.lesson-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.lesson-dots button {
  width: 12px;
  height: 12px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #c3d2e0;
  cursor: pointer;
}

.lesson-dots button.active {
  width: 28px;
  border-radius: 99px;
  background: var(--blue);
}

@media (max-width: 840px) {
  .edu-topbar {
    min-height: 62px;
    padding-inline: 12px;
  }

  .edu-brand > span:last-child {
    display: none;
  }

  .edu-logo img {
    width: 145px;
  }

  .edu-shell {
    width: min(680px, calc(100% - 20px));
    padding-top: 18px;
  }

  .edu-hero {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .edu-hero h1 br {
    display: none;
  }

  .lesson-card {
    min-height: 0;
    padding: 18px;
    border-radius: 18px;
  }

  .balance-grid,
  .map-grid {
    grid-template-columns: 1fr;
  }

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

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

  .cycle > i {
    justify-self: center;
    transform: rotate(90deg);
  }

  .automatic-band {
    align-items: flex-start;
  }

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

@media (max-width: 560px) {
  .edu-close {
    padding: 7px 9px;
    font-size: 11px;
  }

  .edu-hero h1 {
    font-size: 30px;
  }

  .lesson-heading {
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 10px;
  }

  .lesson-number {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    font-size: 14px;
  }

  .lesson-heading h2 {
    font-size: 23px;
  }

  .trigger-grid,
  .recovery-grid {
    grid-template-columns: 1fr;
  }

  .trigger-grid button {
    min-height: 86px;
  }

  .choice-callout {
    grid-template-columns: 1fr;
  }

  .choice-callout > span {
    min-height: 44px;
  }

  .cycle-explainer {
    padding: 15px;
  }

  .cycle-explainer p {
    font-size: 13px;
  }

  .cycle > div {
    padding: 14px;
  }

  .automatic-band {
    display: grid;
    gap: 7px;
  }

  .automatic-band b {
    justify-self: start;
  }

  .video-panel {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .video-panel a {
    grid-column: 1 / -1;
    text-align: center;
  }

  .finish-panel {
    grid-template-columns: 1fr;
    padding: 15px;
  }

  .today-marker {
    min-height: 40px;
  }

  .lesson-nav {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .lesson-dots {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .lesson-nav > button {
    grid-row: 2;
  }
}

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