@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;700;900&family=Roboto+Condensed:wght@700;900&display=swap");

:root {
  --ink: #171717;
  --ink-2: #282828;
  --paper: #f0e8db;
  --paper-2: #d9c9b5;
  --white: #fffaf1;
  --red: #d63a35;
  --red-dark: #9e2928;
  --brass: #caa25a;
  --gray: #77736d;
  --line: #9c9184;
  --font: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --display: "Roboto Condensed", "Noto Sans TC", sans-serif;
  --page: min(1360px, calc(100vw - 64px));
  --read: 70ch;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--ink); }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font); font-size: 18px; line-height: 1.85; }
a { color: inherit; }
img { display: block; max-width: 100%; }
button { font: inherit; }
:focus-visible { outline: 3px solid var(--brass); outline-offset: 4px; }
.skip-link { position: fixed; top: -80px; left: 16px; z-index: 100; padding: 8px 14px; background: white; }
.skip-link:focus { top: 16px; }

.site-nav { position: sticky; z-index: 50; top: 0; background: rgba(23,23,23,.97); color: white; border-bottom: 4px solid var(--red); }
.nav-inner { width: var(--page); min-height: 70px; margin: auto; display: flex; align-items: stretch; gap: 30px; }
.brand { display: flex; align-items: center; gap: 11px; font: 900 1.15rem/1 var(--display); letter-spacing: .05em; text-decoration: none; }
.brand-mark { width: 32px; height: 32px; border: 2px solid var(--paper); border-radius: 50%; position: relative; }
.brand-mark::before { content: ""; position: absolute; inset: 6px; border: 1px solid var(--brass); border-radius: 50%; }
.brand-mark::after { content: ""; position: absolute; inset: 13px; background: var(--red); border-radius: 50%; }
.site-menu { margin-left: auto; display: flex; }
.nav-group { position: relative; }
.nav-group summary { list-style: none; min-height: 70px; display: flex; align-items: center; padding: 0 15px; cursor: pointer; font-size: .82rem; font-weight: 700; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::after { content: "＋"; color: var(--red); margin-left: 8px; }
.nav-group[open] summary::after { content: "−"; }
.nav-group.is-active summary { box-shadow: inset 0 -6px var(--red); }
.nav-panel { position: absolute; top: 66px; right: 0; width: 255px; padding: 10px; background: var(--ink-2); border: 1px solid #555; box-shadow: 0 20px 50px rgba(0,0,0,.38); }
.nav-panel a { display: block; padding: 10px 12px; text-decoration: none; font-size: .86rem; }
.nav-panel a:hover, .nav-panel a[aria-current="page"] { background: var(--red); color: white; }
.nav-toggle { display: none; margin-left: auto; border: 0; background: transparent; color: white; font-weight: 800; }

.hero { position: relative; min-height: min(770px, calc(100vh - 70px)); background: var(--ink); color: white; overflow: hidden; display: grid; }
.hero-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 0 46%, rgba(23,23,23,.55) 58%, rgba(23,23,23,.98) 76%); }
.hero-copy { position: relative; z-index: 2; width: var(--page); margin: auto; display: grid; justify-items: start; align-content: center; padding-left: 55%; }
.eyebrow { margin: 0 0 20px; color: var(--red); font: 900 .75rem/1.2 var(--display); letter-spacing: .18em; }
.hero h1, .lesson-hero h1, .section-head h2 { font-family: var(--display); text-transform: uppercase; letter-spacing: -.035em; }
.hero h1 { margin: 0; font-size: clamp(3.7rem, 7.2vw, 8.7rem); line-height: .9; text-wrap: balance; }
.hero .lead { max-width: 630px; color: #d3ccc3; margin: 28px 0 34px; }
.button { display: inline-flex; min-height: 50px; align-items: center; padding: 10px 20px; background: var(--red); color: white; border: 1px solid var(--red); text-decoration: none; font-weight: 900; }
.button.secondary { margin-left: 8px; background: transparent; border-color: var(--paper); }
.bar-line { height: 46px; background: repeating-linear-gradient(90deg, var(--ink) 0 5%, var(--red) 5% 5.5%, var(--ink) 5.5% 12.5%); border-block: 1px solid #444; }
.page-shell { width: var(--page); margin: auto; }
.home-section { padding: clamp(70px, 9vw, 130px) 0; }
.section-head { display: grid; grid-template-columns: 110px minmax(0, 900px); gap: 26px; margin-bottom: 52px; }
.section-head small { border-top: 7px solid var(--red); padding-top: 10px; font: 900 .75rem/1 var(--display); letter-spacing: .15em; color: var(--red-dark); }
.section-head h2 { margin: 0; font-size: clamp(2.8rem, 5.4vw, 6rem); line-height: .95; }
.section-head p { grid-column: 2; max-width: var(--read); margin: 0; color: #5f5b55; }
.count-grid { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--ink); }
.count-card { min-height: 240px; padding: 26px; border-right: 1px solid var(--ink); text-decoration: none; display: flex; flex-direction: column; }
.count-card:last-child { border: 0; }
.count-card b { font: 900 4.5rem/1 var(--display); color: var(--red); }
.count-card h3 { margin: auto 0 8px; font: 900 1.45rem/1.2 var(--display); text-transform: uppercase; }
.count-card p { margin: 0; color: #5e5952; font-size: .88rem; }

.machine { background: var(--ink); color: white; padding: clamp(48px, 7vw, 94px) max(20px, calc((100vw - min(1360px, calc(100vw - 64px))) / 2)); }
.machine-inner { display: grid; grid-template-columns: .72fr 1.28fr; gap: 70px; align-items: center; }
.machine h2 { margin: 0 0 20px; font: 900 clamp(2.8rem, 5vw, 5.8rem)/.95 var(--display); text-transform: uppercase; }
.machine p { color: #c9c0b6; }
.beat-machine { border: 1px solid #5c5c5c; padding: 24px; background: #202020; }
.beat-row { display: grid; grid-template-columns: 70px repeat(8, 1fr); gap: 7px; margin-bottom: 7px; align-items: center; }
.beat-row strong { color: var(--brass); font: 900 .78rem/1 var(--display); letter-spacing: .08em; }
.beat-cell { aspect-ratio: 1; border: 1px solid #696969; background: #303030; cursor: pointer; }
.beat-cell:nth-of-type(4n + 1) { border-left: 3px solid #878787; }
.beat-cell.is-on { background: var(--red); border-color: var(--red); }
.beat-cell.is-now { outline: 3px solid var(--brass); outline-offset: 1px; }
.beat-play { margin-top: 18px; min-height: 46px; padding: 8px 18px; background: var(--brass); color: var(--ink); border: 0; font-weight: 900; }
.route-list { border-top: 1px solid var(--ink); }
.route-row { min-height: 110px; display: grid; grid-template-columns: 80px 1fr auto; gap: 24px; align-items: center; padding: 20px 0; border-bottom: 1px solid var(--ink); text-decoration: none; }
.route-row b { width: 48px; height: 48px; display: grid; place-items: center; background: var(--red); color: white; font: 900 1rem/1 var(--display); }
.route-row h3 { margin: 0; font: 900 1.5rem/1.2 var(--display); text-transform: uppercase; }
.route-row p { margin: 6px 0 0; color: #625c54; font-size: .9rem; }
.route-row span { color: var(--red); font-size: 1.6rem; }

.lesson-hero { background: var(--ink); color: white; border-bottom: 14px solid var(--red); }
.lesson-hero-inner { width: var(--page); min-height: 440px; margin: auto; padding: 88px 0 62px; display: grid; grid-template-columns: minmax(0, 940px) 1fr; gap: 50px; align-items: end; }
.lesson-breadcrumb { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 26px; color: #bcb3a9; font-size: .82rem; }
.lesson-breadcrumb a { color: white; text-underline-offset: 4px; }
.lesson-breadcrumb strong { color: var(--brass); font-weight: 900; }
.lesson-hero h1 { margin: 0 0 22px; font-size: clamp(3.3rem, 6.4vw, 7.4rem); line-height: .92; text-wrap: balance; }
.lesson-hero .lead { margin: 0; max-width: var(--read); color: #c9c1b8; }
.lesson-index { align-self: start; justify-self: end; color: var(--brass); font: 900 .75rem/1 var(--display); letter-spacing: .14em; border-top: 5px solid var(--red); padding-top: 10px; }
.lesson-layout { width: var(--page); margin: auto; padding: 72px 0 120px; display: grid; grid-template-columns: 250px minmax(0, 900px); gap: clamp(50px, 8vw, 120px); align-items: start; }
.lesson-rail { position: sticky; top: 100px; font-size: .83rem; }
.lesson-rail strong { display: block; margin-bottom: 12px; color: var(--red-dark); font: 900 .75rem/1 var(--display); letter-spacing: .12em; }
.lesson-rail a { display: block; padding: 9px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.lesson-rail a[aria-current="page"] { color: var(--red-dark); font-weight: 900; }
.takeaway { margin: 0 0 62px; padding: 26px 30px; background: var(--white); border-left: 9px solid var(--red); font-size: 1.18rem; font-weight: 700; }
.lesson-section { padding-bottom: 58px; margin-bottom: 58px; border-bottom: 1px solid var(--line); }
.lesson-section h2 { margin: 0 0 20px; font: 900 clamp(2rem, 3.4vw, 3.4rem)/1.08 var(--display); text-transform: uppercase; }
.lesson-section p { margin: 0; color: #56514b; max-width: var(--read); }
.lesson-section ul { padding: 0; list-style: none; display: grid; gap: 8px; }
.lesson-section li { position: relative; padding-left: 26px; }
.lesson-section li::before { content: ""; position: absolute; left: 0; top: .8em; width: 12px; height: 12px; border-radius: 50%; background: var(--red); }
.practice-card { margin-top: 70px; padding: clamp(32px, 5vw, 58px); background: var(--ink); color: white; border-top: 10px solid var(--red); }
.practice-card small { color: var(--brass); font: 900 .8rem/1 var(--display); letter-spacing: .14em; }
.practice-card h2 { margin: 13px 0 20px; font: 900 2.1rem/1.1 var(--display); text-transform: uppercase; }
.practice-card ol { color: #d8d0c6; }
.practice-card .check { margin-top: 22px; padding-top: 18px; border-top: 1px solid #555; }
.resource-list { margin-top: 46px; padding: 24px; border: 1px solid var(--line); background: var(--white); }
.resource-list h2 { margin: 0 0 10px; font: 900 1.2rem/1 var(--display); text-transform: uppercase; }
.resource-list a { display: block; padding: 7px 0; color: var(--red-dark); }
.chapter-turn { margin-top: 60px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chapter-turn a { min-height: 110px; padding: 20px; background: var(--white); border: 1px solid var(--line); text-decoration: none; }
.chapter-turn a:last-child { text-align: right; }
.chapter-turn small { display: block; color: var(--red-dark); font-weight: 900; }
.site-footer { background: #0e0e0e; color: white; border-top: 4px solid var(--red); padding: 58px 0; }
.footer-inner { width: var(--page); margin: auto; display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 40px; }
.site-footer h2 { margin: 0 0 10px; font: 900 1.6rem/1 var(--display); text-transform: uppercase; }
.site-footer p, .site-footer a { color: #a9a39d; font-size: .82rem; }
.site-footer a { display: block; padding: 4px 0; }

@media (max-width: 900px) {
  :root { --page: min(100% - 34px, 720px); }
  body { font-size: 17px; }
  .site-nav, .nav-inner { min-height: 64px; }
  .nav-toggle { display: block; min-width: 48px; }
  .site-menu { display: none; position: absolute; top: 64px; left: 0; right: 0; max-height: calc(100vh - 64px); overflow: auto; background: var(--ink); padding: 10px 17px 24px; }
  .site-menu[data-open="true"] { display: block; }
  .nav-group summary { min-height: 50px; padding: 0; border-bottom: 1px solid #444; }
  .nav-panel { position: static; width: auto; border: 0; box-shadow: none; padding: 6px 0 12px 14px; }
  .hero { min-height: 810px; }
  .hero-art { height: 48%; object-position: 35% center; }
  .hero::after { background: linear-gradient(180deg, transparent 0 31%, rgba(23,23,23,.78) 46%, var(--ink) 57%); }
  .hero-copy { align-content: end; padding: 0 0 58px; }
  .hero h1 { font-size: clamp(3.3rem, 17vw, 5rem); }
  .hero .lead { font-size: .96rem; }
  .section-head { grid-template-columns: 52px 1fr; gap: 16px; }
  .section-head p { grid-column: 1 / -1; }
  .count-grid { grid-template-columns: 1fr; }
  .count-card { min-height: 180px; border-right: 0; border-bottom: 1px solid var(--ink); }
  .machine { padding-inline: 17px; }
  .machine-inner { grid-template-columns: 1fr; gap: 34px; }
  .beat-machine { padding: 14px 9px; }
  .beat-row { grid-template-columns: 50px repeat(8, 1fr); gap: 4px; }
  .route-row { grid-template-columns: 54px 1fr auto; gap: 12px; }
  .lesson-hero-inner { min-height: 410px; grid-template-columns: 1fr; align-content: end; padding: 68px 0 46px; }
  .lesson-index { justify-self: start; }
  .lesson-layout { grid-template-columns: 1fr; padding-top: 28px; }
  .lesson-rail { position: static; display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; }
  .lesson-rail strong { display: none; }
  .lesson-rail a { flex: 0 0 auto; padding: 7px 10px; border: 1px solid var(--line); background: var(--white); }
  .chapter-turn, .footer-inner { grid-template-columns: 1fr; }
  .chapter-turn a:last-child { text-align: left; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
.character-companion {
  width: min(1160px, calc(100% - 64px));
  min-height: 190px;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  align-items: end;
  gap: clamp(1rem, 3vw, 2.5rem);
  margin: clamp(1.5rem, 4vw, 3rem) auto;
  padding: 0 clamp(1.1rem, 3vw, 2rem);
  border: 2px solid var(--ink);
  border-right: 10px solid var(--red);
  color: var(--white);
  background: var(--ink-2);
  overflow: hidden;
}
.lesson-layout article > .character-companion { width: 100%; margin-top: 0; }
.character-companion img { width: 100%; height: 184px; object-fit: contain; object-position: center bottom; }
.character-companion div { align-self: center; padding-block: 1.2rem; }
.character-companion small { color: var(--brass); font-weight: 900; letter-spacing: .09em; }
.character-companion p { max-width: 34rem; margin: .45rem 0 0; color: inherit; font-size: clamp(1.05rem, 2vw, 1.35rem); line-height: 1.65; }
@media (max-width: 620px) {
  .character-companion { width: calc(100% - 2rem); min-height: 132px; grid-template-columns: 108px minmax(0, 1fr); padding-inline: .35rem .9rem; }
  .lesson-layout article > .character-companion { width: 100%; }
  .character-companion img { height: 128px; }
  .character-companion p { font-size: .96rem; line-height: 1.55; }
}
