:root {
  --ink: #27251f;
  --muted: #6d685d;
  --paper: #fbf8f0;
  --surface: #ffffff;
  --line: #e7e0d2;
  --red: #8f2f2a;
  --red-dark: #6f211e;
  --green: #315f4b;
  --gold: #d6a83f;
  --yellow-soft: #f6e9bc;
  --green-soft: #e4efe9;
  --red-soft: #f3e3df;
  --shadow: 0 18px 50px rgba(39, 37, 31, 0.10);
  --radius: 22px;
  --container: min(1160px, calc(100% - 32px));
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  line-height: 1.7;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.container { width: var(--container); margin-inline: auto; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(251, 248, 240, 0.94);
  border-bottom: 1px solid rgba(231, 224, 210, 0.85);
  backdrop-filter: blur(14px);
}
.header-inner { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--red);
  border-radius: 50% 50% 45% 55% / 52% 44% 56% 48%;
  font-weight: 900;
  box-shadow: inset -5px -5px 0 rgba(0,0,0,0.08);
}
.brand strong { display: block; font-size: 1.05rem; letter-spacing: .04em; }
.brand small { display: block; color: var(--muted); font-size: .75rem; line-height: 1.25; }
.site-nav { display: flex; align-items: center; gap: 28px; font-weight: 700; font-size: .94rem; }
.site-nav a:hover { color: var(--red); }
.nav-login { border: 1px solid var(--ink); padding: 8px 17px; border-radius: 999px; }
.menu-button { display: none; border: 0; background: none; font-size: 1.55rem; }

.hero { overflow: hidden; padding: 86px 0 70px; background: linear-gradient(145deg, #fbf8f0 0%, #f8f1df 100%); }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; align-items: center; gap: 70px; }
.hero-kicker, .eyebrow { margin: 0 0 8px; color: var(--red); font-weight: 900; font-size: .78rem; letter-spacing: .16em; text-transform: uppercase; }
.hero h1 { margin: 0; font-size: clamp(2.55rem, 5vw, 5.15rem); line-height: 1.08; letter-spacing: -.045em; }
.hero h1 span { color: var(--red); }
.hero-lead { max-width: 660px; margin: 26px 0 0; color: var(--muted); font-size: 1.12rem; }
.hero-actions { display: flex; gap: 12px; margin-top: 32px; flex-wrap: wrap; }
.button {
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  padding: 11px 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 900;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
.button:hover { transform: translateY(-2px); }
.button.primary { background: var(--red); color: #fff; box-shadow: 0 10px 24px rgba(143,47,42,.22); }
.button.primary:hover { background: var(--red-dark); }
.button.secondary { background: transparent; border: 1px solid var(--ink); }
.button.ghost { background: #f1ecdf; color: var(--ink); align-self: end; }
.button.light { background: #fff; color: var(--red-dark); }
.button.outline-light { color: #fff; border: 1px solid rgba(255,255,255,.7); background: rgba(255,255,255,.06); }
.button.completed { background: var(--green); color: #fff; border-color: var(--green); }
.button.full { width: 100%; }
.hero-note { margin-top: 26px; color: var(--muted); font-size: .88rem; }
.hero-note span { color: var(--green); margin-right: 8px; }
.hero-visual { min-height: 500px; position: relative; display: grid; place-items: center; }
.hero-visual > img { position: relative; z-index: 2; width: min(92%, 520px); filter: drop-shadow(0 30px 30px rgba(54,50,39,.15)); }
.sun-shape { position: absolute; inset: 4% 5% 7% 12%; border-radius: 48% 52% 46% 54% / 54% 43% 57% 46%; background: var(--gold); opacity: .28; transform: rotate(-6deg); }
.hero-card { position: absolute; z-index: 3; padding: 14px 18px; background: rgba(255,255,255,.96); box-shadow: var(--shadow); border-radius: 16px; }
.hero-card strong, .hero-card span { display: block; }
.hero-card strong { color: var(--red); }
.hero-card span { font-size: .78rem; color: var(--muted); }
.hero-card-one { left: -8px; bottom: 80px; }
.hero-card-two { right: -8px; top: 68px; }

.feature-strip { color: #fff; background: var(--green); }
.feature-grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.feature-grid > div { padding: 25px 22px; display: grid; grid-template-columns: auto 1fr; gap: 0 12px; border-right: 1px solid rgba(255,255,255,.15); }
.feature-grid span { grid-row: 1 / 3; font-size: 1.55rem; font-weight: 900; color: #f0cf75; }
.feature-grid strong { font-size: .96rem; }
.feature-grid small { opacity: .72; }

.section { padding: 90px 0; }
.section-heading { margin-bottom: 32px; display: flex; justify-content: space-between; align-items: end; gap: 36px; }
.section-heading.compact { margin-bottom: 20px; }
.section-heading h2 { margin: 0; font-size: clamp(2rem, 3vw, 3.25rem); line-height: 1.15; letter-spacing: -.035em; }
.section-heading > p { max-width: 580px; margin: 0; color: var(--muted); }
.alternate { background: #f3eee3; }
.search-section { padding-bottom: 24px; }
.search-panel { display: grid; grid-template-columns: 190px 190px 1fr auto; gap: 12px; padding: 18px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(39,37,31,.05); }
.search-panel label { display: grid; gap: 6px; }
.search-panel label span { color: var(--muted); font-size: .78rem; font-weight: 800; }
.search-panel input, .search-panel select { width: 100%; min-height: 48px; border: 1px solid var(--line); background: #fffdf8; border-radius: 12px; padding: 10px 13px; color: var(--ink); }
.search-panel input:focus, .search-panel select:focus { outline: 3px solid rgba(214,168,63,.22); border-color: var(--gold); }
.result-count { color: var(--muted); margin: 14px 6px 0; font-size: .9rem; }
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.content-card { overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(39,37,31,.055); transition: transform .25s ease, box-shadow .25s ease; }
.content-card:hover { transform: translateY(-6px); box-shadow: var(--shadow); }
.card-image { aspect-ratio: 16 / 10; position: relative; display: block; overflow: hidden; background: var(--yellow-soft); }
.card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.content-card:hover .card-image img { transform: scale(1.035); }
.card-tag { position: absolute; top: 14px; left: 14px; padding: 5px 10px; color: #fff; background: var(--green); border-radius: 999px; font-size: .72rem; font-weight: 900; }
.card-body { padding: 22px; }
.card-body h3 { margin: 3px 0 4px; font-size: 1.42rem; line-height: 1.35; }
.card-body h3 a:hover { color: var(--red); }
.card-body .subtitle { margin: 0 0 8px; color: var(--green); font-weight: 800; }
.card-body > p:not(.eyebrow):not(.subtitle) { min-height: 3.4em; margin: 10px 0; color: var(--muted); font-size: .93rem; }
.text-link { display: inline-flex; gap: 6px; margin-top: 8px; color: var(--red); font-weight: 900; }
.skeleton-card { height: 390px; border-radius: var(--radius); background: linear-gradient(90deg, #ece6d9 25%, #f7f3ea 50%, #ece6d9 75%); background-size: 200% 100%; animation: skeleton 1.4s infinite; }
@keyframes skeleton { to { background-position: -200% 0; } }
.empty-state { grid-column: 1 / -1; padding: 42px; text-align: center; color: var(--muted); background: rgba(255,255,255,.7); border: 1px dashed #cfc5b3; border-radius: var(--radius); }
.empty-state strong { color: var(--ink); display: block; font-size: 1.1rem; }
.notice { width: var(--container); margin: 30px auto; padding: 18px; border-radius: 14px; }
.notice.error { color: #7e1f1b; background: #f8dfdc; border: 1px solid #e9bbb6; }
.recent-section { padding-bottom: 20px; }
.recent-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.recent-item { padding: 17px; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.recent-item span, .recent-item small { display: block; color: var(--muted); font-size: .76rem; }
.recent-item strong { display: block; margin: 5px 0; }
.recent-item:hover { border-color: var(--gold); }

.cta-section { padding-top: 40px; }
.cta-card { padding: 48px 54px; display: flex; justify-content: space-between; align-items: center; gap: 30px; color: #fff; background: var(--red); border-radius: 28px; position: relative; overflow: hidden; }
.cta-card::after { content: ""; position: absolute; width: 250px; height: 250px; right: -60px; bottom: -150px; border: 35px solid rgba(255,255,255,.09); border-radius: 50%; }
.cta-card h2 { margin: 0; font-size: clamp(1.8rem, 3vw, 3rem); }
.cta-card p { margin-bottom: 0; opacity: .82; }
.eyebrow.light { color: #f4d980; }
.site-footer { margin-top: 85px; color: #ddd7c8; background: #242c27; padding: 48px 0; }
.footer-grid { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.footer-grid strong { color: #fff; font-size: 1.45rem; }
.footer-grid p { margin: 8px 0; }

.detail-page { min-height: 70vh; }
.detail-hero { color: #fff; padding: 68px 0; }
.course-hero { background: linear-gradient(135deg, var(--red-dark), var(--red)); }
.book-hero { background: linear-gradient(135deg, #264b3b, var(--green)); }
.detail-hero-inner { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 50px; }
.detail-hero h1 { max-width: 850px; margin: 10px 0; font-size: clamp(2.6rem, 5vw, 5.4rem); line-height: 1.08; letter-spacing: -.05em; }
.detail-lead { max-width: 760px; margin: 18px 0 0; font-size: 1.08rem; opacity: .86; }
.back-link { display: inline-flex; margin-bottom: 30px; opacity: .78; font-weight: 800; }
.back-link:hover { opacity: 1; }
.detail-actions { display: flex; gap: 10px; margin-top: 28px; flex-wrap: wrap; }
.week-badge { width: 150px; height: 150px; display: grid; place-items: center; align-content: center; border-radius: 50%; border: 2px dashed rgba(255,255,255,.55); background: rgba(255,255,255,.08); transform: rotate(5deg); }
.week-badge span { font-size: .75rem; letter-spacing: .2em; }
.week-badge strong { font-size: 1.75rem; }
.book-hero-grid { display: grid; grid-template-columns: minmax(220px, 330px) 1fr; gap: 56px; align-items: center; }
.book-cover { width: 100%; aspect-ratio: 4/5; object-fit: cover; border: 10px solid rgba(255,255,255,.92); border-radius: 12px 24px 24px 12px; box-shadow: 0 28px 55px rgba(0,0,0,.23); transform: rotate(-2deg); }
.book-subtitle { margin: 4px 0; font-size: 1.28rem; color: #f0cf75; font-weight: 800; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 42px; padding-top: 70px; }
.content-block { margin-bottom: 72px; }
.block-heading { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.block-heading > span { flex: none; width: 48px; height: 48px; display: grid; place-items: center; color: #fff; background: var(--green); border-radius: 50%; font-weight: 900; }
.block-heading h2 { margin: 0; font-size: 2rem; }
.block-heading .eyebrow { margin-bottom: 1px; }
.video-frame { position: relative; aspect-ratio: 16/9; overflow: hidden; border-radius: var(--radius); background: #111; box-shadow: var(--shadow); }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.media-placeholder { aspect-ratio: 16/9; display: grid; place-items: center; align-content: center; gap: 5px; color: var(--muted); background: #e8e2d7; border: 1px dashed #bfb5a4; border-radius: var(--radius); }
.media-placeholder span { color: var(--ink); font-size: 1.18rem; font-weight: 900; }
.media-placeholder small { text-align: center; }
.sentence-list, .detail-list { display: grid; gap: 14px; }
.sentence-card { padding: 24px; display: flex; justify-content: space-between; align-items: center; gap: 20px; background: #fff; border: 1px solid var(--line); border-radius: 18px; }
.sentence-main, .vocab-word { margin: 0; color: var(--red); font-size: 1.35rem; font-weight: 900; }
.sentence-translation, .vocab-meaning { margin: 4px 0 0; color: var(--muted); }
.audio-btn { min-width: 136px; border: 0; padding: 10px 14px; color: #fff; background: var(--green); border-radius: 999px; cursor: pointer; font-weight: 800; }
.audio-btn:disabled { color: #777166; background: #e6e0d5; cursor: not-allowed; }
.audio-player { max-width: 260px; height: 42px; }
.vocab-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.vocab-card { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 18px; background: #fff; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.vocab-card img { width: 100%; height: 150px; object-fit: cover; background: #f0eadf; }
.resource-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.resource-card { padding: 26px; display: flex; align-items: center; gap: 18px; border-radius: 18px; background: var(--yellow-soft); border: 1px solid #e5ca73; }
.resource-card:nth-child(2) { background: var(--green-soft); border-color: #b7d2c2; }
.resource-card > span { font-size: 2.1rem; }
.resource-card strong, .resource-card small { display: block; }
.resource-card small { color: var(--muted); }
.resource-card:hover { transform: translateY(-3px); }
.resource-card.disabled { opacity: .5; pointer-events: none; }
.detail-aside { display: grid; align-content: start; gap: 18px; }
.aside-card { position: sticky; top: 98px; padding: 26px; background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 12px 35px rgba(39,37,31,.06); }
.aside-card h3 { margin: 5px 0 12px; font-size: 1.38rem; }
.aside-card p { margin-bottom: 0; color: var(--muted); }
.aside-card.soft { position: static; background: var(--yellow-soft); box-shadow: none; }
.detail-card { padding: 24px; background: #fff; border: 1px solid var(--line); border-radius: 20px; }
.detail-card-head { display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.detail-row { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.detail-row strong { color: var(--green); font-size: .84rem; }
.detail-row p { margin: 4px 0 10px; color: var(--muted); }
.vocab-detail { display: grid; grid-template-columns: 190px 1fr; gap: 22px; }
.vocab-detail > img { width: 100%; height: 190px; object-fit: cover; border-radius: 14px; background: #f0eadf; }
.content-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding-top: 5px; padding-bottom: 30px; }
.nav-card { padding: 20px 22px; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.nav-card span, .nav-card strong { display: block; }
.nav-card span { color: var(--red); font-size: .78rem; font-weight: 900; }
.nav-card.align-right { text-align: right; }
.page-error { margin-top: 80px; }

.auth-page { min-height: 100vh; background: linear-gradient(140deg, #f7f0df, #e7efe9); }
.auth-main { min-height: calc(100vh - 76px); display: grid; place-items: center; padding: 48px 16px; }
.auth-card { width: min(560px, 100%); padding: 42px; text-align: center; background: rgba(255,255,255,.94); border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow); }
.auth-icon { font-size: 3rem; }
.auth-card h1 { margin: 4px 0 12px; font-size: 2.15rem; }
.auth-card > p { color: var(--muted); }
.auth-preview { display: grid; gap: 10px; margin: 26px 0; text-align: left; }
.auth-preview > div { display: flex; gap: 12px; padding: 14px; background: var(--paper); border-radius: 14px; }
.auth-preview span { width: 26px; height: 26px; display: grid; place-items: center; color: #fff; background: var(--green); border-radius: 50%; }
.auth-preview p { margin: 0; }
.auth-preview strong, .auth-preview small { display: block; }
.auth-preview small { color: var(--muted); }
.auth-footnote { font-size: .8rem; }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 100; transform: translate(-50%, 20px); padding: 11px 18px; color: #fff; background: #242c27; border-radius: 999px; opacity: 0; pointer-events: none; transition: .2s ease; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; gap: 30px; }
  .hero-visual { min-height: 420px; }
  .feature-grid { grid-template-columns: 1fr 1fr; }
  .feature-grid > div:nth-child(2) { border-right: 0; }
  .card-grid { grid-template-columns: 1fr 1fr; }
  .search-panel { grid-template-columns: 1fr 1fr; }
  .keyword-field { grid-column: 1 / -1; }
  .search-panel .button { width: max-content; }
  .recent-list { grid-template-columns: 1fr 1fr; }
  .detail-layout { grid-template-columns: 1fr; }
  .detail-aside { grid-template-columns: 1fr 1fr; }
  .aside-card { position: static; }
}

@media (max-width: 720px) {
  .header-inner { min-height: 68px; }
  .menu-button { display: block; }
  .site-nav:not(.static) { display: none; position: absolute; left: 16px; right: 16px; top: 76px; padding: 18px; flex-direction: column; align-items: stretch; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
  .site-nav.open { display: flex; }
  .site-nav.static { display: flex; }
  .nav-login { text-align: center; }
  .hero { padding-top: 54px; }
  .hero h1 { font-size: 2.55rem; }
  .hero-visual { min-height: 330px; }
  .hero-card { padding: 10px 12px; }
  .hero-card-one { left: 0; bottom: 30px; }
  .hero-card-two { right: 0; top: 30px; }
  .feature-grid { grid-template-columns: 1fr; }
  .feature-grid > div { border-right: 0; border-bottom: 1px solid rgba(255,255,255,.13); }
  .section { padding: 66px 0; }
  .section-heading { display: block; }
  .section-heading > p { margin-top: 12px; }
  .search-panel { grid-template-columns: 1fr; }
  .keyword-field { grid-column: auto; }
  .search-panel .button { width: 100%; }
  .card-grid, .recent-list { grid-template-columns: 1fr; }
  .cta-card { padding: 34px 28px; display: block; }
  .cta-card .button { margin-top: 24px; }
  .footer-grid { display: block; }
  .detail-hero { padding: 45px 0; }
  .detail-hero-inner, .book-hero-grid { grid-template-columns: 1fr; }
  .week-badge { display: none; }
  .book-cover { width: min(270px, 85%); margin: 0 auto; }
  .detail-layout { padding-top: 50px; }
  .detail-aside { grid-template-columns: 1fr; }
  .sentence-card, .detail-card-head { align-items: stretch; flex-direction: column; }
  .audio-player { width: 100%; max-width: 100%; }
  .vocab-grid, .resource-grid { grid-template-columns: 1fr; }
  .vocab-card { grid-template-columns: 120px 1fr; }
  .vocab-card img { height: 130px; }
  .vocab-detail { grid-template-columns: 1fr; }
  .vocab-detail > img { height: 240px; }
  .content-nav { grid-template-columns: 1fr; }
  .nav-card.align-right { text-align: left; }
  .auth-card { padding: 30px 22px; }
}

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

/* v1.1 additions */
.current-card { outline: 2px solid rgba(49,95,75,.18); outline-offset: 2px; }
.card-image { position: relative; }
.current-tag { position: absolute; right: 12px; top: 12px; padding: 6px 10px; border-radius: 999px; background: #f5d66f; color: #493d13; font-size: .76rem; font-weight: 900; box-shadow: 0 4px 14px rgba(0,0,0,.12); }
#hero-title { max-width: 830px; }
#current-term { opacity: .72; }
