:root {
  --bg: #fbf9f4;
  --surface: rgba(250, 246, 238, 0.9);
  --surface-strong: #fffdf8;
  --ink: #1c1613;
  --muted: #70645e;
  --line: rgba(28, 22, 19, 0.12);
  --line-strong: rgba(28, 22, 19, 0.88);
  --accent: #9e3a33;
  --accent-hover: #b5453d;
  --accent-soft: #f1e3dc;
  --gold: #c5a880;
  --paper: #faf6ee;
  --hard-shadow: 4px 4px 0 rgba(28, 22, 19, 0.92);
  --soft-shadow: 0 18px 48px rgba(42, 32, 26, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 0%, rgba(197, 168, 128, 0.16), transparent 28%),
    radial-gradient(circle at 86% 12%, rgba(158, 58, 51, 0.08), transparent 24%),
    linear-gradient(180deg, #fffdf8 0%, var(--bg) 62%, #f7f0e7 100%);
  color: var(--ink);
  font-family: "Noto Serif SC", "Songti SC", "PingFang SC", serif;
}


button,
a {
  font: inherit;
  color: inherit;
}

.site-frame {
  min-height: 100vh;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(251, 249, 244, 0.9);
  border-bottom: 1px solid rgba(28, 22, 19, 0.1);
  backdrop-filter: blur(14px);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 18px 34px;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 14px;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 10px;
}

.brand-mark:hover .brand-icon,
.brand-mark:focus-visible .brand-icon {
  box-shadow: 4px 4px 0 var(--ink);
  transform: translate(-1px, -1px);
}

.brand-mark:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--accent);
  box-shadow: 3px 3px 0 var(--ink);
  font-family: "Cinzel", "Iowan Old Style", Georgia, serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: #fffaf4;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-label {
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.brand-copy strong {
  font-family: "Cinzel", "Iowan Old Style", Georgia, serif;
  font-size: 1.28rem;
  font-weight: 900;
  letter-spacing: 0.03em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.utility-link,
.language-toggle {
  border: 0;
  background: transparent;
  padding: 0;
}

.utility-link {
  color: var(--muted);
  font-size: 0.96rem;
}

.account-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-controls[hidden] {
  display: none;
}

.account-email {
  max-width: 150px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-pro-badge {
  padding: 4px 7px 3px;
  border: 1px solid rgba(28, 22, 19, 0.82);
  border-radius: 999px;
  background: var(--gold);
  color: var(--ink);
  font-family: "Fira Code", monospace;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.account-guest-badge {
  border: 1px solid rgba(28, 22, 19, 0.2);
  background: transparent;
  color: var(--muted);
}

.account-controls [hidden] {
  display: none;
}

.language-toggle {
  min-width: 92px;
  padding: 7px 12px 8px;
  border: 1px solid rgba(28, 22, 19, 0.2);
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.72);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  box-shadow: inset 0 0 0 1px rgba(255, 250, 240, 0.7);
  cursor: pointer;
}

.language-toggle:hover,
.language-toggle:focus-visible {
  border-color: rgba(158, 58, 51, 0.42);
  background: rgba(158, 58, 51, 0.08);
  color: var(--accent);
}

.language-toggle:focus-visible {
  outline: 2px solid rgba(158, 58, 51, 0.24);
  outline-offset: 3px;
}

.language-toggle[aria-pressed="true"] {
  border-color: rgba(158, 58, 51, 0.48);
  background: rgba(158, 58, 51, 0.1);
  color: var(--accent);
}

.share-site-button {
  flex-shrink: 0;
  padding: 11px 18px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 180ms ease, background-color 180ms ease;
}

.share-site-button:hover {
  transform: translateY(-1px);
  background: rgba(28, 22, 19, 0.05);
}

.share-site-button:active {
  transform: translate(2px, 2px);
}

.share-site-button:focus-visible {
  outline: 2px solid rgba(158, 58, 51, 0.24);
  outline-offset: 3px;
}

.contact-author-button {
  flex-shrink: 0;
  padding: 11px 18px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--accent);
  box-shadow: 3px 3px 0 var(--ink);
  color: #fffaf4;
  font-size: 0.86rem;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 180ms ease;
}

.contact-author-button:hover {
  transform: translateY(-1px);
}

.contact-author-button:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

.contact-author-button:focus-visible {
  outline: 2px solid rgba(158, 58, 51, 0.24);
  outline-offset: 3px;
}

.page-shell {
  width: min(1260px, calc(100vw - 56px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.hero-section {
  position: relative;
  padding: 10px 0 18px;
}

.hero-section::before {
  content: "";
  position: absolute;
  inset: 46px 0 auto 18%;
  width: 220px;
  height: 220px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(185, 110, 83, 0.11), transparent 72%);
  filter: blur(6px);
  pointer-events: none;
}

.hero-section::after {
  content: "";
  position: absolute;
  right: 12%;
  top: 96px;
  width: 140px;
  height: 140px;
  border: 1px solid rgba(185, 110, 83, 0.12);
  border-radius: 50%;
  pointer-events: none;
}

.hero-meta,
.hero-kicker,
.section-kicker,
.course-learners,
.course-chip,
.course-pill,
.course-volume,
.hero-note-label {
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-meta-row {
  display: flex;
  align-items: center;
  gap: 18px;
}

.hero-meta {
  color: var(--muted);
  font-size: 0.76rem;
  white-space: nowrap;
}

.hero-rule {
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, rgba(43, 37, 32, 0.16), rgba(43, 37, 32, 0));
}

.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 320px);
  gap: 40px;
  align-items: start;
  padding: 14px 0 8px;
}

.hero-copy-block {
  position: relative;
  max-width: 920px;
  padding-top: 10px;
}

.hero-copy-block::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 64px;
  height: 1px;
  background: rgba(43, 37, 32, 0.24);
}

.hero-kicker {
  margin: 0 0 12px;
  color: var(--accent);
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.05rem;
  font-style: italic;
  font-weight: 700;
}

.hero-title {
  margin: 0;
  max-width: 15.5ch;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(2.2rem, 3.4vw, 3.15rem);
  font-weight: 900;
  line-height: 1.12;
  letter-spacing: -0.08em;
  text-wrap: balance;
}

.hero-title span {
  display: inline;
}

.hero-title-accent {
  position: relative;
  padding: 0 0.04em;
  color: var(--accent);
  background: transparent;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.hero-title-accent::after {
  content: "";
  position: absolute;
  left: 0.02em;
  right: 0.02em;
  bottom: 0.03em;
  height: 0.08em;
  background: linear-gradient(90deg, var(--gold), rgba(197, 168, 128, 0.34));
  transform: rotate(-1.2deg);
  transform-origin: left center;
  z-index: -1;
}

.hero-copy {
  max-width: 620px;
  margin: 14px 0 0 48px;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
  margin-left: 48px;
}

.hero-button,
.hero-secondary,
.hero-pro-button,
.course-link {
  border-radius: 999px;
  transition: transform 180ms ease, background-color 180ms ease, color 180ms ease, border-color 180ms ease;
}

.hero-button:hover,
.hero-secondary:hover,
.hero-pro-button:hover,
.course-link:hover {
  transform: translateY(-1px);
}

.hero-button {
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--accent);
  box-shadow: var(--hard-shadow);
  color: #fffaf4;
  padding: 15px 24px;
  font-weight: 800;
}

.hero-secondary {
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  padding: 14px 22px;
  font-weight: 800;
}

.hero-pro-button {
  position: relative;
  padding: 13px 18px 12px;
  border: 2px solid rgba(28, 22, 19, 0.92);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(197, 168, 128, 0.22), rgba(158, 58, 51, 0.1)),
    #fff7e8;
  box-shadow: 4px 4px 0 rgba(28, 22, 19, 0.92);
  color: var(--accent);
  font-weight: 900;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.hero-pro-button::after {
  content: "PRO";
  position: absolute;
  top: -10px;
  right: 10px;
  padding: 2px 6px;
  border: 1px solid rgba(28, 22, 19, 0.86);
  border-radius: 999px;
  background: var(--ink);
  color: #fffaf0;
  font-family: "Fira Code", monospace;
  font-size: 0.56rem;
  letter-spacing: 0.12em;
}

.hero-pro-button:focus-visible {
  outline: 2px solid rgba(158, 58, 51, 0.28);
  outline-offset: 4px;
}

.hero-button:active,
.hero-secondary:active,
.hero-pro-button:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

.hero-aside {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 30px;
}

.hero-note-card {
  padding: 18px 20px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  box-shadow: var(--hard-shadow);
}

.hero-note-primary {
  background: var(--paper);
  transform: translateX(8px);
}

.hero-note-secondary {
  max-width: 290px;
  border-color: rgba(28, 22, 19, 0.18);
  background: rgba(250, 246, 238, 0.62);
  box-shadow: none;
}

.hero-note-label {
  color: var(--muted);
  font-size: 0.68rem;
}

.hero-note-card strong {
  display: block;
  margin-top: 8px;
  font-family: "Playfair Display", "Noto Serif SC", Georgia, serif;
  font-size: 1.4rem;
  font-weight: 600;
}

.hero-note-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 0.9rem;
}

.courses-section {
  padding-top: 4px;
}

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

.section-kicker {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.78rem;
}

.section-head h2 {
  margin: 0;
  font-family: "Playfair Display", "Noto Serif SC", Georgia, serif;
  font-size: 2rem;
  font-weight: 600;
}

.view-all {
  text-decoration: none;
  color: var(--accent);
}

.course-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

.course-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(98px, 0.34fr) minmax(0, 1fr);
  aspect-ratio: 1 / 1;
  border: 2px solid var(--ink);
  border-radius: 10px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(158, 58, 51, 0.06), transparent 38%),
    #fbf7ee;
  box-shadow: 5px 5px 0 rgba(28, 22, 19, 0.92);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
  cursor: pointer;
}

.course-card::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(28, 22, 19, 0.1);
  pointer-events: none;
}

.course-card:hover,
.course-card:focus-visible {
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 rgba(28, 22, 19, 0.92);
  border-color: var(--ink);
  outline: none;
}

.course-index-panel {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 12px 8px 10px;
  border-right: 1px solid rgba(28, 22, 19, 0.16);
  background:
    repeating-linear-gradient(180deg, rgba(28, 22, 19, 0.035) 0 1px, transparent 1px 20px),
    #f5ead9;
}

.course-index-label,
.course-track {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.course-index-label {
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
  font-size: 0.56rem;
  letter-spacing: 0.08em;
}

.course-index-panel strong {
  margin-top: 8px;
  color: var(--accent);
  font-family: "Cinzel", Georgia, serif;
  font-size: clamp(2rem, 4.6vw, 2.8rem);
  font-weight: 900;
  line-height: 0.86;
  letter-spacing: 0;
}

.course-identity-stamp {
  display: grid;
  gap: 3px;
  width: 100%;
  min-width: 0;
  margin-top: auto;
  padding: 8px 5px 8px;
  border: 1px solid rgba(158, 58, 51, 0.38);
  background:
    linear-gradient(135deg, rgba(158, 58, 51, 0.08), transparent 52%),
    rgba(255, 250, 240, 0.54);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(255, 250, 240, 0.58);
  text-transform: uppercase;
  overflow: hidden;
}

.course-identity-stamp span,
.course-identity-stamp em {
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
  color: var(--muted);
  font-size: 0.6rem;
  font-style: normal;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.course-identity-stamp b {
  width: 100%;
  min-width: 0;
  overflow-wrap: break-word;
  font-family: "Cinzel", Georgia, serif;
  font-size: 0.74rem;
  line-height: 1.15;
  letter-spacing: 0;
}

.course-identity-stamp em {
  padding-top: 6px;
  border-top: 1px solid rgba(28, 22, 19, 0.14);
  color: #8c837a;
  font-size: 0.56rem;
  line-height: 1.35;
}

.course-info-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 14px 10px;
}

.course-info-top,
.course-badges {
  display: flex;
  align-items: center;
  gap: 5px;
}

.course-info-top {
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
  padding-right: 36px;
}

.course-badges {
  min-width: 0;
  flex-wrap: wrap;
  order: 2;
}

.course-pill,
.course-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 0.64rem;
  font-weight: 900;
  line-height: 1;
}

.course-pill-pro {
  background: #c5a880;
  color: #fffaf0;
}

.course-chip {
  background: rgba(28, 22, 19, 0.08);
  color: var(--muted);
}

.course-chip-muted {
  background: rgba(158, 58, 51, 0.11);
  color: var(--accent);
}

.course-learners {
  color: #8c837a;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.course-favorite {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 28px;
  height: 28px;
  padding: 0;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 2px solid rgba(28, 22, 19, 0.76);
  border-radius: 10px;
  background: #fffaf0;
  color: #7a7168;
  box-shadow: 3px 3px 0 rgba(28, 22, 19, 0.2);
}

.course-favorite svg {
  display: block;
}

.course-track {
  margin: 8px 0 0;
  color: var(--accent);
}

.course-info-panel h3 {
  margin: 4px 0 0;
  color: #2a2521;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(1.05rem, 1.7vw, 1.3rem);
  line-height: 1.15;
  font-weight: 900;
  letter-spacing: -0.03em;
  transition: color 180ms ease;
}

.course-info-panel .cover-summary {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  margin: 6px 0 0;
  color: #70675f;
  font-size: 0.78rem;
  line-height: 1.5;
}

.course-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.course-metrics span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 34px;
  justify-content: center;
  border-top: 1px solid rgba(28, 22, 19, 0.16);
  border-bottom: 1px solid rgba(28, 22, 19, 0.08);
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
}

.course-metrics b {
  color: var(--ink);
  font-family: "Cinzel", Georgia, serif;
  font-size: 1.05rem;
  line-height: 1;
}

.course-card-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
  color: var(--muted);
  font-size: 0.8rem;
}

/* English badge labels ("Recommended") are long enough to wrap onto a 3rd
   line inside the narrow badge lane, which overflows the fixed square card.
   Force a deterministic 3-line badge layout in English so every card wraps
   the same way regardless of label length, and trim a bit of vertical
   space elsewhere to make room — Chinese labels are short enough to stay
   on one line and are left untouched. */
html[lang="en"] .course-chip-muted,
html[lang="en"] .course-learners {
  flex-basis: 100%;
}

html[lang="en"] .course-info-panel .cover-summary {
  -webkit-line-clamp: 1;
}

html[lang="en"] .course-card-footer {
  padding-top: 4px;
}

html[lang="en"] .course-metrics {
  margin-top: 4px;
}

.course-test-link {
  color: var(--accent);
  font-weight: 900;
}

.course-card:hover h3,
.course-card:focus-visible h3,
.course-card:hover .course-test-link,
.course-card:focus-visible .course-test-link {
  color: var(--accent);
}

.is-hidden {
  display: none !important;
}

.home-view {
  display: block;
}

.detail-view {
  display: block;
}

.back-link {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--accent);
  margin-bottom: 18px;
}

.detail-hero {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  padding: 4px 0 16px;
  border-bottom: 1px solid var(--line);
}

.detail-cover {
  width: 100%;
  max-width: 210px;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 14px;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.detail-cover-inner {
  width: 100%;
  border: 1px solid rgba(43, 37, 32, 0.12);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}

.cover-kicker {
  margin: 0;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.detail-cover-inner h2 {
  margin: 0;
  font-family: "Playfair Display", "Noto Serif SC", Georgia, serif;
  font-size: 1.3rem;
  line-height: 1.1;
}

.detail-cover-note {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.detail-summary {
  padding-top: 6px;
}

.detail-title {
  margin: 8px 0 0;
  font-family: "Playfair Display", "Noto Serif SC", Georgia, serif;
  font-size: clamp(1.8rem, 3.2vw, 2.6rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.detail-description {
  margin: 8px 0 0;
  max-width: 780px;
  color: var(--muted);
  line-height: 1.6;
  font-size: 0.95rem;
}

.detail-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.detail-curriculum {
  padding-top: 14px;
}

.detail-section-head {
  margin-bottom: 10px;
}

#topic-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.topic-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px 16px;
  border: 2px solid rgba(43, 37, 32, 0.82);
  border-right-width: 6px;
  border-radius: 16px;
  background: rgba(255, 252, 246, 0.92);
  box-shadow: 0 10px 22px rgba(43, 37, 32, 0.04);
  transition: transform 180ms ease, box-shadow 220ms ease, border-color 180ms ease, background-color 180ms ease;
}

.topic-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 34px rgba(43, 37, 32, 0.08);
}

.topic-index {
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-family: "Inter", "Helvetica Neue", Arial, sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  transition: color 180ms ease;
}

.topic-copy h3 {
  margin: 4px 0 0;
  font-size: 1.02rem;
  line-height: 1.28;
  font-family: "Playfair Display", "Noto Serif SC", Georgia, serif;
  font-weight: 600;
  transition: color 180ms ease;
}

.topic-copy p {
  margin: 3px 0 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
  color: var(--muted);
}

.topic-label-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.topic-test-label,
.topic-priority-label {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topic-test-label {
  color: var(--muted);
}

.topic-priority-label {
  padding: 4px 8px;
  background: rgba(158, 58, 51, 0.1);
  color: var(--accent);
}

.topic-item.is-priority {
  background: linear-gradient(180deg, rgba(250, 246, 238, 0.96), rgba(241, 227, 220, 0.64));
  border-color: rgba(158, 58, 51, 0.44);
}

.topic-item.is-openable {
  cursor: pointer;
}

.topic-item.is-openable:hover,
.topic-item.is-openable:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 22px 38px rgba(43, 37, 32, 0.1);
  border-color: rgba(185, 110, 83, 0.88);
  outline: none;
}

.topic-item.is-openable:hover .topic-index,
.topic-item.is-openable:focus-visible .topic-index {
  color: var(--accent);
}

.topic-item.is-openable:hover .topic-copy h3,
.topic-item.is-openable:focus-visible .topic-copy h3 {
  color: var(--accent);
}

.topic-item.is-openable:active {
  transform: translateY(-1px) scale(0.995);
}


.topic-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 28px;
}

.band-pill {
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  padding: 8px 14px;
  transition: transform 180ms ease, background-color 180ms ease, color 180ms ease, border-color 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.topic-arrow {
  font-size: 1.1rem;
  color: var(--accent);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 200ms ease, transform 200ms ease;
}

.topic-item.is-openable:hover .topic-arrow,
.topic-item.is-openable:focus-visible .topic-arrow {
  opacity: 1;
  transform: translateX(0);
}

.topic-lock {
  font-size: 0.95rem;
  color: var(--muted);
  opacity: 0.6;
}

.practice-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 0.86rem;
}

.practice-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.practice-divider {
  opacity: 0.45;
}

.practice-stats {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 252, 246, 0.78);
}

.practice-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 48px;
}

.practice-stat b {
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.practice-stat em {
  font-style: normal;
  color: var(--accent);
}

.practice-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 0 0;
}

.practice-band-block,
.practice-mode-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.practice-label {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mode-switcher {
  display: flex;
  gap: 8px;
}

.mode-pill {
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  padding: 8px 14px;
}

.mode-pill-active {
  background: var(--accent);
  color: #fffaf5;
  border-color: var(--accent);
}

.practice-canvas {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 252, 246, 0.66);
  padding: 18px 22px 22px;
}

.practice-sentence-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 14px;
}

.typing-stage-wrap {
  position: relative;
  padding-top: 16px;
}

.typing-stage-clip {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 28px;
  border-radius: 4px;
  background: linear-gradient(180deg, #eef0f3, #dfe4ea);
}

.typing-stage {
  min-height: 430px;
  border: 2px solid rgba(43, 37, 32, 0.9);
  border-right-width: 7px;
  border-radius: 18px;
  padding: 52px 56px 36px;
  background: #fffefb;
}

.typing-stage h2 {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 1rem;
  font-family: "Avenir Next", "Segoe UI", "PingFang SC", sans-serif;
  font-weight: 500;
}

.typing-input-hidden {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}

.practice-char {
  border-radius: 4px;
  transition: background-color 120ms ease, color 120ms ease;
}

.practice-char.is-correct {
  color: #19a86d;
}

.practice-char.is-incorrect {
  color: #d86853;
  background: rgba(216, 104, 83, 0.16);
}

.practice-char.is-current {
  color: var(--ink);
  background: rgba(43, 37, 32, 0.08);
  box-shadow: inset 0 -2px 0 rgba(185, 110, 83, 0.9);
}

.practice-char.is-space {
  opacity: 0.42;
}

.practice-translation-bar {
  display: flex;
  justify-content: center;
  margin-top: -10px;
  position: relative;
  z-index: 2;
}

.translation-card {
  width: min(720px, 100%);
  padding: 16px 20px;
  border: 2px solid rgba(43, 37, 32, 0.9);
  border-right-width: 6px;
  border-radius: 12px;
  background: #fffdf9;
  box-shadow: 0 8px 20px rgba(43, 37, 32, 0.08);
}

.translation-card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.course-card.is-locked {
  position: relative;
}

.course-card.is-locked::after {
  content: attr(data-locked-label);
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(28, 22, 19, 0.92);
  color: #fffaf0;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.course-card.is-locked .course-info-panel,
.course-card.is-locked .course-index-panel {
  filter: saturate(0.65);
}

.course-card.is-locked .course-info-panel {
  position: relative;
}

.course-card.is-locked .course-info-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(251, 247, 238, 0.08), rgba(251, 247, 238, 0.46));
  pointer-events: none;
}

.course-card.is-locked .course-test-link {
  color: #8c837a;
}

.topic-item.is-locked {
  opacity: 0.72;
}

.lock-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 28px;
}

.lock-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 16, 14, 0.56);
  backdrop-filter: blur(4px);
}

.lock-modal-panel {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  padding: 28px 28px 24px;
  border: 2px solid rgba(28, 22, 19, 0.92);
  border-right-width: 8px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 252, 246, 0.98), rgba(248, 240, 229, 0.98));
  box-shadow: 0 26px 70px rgba(20, 16, 14, 0.28);
}

.lock-modal-kicker {
  margin: 0;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.lock-modal-panel h2 {
  margin: 12px 0 0;
  font-family: "Playfair Display", "Noto Serif SC", Georgia, serif;
  font-size: clamp(2rem, 3vw, 2.6rem);
  line-height: 1.02;
}

.lock-modal-copy {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.lock-modal-form {
  margin-top: 20px;
}

.lock-modal-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.lock-modal-row {
  display: flex;
  gap: 10px;
}

.lock-modal-row input,
.lock-modal-input {
  width: 100%;
  flex: 1;
  min-width: 0;
  padding: 14px 14px 13px;
  border: 1px solid rgba(28, 22, 19, 0.22);
  border-radius: 14px;
  background: #fffdf8;
  color: var(--ink);
  font: inherit;
}

.lock-modal-input + .lock-modal-label {
  margin-top: 14px;
}

.lock-modal-input[hidden],
.lock-modal-label[hidden],
.auth-switch-button[hidden] {
  display: none;
}

.auth-switch-button {
  width: 100%;
  margin-top: 12px;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.lock-modal-row input:focus,
.lock-modal-input:focus {
  outline: 2px solid rgba(158, 58, 51, 0.28);
  outline-offset: 2px;
}

.lock-modal-submit {
  padding: 0 18px;
  border: 1px solid rgba(28, 22, 19, 0.92);
  border-radius: 14px;
  background: var(--accent);
  color: #fffaf0;
  font-weight: 900;
}

.lock-modal-form > .lock-modal-submit {
  width: 100%;
  min-height: 48px;
  margin-top: 16px;
}

.lock-modal-footnote {
  margin: 12px 0 0;
  color: #8a8077;
  font-size: 0.78rem;
  line-height: 1.5;
}

.lock-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(28, 22, 19, 0.18);
  border-radius: 999px;
  background: #fffdf8;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
}

.contact-modal .lock-modal-panel {
  min-width: 0;
}

.contact-modal-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  margin-top: 20px;
}

.contact-modal-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid rgba(28, 22, 19, 0.16);
  border-radius: 14px;
  background: #fffdf8;
}

.contact-modal-label {
  min-width: 62px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.contact-modal-value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

a.contact-modal-value {
  color: var(--accent);
  text-decoration: none;
}

a.contact-modal-value:hover {
  text-decoration: underline;
}

.contact-copy-button {
  flex-shrink: 0;
  padding: 6px 12px;
  border: 1px solid rgba(28, 22, 19, 0.22);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 900;
}

.contact-copy-button:hover {
  border-color: rgba(158, 58, 51, 0.42);
  color: var(--accent);
}

.contact-copy-button:disabled {
  border-color: rgba(158, 58, 51, 0.48);
  color: var(--accent);
  cursor: default;
}

.share-modal .lock-modal-panel {
  width: min(360px, 100%);
}

.share-card-preview {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

.share-card-preview canvas {
  width: 100%;
  max-width: 240px;
  height: auto;
  border: 1px solid rgba(28, 22, 19, 0.16);
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(28, 22, 19, 0.18);
}

.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.share-actions .lock-modal-submit,
.share-actions .hero-secondary {
  flex: 1;
  min-width: 140px;
  padding: 12px 16px;
  font-size: 0.86rem;
  text-align: center;
}

.lock-modal-submit:disabled {
  opacity: 0.72;
  cursor: progress;
}

.lock-modal-submit:disabled:hover {
  transform: none;
}

.lock-modal.is-pro-intent .lock-modal-panel {
  width: min(560px, 100%);
  border-right-width: 2px;
  border-bottom-width: 8px;
  background:
    radial-gradient(circle at 88% 12%, rgba(197, 168, 128, 0.2), transparent 34%),
    linear-gradient(180deg, rgba(255, 252, 246, 0.98), rgba(247, 236, 222, 0.98));
}

.lock-modal.is-pro-intent .lock-modal-panel::before {
  content: "$9.90/mo";
  position: absolute;
  right: 62px;
  top: 22px;
  transform: rotate(4deg);
  padding: 5px 9px;
  border: 1px solid rgba(158, 58, 51, 0.78);
  border-radius: 999px;
  color: var(--accent);
  font-family: "Fira Code", monospace;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.lock-modal.is-pro-intent .lock-modal-kicker {
  color: #8b2f2a;
}

.lock-modal.is-pro-intent .lock-modal-submit {
  background: var(--ink);
}

.lock-modal.is-pro-intent .lock-modal-footnote {
  color: #7d5d43;
}

.success-modal[data-mode="pro"] .lock-modal-panel {
  border-bottom-width: 8px;
  border-right-width: 2px;
}

.success-modal[data-mode="pro"] .success-modal-kicker {
  color: var(--accent);
}

.success-modal[data-mode="pro"] .success-modal-button {
  background: var(--ink);
}

.success-modal-copy {
  margin-bottom: 20px;
}

.success-modal-button {
  width: 100%;
}

@media (max-width: 760px) {
  .lock-modal {
    padding: 18px;
  }

  .lock-modal-row {
    flex-direction: column;
  }

  .lock-modal-submit {
    min-height: 46px;
  }
}

.compact-sentence-list .sentence-item {
  grid-template-columns: 42px minmax(0, 1fr);
  padding: 16px;
}

.compact-sentence-list .sentence-order {
  width: 42px;
  height: 42px;
  font-size: 1rem;
}


.article-view {
  display: block;
  color: #332f2a;
}

body.is-practicing {
  background: #fbfaf7;
}

body.is-practicing .site-header-inner {
  padding: 12px 18px;
}

body.is-practicing .brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 1.05rem;
}

body.is-practicing .brand-copy strong {
  font-size: 1.35rem;
}

body.is-practicing .brand-label {
  font-size: 0.64rem;
}

body.is-practicing .header-actions .utility-link {
  font-size: 0.82rem;
}

body.is-practicing .page-shell {
  width: min(1180px, calc(100vw - 88px));
  padding-top: 18px;
}

.practice-workspace {
  min-width: 0;
}

.practice-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  margin-bottom: 12px;
}

.practice-back-button {
  border: 0;
  border-radius: 8px;
  background: rgba(43, 37, 32, 0.06);
  color: #6d6760;
  padding: 5px 9px;
  cursor: pointer;
}

.practice-course-label {
  color: #2f2b27;
  font-weight: 700;
}

.practice-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: #5f5952;
  font-size: 0.86rem;
  white-space: nowrap;
}

.practice-breadcrumb span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.practice-divider {
  opacity: 0.35;
}

.practice-stats {
  display: grid;
  grid-template-columns: repeat(5, 52px);
  gap: 0;
  padding: 6px 8px;
  border: 1px solid rgba(43, 37, 32, 0.08);
  border-radius: 10px;
  background: #f4f1eb;
}

.practice-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.practice-stat b {
  color: #8f887f;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.practice-stat em {
  color: #1c9d62;
  font-size: 0.82rem;
  font-style: normal;
  font-weight: 700;
}

.practice-shell {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.prompt-strip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border: 1px solid rgba(43, 37, 32, 0.1);
  border-radius: 14px;
  background: rgba(255, 254, 251, 0.78);
}

.prompt-strip div {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #332f2a;
  font-size: 0.92rem;
  font-weight: 700;
}

.prompt-mark {
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 999px;
  color: #b86c54;
  font-size: 0.62rem;
}

.prompt-strip p {
  margin: 0;
  color: #47413b;
  font-size: 0.98rem;
  line-height: 1.65;
}

.practice-toolbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
}

.practice-band-block,
.practice-mode-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.practice-mode-block {
  justify-content: flex-end;
}

.practice-label {
  color: #80786f;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.band-switcher,
.mode-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
}

.band-pill,
.mode-pill {
  min-width: 58px;
  height: 44px;
  border: 1px solid rgba(43, 37, 32, 0.18);
  border-radius: 999px;
  background: rgba(255, 254, 251, 0.86);
  color: #302c28;
  padding: 0 16px;
  font-size: 1rem;
}

.band-pill.is-active,
.mode-pill-active {
  border-color: #9e3a33;
  background: #9e3a33;
  color: #fffaf5;
}

.time-pill {
  justify-self: center;
  color: #302c28;
  font-size: 0.98rem;
}

.sound-toggle,
.keyboard-toggle {
  border: 1px solid rgba(43, 37, 32, 0.14);
  border-radius: 999px;
  background: rgba(255, 254, 251, 0.88);
  color: #6b625a;
  padding: 10px 16px;
  font-size: 0.86rem;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(54, 43, 31, 0.045);
}

.sound-toggle[aria-pressed="true"] {
  border-color: rgba(158, 58, 51, 0.32);
  background: rgba(158, 58, 51, 0.08);
  color: #9e3a33;
}

.sound-toggle:hover,
.keyboard-toggle:hover {
  border-color: rgba(185, 109, 83, 0.32);
  color: #9e3a33;
}


.practice-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.practice-canvas {
  min-width: 0;
  border: 1px solid rgba(43, 37, 32, 0.09);
  border-radius: 20px;
  background: rgba(255, 254, 251, 0.54);
  padding: 20px 22px 22px;
}

.practice-sentence-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  max-width: 1210px;
  margin: 0 auto 18px;
  color: #6f685f;
  font-size: 0.86rem;
}

.typing-stage-wrap {
  position: relative;
  max-width: 1210px;
  margin: 0 auto;
  padding-top: 0;
}

.sentence-coach {
  display: grid;
  grid-template-columns: minmax(180px, 0.32fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  margin: 0 0 14px;
  padding: 14px 16px;
  border: 2px solid rgba(28, 22, 19, 0.88);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: 3px 3px 0 rgba(28, 22, 19, 0.9);
}

.coach-topline {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.coach-role {
  padding: 8px 11px;
  border-radius: 999px;
  background: #2b2520;
  color: #fffaf4;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.coach-index {
  color: #8a8177;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.coach-note {
  margin: 0;
  color: #4f4740;
  font-size: 0.94rem;
  line-height: 1.65;
}

.coach-tags {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 7px;
}

.coach-tags span {
  padding: 6px 9px;
  border: 1px solid rgba(185, 109, 83, 0.2);
  border-radius: 999px;
  background: rgba(185, 109, 83, 0.08);
  color: #9a5b46;
  font-size: 0.76rem;
  white-space: nowrap;
}

.typing-stage {
  min-height: 420px;
  max-height: none;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-right-width: 7px;
  border-bottom-width: 5px;
  border-radius: 14px;
  background:
    radial-gradient(rgba(28, 22, 19, 0.03) 1px, transparent 1px),
    #fffdf8;
  background-size: 24px 24px, auto;
  padding: 54px 56px 46px;
}

.typing-stage h2 {
  margin: 0 0 20px;
  color: #70695f;
  font-family: "Avenir Next", "Segoe UI", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: 0.96rem;
  font-weight: 700;
}

.practice-essay-text {
  color: #2b2723;
  max-width: 1040px;
  font-size: clamp(1.48rem, 2.06vw, 1.92rem);
  line-height: 1.9;
  overflow-wrap: normal;
  white-space: pre-wrap;
  word-break: normal;
}

.typing-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.practice-char {
  border-radius: 3px;
  transition: background-color 120ms ease, color 120ms ease;
}

.practice-char.is-coach-sentence {
  background: linear-gradient(180deg, transparent 52%, rgba(185, 109, 83, 0.11) 52%);
}

.practice-char.is-correct {
  color: #178f5a;
}

.practice-char.is-incorrect {
  color: #c8503c;
  background: rgba(200, 80, 60, 0.14);
}

.practice-char.is-current {
  color: #302c28;
  background: rgba(185, 109, 83, 0.12);
  box-shadow: inset 0 -2px 0 #9e3a33;
}

.practice-char.is-space {
  display: inline;
}

.keyboard-dock {
  display: flex;
  justify-content: center;
  padding: 4px 0 0;
}

.keyboard-shell {
  width: min(620px, 100%);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.keyboard-rows-desktop {
  display: contents;
}

.keyboard-rows-mobile {
  display: none;
}

.keyboard-row {
  display: grid;
  grid-template-columns: repeat(15, minmax(0, 1fr));
  gap: 6px;
}

.keyboard-row button {
  min-height: 34px;
  border: 1px solid rgba(43, 37, 32, 0.12);
  border-radius: 7px;
  background: rgba(255, 254, 251, 0.9);
  color: #55504a;
  font-size: 0.78rem;
}

.key-wide {
  grid-column: span 2;
}

.key-medium {
  grid-column: span 2;
}

.key-space {
  grid-column: span 6;
}

@media (max-width: 760px) {
  body.is-practicing .page-shell {
    width: min(100vw - 24px, 100%);
  }

  .practice-topbar,
  .practice-toolbar,
  .prompt-strip {
    grid-template-columns: 1fr;
  }

  .practice-stats {
    grid-template-columns: repeat(5, 1fr);
    width: 100%;
  }

  .practice-mode-block {
    justify-content: flex-start;
  }

  body.is-practicing .typing-stage {
    min-height: 320px;
    padding: 44px 20px 26px;
  }

  .keyboard-rows-desktop {
    display: none;
  }

  .keyboard-rows-mobile {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .keyboard-row-mobile {
    display: grid;
    gap: 6px;
  }

  .keyboard-row-mobile button {
    min-height: 38px;
    border: 1px solid rgba(43, 37, 32, 0.12);
    border-radius: 7px;
    background: rgba(255, 254, 251, 0.9);
    color: #55504a;
    font-size: 0.82rem;
  }

  .keyboard-row-mobile-1 {
    grid-template-columns: repeat(10, minmax(0, 1fr));
  }

  .keyboard-row-mobile-2 {
    grid-template-columns: repeat(9, minmax(0, 1fr));
    padding: 0 5%;
  }

  .keyboard-row-mobile-3 {
    grid-template-columns: 1.4fr repeat(7, minmax(0, 1fr)) 1.4fr;
  }

  .keyboard-row-mobile-4 {
    grid-template-columns: 1.3fr 4fr 1.3fr;
  }
}

@media (max-width: 1160px) {
  .detail-hero,
  .article-content-grid {
    grid-template-columns: 1fr;
  }
}

body.is-practicing .typing-input-hidden {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 760px) {
  .sentence-coach {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .coach-tags {
    justify-content: flex-start;
  }

  .practice-topline,
  .practice-toolbar,
  .practice-band-block,
  .practice-mode-block {
    align-items: flex-start;
    flex-direction: column;
  }

  .practice-stats {
    width: 100%;
    justify-content: space-between;
  }

  .typing-stage {
    min-height: 300px;
    padding: 42px 20px 22px;
  }
}

@media (max-width: 1160px) {
  .site-header-inner {
    flex-direction: column;
    align-items: center;
  }

  .hero-layout,
  .course-grid,
  .detail-hero {
    grid-template-columns: 1fr;
  }

  .course-card {
    aspect-ratio: auto;
    min-height: 220px;
  }

  .hero-copy {
    margin-left: 0;
  }

  .hero-actions {
    margin-left: 0;
  }

  .hero-aside {
    padding-top: 12px;
  }

  .hero-note-primary {
    transform: none;
  }

  .hero-note-secondary {
    max-width: none;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100vw - 24px, 100%);
    padding-top: 26px;
  }

  .site-header-inner {
    padding: 16px 18px;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
  }

  .language-toggle {
    min-width: 0;
    padding: 6px 10px 7px;
  }

  .share-site-button,
  .contact-author-button {
    padding: 8px 14px;
  }

  .header-actions,
  .account-controls,
  .hero-actions,
  .detail-actions {
    flex-wrap: wrap;
    justify-content: center;
  }

  .hero-meta-row {
    align-items: flex-start;
  }

  .hero-rule {
    display: none;
  }

  .hero-title {
    font-size: clamp(1.9rem, 7.5vw, 2.6rem);
    max-width: 11ch;
  }

  .hero-copy-block {
    padding-top: 22px;
  }

  .hero-copy,
  .hero-actions {
    margin-left: 0;
  }

  .course-cover,
  .course-info,
  .detail-cover,
  .topic-item {
    padding: 20px;
  }

  .course-card {
    grid-template-columns: 1fr;
  }

  .course-index-panel {
    border-right: 0;
    border-bottom: 1px solid rgba(28, 22, 19, 0.16);
  }

  .course-identity-stamp {
    margin-top: 20px;
  }

  .course-index-panel strong {
    font-size: 4.4rem;
  }

  .topic-item {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .topic-actions {
    display: none;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: clamp(1.65rem, 9vw, 2.05rem);
    max-width: 12ch;
  }
}

body.is-practicing .practice-shell {
  padding-bottom: calc(214px + env(safe-area-inset-bottom));
}

body.is-practicing .keyboard-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  width: 100vw;
  transform: none;
  justify-content: center;
  padding: 34px 20px calc(12px + env(safe-area-inset-bottom));
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(90deg, #fbfaf7 0%, rgba(251, 250, 247, 0.9) 10%, rgba(251, 250, 247, 0.3) 20%, rgba(251, 250, 247, 0.3) 80%, rgba(251, 250, 247, 0.9) 90%, #fbfaf7 100%),
    linear-gradient(180deg, rgba(251, 250, 247, 0), rgba(251, 250, 247, 0.52) 30%, #fbfaf7 100%);
  backdrop-filter: blur(2px);
  box-shadow: none;
  overflow: visible;
  pointer-events: none;
}

body.is-practicing .keyboard-dock::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 44px;
  background:
    linear-gradient(90deg, #fbfaf7 0%, rgba(251, 250, 247, 0.54) 18%, rgba(251, 250, 247, 0.34) 50%, rgba(251, 250, 247, 0.54) 82%, #fbfaf7 100%),
    linear-gradient(180deg, rgba(251, 250, 247, 0), rgba(251, 250, 247, 0.84));
  filter: blur(7px);
  pointer-events: none;
}

body.is-practicing .keyboard-dock::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 0;
  width: min(640px, calc(100vw - 40px));
  height: 207px;
  transform: translateX(-50%);
  border: 1px solid rgba(43, 37, 32, 0.045);
  border-radius: 18px;
  background: rgba(251, 250, 247, 0.42);
  box-shadow: 0 12px 30px rgba(54, 43, 31, 0.055);
  backdrop-filter: blur(2px);
  pointer-events: none;
}

body.is-practicing .keyboard-shell {
  position: relative;
  z-index: 1;
  width: min(620px, calc(100vw - 60px));
  max-width: 100%;
  margin: 0 auto;
  pointer-events: auto;
}

body.is-practicing .keyboard-row {
  gap: 5px;
}

body.is-practicing .keyboard-row button {
  min-height: 33px;
  border-color: rgba(43, 37, 32, 0.1);
  border-radius: 7px;
  background: rgba(255, 254, 251, 0.92);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.72), 0 5px 14px rgba(54, 43, 31, 0.026);
  font-size: 0.72rem;
}

body.is-practicing.is-keyboard-hidden .practice-shell {
  padding-bottom: 0;
}

body.is-practicing.is-keyboard-hidden .keyboard-dock {
  display: none;
}

body.is-practicing.is-keyboard-hidden .keyboard-toggle {
  border-color: rgba(185, 109, 83, 0.32);
  color: #9e3a33;
}

/* ==========================================================================
   Game loop: combo · sentence settlement · streak · exam stakes
   ========================================================================== */

/* --- Streak flame in the stats row --- */
.practice-streak em {
  color: var(--accent);
  font-weight: 700;
}
.practice-streak.is-live em {
  animation: streak-pop 0.5s ease;
}
@keyframes streak-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.32); }
  100% { transform: scale(1); }
}

/* --- Exam consequence card --- */
.exam-consequence {
  display: grid;
  grid-template-columns: 6px 1fr auto;
  align-items: center;
  gap: 16px;
  margin: 14px 0 4px;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 14px;
  background: rgba(255, 252, 246, 0.72);
  transition: background 0.35s ease, box-shadow 0.35s ease;
}
.exam-gauge {
  align-self: stretch;
  width: 6px;
  min-height: 40px;
  border-radius: 4px;
  background: rgba(28, 22, 19, 0.1);
  overflow: hidden;
  position: relative;
}
.exam-fill {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 0%;
  background: var(--accent);
  transition: height 0.4s ease, background 0.35s ease;
}
.exam-lines {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.exam-lines strong {
  font-size: 0.98rem;
  color: var(--ink);
  letter-spacing: 0.01em;
}
.exam-lines span {
  font-size: 0.86rem;
  color: var(--muted);
}
.exam-verdict {
  font-family: "Cinzel", "Noto Serif SC", serif;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--line-strong);
  color: var(--muted);
  white-space: nowrap;
}
.exam-consequence.is-calm { background: rgba(233, 244, 234, 0.7); }
.exam-consequence.is-calm .exam-fill { background: #3f8f5b; }
.exam-consequence.is-calm .exam-verdict { color: #2f6f45; border-color: #3f8f5b; }
.exam-consequence.is-tight { background: rgba(250, 244, 228, 0.8); }
.exam-consequence.is-tight .exam-fill { background: #c58a2b; }
.exam-consequence.is-tight .exam-verdict { color: #9a6a15; border-color: #c58a2b; }
.exam-consequence.is-danger {
  background: rgba(250, 232, 230, 0.85);
  box-shadow: inset 0 0 0 1px rgba(158, 58, 51, 0.35);
}
.exam-consequence.is-danger .exam-fill { background: var(--accent); }
.exam-consequence.is-danger .exam-verdict {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  animation: danger-pulse 1.5s ease-in-out infinite;
}
@keyframes danger-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(158, 58, 51, 0.4); }
  50% { box-shadow: 0 0 0 5px rgba(158, 58, 51, 0); }
}

/* --- Combo meter --- */
.practice-canvas { position: relative; }
.combo-meter {
  position: absolute;
  top: -14px;
  right: 14px;
  z-index: 6;
  display: flex;
  align-items: baseline;
  gap: 2px;
  padding: 6px 14px 8px;
  border-radius: 14px;
  background: var(--surface-strong);
  border: 1.5px solid var(--line-strong);
  box-shadow: var(--hard-shadow);
  opacity: 0;
  transform: translateY(-6px) scale(0.9);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}
.combo-meter.is-active {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.combo-meter.is-pulse .combo-count {
  animation: combo-pulse 0.16s ease;
}
.combo-meter.is-break {
  animation: combo-break 0.4s ease;
}
.combo-x {
  font-family: "Cinzel", serif;
  font-size: 1rem;
  color: var(--muted);
  transform: translateY(-2px);
}
.combo-count {
  font-family: "Cinzel", "Fira Code", serif;
  font-weight: 900;
  font-size: 1.9rem;
  line-height: 1;
  color: var(--accent);
  transition: color 0.2s ease;
}
.combo-label {
  font-size: 0.66rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-left: 4px;
}
.combo-meter.tier-hot .combo-count { color: #d24a1e; }
.combo-meter.tier-fire {
  border-color: #d98324;
  box-shadow: 4px 4px 0 rgba(217, 131, 36, 0.9), 0 0 22px rgba(217, 131, 36, 0.35);
}
.combo-meter.tier-fire .combo-count {
  color: #d98324;
  text-shadow: 0 0 14px rgba(217, 131, 36, 0.5);
}
.combo-meter.tier-gold {
  border-color: var(--gold);
  box-shadow: 4px 4px 0 rgba(197, 168, 128, 0.9), 0 0 30px rgba(197, 168, 128, 0.5);
}
.combo-meter.tier-gold .combo-count {
  color: #b98a3a;
  text-shadow: 0 0 18px rgba(197, 168, 128, 0.7);
}
@keyframes combo-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.28); }
  100% { transform: scale(1); }
}
@keyframes combo-break {
  0% { transform: translateX(0); border-color: var(--accent); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
  100% { transform: translateX(0); }
}

/* error shake on the essay when combo breaks */
.essay-text.is-shake {
  animation: essay-shake 0.32s ease;
}
@keyframes essay-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

/* --- Per-sentence settlement toast --- */
.settlement-layer {
  position: absolute;
  top: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 7;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.settlement-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  border-radius: 16px;
  background: var(--surface-strong);
  border: 1.5px solid var(--line-strong);
  box-shadow: var(--hard-shadow);
  animation: settle-in 1.7s ease forwards;
}
.settlement-grade {
  font-family: "Cinzel", serif;
  font-weight: 900;
  font-size: 2.1rem;
  line-height: 1;
  width: 46px;
  text-align: center;
}
.settlement-grade.grade-S { color: #b98a3a; text-shadow: 0 0 16px rgba(197, 168, 128, 0.6); }
.settlement-grade.grade-A { color: #3f8f5b; }
.settlement-grade.grade-B { color: var(--accent); }
.settlement-grade.grade-C { color: var(--muted); }
.settlement-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.settlement-body strong {
  font-size: 0.9rem;
  color: var(--ink);
}
.settlement-body span {
  font-size: 0.78rem;
  color: var(--muted);
  font-family: "Fira Code", monospace;
}
@keyframes settle-in {
  0% { opacity: 0; transform: translateY(14px) scale(0.85); }
  14% { opacity: 1; transform: translateY(0) scale(1.06); }
  22% { transform: translateY(0) scale(1); }
  78% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-16px) scale(0.96); }
}

@media (prefers-reduced-motion: reduce) {
  .combo-meter, .combo-meter.is-pulse .combo-count, .combo-meter.is-break,
  .essay-text.is-shake, .settlement-card, .exam-consequence.is-danger .exam-verdict,
  .practice-streak.is-live em {
    animation: none !important;
  }
}

/* Hero speed-test hook — the fear-driven top-of-funnel CTA */
.hero-speedtest {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 20px;
  padding: 13px 22px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #7d2d27);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  box-shadow: 0 8px 22px rgba(158, 58, 51, 0.32);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  animation: speedtest-pulse 2.4s ease-in-out infinite;
}
.hero-speedtest:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(158, 58, 51, 0.42);
  text-decoration: none;
}
@keyframes speedtest-pulse {
  0%, 100% { box-shadow: 0 8px 22px rgba(158, 58, 51, 0.32); }
  50% { box-shadow: 0 8px 22px rgba(158, 58, 51, 0.32), 0 0 0 6px rgba(158, 58, 51, 0.08); }
}
@media (prefers-reduced-motion: reduce) { .hero-speedtest { animation: none; } }
