:root {
  --navy: #0f1c3f;
  --navy-mid: #1a2d5a;
  --navy-light: #2a4170;
  --cream: #f7f1e3;
  --cream-dark: #ebe3d1;
  --coral: #e85d4c;
  --gold: #d4a017;
  --gold-soft: #f0c75e;
  --success: #1f7a4d;
  --success-bg: #e7f6ee;
  --trap: #b83a2e;
  --trap-bg: #fdecea;
  --white: #fff;
  --text: #1a2438;
  --muted: #5c677a;
  --line: #e4dcc8;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(15, 28, 63, 0.12);
  --font: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --site-max: 960px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--cream);
  color: var(--text);
  line-height: 1.55;
}
button, input { font-family: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(247, 241, 227, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.top-inner {
  max-width: var(--site-max);
  margin: 0 auto;
  padding: 0.75rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: none;
  border: 0;
  color: var(--navy);
  font-weight: 800;
  font-size: 1rem;
  padding: 0;
}
.mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--navy), var(--navy-light));
  color: var(--gold-soft);
  font-size: 1.05rem;
}
.top-meta { margin-left: auto; color: var(--muted); font-size: 0.82rem; font-weight: 700; }
.glossary-toggle {
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--navy);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 800;
}
.glossary-toggle.on { background: var(--navy); color: var(--cream); border-color: var(--navy); }
.glossary {
  max-width: var(--site-max);
  margin: 0 auto;
  padding: 0 1.1rem 0.85rem;
  max-height: min(58vh, 520px);
  overflow: auto;
}
.glossary-bar { display: flex; flex-wrap: wrap; gap: 0.55rem; align-items: center; margin-bottom: 0.45rem; }
.glossary-search {
  flex: 1 1 12rem;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  color: var(--text);
  font-size: 0.9rem;
}
.glossary-filters { margin: 0; }
.glossary-group h2 {
  margin: 0.7rem 0 0.3rem;
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
.glossary-group dl { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0.35rem; }
.gloss { background: var(--white); border-radius: 10px; border: 1px solid var(--line); }
.gloss-term {
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 0.45rem 0.65rem;
  font-weight: 800;
  color: var(--navy);
}
.gloss-term::after { content: " ▾"; color: var(--muted); font-weight: 700; }
.gloss.open .gloss-term::after { content: " ▴"; }
.gloss dd { display: none; margin: 0; padding: 0 0.65rem 0.6rem; color: var(--text); font-size: 0.88rem; }
.gloss.open dd { display: block; }
.gloss-pron-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.15rem 0 0.35rem;
  flex-wrap: wrap;
}
.gloss-say {
  font-size: 0.78rem;
  font-weight: 750;
  color: var(--coral);
  background: #fff0ed;
  padding: 0.12rem 0.45rem;
  border-radius: 6px;
  border: 1px solid #ffd8d2;
  letter-spacing: 0.02em;
}
.gloss-speak {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--navy);
  color: var(--cream);
  border: 0;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 750;
  padding: 0.18rem 0.55rem;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s;
}
.gloss-speak:hover {
  background: var(--navy-light);
  transform: scale(1.04);
}
.gloss-speak:active {
  transform: scale(0.96);
}
.gloss-speak.playing {
  background: var(--gold);
  color: var(--navy);
}
.gloss-meaning {
  color: var(--text);
  line-height: 1.45;
}
.glossary-empty { color: var(--muted); margin: 0.4rem 0; }

.wrap { max-width: var(--site-max); width: 100%; margin: 0 auto; padding: 1.25rem 1.1rem 4rem; }

.hero {
  background: linear-gradient(155deg, var(--navy), #243a6b 70%);
  color: var(--cream);
  border-radius: 22px;
  padding: 1.8rem 1.5rem 1.4rem;
  box-shadow: var(--shadow);
}
.kicker {
  display: inline-block;
  background: rgba(240, 199, 94, 0.18);
  color: var(--gold-soft);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.28rem 0.55rem;
  border-radius: 6px;
  margin-bottom: 0.7rem;
}
.hero h1 { margin: 0 0 0.4rem; font-size: clamp(1.7rem, 4vw, 2.3rem); line-height: 1.15; }
.hero p { margin: 0; max-width: 40rem; color: rgba(247, 241, 227, 0.9); }
.hero-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.1rem; }
.stat {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 0.55rem 0.75rem;
  min-width: 7rem;
}
.stat b { display: block; font-size: 1.05rem; }
.stat span { font-size: 0.75rem; opacity: 0.8; }

.why {
  margin-top: 1rem;
  background: var(--white);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}
.why h2 { margin: 0 0 0.35rem; font-size: 1.05rem; color: var(--navy); }
.why p { margin: 0; color: var(--muted); }

.plan {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
  margin-top: 1.1rem;
  align-items: stretch;
}
.week {
  background: var(--white);
  border-radius: 16px;
  padding: 0.9rem 0.75rem 0.75rem;
  box-shadow: var(--shadow);
  min-width: 0;
}
.week-label {
  margin: 0 0.25rem 0.65rem;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 800;
}
.week .day-card {
  width: 100%;
  margin: 0 0 0.5rem;
  box-shadow: none;
  background: var(--cream);
}
.week .day-card:last-child { margin-bottom: 0; }
.day-card {
  text-align: left;
  background: var(--white);
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 0.9rem 0.95rem 0.85rem;
  box-shadow: var(--shadow);
}
.day-card:hover { border-color: var(--gold); }
.day-card .when { color: var(--muted); font-size: 0.75rem; font-weight: 700; }
.day-card h3 { margin: 0.2rem 0 0.25rem; font-size: 1.02rem; color: var(--navy); }
.day-card p { margin: 0; color: var(--muted); font-size: 0.88rem; }
.badge {
  display: inline-block;
  margin-top: 0.55rem;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  background: var(--cream-dark);
  color: var(--navy);
}
.badge.done { background: var(--success-bg); color: var(--success); }
.badge.next { background: #fff4d6; color: #8a5a00; }

.layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.side {
  position: sticky;
  top: 4.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  background: var(--white);
  border-radius: 16px;
  padding: 0.45rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(15, 28, 63, 0.08);
}
.side button {
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 10px;
  padding: 0.45rem 0.6rem;
  color: var(--navy);
  transition: background 0.15s, color 0.15s;
}
.side button:hover { background: var(--cream); }
.side button strong { display: block; font-size: 0.86rem; }
.side button span { display: block; color: var(--muted); font-size: 0.72rem; font-weight: 600; }
.side button.active { background: var(--navy); color: var(--cream); }
.side button.active span { color: var(--gold-soft); }
.side button.done-dot strong::before {
  content: "✓ ";
  color: var(--success);
}
.side button.active.done-dot strong::before { color: var(--gold-soft); }

.panel {
  background: var(--white);
  border-radius: 18px;
  padding: 1.4rem 1.5rem 1.6rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(15, 28, 63, 0.08);
}
.panel h1 { margin: 0.2rem 0 0.35rem; font-size: clamp(1.45rem, 3vw, 1.9rem); color: var(--navy); line-height: 1.2; }
.lede { margin: 0 0 0.9rem; color: var(--muted); }

.steps { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; }
.steps button {
  border: 1px solid var(--line);
  background: var(--cream);
  color: var(--navy);
  border-radius: 999px;
  padding: 0.32rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 800;
}
.steps button.on { background: var(--navy); color: var(--cream); border-color: var(--navy); }

.card {
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 0.65rem;
  overflow: hidden;
  background: #fffdf8;
}
.card h3 {
  margin: 0;
}
.card h3 button {
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 0.85rem 1rem;
  font-weight: 800;
  color: var(--navy);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.98rem;
}
.card .body { padding: 0 1rem 1rem; display: none; font-size: 0.96rem; line-height: 1.62; }
.card.open .body { display: block; }
.card .body p { margin: 0.45rem 0; }
.card .body ul { margin: 0.4rem 0 0.4rem 1.1rem; padding: 0; }
.card .body li { margin: 0.25rem 0; }
.callout {
  background: #fff6df;
  border-left: 4px solid var(--gold);
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  margin: 0.6rem 0;
}
.callout.trap { background: var(--trap-bg); border-left-color: var(--trap); }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin: 0.5rem 0;
}
th, td { text-align: left; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--navy); font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; }
.scale {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.45rem 0;
}
.note {
  min-width: 2.3rem;
  text-align: center;
  background: var(--navy);
  color: var(--cream);
  border-radius: 8px;
  padding: 0.35rem 0.3rem;
  font-weight: 800;
}
.note em { display: block; font-style: normal; color: var(--gold-soft); font-size: 0.72rem; }

.q-top { display: flex; justify-content: space-between; gap: 0.5rem; color: var(--muted); font-size: 0.78rem; font-weight: 800; }
.prompt { font-size: 1.08rem; color: var(--navy); font-weight: 700; margin: 0.45rem 0 0.75rem; }
.prompt p { margin: 0.35rem 0; font-weight: 600; color: var(--text); }
.options { display: flex; flex-direction: column; gap: 0.45rem; }
.opt {
  text-align: left;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  font-weight: 650;
  color: var(--text);
  max-width: 600px;
}
.opt .letter {
  display: inline-grid;
  place-items: center;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 50%;
  background: var(--cream-dark);
  color: var(--navy);
  font-size: 0.75rem;
  font-weight: 800;
  margin-right: 0.45rem;
}
.opt.picked { border-color: var(--navy); background: #f4f7ff; }
.opt.good { border-color: var(--success); background: var(--success-bg); }
.opt.bad { border-color: var(--trap); background: var(--trap-bg); }
#stage .why {
  margin-top: 0.75rem;
  box-shadow: none;
  padding: 0.7rem 0.8rem;
  background: var(--success-bg);
  border-radius: 12px;
}
#stage .why.trap { background: var(--trap-bg); }
.actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 0.55rem; margin-top: 1rem; }
.actions .ghost { margin-right: auto; }
.btn {
  border: 0;
  border-radius: 999px;
  padding: 0.62rem 1rem;
  font-weight: 800;
  background: var(--coral);
  color: white;
}
.btn.ghost { background: var(--cream-dark); color: var(--navy); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.hear {
  border: 0;
  background: var(--navy);
  color: var(--cream);
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 800;
  margin: 0.15rem 0.25rem 0.15rem 0;
}
.cycle-row, .tap-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.cycle, .tap {
  min-width: 3.1rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: white;
  padding: 0.55rem 0.4rem;
  font-weight: 800;
  color: var(--navy);
}
.cycle b, .tap b { display: block; font-size: 0.68rem; color: var(--muted); font-weight: 700; }
.tap.on { background: var(--navy); color: var(--cream); }
.tap.on b { color: var(--gold-soft); }

.score-big { font-size: 2.4rem; font-weight: 900; color: var(--navy); margin: 0.2rem 0; }
.timer {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  color: var(--navy);
}
.fine {
  margin-top: 1.5rem;
  color: var(--muted);
  font-size: 0.8rem;
}

/* ===== Interactive activities ===== */
.widget {
  margin: 0.9rem 0 0.4rem;
  border: 1px solid #d9cfb6;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff, #fbf7ee);
  padding: 0.8rem 0.85rem 0.85rem;
}
.w-head { display: flex; flex-direction: column; gap: 0.1rem; margin-bottom: 0.55rem; }
.w-head strong { color: var(--navy); font-size: 1rem; }
.w-head strong::before { content: "◆ "; color: var(--coral); font-size: 0.8rem; }
.w-sub { color: var(--muted); font-size: 0.84rem; }
.w-out {
  margin-top: 0.55rem;
  font-size: 0.9rem;
  background: #f4f7ff;
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
  line-height: 1.5;
}
.w-out em { color: var(--muted); font-style: normal; font-size: 0.84rem; }
.w-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.6rem; align-items: center; }
.mini {
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--navy);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-weight: 800;
  font-size: 0.8rem;
}
.mini.play { background: var(--navy); color: var(--cream); border-color: var(--navy); }
.mini:hover { border-color: var(--gold); }
.chip-row { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; margin: 0.35rem 0; }
.row-label { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); margin-right: 0.2rem; min-width: 5.2rem; }
.chip {
  border: 1.5px solid var(--line);
  background: white;
  color: var(--navy);
  border-radius: 999px;
  padding: 0.26rem 0.62rem;
  font-size: 0.8rem;
  font-weight: 750;
}
.chip.on { background: var(--navy); border-color: var(--navy); color: var(--cream); }
.chip.primary { border-color: var(--coral); }
.chip.big { padding: 0.55rem 1rem; font-size: 0.92rem; }

.w-staff { overflow-x: auto; }
.staff { width: 100%; max-width: 640px; height: auto; display: block; }
.st-line { stroke: #6c7486; stroke-width: 1; }
.st-clef { font-size: 46px; fill: #1a2438; font-family: "Segoe UI Symbol", "Noto Music", "Bravura", serif; }
.st-bass { font-size: 34px; }
.st-head { stroke-width: 1.8; }
.st-acc { font-size: 15px; font-family: "Segoe UI Symbol", "Noto Music", serif; }
.st-tag { font-size: 10px; font-weight: 800; }
.st-label { font-size: 12px; text-anchor: middle; fill: #5c677a; font-weight: 700; }
.st-link { stroke-width: 1.6; }
.st-bracket { fill: none; stroke-width: 1.6; }
.st-glabel { font-size: 10px; text-anchor: middle; font-weight: 800; }
.st-cap { font-size: 0.78rem; font-weight: 800; color: var(--muted); margin-top: 0.3rem; }

.kb-key { display: none; margin: 0.15rem 0 0.4rem; font-size: 0.75rem; color: var(--muted); font-weight: 700; }
.kb {
  position: relative;
  display: flex;
  height: 118px;
  max-width: 560px;
  margin: 0.6rem 0 0.3rem;
  user-select: none;
  border-radius: 0 0 8px 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(15, 28, 63, 0.14);
}
.kw {
  flex: 1;
  border: 1px solid #c8c2b3;
  border-top: 0;
  background: linear-gradient(180deg, #fff 80%, #f0ece2);
  position: relative;
  padding: 0;
  overflow: hidden;
}
.kbk {
  position: absolute;
  top: 0;
  height: 62%;
  background: linear-gradient(180deg, #222a3a, #0f1c3f);
  border: 1px solid #0b1022;
  border-radius: 0 0 5px 5px;
  z-index: 2;
  padding: 0;
}
.kl {
  position: absolute;
  bottom: 4px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.58rem;
  font-weight: 800;
  color: var(--navy);
  pointer-events: none;
  line-height: 1;
  white-space: nowrap;
}
.kbk .kl { color: var(--cream); bottom: 5px; }
.kw.hl { background: linear-gradient(180deg, #ffd9d3 60%, #f5b3a9); }
.kbk.hl { background: linear-gradient(180deg, #e85d4c, #b83a2e); }
.kw.hl2 { background: linear-gradient(180deg, #fff0c2 60%, #f0c75e); }
.kbk.hl2 { background: linear-gradient(180deg, #d4a017, #9c7409); }
.kw.ghost { background: linear-gradient(180deg, #fff 60%, #e6ecfa); }
.kbk.ghost { background: linear-gradient(180deg, #3a4f82, #2a4170); }
.kw.press, .kbk.press { filter: brightness(0.82); transform: translateY(1px); }

.steps-strip { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.4rem; }
.step {
  font-size: 0.7rem;
  color: var(--muted);
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.2rem 0.45rem;
  text-align: center;
}
.step b { display: block; color: var(--navy); font-size: 0.85rem; }
.step.semi { background: #fff4d6; border-color: var(--gold); }
.step.aug { background: var(--trap-bg); border-color: var(--trap); }

.letter-row { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.3rem; }
.letter-btn {
  width: 2.7rem;
  height: 2.7rem;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: white;
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--navy);
}
.letter-btn.good { background: var(--success-bg); border-color: var(--success); }
.letter-btn.bad { background: var(--trap-bg); border-color: var(--trap); }

.palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 0.35rem; margin: 0.45rem 0; }
.val {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05rem;
  border: 1px solid var(--line);
  background: white;
  border-radius: 10px;
  padding: 0.35rem 0.3rem;
  font-size: 0.72rem;
  color: var(--text);
}
.val b { color: var(--coral); font-size: 0.85rem; }
.glyph { font-size: 1.5rem; line-height: 1.2; font-family: "Segoe UI Symbol", "Noto Music", serif; color: var(--navy); }
.bar-box {
  min-height: 3.6rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  border-left: 3px solid var(--navy);
  border-right: 3px solid var(--navy);
  padding: 0.35rem 0.55rem;
  background: white;
  border-radius: 4px;
}
.bar-item {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  font-size: 1.45rem;
  font-family: "Segoe UI Symbol", "Noto Music", serif;
  color: var(--navy);
  padding: 0 0.2rem;
}
.bar-item small { font-size: 0.65rem; font-family: var(--font); color: var(--muted); font-weight: 800; }
.bar-item.rest { color: #6c7486; }
.bar-empty { color: var(--muted); font-size: 0.85rem; }
.fill { height: 10px; background: var(--cream-dark); border-radius: 999px; margin-top: 0.45rem; overflow: hidden; }
.fill-in { height: 100%; background: var(--navy-light); transition: width 0.2s; }
.fill-in.full { background: var(--success); }
.fill-in.over { background: var(--trap); }

.pulse-grid { display: flex; gap: 0.45rem; flex-wrap: wrap; margin: 0.5rem 0; }
.beat { display: flex; gap: 0.2rem; padding: 0.3rem; border-radius: 12px; background: var(--cream-dark); }
.pulse {
  min-width: 2.2rem;
  height: 2.2rem;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: white;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.8rem;
  transition: transform 0.08s, background 0.08s;
}
.pulse.on-beat { color: var(--navy); font-size: 1rem; min-width: 2.8rem; height: 2.8rem; align-self: center; }
.pulse.down { border: 2px solid var(--coral); }
.pulse.now { background: var(--coral); color: white; transform: scale(1.08); }
.slider { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; color: var(--muted); font-weight: 700; }

.cf-wrap { display: grid; grid-template-columns: minmax(220px, 320px) 1fr; gap: 0.8rem; align-items: center; }
.cf { width: 100%; height: auto; }
.cf-ring { fill: #f4f7ff; stroke: #d7deef; }
.cf-ring.inner { fill: #eef2fb; }
.cf-core { fill: var(--navy); }
.cf-key circle { fill: white; stroke: #c9d2e6; stroke-width: 1.5; }
.cf-key text { font-size: 13px; font-weight: 800; text-anchor: middle; fill: var(--navy); }
.cf-key .cf-min { font-size: 11px; font-weight: 700; fill: #5c677a; }
.cf-key.known { cursor: pointer; }
.cf-key.later { opacity: 0.35; }
.cf-key.new circle { stroke: var(--coral); stroke-width: 2; }
.cf-key.on circle { fill: var(--coral); stroke: var(--coral); }
.cf-key.on text:first-of-type { fill: white; }
.cf-count { font-size: 10px; text-anchor: middle; fill: #8a93a6; font-weight: 700; }
.cf-mid { text-anchor: middle; fill: var(--gold-soft); font-size: 20px; font-weight: 900; }
.cf-mid.small { font-size: 11px; fill: var(--cream); font-weight: 700; }
.tag-new { display: inline-block; margin-top: 0.3rem; background: var(--trap-bg); color: var(--trap); font-size: 0.72rem; font-weight: 800; padding: 0.1rem 0.45rem; border-radius: 999px; }

.interval-result {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.5rem;
  padding: 0.55rem 0.75rem;
  background: var(--navy);
  color: var(--cream);
  border-radius: 12px;
}
.interval-result strong { font-size: 1.35rem; color: var(--gold-soft); }
.interval-result em { font-style: normal; font-size: 0.75rem; background: rgba(255,255,255,0.12); padding: 0.1rem 0.45rem; border-radius: 999px; }
.chord-view { display: grid; grid-template-columns: minmax(160px, 220px) 1fr; gap: 0.6rem; align-items: center; }

.couplet { display: flex; flex-direction: column; gap: 0.45rem; margin: 0.4rem 0; }
.c-line { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.syl {
  border: 1.5px solid var(--line);
  background: white;
  border-radius: 8px;
  padding: 0.35rem 0.5rem;
  font-size: 0.98rem;
  font-weight: 650;
  color: var(--text);
}
.syl.picked { background: var(--navy); color: var(--cream); border-color: var(--navy); }
.syl.should { box-shadow: inset 0 -4px 0 var(--gold); }
.syl.miss { border-color: var(--trap); }
.syl.now { transform: translateY(-3px); border-color: var(--coral); }

.map-table { overflow-x: auto; }
.map-table td, .map-table th { text-align: center; }
.map-table td:first-child { text-align: left; white-space: nowrap; }

.form-blocks { display: flex; gap: 0.35rem; flex-wrap: wrap; margin: 0.55rem 0; }
.block {
  flex: 1 1 5rem;
  min-height: 4.2rem;
  border: 0;
  border-radius: 12px;
  color: white;
  font-size: 1.5rem;
  font-weight: 900;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s;
}
.block small { font-size: 0.64rem; font-weight: 700; opacity: 0.9; }
.b-A { background: var(--navy-light); }
.b-B { background: #1f7a4d; }
.b-C { background: #b0602a; }
.block.now { transform: translateY(-4px) scale(1.04); box-shadow: 0 0 0 3px var(--gold); }

.flip {
  width: 100%;
  min-height: 8.5rem;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(150deg, var(--navy), var(--navy-light));
  color: var(--cream);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 1rem;
}
.flip.back { background: linear-gradient(150deg, #fff6df, #f0c75e); color: var(--navy); }
.flip-front { font-size: 1.45rem; font-weight: 900; text-align: center; }
.flip-sub { font-size: 0.8rem; opacity: 0.75; font-weight: 700; }

.layout, .panel, .side, .card, .widget { min-width: 0; }
.staff, .kb, .cf, .map-table, .w-staff { max-width: 100%; }
.map-table, .w-staff { overflow-x: auto; }

@media (max-width: 800px) {
  .top-inner { flex-wrap: wrap; gap: 0.45rem; padding: 0.6rem 0.75rem; }
  .brand { font-size: 0.92rem; }
  .mark { width: 32px; height: 32px; }
  .top-meta { font-size: 0.72rem; }
  .glossary { padding: 0 0.75rem 0.7rem; max-height: 48vh; }
  .glossary-search { width: 100%; flex-basis: 100%; }
  .glossary-group dl { grid-template-columns: 1fr; }
  .wrap { width: 100%; max-width: 100%; padding: 0.75rem 0.7rem 2.75rem; }
  .hero { padding: 1.2rem 1rem 1rem; border-radius: 16px; }
  .hero-row .stat { min-width: 0; flex: 1 1 6.2rem; }
  .plan { grid-template-columns: 1fr; }
  .layout { grid-template-columns: 1fr; }
  .panel { padding: 0.85rem 0.75rem 1rem; border-radius: 14px; }
  .side {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    max-width: 100%;
    padding: 0 0 0.15rem;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    scrollbar-width: thin;
  }
  .kb-key { display: block; }
  .side button { flex: 0 0 auto; min-width: 8.4rem; background: white; box-shadow: var(--shadow); }
  .steps { flex-wrap: wrap; max-width: 100%; }
  .steps button { flex: 0 1 auto; min-height: 44px; padding: 0.4rem 0.72rem; }
  .cf-wrap, .chord-view { grid-template-columns: 1fr; }
  .kb { height: 96px; }
  .row-label { min-width: 100%; }
  .letter-btn { width: 44px; height: 44px; font-size: 1rem; }
  .actions, .w-actions { flex-wrap: wrap; }
  .btn, .mini, .chip, .letter-btn, .opt { min-height: 44px; }
  .chip { display: inline-flex; align-items: center; }
  .prompt { font-size: 1rem; }
  .flip-front { font-size: 1.15rem; }
  .block { min-height: 3.5rem; font-size: 1.2rem; }
  .card .body table { display: block; overflow-x: auto; }
  .opt { font-size: 0.95rem; }
}
