:root {
  --bg: #f6f1e7;
  --bg-soft: #fffaf2;
  --surface: rgba(255, 251, 244, 0.86);
  --surface-strong: #fffdf9;
  --text: #2a2017;
  --muted: #6a5748;
  --line: rgba(97, 71, 46, 0.16);
  --accent: #8f3f2a;
  --accent-strong: #6f2515;
  --accent-soft: #f3d2bd;
  --olive: #47563b;
  --shadow: 0 24px 60px rgba(57, 40, 23, 0.14);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Outfit", "Noto Sans TC", sans-serif;
  background:
    radial-gradient(circle at top right, rgba(143, 63, 42, 0.14), transparent 30%),
    radial-gradient(circle at left 15%, rgba(71, 86, 59, 0.12), transparent 24%),
    linear-gradient(180deg, #efe4d2 0%, var(--bg) 22%, #fcf8f1 100%);
}

img {
  max-width: 100%;
}

a {
  color: inherit;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  background: var(--accent-strong);
  color: #fff;
  padding: 10px 14px;
  border-radius: 999px;
  z-index: 20;
}

.skip-link:focus {
  top: 16px;
}

.hero {
  position: relative;
  min-height: 72vh;
  padding: 56px 24px 40px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.hero__backdrop {
  position: absolute;
  inset: 20px;
  border-radius: 36px;
  background:
    linear-gradient(135deg, rgba(76, 92, 63, 0.84), rgba(143, 63, 42, 0.88)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.25), transparent);
  box-shadow: var(--shadow);
}

.hero__backdrop::before,
.hero__backdrop::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(255, 245, 230, 0.26);
}

.hero__backdrop::before {
  width: 320px;
  height: 320px;
  right: -40px;
  top: -60px;
}

.hero__backdrop::after {
  width: 220px;
  height: 220px;
  left: -50px;
  bottom: -50px;
}

.hero__content {
  position: relative;
  max-width: 880px;
  text-align: center;
  color: #fff8f1;
  z-index: 1;
}

.eyebrow,
.section__eyebrow {
  margin: 0 0 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.82rem;
}

.hero h1,
.section h2,
.comic-panel h3,
.learning-card h3,
.doc-card h3 {
  font-family: "Noto Serif TC", serif;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.3rem, 5vw, 4.6rem);
  line-height: 1.15;
}

.hero__meta {
  margin: 18px 0 0;
  font-size: 1.1rem;
}

.hero__meta--sub {
  margin-top: 10px;
  color: rgba(255, 248, 241, 0.86);
}

.hero__actions,
.quiz__actions,
.doc-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero__actions {
  justify-content: center;
  margin-top: 28px;
}

.section-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 18px;
  backdrop-filter: blur(16px);
  background: rgba(252, 248, 241, 0.72);
  border-top: 1px solid rgba(255, 255, 255, 0.4);
  border-bottom: 1px solid var(--line);
}

.section-nav a {
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 999px;
  color: var(--muted);
  transition: 0.2s ease;
}

.section-nav a.is-current,
.section-nav a:hover {
  background: var(--accent);
  color: #fff;
}

.shell {
  width: min(1140px, calc(100% - 32px));
  margin: 0 auto;
}

.section {
  padding: 72px 0 12px;
}

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

.section h2 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 3rem);
}

.section__summary {
  max-width: 460px;
  line-height: 1.7;
  color: var(--muted);
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 253, 249, 0.7);
}

.chip-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.chip,
.button {
  border: 0;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.chip {
  background: #efe3d6;
  color: var(--muted);
  border-radius: 999px;
  padding: 10px 16px;
  font: inherit;
}

.chip.is-active,
.chip:hover {
  background: var(--olive);
  color: #fff;
}

.searchbox {
  display: grid;
  gap: 8px;
  min-width: min(100%, 320px);
}

.searchbox__label {
  font-size: 0.92rem;
  color: var(--muted);
}

.searchbox input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffdfa;
  font: inherit;
}

.document-grid,
.learning-grid,
.comic-grid {
  display: grid;
  gap: 18px;
}

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

.doc-card,
.learning-card,
.quiz-card,
.comic-panel,
.quiz-result {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.doc-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.doc-card__top {
  display: grid;
  gap: 12px;
}

.doc-type {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.84rem;
  font-weight: 700;
}

.doc-card h3,
.learning-card h3,
.comic-panel h3 {
  margin: 0;
  font-size: 1.35rem;
}

.doc-card p,
.learning-card p,
.comic-panel p {
  margin: 0;
  line-height: 1.75;
}

.doc-points {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.doc-card[hidden] {
  display: none;
}

.doc-preview {
  margin-top: 28px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.doc-preview__header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 20px;
}

.doc-preview__header h3 {
  margin: 0;
  font-family: "Noto Serif TC", serif;
  font-size: 1.6rem;
}

.doc-preview__content {
  display: grid;
  gap: 16px;
}

.doc-preview__lead {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.doc-preview__frame {
  width: 100%;
  min-height: 480px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
}

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

.doc-preview__panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(246, 241, 231, 0.58);
}

.doc-preview__panel h4 {
  margin: 0 0 10px;
  font-family: "Noto Serif TC", serif;
}

.doc-preview__panel p,
.doc-preview__panel li {
  line-height: 1.75;
}

.empty-state {
  margin-top: 20px;
  color: var(--muted);
}

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

.learning-card {
  position: relative;
  min-height: 250px;
  padding: 0;
  text-align: left;
  background: transparent;
  border: 0;
  box-shadow: none;
  perspective: 1200px;
  transform-style: preserve-3d;
}

.learning-card__face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 22px;
  border-radius: var(--radius-lg);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transition: transform 0.7s ease;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.learning-card__face--front {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.75), rgba(252, 245, 237, 0.94)),
    radial-gradient(circle at right bottom, rgba(143, 63, 42, 0.12), transparent 34%);
  color: var(--text);
  transform: rotateY(0deg);
}

.learning-card__face--back {
  background:
    linear-gradient(135deg, rgba(71, 86, 59, 0.95), rgba(143, 63, 42, 0.9)),
    radial-gradient(circle at left top, rgba(255, 255, 255, 0.16), transparent 34%);
  color: #fff9f1;
  transform: rotateY(180deg);
}

.learning-card.is-flipped .learning-card__face--front {
  transform: rotateY(-180deg);
}

.learning-card.is-flipped .learning-card__face--back {
  transform: rotateY(0deg);
}

.learning-card__index {
  display: inline-block;
  margin-bottom: 14px;
  color: var(--accent);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.quiz {
  display: grid;
  gap: 18px;
}

.quiz-player {
  display: grid;
  gap: 20px;
}

.quiz-progress {
  display: grid;
  gap: 10px;
}

.quiz-progress__bar {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: #eadccf;
}

.quiz-progress__bar span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--olive), var(--accent));
  transition: width 0.25s ease;
}

.quiz-card {
  margin: 0;
  padding: 22px 24px;
  display: grid;
  gap: 14px;
}

.quiz-card legend {
  padding: 0;
  margin-bottom: 10px;
  font-weight: 600;
  line-height: 1.7;
}

.quiz-card label {
  display: flex;
  gap: 10px;
  align-items: start;
  line-height: 1.6;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 252, 248, 0.92);
}

.quiz-result {
  margin-top: 22px;
  padding: 22px 24px;
  background: linear-gradient(135deg, rgba(71, 86, 59, 0.93), rgba(143, 63, 42, 0.94));
  color: #fff7ef;
}

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

.comic-panel {
  padding: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.65), rgba(255, 251, 245, 0.88)),
    repeating-linear-gradient(135deg, rgba(143, 63, 42, 0.05), rgba(143, 63, 42, 0.05) 12px, transparent 12px, transparent 24px);
}

.comic-panel img {
  margin: 12px 0 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #fffaf4;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.comic-panel__tag {
  display: inline-block;
  margin-bottom: 14px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #ede2d2;
  color: var(--accent-strong);
  font-size: 0.85rem;
  font-weight: 700;
}

.comic-line {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed rgba(111, 37, 21, 0.24);
  color: var(--accent-strong);
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  width: min(1140px, calc(100% - 32px));
  margin: 48px auto 36px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 18px;
  border-radius: 999px;
  text-decoration: none;
  font: inherit;
}

.button:hover,
.chip:hover {
  transform: translateY(-1px);
}

.button--primary {
  background: var(--accent);
  color: #fff;
}

.button--primary:hover {
  background: var(--accent-strong);
}

.button--ghost {
  background: transparent;
  color: inherit;
  border: 1px solid var(--line);
}

.button--small {
  padding: 10px 14px;
  font-size: 0.92rem;
}

@media (max-width: 980px) {
  .document-grid,
  .learning-grid {
    grid-template-columns: 1fr 1fr;
  }

  .doc-preview__columns {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 720px) {
  .hero {
    min-height: auto;
    padding-top: 24px;
  }

  .hero__backdrop {
    inset: 12px;
  }

  .section {
    padding-top: 56px;
  }

  .document-grid,
  .learning-grid,
  .comic-grid {
    grid-template-columns: 1fr;
  }

  .section-nav {
    justify-content: start;
    overflow-x: auto;
  }

  .toolbar {
    padding: 16px;
  }
}
