@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400..800&display=swap');

/* Layout: a "music stand" — chord card + controls above a falling-notes piano, then the bar-by-bar chord map. */
:root {
  --bg: #F5F6FB; --surface: #FFFFFF; --ink: #14151C; --muted: #5B5D70; --line: #14151C;
  --edge: #14151C; --shadow-ink: #14151C; --dot: rgba(20,21,28,.07); --hl: #FFF4CF;
  --melody: #FFC83A; --melody-soft: #FFF1C7; --chord: #2F45FF; --chord-soft: #DCE0FF; --bass: #24C49B;
  --sun: #FFC83A; --cobalt: #2F45FF; --mint: #24C49B; --coral: #FF6A50; --lilac: #B7A3FF;
  --key-white: #FBFBFD; --key-black: #14151C; --roll-bg: #14151C; --grid: rgba(255,255,255,.09);
  --roll-chord: #7F95FF; --roll-bass: #24C49B; --roll-text: rgba(255,255,255,.5);
  --sheet-rh: #2F45FF; --sheet-lh: #D9432A; --on-accent: #FFFFFF; --stage-shadow: #2F45FF;
  --font-display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --font-ui: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: 12px; color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #101119; --surface: #1B1D29; --ink: #EEEEF5; --muted: #A3A5B8; --line: #3B3F58;
  --edge: #3B3F58; --shadow-ink: #05060A; --dot: rgba(255,255,255,.05); --hl: #3A3115;
  --melody: #FFC83A; --melody-soft: #3D3214; --chord: #8C9BFF; --chord-soft: #262F5E; --bass: #24C49B;
  --key-white: #E6E6EE; --key-black: #0B0C12; --roll-bg: #0B0C12; --grid: rgba(255,255,255,.08);
  --sheet-rh: #8C9BFF; --sheet-lh: #FF8A73; --on-accent: #10111A; --stage-shadow: #2F45FF;
  color-scheme: dark;
}

body { background: var(--bg); color: var(--ink); font-family: var(--font-ui); font-size: 15px; line-height: 1.5; }
.wrap { max-width: 1180px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 16px 56px; display: grid; gap: 22px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 500; text-wrap: balance; margin: 0; }
.eyebrow { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
[hidden] { display: none !important; }
button, select, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--chord); outline-offset: 2px; }

/* Header */
.top { display: grid; gap: 4px; }
.top h1 { font-size: clamp(26px, 4vw, 38px); line-height: 1.08; letter-spacing: -.01em; }
.top h1 em { font-style: italic; color: var(--melody); }
.meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: 14px; }
.meta b { color: var(--ink); font-weight: 600; }
.intro { max-width: 64ch; margin: 4px 0 0; color: var(--muted); }

/* Stage */
.stage { display: grid; gap: 14px; }
.board { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.6fr); gap: 14px; }
@media (max-width: 820px) { .board { grid-template-columns: minmax(0, 1fr); } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; min-width: 0; }

.now { display: grid; gap: 8px; align-content: start; }
.now-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.now-sym { font-family: var(--font-display); font-size: clamp(46px, 7vw, 64px); line-height: .9; color: var(--chord); }
.now-rom { font-family: var(--font-display); font-style: italic; font-size: 24px; color: var(--muted); }
.tones { display: flex; flex-wrap: wrap; gap: 6px; }
.tone { padding: 3px 10px; border-radius: 999px; background: var(--chord-soft); color: var(--ink); font-weight: 600; font-size: 14px; }
.tone.root { background: var(--chord); color: var(--on-accent); }
.next { color: var(--muted); font-size: 14px; }
.next b { color: var(--ink); font-family: var(--font-display); font-size: 18px; font-weight: 600; }
.counter { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.counter .pos { font-size: 14px; color: var(--muted); min-width: 120px; }
.counter .pos b { color: var(--ink); }
.meter { display: flex; gap: 8px; }
.meter .beat { display: flex; gap: 3px; padding: 4px 5px; border-radius: 6px; background: var(--bg); }
.meter i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); display: block; }
.meter i.big { width: 11px; height: 11px; margin-top: -1px; }
.meter i.on { background: var(--melody); }
.sec-tag { font-size: 13px; color: var(--muted); }
.sec-tag b { font-family: var(--font-display); color: var(--ink); font-size: 16px; }

.controls { display: grid; gap: 10px; align-content: start; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.btn { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 8px 16px; cursor: pointer; font-weight: 600; }
.btn:hover { border-color: var(--chord); }
.btn.primary { background: var(--chord); color: var(--on-accent); border-color: var(--chord); min-width: 108px; }
.field { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.field select, .field input[type=number] { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.field input[type=number] { width: 4.2em; }
.tempo { flex: 1 1 260px; display: grid; gap: 4px; }
.tempo label { font-size: 14px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.tempo label b { color: var(--ink); font-variant-numeric: tabular-nums; }
input[type=range] { width: 100%; accent-color: var(--chord); }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; user-select: none; }
.switch input { width: 18px; height: 18px; accent-color: var(--chord); }
.swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.hint { font-size: 13px; color: var(--muted); margin: 0; }
kbd { font-family: var(--font-ui); font-size: 12px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--bg); }

.piano { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.piano-scroll { overflow-x: auto; }
.piano-inner { min-width: 760px; }
.piano canvas { display: block; width: 100%; }
#roll { height: 180px; }
#keys { height: 96px; cursor: pointer; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

.strip { padding: 10px 12px; border-bottom: 1px solid var(--line); display: grid; gap: 6px; }
.strip-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.strip-bars { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 1fr); gap: 8px; overflow-x: auto; position: relative; padding: 2px; }
.strip .bar { background: var(--bg); padding: 5px 8px 7px; gap: 4px; }
.strip .chip { padding: 5px 2px 4px; }

/* Chord map */
.map { display: grid; gap: 22px; }
.map-head { display: grid; gap: 6px; }
.map-head h2 { font-size: clamp(28px, 4vw, 38px); }
.map-head p { margin: 0; max-width: 70ch; color: var(--muted); }
.section { display: grid; gap: 10px; }
.section-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.section-head h3 { font-size: 26px; min-width: 2.2em; }
.section-head .what { color: var(--muted); max-width: 72ch; font-size: 14px; }
.section-head .loopit { margin-left: auto; font-size: 13px; padding: 4px 12px; }
.bars { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 760px) { .bars { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.bar { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px; display: grid; gap: 6px; min-width: 0; }
.bar.wide { grid-column: span 2; }
.bar.cur { border-color: var(--melody); box-shadow: 0 0 0 1px var(--melody); }
.bar-n { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-n button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 2px; font-size: 12px; text-decoration: underline; text-underline-offset: 2px; }
.chips { display: flex; gap: 3px; }
.chip { min-width: 0; border: 0; border-radius: 6px; background: var(--chord-soft); color: var(--ink); padding: 8px 2px 6px; cursor: pointer; display: grid; justify-items: center; gap: 1px; overflow: hidden; }
.chip:hover { outline: 1px solid var(--chord); }
.chip .s { font-family: var(--font-display); font-weight: 600; font-size: 15px; line-height: 1.1; white-space: normal; overflow-wrap: anywhere; text-align: center; }
.tone.bassnote { background: none; border: 1px solid var(--line); color: var(--muted); }
.chip .ro { font-size: 11px; color: var(--muted); white-space: nowrap; font-style: italic; }
.stack { display: grid; gap: 2px; min-width: 0; }
.chip.tiny { padding: 2px; }
.chip.tiny .s { font-size: 13px; }
.chip.tiny .ro { display: none; }
.chip.cur { background: var(--chord); color: var(--on-accent); }
.chip.cur .ro { color: var(--on-accent); opacity: .85; }
.beats { display: grid; grid-template-columns: repeat(var(--beats, 4), 1fr); font-size: 10px; color: var(--muted); letter-spacing: .04em; }
.beats span { border-left: 1px solid var(--line); padding-left: 3px; }

/* Learn */
.learn { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
@media (max-width: 820px) { .learn { grid-template-columns: minmax(0, 1fr); } }
.learn h2 { font-size: 26px; margin-bottom: 10px; }
.learn ol { margin: 0; padding-left: 1.3em; display: grid; gap: 10px; }
.learn li { max-width: 62ch; }
.learn li b { font-weight: 600; }
.glossary { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 14px; margin: 0; font-size: 14px; }
.glossary dt { font-family: var(--font-display); font-weight: 600; font-size: 17px; }
.glossary dd { margin: 0; color: var(--muted); }
footer { font-size: 13px; color: var(--muted); max-width: 90ch; }
footer a { color: var(--chord); }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* flatter control panel */
.board.card { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 8px 14px; }
.nowbar { display: flex; align-items: center; gap: 6px 18px; flex-wrap: wrap; }
.nowbar .now-sym { font-size: clamp(30px, 4.4vw, 40px); line-height: 1; min-width: 4.6em; }
.nowbar .now-rom { font-size: 20px; min-width: 2.6em; }
.nowbar .tones { min-width: 0; }
.nowbar .tone { padding: 2px 9px; font-size: 13px; }
.nowbar .meter .beat { padding: 3px 4px; }
.nowbar .next { min-width: 150px; font-size: 13px; }
.nowbar .counter { gap: 10px; }
.nowbar .counter .pos { min-width: 104px; font-size: 13px; }
.nowbar .repeat { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ctrlbar { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 8px; }
.ctrlbar .btn { padding: 6px 14px; }
.ctrlbar .btn.primary { min-width: 96px; }
.ctrlbar .btn.icon { padding: 6px 11px; }
.ctrlbar select { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; max-width: 150px; }
.ctrlbar .speed { flex: 1 1 150px; }
.ctrlbar .speed b { color: var(--ink); font-variant-numeric: tabular-nums; min-width: 2.2em; }
.ctrlbar .speed input { flex: 1; min-width: 80px; }
/* foldable chord bar and sheet */
.fold { border-bottom: 1px solid var(--line); }
.fold summary { cursor: pointer; padding: 7px 12px; display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; font-size: 13px; color: var(--muted); list-style: none; user-select: none; }
.fold summary::-webkit-details-marker { display: none; }
.fold summary { align-items: center; }
.fold summary::before { content: "▸"; color: var(--ink); font-size: 22px; line-height: 1; width: 22px; text-align: center; }
.fold[open] summary::before { content: "▾"; }
.fold-title { font-weight: 600; color: var(--ink); }
.fold-note { margin-left: auto; }
.fold .strip-bars { padding: 0 12px 10px; }
.fold .bar { background: var(--bg); padding: 5px 8px 7px; gap: 4px; }
.fold .chip { padding: 5px 2px 4px; }
#sheet { display: block; width: 100%; height: 184px; }
#roll { height: 150px; }

@media (max-width: 600px) {
  .nowbar { gap: 4px 12px; }
  .nowbar .now-sym { min-width: 0; font-size: 34px; }
  .nowbar .now-rom { min-width: 0; font-size: 17px; }
  .nowbar .next, .nowbar .counter .pos { min-width: 0; }
  .nowbar .repeat { margin-left: 0; }
  .ctrlbar { gap: 6px 10px; }
  .ctrlbar .speed { flex-basis: 100%; }
  .legend .kbd-hint { display: none; }
  .fold .strip-bars { grid-auto-columns: minmax(132px, 1fr); }
  .chip .s { font-size: 13px; }
  .top h1 { font-size: 30px; }
}
@media (hover: none) { .legend .kbd-hint { display: none; } }
body { margin: 0; }
.back { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; justify-self: start; }
.back:hover { color: var(--ink); border-color: var(--chord); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- front-page look: paper, ink outlines, sticker shadows ---------- */
body { background-color: var(--bg); background-image: radial-gradient(var(--dot) .8px, transparent .8px); background-size: 22px 22px; }
h1, h2, h3, .now-sym, .now-rom, .chip .s, .next b, .sec-tag b, .glossary dt { font-family: var(--font-display); }
h1, h2, h3 { font-weight: 800; letter-spacing: -.02em; }
.now-sym { font-weight: 700; letter-spacing: -.02em; }
.top h1 { font-size: clamp(30px, 4.6vw, 46px); }
.top h1 em { font-style: normal; color: inherit; background: linear-gradient(transparent 60%, var(--sun) 60%); padding: 0 2px; }
:root[data-theme="dark"] .top h1 em { background: linear-gradient(transparent 60%, #2F45FF 60%); }
.sitebar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.logo { display: inline-flex; align-items: center; gap: 9px; font-family: var(--font-display); font-weight: 800; font-size: 17px; text-decoration: none; color: var(--ink); }
.logo i { display: inline-grid; grid-template-columns: repeat(3, 6px); gap: 2px; height: 24px; padding: 3px; border: 2px solid var(--edge); border-radius: 6px; background: var(--surface); }
.logo i b { background: var(--ink); height: 60%; border-radius: 0 0 2px 2px; } .logo i b:nth-child(2) { background: var(--cobalt); height: 100%; border-radius: 2px; }
.sitebar-r { display: flex; gap: 8px; align-items: center; }
.back, .themebtn { font: inherit; font-size: 13px; font-weight: 700; color: var(--ink); background: var(--surface); border: 2px solid var(--edge); border-radius: 999px; padding: 4px 12px; box-shadow: 2px 2px 0 var(--shadow-ink); text-decoration: none; cursor: pointer; }
.themebtn { padding: 4px 10px; }
.back, .themebtn { white-space: nowrap; }
@media (max-width: 600px) { .logo { font-size: 15px; } .back, .themebtn { padding: 4px 9px; font-size: 12px; } .sitebar-r { gap: 6px; } }
.back:hover, .themebtn:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--shadow-ink); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badges span { font-size: 12px; font-weight: 700; border: 1.5px solid var(--edge); border-radius: 999px; padding: 1px 10px; background: var(--surface); color: var(--ink); }
.badges .lvl, .badges .mood { color: #14151C; border-color: #14151C; }
.badges .mood { background: var(--lilac); }
.card { border: 2px solid var(--edge); border-radius: 14px; box-shadow: 3px 3px 0 var(--shadow-ink); }
.piano { border: 2px solid var(--edge); border-radius: 16px; box-shadow: 5px 5px 0 var(--stage-shadow); background: var(--surface); }
.fold { border-bottom: 2px solid var(--edge); }
.legend { border-top: 2px solid var(--edge); }
.btn { border: 2px solid var(--edge); border-radius: 10px; background: var(--surface); color: var(--ink); font-weight: 700; box-shadow: 2px 2px 0 var(--shadow-ink); transition: transform .1s, box-shadow .1s; }
.btn:hover { border-color: var(--edge); transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--shadow-ink); }
.btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--shadow-ink); }
.btn.primary { background: var(--cobalt); color: #fff; border-color: var(--edge); }
.ctrlbar { border-top: 2px dashed var(--line); }
.ctrlbar select, .field select, .field input[type=number] { border: 1.5px solid var(--edge); border-radius: 999px; background: var(--surface); color: var(--ink); font-weight: 600; }
.tone { border: 1.5px solid var(--edge); background: var(--surface); }
.tone.root { background: var(--chord); color: var(--on-accent); }
.bar { border: 2px solid var(--edge); border-radius: 10px; box-shadow: 2px 2px 0 var(--shadow-ink); }
.bar.cur { border-color: var(--edge); background: var(--hl); box-shadow: 3px 3px 0 var(--sun); }
.fold .bar { background: var(--bg); }
.fold .bar.cur { background: var(--hl); }
.chip { border: 1.5px solid var(--edge); background: var(--chord-soft); }
.chip.cur { background: var(--chord); color: var(--on-accent); }
.meter .beat { background: var(--bg); border: 1.5px solid var(--line); }
.meter i.on { background: var(--sun); }
.section-head h3 { display: inline-grid; place-items: center; min-width: 2em; padding: 0 10px; height: 34px; font-size: 18px; background: var(--sun); color: #14151C; border: 2px solid #14151C; border-radius: 999px; }
footer a, .glossary a { color: var(--chord); }
kbd { border-color: var(--edge); }
@media (prefers-reduced-motion: reduce) { .btn, .back, .themebtn { transition: none; } }

#foldSheet { position: relative; }
#sheet { cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
#sheet.dragging { cursor: grabbing; }
.scrub-tip { position: absolute; top: 44px; transform: translateX(-50%); background: var(--ink); color: var(--bg); font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; pointer-events: none; white-space: nowrap; box-shadow: 2px 2px 0 var(--sun); }

/* ---------- fun fact sticky note, floating next to the title ---------- */
:root { --note-bg: #FFF6DA; }
:root[data-theme="dark"] { --note-bg: #2B2819; }
:root[data-theme="dark"] .fn-card::before { background: rgba(255,255,255,.22); border-color: rgba(255,255,255,.12); }
.top-main { display: grid; gap: 4px; min-width: 0; }
.fact-note { position: relative; margin-top: 6px; }
.fn-card { position: relative; display: block; width: 100%; text-align: left; font: inherit; cursor: pointer;
  background: var(--note-bg); color: var(--ink); border: 2px solid var(--edge); border-radius: 4px 14px 14px 14px;
  box-shadow: 4px 4px 0 var(--shadow-ink); padding: 14px 16px 12px; transform: rotate(-1.2deg);
  transition: transform .18s ease, box-shadow .18s ease; }
.fn-card::before { content: ""; position: absolute; top: -11px; left: 50%; width: 74px; height: 20px; transform: translateX(-50%) rotate(3deg);
  background: rgba(255,255,255,.6); border: 1px solid rgba(20,21,28,.18); }
.fn-card:hover { transform: rotate(0deg) translate(-2px, -2px); box-shadow: 6px 6px 0 var(--shadow-ink); }
.fn-card:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 3px; }
.fn-front { display: flex; align-items: center; gap: 12px; }
.fn-mascot { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--cobalt); color: #fff;
  border: 2px solid #14151C; font-size: 22px; animation: fnWiggle 3.2s ease-in-out infinite; }
.fn-txt b, .fn-back b { display: block; font-family: var(--font-display); font-size: 16px; font-weight: 800; letter-spacing: -.01em; }
.fn-txt small, .fn-back small { display: block; font-size: 12px; font-weight: 600; opacity: .7; margin-top: 2px; }
.fn-back { display: none; font-size: 14px; line-height: 1.45; }
.fn-back b { margin-bottom: 4px; }
.fn-back small { margin-top: 6px; }
.fact-note.open .fn-front { display: none; }
.fact-note.open .fn-back { display: block; }
.fact-note.open .fn-card { background: var(--surface); color: var(--ink); border-color: var(--edge); box-shadow: 4px 4px 0 var(--sun); }
.fact-note.open .fn-card::before { background: rgba(255,200,58,.75); }
.fn-card.flip { animation: fnFlip .32s ease-in-out; }
.fn-drift { position: absolute; right: 18px; top: -6px; width: 60px; height: 0; pointer-events: none; }
.fn-drift i { position: absolute; bottom: 0; font-style: normal; font-size: 16px; color: var(--cobalt); opacity: 0; animation: fnDrift 6s ease-in infinite; }
.fn-drift i:nth-child(2) { left: 22px; animation-delay: 2s; font-size: 19px; color: var(--coral); }
.fn-drift i:nth-child(3) { left: 44px; animation-delay: 4s; color: var(--mint); }
.fn-burst { position: absolute; left: 50%; top: 50%; font-style: normal; font-size: 20px; pointer-events: none; z-index: 5; animation: fnBurst 1.1s ease-out forwards; }
@keyframes fnWiggle { 0%, 70%, 100% { transform: rotate(0); } 76% { transform: rotate(-14deg); } 84% { transform: rotate(12deg); } 92% { transform: rotate(-6deg); } }
@keyframes fnDrift { 0% { transform: translateY(0) rotate(0); opacity: 0; } 15% { opacity: .75; } 100% { transform: translateY(-46px) rotate(18deg); opacity: 0; } }
@keyframes fnFlip { 0% { transform: rotate(-1.2deg) scaleX(1); } 50% { transform: rotate(0) scaleX(0); } 100% { transform: rotate(-1.2deg) scaleX(1); } }
@keyframes fnBurst { from { transform: translate(-50%, -50%) scale(.6); opacity: 1; } to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.2) rotate(var(--r)); opacity: 0; } }
@keyframes fnPop { 0% { transform: rotate(-1.2deg) scale(1); } 40% { transform: rotate(2deg) scale(1.06); } 100% { transform: rotate(-1.2deg) scale(1); } }
.fn-card.pop { animation: fnPop .6s ease-out; }
/* open note: compact text and a corner × instead of a "fold away" line, so it stays about as tall as the title block */
.fact-note.open .fn-card { padding: 9px 30px 9px 14px; }
.fact-note.open .fn-card::after { content: "×"; position: absolute; top: 3px; right: 9px; font-size: 19px; line-height: 1; color: var(--muted); }
.fn-back { font-size: 13px; line-height: 1.4; }
.fn-back b { font-size: 14px; margin-bottom: 2px; }
.fn-back small { display: none; }
/* computer: the note floats beside the title and never changes the header's height */
@media (min-width: 900px) {
  .top { position: relative; padding-right: 440px; }
  .fact-note { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 400px; margin: 0; }
}
/* phone: the closed note keeps its place; the open note drops down over the player like a pop-up */
@media (max-width: 899px) { .fn-drift { display: none; } .fact-note { margin-top: 12px; } .fn-card { transform: rotate(-.6deg); padding: 9px 12px 8px; }
  .fn-mascot { width: 32px; height: 32px; font-size: 17px; } .fn-front { gap: 10px; } .fn-txt b { font-size: 15px; } .fn-txt small { margin-top: 0; }
  .fact-note.open { z-index: 30; }
  .fact-note.open .fn-card { position: absolute; top: 0; left: 0; right: 0; width: auto; z-index: 30; box-shadow: 4px 4px 0 var(--sun), 0 10px 30px rgba(20,21,28,.25); } }
@media (prefers-reduced-motion: reduce) { .fn-mascot, .fn-drift i, .fn-card.flip, .fn-card.pop, .fn-burst { animation: none; } .fn-burst { display: none; } .fn-card { transition: none; } }
