@font-face { font-family: 'Lexend'; src: url('fonts/Lexend-Regular.ttf') format('truetype'); font-weight: 400 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Lexend'; src: url('fonts/Lexend-SemiBold.ttf') format('truetype'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Lexend'; src: url('fonts/Lexend-Bold.ttf') format('truetype'); font-weight: 700; font-style: normal; font-display: swap; }
/* Lantern Lighting: the calm arcade game in the Mars Theory typing game. A town square at dusk during the lantern festival,
   with the corner bakery on the right. Festival-goers write a word on each paper lantern; typing the word lights it, and it
   floats up to join the others, so the sky fills with every word you typed. */
:root {
  --paper: #fdf8ee;
  --ink: #22201c;
  --brand-bg: #faf8f5;
  --brand-ink: #1a1a1a;
  --brand-green: #0f4c3a;
  --glow: #ffcf7a;
  --body: "Lexend", "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
}
html, body { height: 100%; }
body { margin: 0; background: #15112a; color: var(--paper); font-family: var(--body); letter-spacing: .02em; overflow: hidden; -webkit-tap-highlight-color: transparent; }
#stage { position: fixed; inset: 0; }
canvas { display: block; width: 100%; height: 100%; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.hud { position: absolute; top: max(10px, env(safe-area-inset-top)); left: max(16px, env(safe-area-inset-left)); right: max(16px, env(safe-area-inset-right)); display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; pointer-events: none; font-weight: 600; font-variant-numeric: tabular-nums; text-shadow: 0 1px 3px rgba(10,6,24,.7); }
.hud .score { display: grid; gap: 0; line-height: 1.2; }
.hud .score .lbl { font-size: .8rem; opacity: .85; letter-spacing: .06em; }
.hud .score .num { font-size: 1.7rem; font-weight: 700; }
.hud .score .best { font-size: .8rem; font-weight: 400; opacity: .85; }
.hud .crownline { align-self: center; font-size: .9rem; font-weight: 600; opacity: .9; text-align: center; }
.hud .right { display: flex; align-items: center; gap: 14px; }
.drifts { display: inline-flex; gap: 6px; align-items: center; }
.drifts .dl { width: 13px; height: 17px; border-radius: 45% 45% 30% 30%; background: var(--glow); box-shadow: 0 0 10px 2px rgba(255,190,100,.55); }
.drifts .dl.gone { background: transparent; box-shadow: none; border: 1.5px solid rgba(253,248,238,.45); box-sizing: border-box; }
.hudbtn { pointer-events: auto; font: 600 .85rem var(--body); letter-spacing: .02em; color: var(--paper); background: rgba(253,248,238,.12); border: 1.5px solid rgba(253,248,238,.4); border-radius: 999px; padding: 6px 14px; min-height: 36px; cursor: pointer; }
.hudbtn:focus-visible { outline: 3px solid var(--glow); outline-offset: 2px; }

.caps { position: absolute; left: 50%; bottom: 22%; transform: translateX(-50%); background: rgba(14,10,30,.82); border: 1.5px solid rgba(253,248,238,.5); border-radius: 999px; padding: 6px 16px; font-size: .9rem; pointer-events: none; }

.overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px max(16px, env(safe-area-inset-left)); pointer-events: none; overflow: auto; }
.card { pointer-events: auto; background: var(--brand-bg); color: var(--brand-ink); border-radius: 18px; padding: 22px 26px; display: grid; gap: 10px; justify-items: center; text-align: center; max-width: 46ch; box-sizing: border-box;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .35 0 0 0 0 .25 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)'/%3E%3C/svg%3E"), radial-gradient(ellipse at 50% 0%, rgba(255,255,255,.55), rgba(255,255,255,0) 60%), linear-gradient(#fbf7ef, #f3eadb);
  box-shadow: 0 12px 34px rgba(10,4,20,.5), inset 0 0 0 5px rgba(255,255,255,.4), inset 0 0 0 6.5px rgba(140,100,70,.22); border: 1px solid rgba(120,86,60,.25); }
.card h1 { margin: 0; font-weight: 700; font-size: clamp(1.7rem, 4.2vw, 2.4rem); line-height: 1.15; color: var(--brand-green); text-wrap: balance; }
.card p { margin: 0; font-size: 1.02rem; line-height: 1.6; }
.card .eyebrow { font-size: .85rem; font-weight: 600; color: #5a5148; letter-spacing: .05em; }
.card .small { font-size: .9rem; color: #4a433c; }
.card .home { background: #efe6d6; border-radius: 12px; padding: 10px 14px; }
.card .home strong { color: var(--brand-green); }
.card kbd { font: 600 .9em var(--body); background: #fff; border: 1.5px solid #c9bba6; border-bottom-width: 3px; border-radius: 6px; padding: 0 6px; }
.stats { width: 100%; display: grid; gap: 6px; margin: 2px 0; }
.stats div { display: flex; justify-content: space-between; gap: 16px; background: #f1ebe0; border-radius: 10px; padding: 6px 12px; font-variant-numeric: tabular-nums; }
.stats div span:first-child { color: #4a433c; }
.stats div span:last-child { font-weight: 700; }
.tip { width: 100%; box-sizing: border-box; background: #e3efe9; border-radius: 12px; padding: 10px 14px; text-align: left; font-size: .97rem; line-height: 1.55; }
.tip strong { color: var(--brand-green); }
.toggles { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.toggle { font: 600 .88rem var(--body); letter-spacing: .02em; color: var(--brand-green); background: #fff; border: 2px solid var(--brand-green); border-radius: 999px; padding: 7px 14px; min-height: 40px; cursor: pointer; }
.toggle[aria-pressed="true"] { color: var(--brand-bg); background: var(--brand-green); }
.btnrow { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: center; margin-top: 4px; }
.go { font: 700 1.08rem var(--body); letter-spacing: .02em; color: var(--brand-bg); background: var(--brand-green); border: 0; border-radius: 999px; padding: 10px 24px; min-height: 46px; cursor: pointer; }
.plain { font: 600 .95rem var(--body); color: var(--brand-green); background: none; border: 0; text-decoration: underline; text-underline-offset: 3px; padding: 8px 10px; min-height: 44px; cursor: pointer; }
.toggle:focus-visible, .go:focus-visible, .plain:focus-visible { outline: 3px solid var(--brand-ink); outline-offset: 3px; }
@media (prefers-reduced-motion: no-preference) { .go.breathe { animation: breathe 2.6s ease-in-out infinite; } }
@keyframes breathe { 50% { transform: scale(1.04); } }
.startlv { display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 600; color: var(--brand-green); }
.startlv .step { width: 42px; height: 42px; border-radius: 50%; border: 2px solid var(--brand-green); background: #fff; color: var(--brand-green); font: 700 1.3rem/1 var(--body); cursor: pointer; }
.startlv .step:disabled { opacity: .35; cursor: default; }
.startlv .step:focus-visible { outline: 3px solid var(--brand-ink); outline-offset: 2px; }
.startlv { flex-wrap: wrap; }
.startlv .strictnote { flex-basis: 100%; text-align: center; }
.startlv output { min-width: 2.2ch; text-align: center; font-size: 1.35rem; font-weight: 700; color: var(--brand-ink); }
#map { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#mapui { position: fixed; inset: 0; pointer-events: none; }
.place { position: absolute; transform: translateX(-50%); pointer-events: auto; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; border-radius: 10px; transition: opacity .2s; font: inherit; }
.place .rib { filter: drop-shadow(0 0 .6px #4a3524) drop-shadow(0 0 .6px #4a3524) drop-shadow(0 2px 1px rgba(74,53,36,.35)); }
.place .ribbon { display: block; font: 600 var(--lfs, 16px)/1.3 var(--body); color: #3b2a1c; background: #f3e4bd; padding: .2em 1.15em; letter-spacing: .02em; white-space: nowrap; clip-path: polygon(0 0, 100% 0, calc(100% - .6em) 50%, 100% 100%, 0 100%, .6em 50%); }
.place .ribbon b { color: var(--brand-green); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.place:hover .ribbon, .place:focus-visible .ribbon { background: #fff7de; color: var(--brand-green); }
.place.here .ribbon { background: #f8df9c; }
.place:focus-visible { outline: 3px solid var(--brand-green); outline-offset: 3px; }
.place.dim { opacity: .4; }
.typebar { position: fixed; left: 50%; top: max(10px, env(safe-area-inset-top)); transform: translateX(-50%); pointer-events: none; background: rgba(250,243,226,.96); color: #3b2a1c; border: 1.5px solid #6b4f36; border-radius: 16px; padding: 7px 20px; font: 600 1rem/1.4 var(--body); box-shadow: 0 4px 14px rgba(20,10,0,.35); text-align: center; max-width: calc(100vw - 32px); box-sizing: border-box; }
.typebar .buf { color: var(--brand-green); font-weight: 700; font-size: 1.15em; letter-spacing: .03em; }
.typebar .caret { display: inline-block; width: 2px; height: 1.1em; background: var(--brand-green); vertical-align: -.2em; margin-left: 2px; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
#typeWhat { font-weight: 400; font-size: .9rem; color: #5a4632; }
#typeWhat:empty { display: none; }
.typebar.bump { animation: bump .25s; }
@keyframes bump { 25% { transform: translateX(calc(-50% - 5px)); } 75% { transform: translateX(calc(-50% + 5px)); } }
#fade { position: fixed; inset: 0; background: #120e1c; opacity: 0; pointer-events: none; transition: opacity .32s; z-index: 40; }
#fade.on { opacity: 1; }
#map[hidden], #mapui[hidden] { display: none !important; }
body:has(#map[hidden]) .typebar { display: none; }
@media (prefers-reduced-motion: reduce) { .typebar .caret, .typebar.bump { animation: none; } }
#cottage { position: fixed; inset: 0; pointer-events: none; }
.ctpanel { pointer-events: auto; position: absolute; top: 16px; right: 16px; bottom: 16px; width: min(560px, 48vw); box-sizing: border-box; overflow: auto; padding: 22px 26px 18px; color: var(--brand-ink); border-radius: 18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .35 0 0 0 0 .25 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)'/%3E%3C/svg%3E"), linear-gradient(#fbf7ef, #f3eadb);
  box-shadow: 0 12px 34px rgba(10,4,20,.5), inset 0 0 0 5px rgba(255,255,255,.4), inset 0 0 0 6.5px rgba(140,100,70,.22); border: 1px solid rgba(120,86,60,.25); }
@media (max-width: 860px) { .ctpanel { left: 12px; right: 12px; width: auto; top: 12px; bottom: 12px; } }
.cthead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.cthead .eyebrow { margin: 0; font-size: .82rem; font-weight: 600; color: #5a5148; letter-spacing: .06em; }
.cthead h1 { margin: 2px 0 0; font-size: clamp(1.4rem, 3vw, 1.9rem); color: var(--brand-green); line-height: 1.2; overflow-wrap: anywhere; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 12px; border-bottom: 2px solid #e2d6c2; padding-bottom: 8px; }
.tabs [role="tab"] { font: 600 .92rem var(--body); color: var(--brand-green); background: #fff; border: 2px solid #cfc2ad; border-radius: 999px; padding: 6px 14px; min-height: 38px; cursor: pointer; }
.tabs [role="tab"][aria-selected="true"] { background: var(--brand-green); border-color: var(--brand-green); color: var(--brand-bg); }
.tabs [role="tab"]:focus-visible, .pane:focus-visible, .switch:focus-visible, .mini:focus-visible, .whobadge:focus-visible { outline: 3px solid var(--brand-ink); outline-offset: 2px; }
.pane h2 { font-size: 1.15rem; color: var(--brand-green); margin: 14px 0 8px; }
.pane h3 { font-size: 1rem; margin: 14px 0 6px; }
.pane p { margin: 6px 0; line-height: 1.55; }
.pane .muted { color: #5a5148; font-size: .95rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.tile { background: #f1ebe0; border-radius: 12px; padding: 10px 12px; display: grid; gap: 2px; }
.tile span { font-size: .85rem; color: #5a5148; }
.tile strong { font-size: 1.1rem; }
table.nights { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .95rem; }
table.nights th { text-align: left; font-weight: 600; color: #5a5148; border-bottom: 2px solid #e2d6c2; padding: 6px 8px; }
table.nights td { padding: 6px 8px; border-bottom: 1px solid #ece3d4; }
ul.achs, ul.settings, ul.profiles { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 8px; }
.ach { display: flex; gap: 12px; align-items: center; background: #f6f1e7; border-radius: 12px; padding: 8px 12px; }
.ach.won { background: #e9f2ec; }
.ach svg { width: 52px; height: 46px; flex: none; }
.ach div { display: grid; gap: 1px; }
.ach strong { font-size: 1rem; }
.ach span { font-size: .9rem; color: #4a433c; }
.ach .when { font-style: normal; font-size: .82rem; color: var(--brand-green); font-weight: 600; }
.settings li { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: #f6f1e7; border-radius: 12px; padding: 10px 12px; }
.settings li div { display: grid; gap: 2px; } .settings li div span { font-size: .9rem; color: #4a433c; }
.switch span { color: inherit; font: inherit; }
.switch { flex: none; min-width: 64px; min-height: 38px; border-radius: 999px; border: 2px solid var(--brand-green); background: #fff; color: var(--brand-green); font: 700 .9rem var(--body); cursor: pointer; }
.switch[aria-checked="true"] { background: var(--brand-green); color: var(--brand-bg); }
.profiles li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: #f6f1e7; border-radius: 12px; padding: 8px 12px; }
.profiles .dot, .whobadge .dot { width: 14px; height: 18px; border-radius: 45% 45% 30% 30%; flex: none; box-shadow: 0 0 8px rgba(255,190,100,.6); }
.profiles .pname { flex: 1; font-weight: 600; overflow-wrap: anywhere; } .profiles .pname em { font-style: normal; font-weight: 400; color: var(--brand-green); }
.pbtns { display: flex; gap: 6px; flex-wrap: wrap; }
.mini { font: 600 .88rem var(--body); color: var(--brand-bg); background: var(--brand-green); border: 2px solid var(--brand-green); border-radius: 999px; padding: 5px 12px; min-height: 36px; cursor: pointer; }
.mini.plainmini { background: #fff; color: var(--brand-green); }
.mini.danger, .go.danger { background: #9b3b2f; border-color: #9b3b2f; color: #fff; }
.go:disabled { opacity: .45; cursor: default; }
form.rename { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; }
form.rename input, .addp input[type="text"], .addp #newName, #mInput { font: 500 1rem var(--body); border: 2px solid #b9ab95; border-radius: 10px; padding: 6px 10px; min-height: 38px; box-sizing: border-box; background: #fff; color: var(--brand-ink); }
form.rename input { flex: 1; min-width: 140px; }
.profiles li.me { background: #e9f2ec; }
.dotbtn .dot { display: block; }
.dotbtn { background: none; border: 0; padding: 6px; margin: -6px 0; cursor: pointer; border-radius: 8px; }
.dotbtn:focus-visible { outline: 3px solid var(--brand-ink); }
.pname-in { flex: 1; min-width: 120px; font: 600 1rem var(--body); color: var(--brand-ink); background: #fff; border: 2px solid #cfc2ad; border-radius: 10px; padding: 6px 10px; min-height: 38px; box-sizing: border-box; }
.pname-in:focus { outline: 3px solid var(--brand-green); outline-offset: 1px; border-color: var(--brand-green); }
.profiles .now { font-size: .9rem; font-weight: 600; color: var(--brand-green); padding: 0 4px; }
.addbtn { margin-top: 4px; }
.addp { display: grid; gap: 8px; margin-top: 12px; background: #f6f1e7; border-radius: 12px; padding: 12px; }
.addp h3 { margin: 0; } .addp label { font-weight: 600; font-size: .92rem; }
.addp fieldset { border: 0; padding: 0; margin: 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.addp legend { font-weight: 600; font-size: .92rem; margin-bottom: 4px; }
.swatch { position: relative; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.swatch span:first-of-type { display: block; width: 28px; height: 34px; border-radius: 45% 45% 30% 30%; border: 3px solid transparent; }
.swatch input:checked + span { border-color: var(--brand-ink); }
.swatch input:focus-visible + span { outline: 3px solid var(--brand-green); outline-offset: 2px; }
.btnrow.left { justify-content: flex-start; }
.msg { font-weight: 600; color: var(--brand-green); min-height: 1.2em; } .msg.warn { color: #9b3b2f; }
.ctprivacy { margin: 14px 0 0; font-size: .85rem; color: #5a5148; border-top: 1px solid #e2d6c2; padding-top: 10px; }
#mInput { width: 100%; margin-top: 4px; }
.whobadge { position: fixed; left: max(14px, env(safe-area-inset-left)); bottom: max(12px, env(safe-area-inset-bottom)); display: inline-flex; align-items: center; gap: 8px; font: 600 .9rem var(--body); color: #3b2a1c; background: rgba(250,243,226,.96); border: 1.5px solid #6b4f36; border-radius: 999px; padding: 6px 14px; min-height: 36px; cursor: pointer; box-shadow: 0 3px 10px rgba(20,10,0,.3); }
body:has(#map[hidden]) .whobadge { display: none; }
.achtoast { position: fixed; left: 50%; bottom: 70px; transform: translate(-50%, 20px); opacity: 0; display: grid; justify-items: center; gap: 2px; background: #fbf3df; color: var(--brand-ink); border: 2px solid #c9a24a; border-radius: 14px; padding: 10px 22px; box-shadow: 0 8px 24px rgba(10,4,20,.45); transition: transform .35s, opacity .35s; z-index: 30; pointer-events: none; }
.achtoast.show { transform: translate(-50%, 0); opacity: 1; }
.achtoast .achlabel { font-size: .8rem; font-weight: 600; letter-spacing: .06em; color: #8a6a10; text-transform: uppercase; }
.achtoast .achname { font-size: 1.15rem; font-weight: 700; color: var(--brand-green); }
#modal { z-index: 35; background: rgba(10,6,20,.45); pointer-events: auto; }
.crown-art svg { width: 72px; height: 54px; display: block; }
.crown-icon svg { width: 1.2em; height: .9em; vertical-align: -.08em; }
.needkb { background: #fff3d6; border-radius: 10px; padding: 8px 12px; font-size: .92rem; }
@media (max-width: 600px) { .hud .crownline { display: none; } .hud .score .lbl { font-size: .7rem; } }
@media (max-height: 600px) { .card { padding: 14px 18px; gap: 7px; } .card p { font-size: .94rem; line-height: 1.45; } .card h1 { font-size: 1.6rem; } .card .eyebrow { display: none; } }
@media (max-height: 460px) { .card { max-width: 60ch; } .toggle { min-height: 34px; padding: 4px 10px; } }
#runner { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#runner > * { pointer-events: auto; }
#runner > .overlay { pointer-events: none; }
#runner > .certwrap { pointer-events: auto; }
#lessonView { isolation: isolate; }
#lessonCard { z-index: 2; }
#lTime { color: var(--brand-green); }
.ltext .c.nl { color: #a0907a; font-size: .8em; }
#school { position: fixed; inset: 0; pointer-events: none; }
#school > * { pointer-events: auto; }
#school > .overlay { pointer-events: none; }
.schpanel { width: min(640px, 54vw); }
@media (max-width: 860px) { .schpanel { width: auto; } }
.schpanel kbd, .lcbody kbd, .stats kbd { font: 600 .9em var(--body); background: #fff; border: 1.5px solid #c9bba6; border-bottom-width: 3px; border-radius: 6px; padding: 0 6px; }
.progbar { height: 10px; background: #e6dccb; border-radius: 99px; overflow: hidden; margin: 14px 0 6px; }
.progbar span { display: block; height: 100%; background: var(--brand-green); }
.ltoggles { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 16px 0 6px; font-weight: 600; color: #5a5148; }
.mods { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 14px; }
.mod { background: #f6f1e7; border-radius: 14px; padding: 14px 16px; }
.modhead { display: flex; gap: 12px; align-items: center; }
.modnum { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--brand-green); color: #fff; display: grid; place-items: center; font-weight: 700; }
.mod h2 { margin: 0 !important; font-size: 1.05rem; color: var(--brand-ink); }
.mod .keys { margin: 4px 0 0 !important; font-size: .88rem; color: #5a5148; }
.lsns { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 10px; margin-top: 12px; }
.lsn { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; font: 600 .9rem var(--body); color: var(--brand-green); background: #fff; border: 2px solid #d8ccb7; border-radius: 12px; padding: 9px 11px; min-height: 66px; cursor: pointer; }
.lsn .lk { width: 20px; height: 20px; border-radius: 50%; border: 2px solid currentColor; font-size: .75rem; display: grid; place-items: center; box-sizing: border-box; }
.lsn svg { width: 20px; height: 20px; }
.lsn.done { background: #e9f2ec; border-color: #9cc5ac; }
.lsn.next { border-color: #c9a24a; box-shadow: 0 0 0 3px rgba(201,162,74,.35); }
.lsn em { font-style: normal; font-size: .72rem; font-weight: 700; color: #8a6a10; text-transform: uppercase; letter-spacing: .05em; }
.lsn small { font-weight: 400; color: #5a5148; font-size: .78rem; }
.lsn:focus-visible { outline: 3px solid var(--brand-ink); outline-offset: 2px; }
.certbox { background: #fbf3df; border: 2px dashed #c9a24a; border-radius: 14px; padding: 16px 18px; margin-top: 10px; }
.certbox h2 { margin-top: 0 !important; }
.lesson { position: absolute; inset: 14px; margin: auto; height: fit-content; max-height: calc(100% - 28px); max-width: 1060px; display: flex; flex-direction: column; gap: 10px; padding: 18px 28px; box-sizing: border-box; overflow: auto; color: var(--brand-ink); border-radius: 18px; outline: none;
  background-image: linear-gradient(#fbf7ef, #f3eadb); box-shadow: 0 12px 34px rgba(10,4,20,.5), inset 0 0 0 5px rgba(255,255,255,.4), inset 0 0 0 6.5px rgba(140,100,70,.22); border: 1px solid rgba(120,86,60,.25); }
.lhead { display: flex; justify-content: space-between; gap: 12px 18px; align-items: flex-start; flex-wrap: wrap; }
.lhead .eyebrow { margin: 0; font-size: .8rem; font-weight: 600; color: #5a5148; letter-spacing: .06em; }
.lhead h1 { margin: 2px 0 0; font-size: clamp(1.3rem, 2.4vw, 1.7rem); color: var(--brand-green); }
.lstats { display: flex; gap: 14px; align-items: center; font-weight: 600; font-variant-numeric: tabular-nums; color: #3b2a1c; }
.lprog { height: 6px; background: #e6dccb; border-radius: 99px; overflow: hidden; flex: none; }
.lprog span { display: block; height: 100%; width: 0; background: var(--brand-green); transition: width .2s; }
.lhint { margin: 0; color: #4a433c; font-size: .95rem; line-height: 1.55; }
.ltext { flex: none; background: #fffdf7; border: 2px solid #e2d6c2; border-radius: 14px; padding: 10px 20px; font: 500 clamp(19px, min(2.5vw, 3.5vh), 32px)/1.75 var(--body); letter-spacing: .04em; color: #2b2118; height: calc(3 * 1.75em); overflow: hidden; }
body.bigtext .ltext { font-size: clamp(22px, min(3vw, 4.2vh), 40px); }
.ltext .w { white-space: nowrap; }
.ltext .c { border-radius: 4px; }
.ltext .c.sp { display: inline-block; min-width: .42em; }
.ltext .c.ok { color: #2f7a5c; }
.ltext .c.slipped { color: #a8661c; text-decoration: underline dotted 2px; text-underline-offset: 5px; }
.ltext .c.cur { background: #fde9a8; box-shadow: inset 0 -3px 0 var(--brand-green); }
.ltext .c.miss { box-shadow: inset 0 -3px 0 #c98a12; animation: nudge .22s; }
@keyframes nudge { 30% { transform: translateX(-2px); } 70% { transform: translateX(2px); } }
.fingertip { margin: 0; text-align: center; font-weight: 600; color: #3b2a1c; min-height: 1.4em; }
.lcaps { margin: 0; text-align: center; color: #9b3b2f; font-weight: 600; }
.kb { display: flex; flex-direction: column; gap: 5px; max-width: 880px; width: 100%; margin: 0 auto; user-select: none; flex: none; }
.kbrow { display: flex; gap: 5px; }
.key { flex: 1 1 0; min-width: 0; height: clamp(26px, min(4.4vw, 5vh), 46px); background: var(--fc, #e8e1d4); border: 1.5px solid rgba(70,50,30,.35); border-bottom-width: 3px; border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; font: 600 clamp(11px, 1.3vw, 16px)/1.05 var(--body); color: #2b2118; position: relative; box-sizing: border-box; transition: transform .1s; }
.key small { font-size: .7em; opacity: .75; }
.key.special { background: #ebe5d9; color: #6a5d4c; font-size: clamp(9px, 1vw, 12px); }
.key.later { opacity: .32; }
.key.bump::after { content: ''; position: absolute; bottom: 5px; width: 10px; height: 2px; background: rgba(40,25,10,.6); border-radius: 2px; }
.key.next { background: var(--fs, #0f4c3a); color: #fff; border-color: #2b2118; box-shadow: 0 0 0 3px #fffdf7, 0 0 0 6px var(--fs, #0f4c3a); transform: translateY(-2px); opacity: 1; z-index: 1; }
.hands { max-width: 560px; width: 100%; margin: 0 auto; flex: none; }
.hands svg { width: 100%; height: auto; max-height: clamp(70px, 15vh, 150px); display: block; }
.hands .finger.lit rect:first-child { fill: var(--fsx); stroke: #2b2118; stroke-width: 3.5; }
.hands .hlabel { font: 600 17px Lexend, sans-serif; fill: #5a5148; }
@media (max-height: 760px) { .hands svg { max-height: 100px; } .lesson { gap: 8px; padding: 14px 22px; } }
@media (max-height: 640px) { .hands { display: none; } }
.newkeys { font-weight: 600; }
.certwrap { background: rgba(10,6,20,.6); pointer-events: auto !important; z-index: 36; }
.certpanel { display: grid; gap: 16px; justify-items: center; width: 100%; max-width: 900px; pointer-events: auto; }
.cert { width: min(860px, 92vw); aspect-ratio: 11 / 8.5; box-sizing: border-box; padding: 5% 8%; background: #fffaf0; border: 10px double #0f4c3a; outline: 2px solid #c9a24a; outline-offset: -24px; text-align: center; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: .6em; color: #2b2118; position: relative; font-family: var(--body); }
.cert .seal { width: clamp(44px, 8vw, 72px); height: auto; }
.cert h1 { font-size: clamp(1.5rem, 4vw, 2.6rem); color: #0f4c3a; margin: 0; }
.cert p { margin: 0; font-size: clamp(.8rem, 1.6vw, 1.1rem); line-height: 1.5; }
.certtop { letter-spacing: .3em; font-weight: 700; color: #8a6a10; }
.certname { font-size: clamp(1.4rem, 3.6vw, 2.3rem) !important; font-weight: 700; border-bottom: 2px solid #c9a24a; padding: 0 1em .1em; min-width: 50%; overflow-wrap: anywhere; }
.certfine { font-size: clamp(.62rem, 1.1vw, .8rem) !important; color: #6a5d4c; max-width: 46em; margin-top: .6em !important; }
.certctl { background: var(--brand-bg); color: var(--brand-ink); border-radius: 14px; padding: 16px 20px; display: grid; gap: 10px; width: min(560px, 92vw); box-sizing: border-box; }
.certctl label { font-weight: 600; }
.certctl input { font: 600 1rem var(--body); border: 2px solid #b9ab95; border-radius: 10px; padding: 6px 10px; min-height: 40px; }
.certctl p { margin: 0; }
@media print {
  @page { size: landscape; margin: 0; }   /* no browser header or footer (they can print the file's location) */
  html, body { background: #fff !important; height: auto; overflow: visible; }
  body * { visibility: hidden !important; }
  #certSheet, #certSheet * { visibility: visible !important; }
  #certSheet { position: fixed; inset: 10mm; width: auto; height: auto; aspect-ratio: auto; border-width: 8px; }
}
/* Spacing pass (Oct 31): more breathing room everywhere. These come last on purpose, so they win. */
.card { gap: 14px; padding: 26px 30px; }
.card p { line-height: 1.65; }
.card .home { padding: 12px 16px; }
.toggles { gap: 10px; }
.btnrow { gap: 14px; margin-top: 8px; }
.stats { gap: 8px; margin: 4px 0; }
.stats div { padding: 8px 14px; }
.tip { padding: 12px 16px; }
.startlv { gap: 12px; margin: 4px 0; }
.ctpanel { padding: 28px 32px 24px; }
.cthead { gap: 14px 18px; }
.tabs { gap: 8px; margin: 20px 0 18px; padding-bottom: 14px; }
.pane > *:first-child { margin-top: 0; }
.pane p { margin: 0 0 14px; line-height: 1.65; }
.pane h2 { margin: 26px 0 12px; }
.pane h3 { margin: 22px 0 10px; }
.pane .btnrow { margin: 18px 0 8px; }
.tiles { gap: 10px; margin-bottom: 8px; }
.tile { padding: 12px 14px; gap: 4px; }
table.nights th, table.nights td { padding: 8px 10px; }
ul.achs, ul.settings, ul.profiles { gap: 10px; margin: 12px 0 16px; }
.ach { padding: 12px 14px; gap: 14px; }
.settings li { padding: 12px 16px; gap: 16px; }
.settings li div { gap: 4px; }
.profiles li { padding: 10px 14px; gap: 12px; }
.pbtns { gap: 8px; }
.addbtn { margin-top: 2px; }
.danger-zone { margin-top: 28px; padding-top: 20px; border-top: 1px solid #e2d6c2; }
.ctprivacy { margin-top: 24px; padding-top: 14px; }
.credits { margin: 8px 0 0; font-size: .78rem; color: #5a5148; line-height: 1.5; }
.go.secondary { background: #fff; color: var(--brand-green); border: 2px solid var(--brand-green); }
.typebar { padding: 9px 22px; }
#typeWhat { margin-top: 2px; }
.whobadge { padding: 7px 16px; gap: 10px; }
/* Practice rooms and the bakery (Nov 1) */
#practice { position: fixed; inset: 0; pointer-events: none; }
#practice > * { pointer-events: auto; }
.shelfnum svg { display: block; }
.badge { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .04em; color: #8a6a10; background: #fbf3df; border: 1.5px solid #c9a24a; border-radius: 99px; padding: 1px 9px; margin-left: 6px; vertical-align: middle; }
.shelfsub { margin: 14px 0 0 !important; font-size: .82rem !important; letter-spacing: .06em; text-transform: uppercase; color: #6a5d4c !important; }
.lsn small.book { font-style: normal; color: #6a5d4c; }
.lsns.tests { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); margin-bottom: 14px; }
.lsns.tests .lk { width: auto; min-width: 20px; padding: 0 4px; border-radius: 10px; }
#bakery { position: fixed; inset: 0; pointer-events: none; }
#bakery > .overlay { pointer-events: none; }
#bakery .card { pointer-events: auto; }
.bkhud { position: absolute; top: 14px; left: 14px; right: 14px; display: flex; gap: 14px; align-items: center; pointer-events: none; font-weight: 600; color: var(--brand-ink); }
.bkhud > span { background: rgba(251,247,239,.92); border-radius: 99px; padding: 7px 16px; box-shadow: 0 2px 8px rgba(40,25,10,.18); }
.bkhud .bkday { background: var(--brand-green); color: #fbf7ef; letter-spacing: .04em; }
.bkhud .hudbtn { margin-left: auto; pointer-events: auto; color: var(--brand-green); background: rgba(251,247,239,.95); border: 2px solid var(--brand-green); box-shadow: 0 2px 8px rgba(40,25,10,.18); }
.bkhud .hudbtn:focus-visible { outline-color: var(--brand-ink); }
.achtoast.top { bottom: auto; top: 10px; }
.cert { width: min(860px, 92vw, calc((100vh - 200px) * 1.294)); }
.certctl input { background: #fff; color: var(--brand-ink); border: 2px solid #c9bba6; border-radius: 10px; padding: 8px 12px; font: 600 1rem var(--body); }
.certctl input:focus-visible { outline: 3px solid var(--brand-green); outline-offset: 1px; }
#bkBubbles { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.bkbub { position: absolute; transform: translate(-50%, -100%); max-width: min(300px, 30vw); background: #fffdf7; color: #2b2118; border: 2px solid #d8ccb7; border-radius: 16px; padding: 9px 14px; font: 500 clamp(13px, 1.25vw, 16px)/1.4 var(--body); box-shadow: 0 6px 16px rgba(40,25,10,.18); text-align: center; }
.bkbub::after { content: ''; position: absolute; left: 50%; bottom: -9px; width: 14px; height: 14px; background: #fffdf7; border-right: 2px solid #d8ccb7; border-bottom: 2px solid #d8ccb7; transform: translateX(-50%) rotate(45deg); }
.bkbub.ordering { border-color: var(--brand-green); box-shadow: 0 0 0 3px rgba(15,76,58,.18), 0 6px 16px rgba(40,25,10,.18); font-weight: 600; }
.bkbar { position: absolute; left: 14px; right: 14px; bottom: 14px; display: flex; gap: 14px; align-items: stretch; pointer-events: none; }
.bkbar > * { pointer-events: auto; }
.bktickets { list-style: none; margin: 0; padding: 0; width: min(270px, 26vw); display: grid; gap: 8px; align-content: end; }
.bktickets li { background: #fffaf0; border: 1.5px solid #d8ccb7; border-left: 5px solid #c9a24a; border-radius: 10px; padding: 7px 11px; display: grid; gap: 1px; font-size: .86rem; color: #3b2a1c; box-shadow: 0 3px 10px rgba(40,25,10,.18); }
.bktickets li strong { color: var(--brand-green); }
.bktickets .dots { display: flex; gap: 4px; margin: 3px 0 1px; }
.bktickets .dots i { width: 9px; height: 9px; border-radius: 50%; background: #e6dccb; }
.bktickets .dots i.on { background: var(--brand-green); }
.bktickets small { color: #5a5148; }
.bktickets small.oven { color: #a8521c; font-weight: 600; }
.bktype { flex: 1; min-width: 0; background: linear-gradient(#fbf7ef, #f3eadb); border-radius: 16px; padding: 12px 22px 14px; box-shadow: 0 10px 28px rgba(10,4,20,.4), inset 0 0 0 5px rgba(255,255,255,.4); border: 1px solid rgba(120,86,60,.25); outline: none; }
.bkwhat { margin: 0 0 4px; font-size: .86rem; font-weight: 600; letter-spacing: .04em; color: #5a5148; min-height: 1.3em; }
.bkline { font: 500 clamp(19px, min(2.3vw, 3.6vh), 30px)/1.6 var(--body); letter-spacing: .03em; color: #2b2118; min-height: 1.6em; }
body.bigtext .bkline { font-size: clamp(22px, min(2.8vw, 4.2vh), 38px); }
.bkline .w { white-space: nowrap; }
.bkline .c { border-radius: 4px; }
.bkline .c.sp { display: inline-block; min-width: .42em; }
.bkline .c.ok { color: #2f7a5c; }
.bkline .c.slipped { color: #a8661c; text-decoration: underline dotted 2px; text-underline-offset: 5px; }
.bkline .c.cur { background: #fde9a8; box-shadow: inset 0 -3px 0 var(--brand-green); }
.bkline .c.miss { box-shadow: inset 0 -3px 0 #c98a12; animation: nudge .22s; }
.bkidle { color: #8a7c66; font-size: .8em; }
.bknews { width: 100%; text-align: left; background: #fbf3df; border-radius: 12px; padding: 10px 16px; box-sizing: border-box; }
.bknews h2 { margin: 0 0 6px; font-size: 1rem; color: var(--brand-green); }
.bknews ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: .95rem; line-height: 1.5; }
.card .credit { color: #6a5d4c; font-size: .8rem; }
@media (max-width: 760px) { .bktickets { display: none !important; } }
.othertab { z-index: 60; pointer-events: auto; background: rgba(10,6,20,.6); }
.devnote { position: absolute; bottom: max(78px, calc(env(safe-area-inset-bottom) + 70px)); left: 50%; transform: translateX(-50%); width: min(560px, calc(100% - 32px)); box-sizing: border-box; margin: 0; background: #fbf3df; color: var(--brand-ink); border: 2px solid #c9a24a; border-radius: 14px; padding: 10px 16px; font-weight: 600; line-height: 1.5; text-align: center; box-shadow: 0 6px 18px rgba(10,4,20,.35); z-index: 3; }
#well { position: fixed; inset: 0; pointer-events: none; }
#well > .ctpanel { pointer-events: auto; }
.wellplay .card { pointer-events: auto; max-width: 52ch; }
.wellcard input { font: 600 clamp(24px, 3.4vw, 36px) var(--body); letter-spacing: .12em; text-align: center; width: min(420px, 80vw); padding: 10px 14px; border: 2px solid #c9bba6; border-radius: 14px; background: #fffdf7; color: var(--brand-ink); }
.wellcard input:focus-visible { outline: 3px solid var(--brand-green); outline-offset: 2px; }
.wellmsg { min-height: 1.6em; font-weight: 600; color: #3b2a1c; }
.wellmsg.fix { color: #8a5a10; }
.wellcard kbd { margin-left: 6px; }
#wellCard { display: grid; gap: 10px; justify-items: center; border-top: 1px solid #e2d6c2; padding-top: 12px; width: 100%; }
#wellCard h1 { font-size: 1.5rem; }
.wellgo { margin-left: auto; min-height: 40px; padding: 6px 16px; font-size: .95rem; }
.wellgo:disabled { opacity: .55; }
@media (max-height: 560px) { .bkbar { bottom: 8px; } .bktype { padding: 8px 14px; } }
/* Accessibility and polish pass (Nov 1) */
.overlay { align-items: center; align-items: safe center; justify-items: center; }
#lessonCard { background: rgba(28,18,8,.38); }
.lcbody, .bkbody, .wellbody { display: grid; gap: 14px; justify-items: center; width: 100%; }
.lcbody > *, .bkbody > *, .wellbody > * { margin: 0; }
.ltext .c.nl { color: #7a6a54; }
.bkidle { color: #6a5d4c; }
.place.dim { opacity: .72; }
.hands .hlabel { font: 600 26px Lexend, sans-serif; }
body.bigtext .ltext { font-size: clamp(26px, min(3.4vw, 4.8vh), 46px); }
body.bigtext .bkline { font-size: clamp(26px, min(3.3vw, 4.8vh), 44px); }
.esc { font-size: .72em; font-weight: 700; letter-spacing: .04em; border: 1.5px solid currentColor; border-radius: 5px; padding: 0 4px; margin-left: 4px; opacity: .85; }
body.calm .go.breathe, body.calm .caret, body.calm .c.miss, body.calm .typebar.bump, body.calm .achtoast { animation: none !important; }
body.calm .achtoast { transition: opacity .2s; }
@media (prefers-reduced-motion: reduce) { .go.breathe, .caret, .c.miss, .typebar.bump { animation: none !important; } .achtoast { transition: opacity .2s; } }
.tabs { flex-wrap: nowrap; }
.tabs [role="tab"] { flex: 1 1 auto; padding: 6px 9px; font-size: .86rem; }
@media (max-width: 600px) { .tabs { flex-wrap: wrap; } }
.mod h3 { margin: 0 !important; font-size: 1.05rem; color: var(--brand-ink); }
.mod h4.shelfsub { margin: 14px 0 0 !important; font-size: .82rem !important; letter-spacing: .06em; text-transform: uppercase; color: #6a5d4c !important; }
.bkbar { left: max(14px, calc(50% - 720px)); right: max(14px, calc(50% - 720px)); }
.wellcard.done > :not(#wellCard):not(.eyebrow) { display: none !important; }
#wellCard h2 { margin: 0; font-size: 1.5rem; color: var(--brand-green); }
.ltext .c.sp, .bkline .c.sp { white-space: pre; }   /* a space keeps its height, so the cursor shows there too */
@media (max-height: 800px) {   /* shorter screens (many laptops and Chromebooks): tighter cards so the buttons fit */
  .card { padding: 16px 24px; gap: 9px; }
  .card h1 { font-size: clamp(1.4rem, 3.4vw, 1.9rem); }
  .card p { font-size: .96rem; line-height: 1.5; }
  .card .home { padding: 8px 12px; }
  .toggles { gap: 6px; }
  .toggle { min-height: 34px; padding: 4px 11px; font-size: .86rem; }
  .btnrow { margin-top: 2px; gap: 10px; }
}
.quietnote { margin: 10px 0 0; font-size: .9rem; color: #3b2a1c; background: #e3efe9; border-radius: 10px; padding: 8px 12px; }
