@font-face{font-family:Marcellus;src:url('../../assets/fonts/marcellus.woff2') format('woff2');font-display:swap}
:root{color-scheme:light;--ink:#302c20;--muted:#665f47;--paper:#f5ead2;--line:#caba90;--accent:#425536;--heart:#b6503c;font-family:system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;color:var(--ink);background:#FFFFEC}
*{box-sizing:border-box}body{margin:0;min-height:100svh;padding:22px 24px 12px;isolation:isolate}.scene{position:fixed;inset:0;z-index:-2;background:#FFFFEC url('../../assets/handmade-paper.svg') 0 0/480px 480px repeat}

.page-header{text-align:center;color:#fff4d8;text-shadow:0 2px 3px #152012;margin:0 auto 20px}.eyebrow{font-size:12px;letter-spacing:.17em;text-transform:uppercase;margin:0 0 8px}.eyebrow span{margin:0 7px;color:#dcb773}h1{font:400 clamp(28px,3.7vw,46px)/1.16 Marcellus,Georgia,serif;margin:0}.coming-soon{font-size:13px;letter-spacing:.04em;margin:8px 0 0;color:#f1e2ba}#game{max-width:1010px;margin:auto}.page-footer{text-align:center;font-size:12px;color:#fff0cc;margin:18px auto 0;text-shadow:0 1px 2px #192019}.page-footer span{color:#efac82;margin-left:6px}.loading{text-align:center;color:var(--paper)}
.lab{--lab-ink:var(--ink);--lab-muted:var(--muted);--lab-paper:var(--paper);--lab-accent:var(--accent);--lab-line:var(--line);--lab-heart:var(--heart);--lab-serif:Marcellus,Georgia,serif;display:grid;grid-template-columns:minmax(0,1fr) 252px;gap:20px;align-items:start;width:100%}.lab [hidden]{display:none!important}.lab-main{min-width:0;background:#f5ead2f5;border:2px solid #ad8c57;outline:5px solid #443224;box-shadow:0 8px 0 #2d251dc0,0 18px 40px #0d190944;padding:20px}.lab h2,.lab h3{font-family:var(--lab-serif);font-weight:400;margin:0}.lab[data-phase=name]{grid-template-columns:1fr;max-width:570px;margin:30px auto 70px}.lab[data-phase=name] .lab-aside{display:none}.lab[data-phase=name] .lab-main{padding:32px}.lab-name{display:flex;flex-direction:column;gap:20px;text-align:center;margin:0}.lab-name label{font:400 23px/1.4 var(--lab-serif);max-width:400px;align-self:center}.lab-name label em{font-style:normal;color:#455a36}.lab-row{display:flex;gap:10px;justify-content:center;flex-wrap:wrap}.lab-name input{font:inherit;font-size:16px;min-width:0;flex:1 1 170px;max-width:280px;padding:13px 14px;background:#fff8e9;border:2px solid #ae9768;border-radius:0;color:var(--ink)}.lab-name input:focus{outline:2px solid var(--accent);outline-offset:3px}.lab-btn{font:600 14px/1.3 system-ui,sans-serif;color:#fff5dc;background:var(--accent);border:2px solid #293b24;box-shadow:0 3px 0 #25301d;padding:12px 20px;cursor:pointer;border-radius:0}.lab-btn:hover{background:#536b42}.lab-btn:active{transform:translateY(2px);box-shadow:0 1px 0 #25301d}button:focus-visible{outline:3px solid #bd633b;outline-offset:3px}.lab-btn-quiet{font-size:12px;font-weight:400;border:0;box-shadow:none;padding:5px 4px;background:none;color:var(--muted);text-decoration:underline;text-underline-offset:3px}.lab-btn-quiet:hover{background:none;color:var(--ink)}.lab-help{font-size:14px;line-height:1.55;color:var(--muted);margin:0;text-align:center}.lab-name .lab-help{max-width:385px;align-self:center}
.lab-portraits{display:flex;align-items:center;justify-content:center;gap:24px;margin:0 0 24px}.lab-portrait{margin:0;text-align:center}.lab-portrait img{width:104px;height:104px;object-fit:cover;image-rendering:pixelated;border:3px solid #e1d2aa;outline:1px solid #9e8151;display:block;background:#f5ead2}.lab-portrait figcaption{font:16px var(--lab-serif);margin-top:7px}.lab-between{color:var(--heart);font-size:23px}.lab:is([data-phase=playing],[data-phase=name]) .lab-portraits{gap:18px;margin-bottom:14px}.lab:is([data-phase=playing],[data-phase=name]) .lab-portrait img{width:56px;height:56px}.lab:is([data-phase=playing],[data-phase=name]) .lab-portrait{display:flex;align-items:center;gap:10px}.lab:is([data-phase=playing],[data-phase=name]) .lab-portrait figcaption{margin:0;font-size:15px}.lab:is([data-phase=playing],[data-phase=name]) .lab-between{font-size:18px}
.lab-play{display:flex;flex-direction:column;align-items:center;gap:12px}.lab-hud{display:flex;gap:10px;align-items:center;justify-content:center;flex-wrap:wrap;width:100%;padding:10px 0 12px;border-top:1px solid #cdbd94}.lab-stat{margin:0;min-width:72px;text-align:center}.lab-stat dt{font-size:12px;color:var(--muted);margin-bottom:2px}.lab-stat dd{font:26px/1.1 var(--lab-serif);margin:0;font-variant-numeric:tabular-nums}.lab-stat.lab-urgent dd{color:var(--heart)}.lab-stage{position:relative;width:100%;display:flex;justify-content:center}.lab canvas{display:block;background:#f1e4bf;image-rendering:pixelated;touch-action:none;user-select:none;-webkit-user-select:none;border:0;outline:3px solid #8a7149;box-shadow:0 5px 0 #665334}.lab-status{font-size:13px;line-height:1.45;min-height:19px;color:var(--muted);text-align:center;margin:4px 0 0}.lab-dpad{display:grid;grid-template-columns:repeat(3,44px);grid-template-rows:repeat(2,44px);gap:5px;touch-action:none;user-select:none}.lab-dpad button{width:44px;height:44px;display:grid;place-items:center;background:#e4d6ad;color:#35472d;border:2px solid #a08b59;box-shadow:0 2px 0 #a08b59;border-radius:0;cursor:pointer;touch-action:none}.lab-dpad button:active,.lab-dpad .lab-held{background:var(--accent);color:var(--paper);box-shadow:none;transform:translateY(2px)}.lab-dpad svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linejoin:miter;stroke-linecap:square}.lab-up{grid-area:1/2}.lab-left{grid-area:2/1}.lab-down{grid-area:2/2}.lab-right{grid-area:2/3}.lab-mid{display:none}
.lab-aside{background:#f5ead2f5;border:2px solid #ad8c57;outline:5px solid #443224;box-shadow:0 8px 0 #2d251dc0,0 18px 40px #0d190933;padding:21px 16px}.lab-aside h2{font-size:23px;margin-bottom:14px}.lab-aside table{width:100%;border-collapse:collapse;font-size:14px;font-variant-numeric:tabular-nums}.lab-aside th{font-size:12px;text-align:left;font-weight:500;color:var(--muted);padding:5px 3px;border-bottom:1px solid var(--line)}.lab-aside td{padding:8px 3px;border-bottom:1px solid var(--line)}.lab-name-cell{max-width:78px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.lab-num{text-align:right!important}.lab-aside svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.6}.lab-me{color:#455b34;font-weight:600}.lab-empty{font-size:14px;line-height:1.6;color:var(--muted)}.lab-note{font-size:12px;line-height:1.5;color:var(--muted);margin:14px 0 0}.lab-error{color:#9d3526;font-size:16px;line-height:1.5}
.lab-overlay{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;pointer-events:none;background:#f8edc9c9;gap:12px}.lab-overlay svg{width:38%;height:38%;max-width:170px;max-height:170px;color:var(--heart);filter:drop-shadow(0 4px 0 #81402a33)}.lab-overlay p{font:24px var(--lab-serif);margin:0;color:var(--ink);text-align:center}.lab-won svg{animation:lab-pop .6s steps(5,end) both}.lab-lost svg #left{animation:lab-split-l .7s steps(5,end) both;transform-origin:center}.lab-lost svg #right{animation:lab-split-r .7s steps(5,end) both;transform-origin:center}@keyframes lab-pop{from{transform:scale(.6)}60%{transform:scale(1.15)}to{transform:scale(1)}}@keyframes lab-split-l{to{transform:translate(-7px,4px);opacity:.65}}@keyframes lab-split-r{to{transform:translate(7px,4px);opacity:.65}}@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation:none!important;scroll-behavior:auto!important}}
@media(max-width:760px){body{padding:20px 14px 14px}.lab{grid-template-columns:minmax(0,1fr);gap:24px;max-width:580px;margin:auto}.lab-main{padding:16px 10px}.lab-aside{padding:18px}.lab-aside table{font-size:14px}.lab-name-cell{max-width:170px}.page-header{margin-bottom:20px}.lab[data-phase=name]{margin:35px auto 80px}.lab[data-phase=name] .lab-main{padding:24px 18px}.lab:is([data-phase=playing],[data-phase=name]) .lab-portrait{gap:7px}.lab:is([data-phase=playing],[data-phase=name]) .lab-portrait img{width:44px;height:44px}.lab:is([data-phase=playing],[data-phase=name]) .lab-portraits{gap:13px}.lab-hud{gap:7px}.lab-stat{min-width:61px}.lab-hud .lab-btn-quiet{font-size:12px}.lab-play>.lab-help{font-size:12px;max-width:310px}.lab-dpad{grid-template-columns:repeat(3,48px);grid-template-rows:repeat(2,48px)}.lab-dpad button{width:48px;height:48px}.scene{background-position:48% center}.coming-soon{font-size:12px}.lab-portrait img{width:88px;height:88px}.lab-name label{font-size:21px}}
@media(max-width:360px){body{padding-left:10px;padding-right:10px}.lab-main{padding-left:7px;padding-right:7px}.lab:is([data-phase=playing],[data-phase=name]) .lab-portrait figcaption{font-size:13px}.lab:is([data-phase=playing],[data-phase=name]) .lab-portraits{gap:9px}.lab-stat{min-width:53px}.lab-hud{gap:5px}.lab[data-phase=name] .lab-main{padding:22px 15px}}
@media(max-height:650px) and (min-width:761px){body{padding-top:12px}.page-header{margin-bottom:14px}h1{font-size:30px}.lab-main{padding:14px}.lab:is([data-phase=playing],[data-phase=name]) .lab-portraits{display:none}.lab-hud{padding-top:0;border-top:0}.lab-play{gap:9px}}

/* The playable scene: a wooden maze on the tea table, with the controls beside it. */
#game{max-width:1480px}.lab{grid-template-columns:minmax(0,1fr) 236px;gap:20px}.lab[data-phase=name]{max-width:570px}.lab-sidebar{min-width:0}.lab[data-phase=name] .lab-sidebar{display:none}.lab:is([data-phase=playing],[data-phase=name]) .lab-main{padding:0;border:0;outline:none;background:none;box-shadow:none}.lab:is([data-phase=playing],[data-phase=name]) .lab-sidebar{padding:18px 14px;background:#f5ead2f2;border:2px solid #ad8c57;outline:4px solid #443224;box-shadow:0 7px 0 #2d251d90}.lab:is([data-phase=playing],[data-phase=name]) .lab-portraits{display:flex;gap:10px;margin-bottom:18px}.lab:is([data-phase=playing],[data-phase=name]) .lab-portrait{display:block}.lab:is([data-phase=playing],[data-phase=name]) .lab-portrait img{width:70px;height:70px}.lab:is([data-phase=playing],[data-phase=name]) .lab-portrait figcaption{margin-top:6px;font-size:14px}.lab:is([data-phase=playing],[data-phase=name]) .lab-hud{padding:14px 0;margin:0 0 14px;gap:4px;border-bottom:1px solid #cdbd94}.lab-hud .lab-btn-quiet{flex-basis:100%;margin-top:8px}.lab-aside{background:none;outline:0;box-shadow:none;border:0;padding:0}.lab-aside h2{font-size:21px;line-height:1.3}.lab-play{gap:0}.lab-stage{overflow:hidden;background:#33291c;outline:3px solid #553b25;box-shadow:0 9px 28px #111b1955}.lab canvas{outline:none;box-shadow:none;background:none;max-width:100%;image-rendering:pixelated}.lab canvas:focus-visible{outline:2px solid #e8ba73;outline-offset:-3px}.lab-controls{color:#f6e7c7;background:#302819eb;padding:12px 16px 15px;width:100%;display:grid;grid-template-columns:1fr auto;column-gap:20px;row-gap:7px;align-items:center;min-width:0}.lab-controls .lab-status{grid-column:1;grid-row:1;color:#eddfc1;text-align:left;font-size:14px;line-height:1.5;min-height:21px;margin:0}.lab-viewbar{grid-column:1;grid-row:2;display:flex;gap:7px;flex-wrap:wrap;align-items:center}.lab-view-btn{font:14px system-ui,sans-serif;cursor:pointer;padding:8px 11px;background:#4a3b28;color:#f5e2ba;border:1px solid #947752;min-height:40px}.lab-view-btn[aria-pressed=true]{background:#e4c28c;color:#302619;border-color:#e4c28c}.lab-view-help{font-size:12px;color:#e2cda8}.lab-controls .lab-dpad{grid-column:2;grid-row:1/4}.lab-controls>.lab-help{grid-column:1;grid-row:3;color:#d8c29b;text-align:left;font-size:12px;max-width:none}.lab-overlay{background:#2d21168c;color:#fff3d8}.lab-overlay p{color:#fff1d7;text-shadow:0 2px #4b2b1a}.lab-overlay svg{color:#df8262;filter:drop-shadow(0 3px #683d28)}.page-header{margin-bottom:24px}.page-footer{margin-top:18px}
@media(max-width:1000px){.lab{grid-template-columns:minmax(0,1fr)}.lab:is([data-phase=playing],[data-phase=name]) .lab-sidebar{display:grid;grid-template-columns:1fr 1fr;gap:10px 20px;outline-width:3px;padding:16px}.lab:is([data-phase=playing],[data-phase=name]) .lab-portraits{margin:0;align-self:center}.lab:is([data-phase=playing],[data-phase=name]) .lab-hud{margin:0;border:0;padding:0}.lab-aside{grid-column:1/-1;border-top:1px solid #cdbd94;padding-top:15px}.lab-aside h2{font-size:20px}.lab-name-cell{max-width:160px}}
@media(max-width:760px){body{padding-top:16px}.page-header{margin-bottom:18px}.lab{max-width:none;gap:18px}.lab-main{padding:0}.lab-controls{padding:10px;gap:8px;grid-template-columns:1fr auto}.lab-controls .lab-status{font-size:12px}.lab-viewbar{gap:5px}.lab-view-btn{padding:7px 8px;font-size:12px}.lab-view-help{display:none}.lab-controls .lab-dpad{grid-template-columns:repeat(3,44px);grid-template-rows:repeat(2,44px);gap:4px}.lab-controls .lab-dpad button{width:44px;height:44px}.lab-controls>.lab-help{grid-column:1/-1;font-size:12px;line-height:1.4;margin-top:5px}.lab-controls .lab-dpad{grid-row:1/3}.lab:is([data-phase=playing],[data-phase=name]) .lab-portrait img{width:48px;height:48px}.lab:is([data-phase=playing],[data-phase=name]) .lab-portrait figcaption{font-size:12px}.lab:is([data-phase=playing],[data-phase=name]) .lab-portraits{gap:8px}.lab:is([data-phase=playing],[data-phase=name]) .lab-sidebar{gap:10px;padding:12px}.lab:is([data-phase=playing],[data-phase=name]) .lab-stat{min-width:38px;flex:1}.lab-stat dd{font-size:23px}.lab-stat dt{font-size:12px}.lab-hud .lab-btn-quiet{font-size:12px}.lab[data-phase=name] .lab-main{padding:24px 18px}.lab[data-phase=name]{margin-top:30px}}
.lab:is([data-phase=playing],[data-phase=name]) .lab-hud{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));width:100%}.lab:is([data-phase=playing],[data-phase=name]) .lab-stat{min-width:0}.lab:is([data-phase=playing],[data-phase=name]) .lab-hud .lab-btn-quiet{grid-column:1/-1}.lab:is([data-phase=playing],[data-phase=name]) .lab-portrait img{width:68px;height:68px}@media(max-width:760px){.lab:is([data-phase=playing],[data-phase=name]) .lab-portrait img{width:48px;height:48px}}
.lab:is([data-phase=playing],[data-phase=name]) .lab-play>.lab-hud{grid-template-columns:repeat(3,minmax(0,1fr)) auto;background:#f5ead2;border:1px solid #a98a57;padding:10px;margin:0 0 12px;gap:6px}.lab:is([data-phase=playing],[data-phase=name]) .lab-play>.lab-hud .lab-btn-quiet{grid-column:auto;margin:0;max-width:78px;line-height:1.5}.lab:is([data-phase=playing],[data-phase=name]) .lab-play>.lab-hud dd{font-size:23px}@media(max-width:1000px){.lab:is([data-phase=playing],[data-phase=name]) .lab-sidebar{display:block}.lab:is([data-phase=playing],[data-phase=name]) .lab-sidebar .lab-portraits{margin:0 0 16px}}

/* Phone gameplay owns one-finger swipes across the entire page. Pinch zoom
   remains available; ordinary scrolling returns on the name screen. */
body:has(.lab[data-device=touch][data-phase=playing]):not(:has(dialog[open])){touch-action:pinch-zoom;overscroll-behavior:none}
.lab[data-device=touch] .lab-controls .lab-dpad{display:none}
.lab[data-device=touch] .lab-controls{grid-template-columns:1fr}
.lab[data-device=touch] .lab-controls>.lab-help{grid-column:1}

.lab-scores-button{display:none}.lab[data-device=touch] .lab-scores-button{display:block}
.lab-scores-panel{color:var(--ink);background:#f5ead2;border:3px solid #80532d;max-width:min(420px,92vw);width:92vw;max-height:85svh;overflow:auto;padding:20px;touch-action:pan-y pinch-zoom}
.lab-scores-panel::backdrop{background:#122016aa}.lab-scores-panel>.lab-btn{margin-bottom:20px}.lab-scores-panel .lab-aside{border:0;padding:0}

/* Shared wedding navigation stays visible without changing the game scene. */
body.game-page { padding: 0; }
.game-content { padding: 22px 24px 12px; }
.page-header .eyebrow a { color: inherit; text-decoration: none; }
.page-header .eyebrow a:hover { text-decoration: underline; }
@media (max-width: 760px) {
  .game-content { padding: 16px 14px 14px; }
  body:has(.lab:is([data-phase=playing],[data-phase=name])) .page-header { display: none; }
}
@media (max-width: 360px) { .game-content { padding-left: 10px; padding-right: 10px; } }
@media (max-height: 650px) and (min-width: 761px) { .game-content { padding-top: 12px; } }

/* One paper surround in every phase; the tea-house artwork belongs to the game. */
body.game-page { background: #FFFFEC url('../../assets/handmade-paper.svg') 0 0/480px 480px; }
.page-header, .page-footer { color: var(--ink); text-shadow: none; }
.loading { color: var(--muted); }
.lab[data-phase=name] {
  max-width: 1000px; min-height: 590px; padding: 32px; margin: 0 auto;
  align-items: center; justify-items: center;
  background: url('assets/yaoyue-foliage.png') center/cover no-repeat;
}
.lab[data-phase=name] .lab-main { width: min(100%, 510px); }
.lab-stage { background: #FFFFEC url('../../assets/handmade-paper.svg') 0 0/480px 480px; }

/* Compact screens use the full viewport below the wedding menu. The stage
   receives all space left after the timer and compact controls, in either view. */
@media (max-width: 1000px) {
  .game-content { padding: 0; }
  .game-content > .page-header, .game-content > .page-footer { display: none; }
  #game { width: 100%; }
  .lab[data-phase=name] {
    min-height: calc(100svh - var(--header-height));
    min-height: calc(100dvh - var(--header-height));
    padding: 24px 20px; margin: 0;
  }
  .lab:is([data-phase=playing],[data-phase=name]) {
    height: calc(100svh - var(--header-height));
    height: calc(100dvh - var(--header-height));
    display: block; margin: 0;
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  }
  .lab:is([data-phase=playing],[data-phase=name]) .lab-main { height: 100%; min-height: 0; }
  .lab:is([data-phase=playing],[data-phase=name]) .lab-sidebar { display: none; }
  .lab:is([data-phase=playing],[data-phase=name]) .lab-play {
    display: grid; height: 100%; min-height: 0;
    grid-template-rows: auto minmax(0,1fr);
  }
  .lab:is([data-phase=playing],[data-phase=name]) .lab-play > .lab-hud {
    margin: 0; padding: 7px 10px; border: 0; border-bottom: 1px solid var(--line);
    background: #FFFFEC url('../../assets/handmade-paper.svg') 0 0/480px 480px;
  }
  .lab:is([data-phase=playing],[data-phase=name]) .lab-stage { height: 100%; min-height: 0; outline: none; box-shadow: none; }
  .lab:is([data-phase=playing],[data-phase=name]) canvas { position: absolute; inset: 0; }
  .lab:is([data-phase=playing],[data-phase=name]) .lab-controls {
    padding: 5px 10px 7px; gap: 4px; grid-template-columns: 1fr;
    background: #FFFFEC url('../../assets/handmade-paper.svg') 0 0/480px 480px;
    color: var(--ink); border-top: 0; border-bottom: 1px solid var(--line);
  }
  .lab-controls .lab-status { color: var(--muted); font-size: 12px; line-height: 1.35; min-height: 17px; }
  .lab-controls .lab-status:empty { display: block; }
  .lab-controls > .lab-help, .lab-controls .lab-dpad, .lab-view-help { display: none; }
  .lab-viewbar { grid-row: auto; flex-wrap: nowrap; }
  .lab-view-btn { min-height: 44px; padding: 7px 10px; font-size: 12px; }
  .lab-scores-button { display: block; margin-left: auto; }
}

/* Feedback floats over the scene only while needed; statistics sit above it. */
.lab-stage > .lab-status {
  position: absolute; z-index: 2; top: 6px; left: 8px; right: 8px;
  margin: 0; padding: 4px 7px; min-height: 0;
  font-size: 12px; line-height: 1.35; text-align: center;
  background: #FFFFECed; color: var(--muted); pointer-events: none;
}
.lab-stage > .lab-status:empty { display: none; }

/* Name entry is a panel over the real scene, not a separately zoomed wallpaper. */
#game .lab[data-phase=name] { max-width: none; min-height: 0; margin: 0; padding: 0; background: none; align-items: start; justify-items: stretch; grid-template-columns: minmax(0,1fr) 236px; }
#game .lab[data-phase=name] .lab-main { width: 100%; padding: 0; background: none; border: 0; outline: none; box-shadow: none; }
#game .lab[data-phase=name] .lab-sidebar { display: block; visibility: hidden; }
.lab[data-phase=name] .lab-hud, .lab[data-phase=name] .lab-controls { visibility: hidden; }
.lab[data-phase=name] .lab-stage > .lab-status { display: none; }
.lab-intro { position: absolute; z-index: 4; top: 50%; left: 50%; transform: translate(-50%,-50%); width: min(510px,calc(100% - 32px)); max-height: calc(100% - 24px); overflow: auto; touch-action: pan-y pinch-zoom; padding: 24px 18px; background: transparent; border: 0; outline: none; }
.lab[data-phase=name] .lab-intro .lab-portraits { display: flex; margin: 0 0 20px; gap: 24px; }
.lab[data-phase=name] .lab-intro .lab-portrait img { width: 72px; height: 72px; }
.lab[data-phase=name] .lab-intro .lab-portrait { display: block; }
@media(max-width:1000px){
 #game .lab[data-phase=name] { display: block; }
 #game .lab[data-phase=name] .lab-sidebar { display: none; }
 .lab-intro .lab-name label { font-size: 19px; }
 .lab-intro .lab-name { gap: 14px; }
 .lab-intro .lab-help { font-size: 12px; }
}



/* A single compact strip above the maze keeps statistics beside the site menu. */
.lab:is([data-phase=playing],[data-phase=name]) .lab-controls {
  display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center;
  padding: 5px 10px 7px; gap: 10px;
  background: #FFFFEC url('../../assets/handmade-paper.svg') 0 0/480px 480px;
  color: var(--ink); border-top: 0; border-bottom: 1px solid var(--line);
}
.lab:is([data-phase=playing],[data-phase=name]) .lab-controls > .lab-hud {
  grid-column: 1; grid-row: 1; margin: 0; padding: 0; border: 0; gap: 8px;
  grid-template-columns: repeat(3,minmax(0,1fr));
}
.lab-controls .lab-stat dt { font-size: 11px; margin-bottom: 1px; }
.lab-controls .lab-stat dd { font-size: 23px; }
.lab-controls > .lab-scores-button { grid-column: 2; grid-row: 1; margin: 0; min-height: 44px; }
.lab-controls > .lab-dpad { display: none; }

/* Full-body bobbleheads share the game's atlas; keep these canvases independent
   of the full-screen scene canvas, especially on phones. */
.lab .lab-portrait canvas.lab-bobblehead { position: static; inset: auto; display: block; width: 84px; height: 95px; max-width: none; margin: 0 auto; background: transparent; border: 0; outline: none; box-shadow: none; touch-action: auto; }
.lab[data-phase=name] .lab-intro .lab-portrait canvas.lab-bobblehead { width: 89.6px; height: 100.8px; }
.lab:lang(zh) .lab-name, .lab:lang(zh) .lab-portrait { --lab-serif: var(--chinese, 'Iansui', serif); font-family: var(--chinese, 'Iansui', serif); }
.lab:lang(zh) .lab-name button, .game-page:lang(zh) .page-header, .game-page:lang(zh) .page-header h1, .game-page:lang(zh) .page-footer { font-family: var(--chinese, 'Iansui', serif); }
@media(max-width:360px), (max-height:500px) {
 .lab[data-phase=name] .lab-intro .lab-portrait canvas.lab-bobblehead { width: 67.2px; height: 76px; }
 .lab[data-phase=name] .lab-intro .lab-portraits { margin-bottom: 12px; }
}
@media(max-height:500px) {
 .lab-intro { padding: 12px 18px; }
 .lab[data-phase=name] .lab-intro .lab-portrait canvas.lab-bobblehead { width: 48px; height: 54.4px; }
 .lab[data-phase=name] .lab-intro .lab-portraits { margin-bottom: 8px; }
 .lab-intro .lab-name { gap: 10px; }
}

/* Let the garden show through; only lettering gets a soft pale edge. */
.lab-intro .lab-name label, .lab-intro .lab-portrait figcaption {
  color: #272b20;
  text-shadow: 0 0 3px #ffffec, 0 0 7px #ffffec, 1px 1px 1px #ffffec, -1px -1px 1px #ffffec;
}
.lab-intro .lab-between { text-shadow: 0 0 5px #ffffec; }
.lab-greeting { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; pointer-events: none; }
.lab .lab-greeting canvas { position: absolute; inset: 0; width: 100%; height: 100%; max-height: none; background: transparent; outline: none; box-shadow: none; }

/* Only wide desktop windows cap the scene width by its usable height.
   Keep overlays and the statistics aligned with the centered artwork. */
@media (min-width: 1001px) {
  .lab:is([data-phase=playing],[data-phase=name]) .lab-stage,
  .lab:is([data-phase=playing],[data-phase=name]) .lab-controls {
    width: var(--desktop-scene-width, 100%); max-width: 100%;
  }
}

/* A compact desktop wedding heading leaves the height for the maze. */
.page-header { margin: 0 auto 12px; }
.page-header h1 { font: 400 18px/1.3 Palatino, "Palatino Linotype", Georgia, serif; }
.page-header a { color: inherit; text-decoration: none; }
.page-header a:hover { text-decoration: underline; }
.lab-note:empty { display: none; }
.lab:lang(zh) { --lab-serif: "Iansui", serif; font-family: "Iansui", serif; }
.lab:lang(zh) button, .lab:lang(zh) input { font-family: "Iansui", serif; }
@media(min-width:1001px) { .game-content { padding-top: 12px; } }

/* One permanent display name per browser, explained where it is chosen. */
.lab-identity-hint,.lab-identity-error{margin:0;max-width:380px;align-self:center;font:500 13px/1.35 system-ui;color:#30271e;text-shadow:0 1px 2px #ffffec,0 0 5px #ffffec;}
.lab-identity-error:empty{display:none}.lab-identity-error{font-weight:700;color:#761c16}.lab:lang(zh) :is(.lab-identity-hint,.lab-identity-error){font-family:var(--chinese,'Iansui',serif)}
.lab-name button:disabled{opacity:.7;cursor:wait}

/* Difficulty word beside the level number; the level column gets the extra width it needs. */
.lab-level-stat dd { display: flex; align-items: baseline; justify-content: center; flex-wrap: wrap; column-gap: 5px; row-gap: 0; }
.lab-level-label { font: 600 11px/1.2 system-ui, -apple-system, sans-serif; letter-spacing: .01em; white-space: nowrap; font-variant-numeric: normal; position: relative; top: -2px; }
.lab-level-label[data-tier=easy] { color: #4b6a3d; }
.lab-level-label[data-tier=medium] { color: #86621f; }
.lab-level-label[data-tier=hard] { color: #a4472c; }
.lab-level-label[data-tier=superhuman] { color: #7a2d55; }
.lab:lang(zh) .lab-level-label { font-family: "Iansui", serif; font-size: 12px; font-weight: 400; }
.lab:is([data-phase=playing],[data-phase=name]) .lab-hud { grid-template-columns: minmax(0,1.7fr) repeat(2,minmax(0,1fr)); }
.lab:is([data-phase=playing],[data-phase=name]) .lab-play > .lab-hud { grid-template-columns: minmax(0,1.7fr) repeat(2,minmax(0,1fr)) auto; }
.lab:is([data-phase=playing],[data-phase=name]) .lab-controls > .lab-hud { grid-template-columns: minmax(0,1.7fr) repeat(2,minmax(0,1fr)); }
@media (max-width: 360px) { .lab-level-stat dd { column-gap: 4px; } .lab-level-label { font-size: 10px; } }

/* Foreground storyteller, with the approved soft box and no speech tail. */
.lab-story-active .lab-intro { top: 32%; padding: 0; overflow: visible; pointer-events: none; }
.lab-story-active .lab-intro .lab-name { display: none !important; }
.lab-story-active .lab-intro .lab-portraits { margin: 0 !important; }
.lab-lore { position:absolute; inset:0; z-index:6; container-type:size; overflow:hidden; touch-action:pan-y pinch-zoom; }
.lab .lab-lore canvas.lab-lore-bird { position:absolute; inset:0; width:100%; height:100%; max-height:none; background:transparent; outline:0; box-shadow:none; pointer-events:none; }
.lab-lore-bubble { position:absolute; left:5%; top:46%; width:65%; max-height:51%; overflow:auto; padding:4% 4.5%; color:#36392d; background:#ffffec url('../../assets/handmade-paper.svg'); border:2px solid #77715a; border-radius:25% 24% 22% 23% / 12% 13% 12% 14%; box-shadow:2px 5px 0 #3f2b2126; }
.lab-lore-bubble p { margin:0; font:400 clamp(16px,3.25cqw,23px)/1.38 Palatino,'Palatino Linotype',Georgia,serif; }
.lab:lang(zh) .lab-lore-bubble p { font-family:'Iansui',serif; line-height:1.55; }
.lab-lore-bubble footer { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-top:14px; }
.lab-lore-bubble footer span { font:400 13px/1.2 system-ui; color:#76705a; }
.lab-lore button { color:#36392d; border:1px solid #8b9270; border-radius:12px; cursor:pointer; font:400 clamp(14px,2.9cqw,19px)/1.25 Palatino,Georgia,serif; padding:9px 13px; background:#e9f0d7; }
.lab-lore button:focus-visible { outline:3px solid #426d80; outline-offset:3px; }
.lab-lore-skip { position:absolute; right:12px; top:12px; z-index:1; background:#ffffeceb !important; }
.lab-lore-skip:disabled { visibility:hidden; }
@container (max-width:420px) {
 .lab-lore-bubble { left:4%; top:43%; width:73%; padding:4%; max-height:54%; }
 .lab-lore-bubble p { font-size:clamp(14px,4.1cqw,17px); line-height:1.34; }
 .lab-lore-bubble footer { margin-top:10px; }
 .lab-lore button { padding:8px 10px; }
}
@container (max-height:440px) {
 .lab-lore-bubble { top:35%; max-height:62%; width:74%; padding:2% 4%; }
 .lab-lore-bubble p { font-size:15px; line-height:1.25; }
}

/* Keep the familiar top-ten-sized frame while retaining every player's best. */
.lab-score-scroll{max-height:390px;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y pinch-zoom;scrollbar-width:thin}
.lab-score-scroll th{position:sticky;top:0;background:#f5ead2;z-index:1}
.lab-score-scroll:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
.lab-scores-panel .lab-score-scroll{max-height:60svh}
