:root {
  --ink: #101018;
  --paper: #f7f2df;
  --paper-2: #fffdf5;
  --acid: #f5f118;
  --cyan: #19d3ff;
  --pink: #ff3ea5;
  --violet: #725cff;
  --muted: #686777;
  --line: 3px solid var(--ink);
  --shadow: 7px 7px 0 var(--ink);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; max-width: 100%; overflow-x: hidden; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, transparent 0 48%, rgba(16,16,24,.035) 49% 51%, transparent 52%) 0 0 / 38px 38px,
    var(--paper);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  overflow-x: hidden;
}
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible { outline: 4px solid var(--cyan); outline-offset: 3px; }

.halftone { position: fixed; z-index: -1; border-radius: 50%; pointer-events: none; opacity: .42; background-image: radial-gradient(var(--ink) 1.4px, transparent 1.4px); background-size: 10px 10px; }
.halftone-a { width: 320px; height: 320px; top: 12%; right: -110px; transform: rotate(12deg); }
.halftone-b { width: 220px; height: 220px; bottom: 4%; left: -90px; background-image: radial-gradient(var(--pink) 1.5px, transparent 1.5px); }

.topbar {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 0 max(24px, calc((100vw - 1180px) / 2));
  border-bottom: var(--line);
  background: rgba(247,242,223,.92);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 56px; height: 44px; background: var(--acid); border: var(--line); box-shadow: 4px 4px 0 var(--pink); font: 900 24px/1 Impact, Haettenschweiler, sans-serif; transform: rotate(-4deg); }
.brand-copy { display: grid; line-height: 1.05; }
.brand-copy strong { font-size: 17px; }
.brand-copy small { margin-top: 5px; color: var(--muted); font-weight: 700; letter-spacing: .04em; }
.desktop-nav { display: flex; align-items: center; gap: 6px; }
.nav-item { border: 0; background: transparent; font-weight: 850; cursor: pointer; padding: 11px 16px; border-radius: 999px; }
.nav-item:hover { background: rgba(16,16,24,.06); }
.nav-item.active { background: var(--ink); color: white; }
.icon-button { width: 42px; height: 42px; border: var(--line); background: var(--cyan); box-shadow: 3px 3px 0 var(--ink); border-radius: 50%; font-size: 24px; font-weight: 900; cursor: pointer; }

.app-shell { width: min(1180px, calc(100% - 40px)); margin: 34px auto 80px; }
.view { display: none; animation: view-in .28s ease both; }
.view.active { display: block; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } }

.hero { min-height: 264px; display: grid; grid-template-columns: 1fr 190px; align-items: center; gap: 36px; padding: 44px 52px; background: var(--ink); color: white; border: var(--line); box-shadow: 10px 10px 0 var(--pink); position: relative; overflow: hidden; }
.hero::before { content: ""; position: absolute; width: 360px; height: 360px; border: 36px solid var(--violet); border-radius: 50%; right: -155px; top: -150px; opacity: .6; }
.hero::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.18) 1px, transparent 1px); background-size: 12px 12px; mask-image: linear-gradient(90deg, transparent 50%, #000); pointer-events: none; }
.panel-cut { clip-path: polygon(0 0, 97% 0, 100% 12%, 100% 100%, 3% 100%, 0 88%); }
.hero-copy { position: relative; z-index: 1; }
.eyebrow, .section-kicker { margin: 0 0 8px; font: 900 13px/1.1 "Arial Narrow", sans-serif; letter-spacing: .18em; text-transform: uppercase; color: var(--pink); }
.hero h1, .page-heading h1 { margin: 0; max-width: 780px; font-size: clamp(34px, 5vw, 64px); line-height: .98; letter-spacing: -.04em; text-wrap: balance; }
.hero-summary { max-width: 720px; margin: 20px 0 24px; color: #d8d7df; font-size: 17px; line-height: 1.6; }
.meta-row { display: flex; flex-wrap: wrap; gap: 9px; }
.meta-pill { padding: 7px 12px; border: 2px solid rgba(255,255,255,.7); border-radius: 999px; font-size: 13px; font-weight: 800; }
.meta-pill.accent { background: var(--acid); border-color: var(--acid); color: var(--ink); }
.countdown-card { position: relative; z-index: 1; width: 168px; height: 168px; display: grid; place-content: center; justify-items: center; background: var(--cyan); color: var(--ink); border: var(--line); box-shadow: 7px 7px 0 var(--acid); transform: rotate(3deg); }
.countdown-card strong { font: 900 74px/.85 Impact, sans-serif; }
.countdown-card small { margin-top: 8px; font-weight: 900; }
.burst { position: absolute; top: -15px; left: -18px; padding: 9px 11px; background: var(--pink); color: white; border: 2px solid var(--ink); font-weight: 900; transform: rotate(-12deg); }

.toolbar { display: flex; align-items: center; gap: 12px; margin: 28px 0; padding: 14px; background: var(--paper-2); border: var(--line); box-shadow: 5px 5px 0 var(--ink); border-radius: 15px; }
.sticky-card { position: sticky; top: 88px; z-index: 15; }
.primary-button, .secondary-button, .text-button, .complete-button { border: 2px solid var(--ink); cursor: pointer; font-weight: 900; transition: transform .15s, box-shadow .15s; }
.primary-button:hover, .secondary-button:hover, .complete-button:hover { transform: translate(-2px,-2px); box-shadow: 4px 4px 0 var(--ink); }
.primary-button { background: var(--acid); padding: 12px 17px; border-radius: 10px; white-space: nowrap; }
.secondary-button { background: white; padding: 12px 15px; border-radius: 10px; white-space: nowrap; }
.secondary-button[aria-pressed="true"] { background: var(--cyan); }
.text-button { margin-left: auto; border-color: transparent; background: transparent; padding: 10px; text-decoration: underline 2px; text-underline-offset: 4px; white-space: nowrap; }
.speed-control { display: flex; align-items: center; gap: 9px; min-width: 200px; margin-left: 4px; font-size: 13px; font-weight: 850; }
.speed-control input { min-width: 90px; accent-color: var(--pink); }
.speed-control output { min-width: 40px; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .75fr); gap: 26px; align-items: start; }
.comic-card { background: var(--paper-2); border: var(--line); box-shadow: var(--shadow); border-radius: var(--radius); }
.dialogue-card { padding: 30px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding-bottom: 20px; border-bottom: 3px solid var(--ink); }
.section-heading.compact { padding-bottom: 14px; }
.section-heading h2, .mission-card h2, .calendar-detail h2 { margin: 0; font-size: 26px; line-height: 1; }
.line-count { background: var(--ink); color: white; border-radius: 999px; padding: 6px 10px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.dialogue-list { display: grid; gap: 5px; padding-top: 14px; }
.dialogue-line { display: grid; grid-template-columns: 76px 1fr 42px; gap: 14px; align-items: start; padding: 16px 8px; border-bottom: 1px dashed #aaa8a0; border-radius: 10px; }
.dialogue-line > div { min-width: 0; }
.dialogue-line:last-child { border-bottom: 0; }
.dialogue-line.speaking { background: rgba(25,211,255,.16); box-shadow: inset 5px 0 var(--cyan); }
.dialogue-line.muted-role { opacity: .32; }
.speaker { display: inline-flex; justify-content: center; padding: 7px 8px; border: 2px solid var(--ink); border-radius: 5px; background: var(--cyan); font-size: 11px; font-weight: 950; text-transform: uppercase; transform: rotate(-2deg); }
.speaker.you { background: var(--pink); color: white; transform: rotate(2deg); }
.english { margin: 0; font-size: 17px; line-height: 1.52; font-weight: 720; overflow-wrap: anywhere; }
.chinese { margin: 7px 0 0; color: var(--muted); line-height: 1.5; font-size: 14px; }
.hide-translations .chinese { display: none; }
.speak-button { width: 38px; height: 38px; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 50%; background: white; cursor: pointer; }
.speak-button:hover { background: var(--acid); }

.practice-sidebar { display: grid; gap: 26px; }
.phrases-card, .mission-card { padding: 24px; }
.phrase-item { position: relative; padding: 17px 0 17px 18px; border-bottom: 1px dashed #aaa8a0; }
.phrase-item:last-child { border-bottom: 0; }
.phrase-item::before { content: ""; position: absolute; left: 0; top: 20px; width: 8px; height: 8px; background: var(--pink); border: 1px solid var(--ink); transform: rotate(45deg); }
.phrase-item strong { display: block; line-height: 1.45; }
.phrase-item span { display: block; margin-top: 5px; color: var(--muted); font-size: 13px; }
.mission-card { background: var(--acid); transform: rotate(.5deg); }
.mission-card ol { margin: 20px 0 24px; padding-left: 22px; }
.mission-card li { margin: 12px 0; padding-left: 4px; line-height: 1.45; font-weight: 700; }
.complete-button { width: 100%; background: var(--ink); color: white; border-radius: 10px; padding: 14px 12px; }
.complete-button.completed { background: var(--cyan); color: var(--ink); }

.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 28px; margin: 12px 0 30px; }
.page-heading h1 { font-size: clamp(42px,6vw,68px); }
.page-heading > div > p:last-child { color: var(--muted); margin: 12px 0 0; }
.month-switcher { display: flex; align-items: center; gap: 16px; padding: 8px; background: white; border: var(--line); box-shadow: 4px 4px 0 var(--ink); border-radius: 12px; }
.month-switcher button { width: 38px; height: 38px; border: 0; border-radius: 7px; background: var(--paper); font-weight: 900; cursor: pointer; }
.month-switcher strong { min-width: 112px; text-align: center; }
.calendar-layout { display: grid; grid-template-columns: minmax(0,1fr) 310px; gap: 26px; align-items: start; }
.calendar-card { padding: 25px; }
.week-row, .calendar-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 8px; }
.week-row span { padding: 6px; text-align: center; color: var(--muted); font-size: 12px; font-weight: 900; }
.calendar-day { min-height: 92px; padding: 10px; text-align: left; border: 2px solid transparent; border-radius: 9px; background: rgba(16,16,24,.035); cursor: default; position: relative; }
button.calendar-day { cursor: pointer; background: white; border-color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }
button.calendar-day:hover { transform: translate(-1px,-1px); box-shadow: 5px 5px 0 var(--pink); }
.calendar-day.outside { opacity: .28; }
.calendar-day.today { outline: 3px solid var(--pink); outline-offset: -3px; }
.calendar-day.completed::after { content: "✓"; position: absolute; right: 7px; top: 6px; width: 20px; height: 20px; display: grid; place-items: center; background: var(--acid); border: 1px solid var(--ink); border-radius: 50%; font-size: 11px; font-weight: 950; }
.day-number { font-weight: 900; }
.day-topic { display: block; margin-top: 16px; font-size: 11px; line-height: 1.25; font-weight: 800; color: var(--muted); }
.topic-dot { display: inline-block; width: 7px; height: 7px; margin-right: 4px; border-radius: 50%; background: var(--pink); }
.calendar-detail { padding: 28px; position: sticky; top: 104px; }
.calendar-detail p:last-child { color: var(--muted); line-height: 1.6; }
.calendar-detail .detail-date { display: inline-block; margin: 12px 0; padding: 6px 9px; background: var(--acid); border: 2px solid var(--ink); font-size: 12px; font-weight: 900; }
.calendar-detail button { margin-top: 12px; width: 100%; }

.archive-heading { align-items: center; }
.search-box { min-width: 290px; display: flex; align-items: center; gap: 8px; background: white; border: var(--line); box-shadow: 4px 4px 0 var(--ink); border-radius: 12px; padding: 0 14px; }
.search-box span { font-size: 25px; font-weight: 900; }
.search-box input { width: 100%; padding: 13px 0; border: 0; outline: 0; background: transparent; }
.filter-row { display: flex; gap: 9px; overflow-x: auto; padding: 4px 4px 12px; scrollbar-width: none; }
.filter-button { flex: none; border: 2px solid var(--ink); border-radius: 999px; background: white; padding: 8px 13px; font-weight: 850; cursor: pointer; }
.filter-button.active { background: var(--pink); color: white; }
.archive-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 22px; margin-top: 12px; }
.archive-card { min-height: 220px; padding: 24px; display: flex; flex-direction: column; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.archive-card:hover { transform: translate(-3px,-3px) rotate(-.3deg); box-shadow: 10px 10px 0 var(--cyan); }
.archive-card time { color: var(--muted); font-size: 12px; font-weight: 800; }
.archive-card h2 { margin: 18px 0 10px; font-size: 25px; line-height: 1.08; }
.archive-card p { color: var(--muted); line-height: 1.5; font-size: 14px; }
.archive-card footer { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 18px; border-top: 2px solid var(--ink); font-weight: 850; font-size: 12px; }
.category-tag { background: var(--acid); color: var(--ink); padding: 5px 8px; border: 1px solid var(--ink); transform: rotate(-2deg); }
.empty-state { grid-column: 1/-1; padding: 44px; text-align: center; border: 3px dashed var(--ink); color: var(--muted); }

.mobile-nav { display: none; }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 50; padding: 12px 18px; background: var(--ink); color: white; border: 2px solid white; box-shadow: 5px 5px 0 var(--pink); border-radius: 9px; font-weight: 800; transform: translate(-50%,30px); opacity: 0; pointer-events: none; transition: .25s; }
.toast.show { opacity: 1; transform: translate(-50%,0); }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr 140px; padding: 38px; }
  .countdown-card { width: 130px; height: 130px; }
  .countdown-card strong { font-size: 58px; }
  .content-grid, .calendar-layout { grid-template-columns: 1fr; }
  .practice-sidebar { grid-template-columns: 1fr 1fr; }
  .calendar-detail { position: static; }
  .archive-grid { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 680px) {
  body { width: 100vw; max-width: 100vw; padding-bottom: 78px; overflow-x: hidden; }
  .topbar { height: 66px; padding: 0 16px; }
  .brand-mark { width: 48px; height: 38px; font-size: 21px; }
  .brand-copy small { display: none; }
  .desktop-nav { display: none; }
  .app-shell { width: calc(100vw - 24px); max-width: calc(100vw - 24px); margin: 18px auto 34px; }
  .view, .hero, .toolbar, .content-grid, .comic-card { width: 100%; max-width: 100%; }
  .hero { min-height: 0; grid-template-columns: minmax(0,1fr); gap: 22px; padding: 28px 24px 34px; box-shadow: 6px 6px 0 var(--pink); clip-path: polygon(0 0,95% 0,100% 8%,100% 100%,4% 100%,0 93%); }
  .hero-copy, .content-grid, .dialogue-card { min-width: 0; }
  .hero h1 { max-width: 100%; font-size: 34px; line-height: 1.06; overflow-wrap: anywhere; text-wrap: wrap; }
  .hero-summary { max-width: 100%; margin: 15px 0 18px; font-size: 15px; overflow-wrap: anywhere; }
  .countdown-card { width: 100%; height: auto; display: flex; align-items: baseline; justify-content: center; gap: 7px; padding: 13px; transform: none; }
  .countdown-card strong { font-size: 42px; }
  .countdown-card small { margin: 0; }
  .burst { top: -10px; left: 12px; }
  .toolbar { top: 75px; display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 8px; margin: 20px 0; padding: 10px; box-shadow: 3px 3px 0 var(--ink); }
  .primary-button, .secondary-button { min-width: 0; padding: 11px 6px; font-size: 13px; white-space: normal; line-height: 1.2; }
  .speed-control { min-width: 0; grid-column: 1/-1; justify-content: space-between; padding: 5px 4px; }
  .speed-control input { flex: 1; }
  .text-button { position: absolute; top: calc(100% + 8px); right: 0; font-size: 12px; }
  .content-grid { gap: 20px; }
  .dialogue-card { padding: 21px 16px; }
  .dialogue-line { grid-template-columns: 55px minmax(0,1fr) 36px; gap: 9px; padding: 15px 2px; }
  .speaker { padding: 6px 4px; font-size: 9px; }
  .english { font-size: 16px; }
  .speak-button { width: 34px; height: 34px; }
  .practice-sidebar { grid-template-columns: 1fr; gap: 20px; }
  .page-heading { display: grid; align-items: start; margin-top: 4px; }
  .page-heading h1 { font-size: 46px; }
  .month-switcher { width: 100%; justify-content: space-between; }
  .calendar-card { padding: 12px; }
  .week-row, .calendar-grid { gap: 4px; }
  .calendar-day { min-height: 63px; padding: 6px; }
  .day-topic { display: none; }
  .topic-dot { position: absolute; left: 7px; bottom: 7px; }
  .search-box { min-width: 0; width: 100%; }
  .archive-grid { grid-template-columns: 1fr; }
  .archive-card { min-height: 190px; }
  .mobile-nav { position: fixed; z-index: 30; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); left: 10px; right: 10px; max-width: calc(100vw - 20px); bottom: max(9px, env(safe-area-inset-bottom)); padding: 7px; background: var(--ink); border: 2px solid white; box-shadow: 5px 5px 0 var(--pink); border-radius: 15px; }
  .mobile-nav .nav-item { display: grid; place-items: center; gap: 2px; padding: 7px 4px; color: white; font-size: 11px; border-radius: 9px; }
  .mobile-nav .nav-item span { font-size: 17px; }
  .mobile-nav .nav-item.active { background: var(--acid); color: var(--ink); }
  .toast { bottom: 100px; width: calc(100% - 40px); text-align: center; }
}

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

@media print {
  .topbar, .toolbar, .mobile-nav, .halftone, .speak-button, .complete-button { display: none !important; }
  body { background: white; }
  .app-shell { width: 100%; margin: 0; }
  .hero { color: black; background: white; box-shadow: none; clip-path: none; }
  .content-grid { grid-template-columns: 1fr; }
  .comic-card { box-shadow: none; break-inside: avoid; }
}
