/* Night sonar: a dark page, mint gems, numbers that ping like sonar.
   Every text colour meets 4.5:1 on its background; marks meet 3:1.
   Motion animates only transform and opacity, and stops for people who ask
   for reduced motion. */
@font-face { font-family: "Sora"; src: url("fonts/sora-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Sora"; src: url("fonts/sora-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Sora"; src: url("fonts/sora-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
:root {
  --bg: #13111C;
  --card: #1D1A2B;
  --sq: #262338;
  --ink: #F3F0FF;
  --soft: #A6A0C4;
  --line: #2E2A42;
  --mint: #4DEBA8;
  --violet: #B49CFF;
  --amber: #FFB547;
  --sky: #6CC4FF;
  --red: #FF7A7A;
  --focus: #6CC4FF;
  --out: cubic-bezier(0.2, 0.9, 0.3, 1);
  --pop: cubic-bezier(0.3, 1.5, 0.5, 1);
  --colour: background-color 0.28s, color 0.28s, border-color 0.28s, box-shadow 0.28s, transform 0.18s;
  color-scheme: dark;
  font-family: "Sora", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body { margin: 0 auto; max-width: 28rem; padding: 0 1rem 3rem; line-height: 1.5; font-size: 1rem; }
a { color: var(--soft); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { font-weight: 700; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.small { font-size: 0.85rem; color: var(--soft); }
.lead { color: var(--soft); max-width: 24rem; margin: 0.3rem auto 0; }

/* Buttons and squares shrink a little while pressed. */
.cell, .pebble, .modes button, .primary, .plain, .langbtn, .helpbtn, .roundbtn, .choices button, .clearpen { transition: var(--colour); }
.cell:active, .pebble:active, .modes button:active, .primary:active, .plain:active, .langbtn:active,
.helpbtn:active, .roundbtn:active, .choices button:active, .clearpen:active { transform: scale(0.93); }

.primary { background: var(--mint); color: #13111C; border: 0; border-radius: 999px; padding: 0.7rem 1.6rem; min-height: 2.75rem; font-weight: 700; }
.plain { border: 0; background: none; color: var(--soft); font-weight: 600; min-height: 44px; padding: 0 0.7rem; border-radius: 999px; }
.plain:hover { background: var(--sq); }

/* How-to drawings: on a #262338 panel */
.fig { position: relative; display: flex; align-items: center; justify-content: center; background: var(--sq); border-radius: 15px; padding: 0.55rem 0.5rem; }
.fig svg { display: block; height: var(--fh, 5rem); width: auto; max-width: 100%; }
.fig[data-fig="tools"] svg { --fh: 2.6rem; }

/* ---- Top bar: the sonar mark and "echo"; language and How to play ---- */
.bar { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 0.5rem; }
.brand { display: flex; align-items: center; gap: 0.5rem; margin: 0; font-size: 23px; font-weight: 700; letter-spacing: -0.01em; line-height: 1; }
.brand svg { width: 26px; height: 26px; flex: none; }
.tools { display: flex; align-items: center; gap: 0.5rem; }
.langwrap { position: relative; }
.langbtn { display: inline-flex; align-items: center; gap: 0.35rem; height: 44px; padding: 0 0.85rem 0 0.7rem; border: 0; border-radius: 999px; background: var(--card); font-weight: 600; font-size: 0.95rem; color: var(--soft); }
.langbtn svg { width: 1.2rem; height: 1.2rem; color: var(--soft); }
.langmenu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; display: grid; gap: 2px; min-width: 10.5rem; padding: 6px; background: var(--card); border-radius: 16px; box-shadow: 0 0 0 1px var(--line), 0 12px 30px rgba(5, 4, 10, 0.5); }
.langmenu[hidden] { display: none; }
.langmenu button { display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 0 0.85rem; border: 0; border-radius: 11px; background: none; font-weight: 600; text-align: left; color: var(--ink); }
.langmenu button:hover { background: var(--sq); }
.langmenu button[aria-checked="true"] { background: rgba(180, 156, 255, 0.16); }
.langmenu button[aria-checked="true"]::after { content: ""; width: 0.45rem; height: 0.8rem; border-right: 2.5px solid var(--violet); border-bottom: 2.5px solid var(--violet); transform: translateY(-2px) rotate(45deg); }
.helpbtn { width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--card); color: var(--ink); font-size: 1.2rem; font-weight: 700; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }

/* ---- Week strip ---- */
.strip { background: var(--card); border-radius: 22px; padding: 0.65rem 0.75rem 0.6rem; margin-top: 0.15rem; }
.stripline { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin: 0 0.1rem; line-height: 1.3; }
.dayline { color: var(--mint); font-weight: 700; font-size: 15px; }
.dayline.tag { background: rgba(255, 181, 71, 0.16); color: var(--amber); border-radius: 999px; padding: 0.1rem 0.65rem; font-size: 0.85rem; }
.dayright { color: var(--soft); font-weight: 400; font-size: 0.9rem; }
.days { list-style: none; margin: 0.5rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.days li { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.days .dot { position: relative; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 0.88rem; transition: background-color 0.3s, box-shadow 0.3s, color 0.3s; }
.days .dot svg { width: 18px; height: 18px; }
.days .ini { font-size: 0.7rem; font-weight: 600; color: var(--soft); line-height: 1.2; }
.days .now .ini { color: var(--ink); }
.days .later .dot { background: var(--sq); color: var(--soft); }
.days .missed .dot { border: 2px dashed #4A4566; color: var(--soft); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.days .today .dot { box-shadow: inset 0 0 0 2px var(--ink); color: var(--ink); font-weight: 700; }
.days .solved .dot { background: var(--mint); box-shadow: 0 0 14px rgba(77, 235, 168, 0.45); }
/* Today breathes: a 6 px halo coming and going. */
.days .now .dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 6px rgba(243, 240, 255, 0.13); opacity: 0; animation: breathe 3.2s ease-in-out infinite; pointer-events: none; }
.days .solved.now .dot::after { box-shadow: 0 0 0 6px rgba(77, 235, 168, 0.2); }
@keyframes breathe { 0%, 100% { opacity: 0; transform: scale(0.86); } 50% { opacity: 1; transform: none; } }
.stripnote { margin: 0.4rem 0.1rem 0; font-size: 0.85rem; color: var(--soft); }

/* ---- Notice: no code or an unknown code ---- */
.notice { display: flex; align-items: flex-start; gap: 0.7rem; margin-top: 0.5rem; padding: 0.65rem 0.8rem; background: var(--card); border-radius: 16px; }
.notice[hidden] { display: none; }
.nicon { flex: none; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.nicon svg { width: 20px; height: 20px; }
.notice.nocode .nicon { background: rgba(180, 156, 255, 0.16); color: var(--violet); }
.notice.badcode .nicon { background: rgba(255, 122, 122, 0.16); color: var(--red); }
.notice p { margin: 0; font-size: 0.86rem; color: var(--soft); line-height: 1.45; }
.notice b { display: block; color: var(--ink); font-size: 0.95rem; font-weight: 700; }

/* ---- Progress line ---- */
.progress { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin: 0.7rem 0.3rem 0.5rem; font-weight: 600; color: var(--soft); font-size: 0.9rem; line-height: 1.3; }
.progress .found { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--ink); }
.progress.has-miss #mist { color: var(--red); }
.pips { display: inline-flex; gap: 0.32rem; }
.pips i { width: 0.6rem; height: 0.6rem; border-radius: 2px; transform: rotate(45deg); background: #34304A; transition: background-color 0.3s, box-shadow 0.3s; }
.pips i.on { background: var(--mint); box-shadow: 0 0 8px rgba(77, 235, 168, 0.6); animation: pippop 420ms var(--pop) backwards; }
@keyframes pippop { 0% { transform: rotate(45deg) scale(0.3); opacity: 0; } 65% { transform: rotate(45deg) scale(1.18); opacity: 1; } 100% { transform: rotate(45deg); } }

/* ---- Board: its frame takes the mode's tint ---- */
.board { background: var(--card); border-radius: 24px; padding: 10px; border: 2px solid var(--frame, #2E2A42); transition: border-color 0.3s; overflow: hidden; }
body[data-mode="note"] { --frame: #2E2A42; }
body[data-mode="pen"] { --frame: #5E4BB8; }
body[data-mode="place"] { --frame: #2B9A6E; }
body.solved { --frame: #2B9A6E; }
.grid { display: grid; gap: 6px; margin: 0 auto; }
.egrid { grid-template-columns: repeat(7, 1fr); }
.cell { aspect-ratio: 1; border: 0; background: var(--sq); border-radius: 10px; padding: 0; display: flex; align-items: center; justify-content: center; position: relative; min-width: 0; color: var(--ink); }
.cell:hover { background: #2C2840; }

/* Marks: a cross, a pencilled gem, a gem. */
.cell.x::after { content: ""; width: 34%; height: 34%; background:
  linear-gradient(45deg, transparent 42%, #7F79A3 42%, #7F79A3 58%, transparent 58%),
  linear-gradient(-45deg, transparent 42%, #7F79A3 42%, #7F79A3 58%, transparent 58%); border-radius: 2px; animation: fadein 200ms ease backwards; }
.cell.x.auto::after { width: 16%; height: 16%; border-radius: 50%; background: #4A4566; }
.egrid .cell.pen::before { content: ""; width: 40%; height: 40%; border: 2.5px dashed var(--violet); transform: rotate(45deg); border-radius: 4px; animation: fadein 200ms ease backwards; }
.egrid .cell.gem { background: rgba(77, 235, 168, 0.12); box-shadow: 0 0 14px rgba(77, 235, 168, 0.25); }
.gemsvg { width: 66%; height: 66%; animation: gempop 420ms var(--pop) backwards; }
@keyframes fadein { from { opacity: 0; } }
@keyframes gempop { 0% { transform: scale(0.3) rotate(-30deg); opacity: 0; } 65% { transform: scale(1.18); opacity: 1; } 100% { transform: none; } }
body.solved .egrid .cell:not(.gem) { background: #211E30; }
body.solved .egrid .cell:not(.gem)::after { opacity: 0.5; }

/* A wrong gem: red for a moment, the square shakes, then it is ruled out. */
.wronggem { position: absolute; width: 62%; height: 62%; opacity: 0; animation: wrong 1s ease; pointer-events: none; }
@keyframes wrong { 0% { opacity: 0; transform: scale(0.3) rotate(-30deg); } 25% { opacity: 1; transform: scale(1.1); } 70% { opacity: 1; transform: none; } 100% { opacity: 0; } }
.miss { animation: miss 0.5s ease; }
@keyframes miss { 0%, 100% { transform: none; } 20% { transform: translateX(-4px) rotate(-3deg); } 50% { transform: translateX(4px) rotate(3deg); } 80% { transform: translateX(-2px); } }

/* Numbers: their colour inside a ring of it. Lit, they fill at 16 %, glow,
   and send sonar pings; their ring of squares lights clockwise from the top. */
.pebble { --k: var(--amber); --kt: rgba(255, 181, 71, 0.16); --kg: rgba(255, 181, 71, 0.55);
  aspect-ratio: 1; border-radius: 50%; border: 0; padding: 0; position: relative; min-width: 0;
  background: var(--sq); color: var(--k); box-shadow: inset 0 0 0 2px var(--k);
  font-size: 18px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.pebble[data-d="2"] { --k: #4DEBA8; --kt: rgba(77, 235, 168, 0.16); --kg: rgba(77, 235, 168, 0.55); }
.pebble[data-d="3"] { --k: #6CC4FF; --kt: rgba(108, 196, 255, 0.16); --kg: rgba(108, 196, 255, 0.55); }
.pebble[data-d="4"] { --k: #FF8FC8; --kt: rgba(255, 143, 200, 0.16); --kg: rgba(255, 143, 200, 0.55); }
.pebble[data-d="5"] { --k: #FFE066; --kt: rgba(255, 224, 102, 0.16); --kg: rgba(255, 224, 102, 0.55); }
.pebble[data-d="6"] { --k: #FF9E7A; --kt: rgba(255, 158, 122, 0.16); --kg: rgba(255, 158, 122, 0.55); }
.pebble[aria-pressed="true"] { z-index: 2; background: var(--kt); box-shadow: inset 0 0 0 2px var(--k), 0 0 22px var(--kg); }
.pebble::before, .pebble::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--k); opacity: 0; pointer-events: none; }
.pebble[aria-pressed="true"]::before { animation: ping 2.4s ease-out infinite; }
.pebble[aria-pressed="true"]::after { animation: ping 2.4s ease-out 1.2s infinite; }
@keyframes ping { 0% { transform: scale(1); opacity: 0.8; } 100% { transform: scale(2.7); opacity: 0; } }
.egrid .cell.ring { background: var(--ring-p); box-shadow: inset 0 0 0 1.5px var(--ring-d); animation: ringin 340ms var(--pop) backwards; animation-delay: calc(var(--i, 0) * 30ms); }
@keyframes ringin { 0% { transform: scale(0.72); opacity: 0.3; } 65% { transform: scale(1.07); opacity: 1; } 100% { transform: none; } }
.egrid .cell.inside { background-image: radial-gradient(circle, #3A3552 18%, transparent 20%); background-size: 8px 8px; }

/* ---- Mode switch: one pill, a lit pill sliding under the chosen mode ---- */
.modes { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 5px; margin: 0.75rem 0 0; background: var(--card); border-radius: 999px; }
.modes .pill { position: absolute; top: 5px; bottom: 5px; left: 5px; width: calc((100% - 18px) / 3); border-radius: 999px; background: var(--pm, #F3F0FF);
  transform: translateX(calc(var(--k, 0) * (100% + 4px)));
  transition: transform 420ms cubic-bezier(0.3, 1.25, 0.5, 1), background-color 0.3s, box-shadow 0.3s; }
body[data-mode="note"] .modes .pill { --k: 0; --pm: #F3F0FF; }
body[data-mode="pen"] .modes .pill { --k: 1; --pm: #B49CFF; box-shadow: 0 0 18px rgba(180, 156, 255, 0.45); }
body[data-mode="place"] .modes .pill { --k: 2; --pm: #4DEBA8; box-shadow: 0 0 18px rgba(77, 235, 168, 0.45); }
.modes button { --m: #F3F0FF; position: relative; height: 48px; border: 0; border-radius: 999px; background: transparent; color: var(--soft); font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem; padding: 0 0.3rem; }
.modes [data-mode="pen"] { --m: #B49CFF; }
.modes [data-mode="place"] { --m: #4DEBA8; }
.modes button svg { width: 1.1rem; height: 1.1rem; flex: none; color: var(--m); transition: color 0.28s; }
.modes button[aria-pressed="true"], .modes button[aria-pressed="true"] svg { color: #13111C; }
.modes button[aria-pressed="true"] { font-weight: 700; }
.hintrow { display: flex; align-items: center; gap: 0.5rem; min-height: 44px; margin: 0.15rem 0.3rem 0; }
.hint { flex: 1; margin: 0; text-align: center; color: var(--soft); font-size: 13px; line-height: 1.35; }
body[data-mode="pen"] .hint { text-align: left; }
.clearpen { flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 0 0.1rem; border: 0; background: none; color: var(--violet); font-size: 13px; font-weight: 600; white-space: nowrap; }
body:not([data-mode="pen"]) .clearpen { display: none; }
body.solved .modes, body.solved .hintrow { display: none; }

/* ---- Solved: play again?, comment, share ---- */
body.solved .board { margin-top: 1rem; }
.solvedbox { background: var(--card); border-radius: 24px; padding: 1.1rem 1rem 1rem; margin: 1rem 0; text-align: center; box-shadow: inset 0 0 0 2px rgba(77, 235, 168, 0.35); animation: rise 0.5s var(--out) backwards; }
.solvedbox:focus { outline: none; }
.solvedbox:focus-visible { outline: 3px solid var(--focus); }
.solvedbox h2 { margin: 0.2rem 0 0.1rem; color: var(--mint); font-size: 1.5rem; }
.solvedbox .badge { display: inline-flex; width: 3rem; height: 3rem; border-radius: 50%; background: rgba(77, 235, 168, 0.16); align-items: center; justify-content: center; box-shadow: 0 0 18px rgba(77, 235, 168, 0.3); }
.solvedbox .badge svg { width: 1.6rem; height: 1.6rem; }
.solvedbox p { margin: 0.2rem 0; }
.solvedbox pre { text-align: left; display: block; width: fit-content; max-width: 100%; margin: 0.6rem auto 0.8rem; background: var(--sq); color: var(--ink); padding: 0.7rem 1rem; border-radius: 14px; font-family: inherit; font-size: 1rem; line-height: 1.5; white-space: pre-wrap; }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } }
.feedback { margin: 0.6rem 0 0.9rem; padding: 0.8rem 0.6rem; background: var(--sq); border-radius: 18px; }
.feedback .q { font-weight: 700; font-size: 1.05rem; margin: 0 0 0.55rem; }
.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; }
.choices button { border: 0; background: var(--card); box-shadow: inset 0 0 0 2px var(--line); border-radius: 999px; min-height: 2.75rem; font-weight: 600; color: var(--ink); }
.choices button[aria-pressed="true"] { background: rgba(77, 235, 168, 0.16); box-shadow: inset 0 0 0 2px var(--mint); font-weight: 700; }
.comment { display: grid; gap: 0.4rem; margin-top: 0.8rem; text-align: left; }
.comment label { font-weight: 600; font-size: 0.92rem; }
.comment textarea { font: inherit; width: 100%; border: 0; box-shadow: inset 0 0 0 2px var(--line); border-radius: 14px; padding: 0.6rem 0.75rem; background: var(--sq); color: var(--ink); resize: vertical; }
.feedback .comment textarea { background: var(--card); }
.comment textarea:focus { outline: none; box-shadow: inset 0 0 0 2px var(--violet); }
.comment textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.comment .primary { justify-self: end; }
.feedback .small { margin: 0.5rem 0 0; min-height: 1.2em; font-weight: 600; color: var(--mint); }
.next { font-weight: 600; color: var(--soft); }
.next:empty { display: none; }

/* ---- What this test records: one row that unfolds ---- */
.records { margin-top: 1.4rem; }
.records summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 0.6rem; min-height: 48px; padding: 0.55rem 0.9rem; background: var(--card); border-radius: 16px; font-weight: 600; }
.records summary::-webkit-details-marker { display: none; }
.records .info { width: 1.25rem; height: 1.25rem; color: var(--violet); flex: none; }
.records .chev { margin-left: auto; width: 0.5rem; height: 0.5rem; border-right: 2.5px solid var(--soft); border-bottom: 2.5px solid var(--soft); transform: translateY(-2px) rotate(45deg); transition: transform 0.28s ease; }
.records[open] .chev { transform: translateY(2px) rotate(-135deg); }
.privacy { margin: 0.7rem 0.4rem 0; line-height: 1.5; }

/* ---- Bottom sheets: sliding up over a scrim that fades in ---- */
dialog.sheet { position: fixed; inset: auto 0 0 0; margin: 0 auto; width: 100%; max-width: 28rem; max-height: 94vh; overflow: auto; border: 0; border-radius: 26px 26px 0 0; padding: 0.5rem 1.2rem 1.4rem; background: var(--card); color: var(--ink); box-shadow: 0 -8px 30px rgba(5, 4, 10, 0.5); }
dialog.sheet[open] { animation: sheetup 300ms var(--out); }
dialog.sheet::backdrop { background: rgba(5, 4, 10, 0.6); animation: fadein 300ms ease; }
@keyframes sheetup { from { transform: translateY(100%); } }
.grabber { display: block; width: 40px; height: 5px; border-radius: 3px; background: #3A3552; margin: 0.2rem auto 0.8rem; }
.sheethead { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
.ruleof { margin: 0; font-size: 0.85rem; font-weight: 600; color: var(--mint); }
.sheethead h2 { margin: 0.05rem 0 0.8rem; font-size: 1.4rem; line-height: 1.2; }
.roundbtn { flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--sq); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; }
.roundbtn svg { width: 1.1rem; height: 1.1rem; }
.rulesheet .fig { border-radius: 20px; padding: 1.1rem; }
.rulesheet .step .fig svg { --fh: 9.5rem; }
.rulesheet .step .fig[data-fig="tools"] svg { --fh: 5.2rem; }
.step p { margin: 0.9rem 0.1rem 0; font-size: 16px; line-height: 1.55; min-height: 4.65em; }
.step[hidden] { display: none; }
.dots { display: flex; justify-content: center; gap: 6px; margin: 1rem 0; }
.dots i { width: 8px; height: 8px; border-radius: 4px; background: #3A3552; transition: width 0.28s, background-color 0.28s; }
.dots i.on { width: 22px; background: var(--mint); }
.sheetnav { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.welcome { text-align: center; }
.welcome .fig.hello { border-radius: 20px; padding: 0.9rem; }
.welcome .fig.hello svg { --fh: 6.5rem; }
.welcome h2 { margin: 0.9rem 0 0.3rem; font-size: 1.45rem; line-height: 1.2; }
.welcome .lead { font-size: 1rem; color: var(--soft); margin: 0 auto; }
.clock { display: inline-flex; align-items: center; gap: 0.4rem; margin: 0.7rem 0 1.1rem; color: var(--soft); font-weight: 600; font-size: 0.9rem; }
.clock svg { width: 1.15rem; height: 1.15rem; color: var(--mint); flex: none; }
.wide { display: block; width: 100%; min-height: 50px; }
.welcome .plain { display: block; margin: 0.4rem auto 0; }

/* ---- One-time tip: the "?" ringed in mint, the rest dimmed ---- */
.tip { position: fixed; inset: 0; z-index: 40; background: rgba(5, 4, 10, 0.6); animation: fadein 300ms ease; }
.tip[hidden] { display: none; }
.helpbtn.lit { position: relative; z-index: 50; box-shadow: 0 0 0 2px var(--mint), 0 0 18px rgba(77, 235, 168, 0.45); }
.bubble { position: fixed; width: min(17rem, calc(100vw - 2rem)); background: var(--card); color: var(--ink); border-radius: 16px; padding: 0.9rem 1rem; box-shadow: 0 12px 30px rgba(5, 4, 10, 0.5); animation: rise 0.3s var(--out) backwards; }
.bubble::before { content: ""; position: absolute; top: -7px; right: 15px; width: 14px; height: 14px; background: var(--card); transform: rotate(45deg); border-radius: 3px; }
.bubble p { margin: 0 0 0.7rem; font-weight: 600; line-height: 1.45; }
.bubble .primary { display: block; margin-left: auto; padding: 0.5rem 1.3rem; }

/* ---- Opening: the parts fade up in turn, the squares arrive in a wave ---- */
@keyframes fadeup { from { opacity: 0; transform: translateY(12px); } }
.bar { animation: fadeup 520ms var(--out) backwards; }
.strip, .notice { animation: fadeup 520ms var(--out) 70ms backwards; }
.progress, .board { animation: fadeup 520ms var(--out) 120ms backwards; }
.modes, .hintrow, .records { animation: fadeup 520ms var(--out) 320ms backwards; }
@keyframes square { from { opacity: 0; transform: translateY(6px) scale(0.9); } }
body:not(.ready) .egrid > * { animation: square 340ms var(--out) backwards; animation-delay: calc(120ms + (var(--r, 0) + var(--c, 0)) * 16ms); }

/* ---- Grain: one still layer over everything, never catching taps ---- */
.grain { position: fixed; inset: 0; z-index: 100; pointer-events: none; opacity: 0.07; mix-blend-mode: hard-light; }
.grain svg { display: block; width: 100%; height: 100%; }

@media (min-width: 640px) {
  body { padding-top: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, ::backdrop { animation: none !important; transition: none !important; }
  .miss { outline: 3px solid var(--red); }
  .wronggem { opacity: 1; }
}
