@font-face {
  font-family: 'Baloo 2';
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url(/fonts/baloo2-vietnamese.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: 'Baloo 2';
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url(/fonts/baloo2-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Baloo 2';
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url(/fonts/baloo2-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --paper: #fbf3e2;
  --paper-2: #f3e6c8;
  --ink: #22382f;
  --ink-soft: #4c5f55;
  --red: #d9452f;
  --red-deep: #a8321f;
  --gold: #f2b33d;
  --teal: #58c6ba;
  --green: #2f6b55;
  --shadow: 0 10px 30px rgba(24, 52, 44, 0.18), 0 2px 6px rgba(24, 52, 44, 0.12);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #58c6ba linear-gradient(#58c6ba, #d7f0df);
  color: var(--ink);
  font-family: 'Baloo 2', ui-rounded, 'Segoe UI', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; }
kbd {
  display: inline-grid;
  place-items: center;
  min-width: 1.8em;
  height: 1.8em;
  padding: 0 0.4em;
  border-radius: 7px;
  background: var(--paper);
  color: var(--ink);
  border: 1.5px solid rgba(34, 56, 47, 0.25);
  box-shadow: 0 2px 0 rgba(34, 56, 47, 0.25);
  font: 700 0.78em/1 'Baloo 2', system-ui, sans-serif;
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

#stage { position: fixed; inset: 0; }
#stage canvas { display: block; width: 100%; height: 100%; touch-action: none; }

/* ---------------------------------------------------------------- screens */
.screen {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  pointer-events: none;
  z-index: 10;
}
.screen > * { pointer-events: auto; }
.title-card {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: calc(5vh + var(--safe-t)) 20px 4vh;
  text-align: center;
  pointer-events: none;
}
.title-card > * { pointer-events: auto; }
.wordmark {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.18em;
  font-size: clamp(34px, 8.4vw, 104px);
  white-space: nowrap;
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.01em;
  color: var(--paper);
  text-shadow:
    0 3px 0 var(--green), 0 -2px 0 var(--green), 3px 0 0 var(--green), -3px 0 0 var(--green),
    3px 3px 0 var(--green), -3px 3px 0 var(--green), 3px -2px 0 var(--green), -3px -2px 0 var(--green),
    0 9px 0 #1b4a3c, 0 14px 26px rgba(16, 48, 40, 0.35);
  transform: rotate(-2deg);
  animation: rise 1.1s var(--ease) both;
}
.wordmark .stamp {
  width: 0.92em;
  height: 0.92em;
  transform: rotate(-8deg) translateY(-0.04em);
  filter: drop-shadow(0 6px 10px rgba(16, 48, 40, 0.3));
  animation: sway 4.5s ease-in-out infinite;
  transform-origin: 50% 0;
}
.tagline {
  margin: 1.4vh auto 0;
  max-width: 40ch;
  font-size: clamp(15px, 1.35vw, 19px);
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
  background: rgba(251, 243, 226, 0.86);
  padding: 0.4em 1em 0.35em;
  border-radius: 999px;
  box-shadow: var(--shadow);
  animation: rise 1.1s 0.12s var(--ease) both;
}
.title-card header, .title-card .head { display: contents; }
.actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: auto; animation: rise 1s 0.25s var(--ease) both; }
.btn {
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  padding: 0.55em 1.7em 0.45em;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.01em;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.2s;
}
.btn.primary {
  background: var(--red);
  color: var(--paper);
  box-shadow: 0 5px 0 var(--red-deep), 0 14px 30px rgba(120, 30, 16, 0.35);
  min-width: 190px;
}
.btn.primary:hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--red-deep), 0 18px 34px rgba(120, 30, 16, 0.38); }
.btn.primary:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--red-deep), 0 8px 18px rgba(120, 30, 16, 0.3); }
.btn.ghost { background: rgba(251, 243, 226, 0.88); color: var(--ink); box-shadow: var(--shadow); }
.btn.ghost:hover { background: var(--paper); transform: translateY(-2px); }
.btn.small { font-size: 15px; padding: 0.45em 1.2em 0.35em; }
.btn:focus-visible, .tool:focus-visible, .round:focus-visible, .swatch:focus-visible, .panel button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}
.how {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: flex;
  gap: 8px 18px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  animation: rise 1s 0.35s var(--ease) both;
}
.how li { display: inline-flex; gap: 4px; align-items: center; background: rgba(251, 243, 226, 0.7); padding: 4px 10px; border-radius: 999px; }
.how .touch-only { display: none; }
.screen-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px calc(16px + var(--safe-b));
}
.signature img { display: block; height: 34px; width: auto; }
.signature { opacity: 0.92; transition: opacity 0.2s; border-radius: 6px; }
.signature:hover { opacity: 1; }
.privacy { color: var(--ink); font-weight: 700; font-size: 14px; text-decoration: none; background: rgba(251, 243, 226, 0.75); padding: 4px 12px; border-radius: 999px; }
.privacy:hover { background: var(--paper); }
.lang-link { color: var(--ink); font-weight: 800; font-size: 14px; text-decoration: none; background: var(--paper); padding: 4px 12px; border-radius: 999px; box-shadow: 0 2px 8px rgba(24, 52, 44, 0.12); }
.lang-link:hover, .lang-link:focus-visible { background: #fff; }
.tool.lang { font: 800 15px/1 'Baloo 2', system-ui, sans-serif; color: var(--ink); letter-spacing: 0.02em; }
.foot-right { display: flex; gap: 8px; align-items: flex-end; }
.about { position: relative; color: var(--ink); }
.about summary {
  list-style: none;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  background: rgba(251, 243, 226, 0.75);
  padding: 4px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.about summary::-webkit-details-marker { display: none; }
.about[open] summary { background: var(--paper); }
.about-body {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  width: min(360px, calc(100vw - 24px));
  background: var(--paper);
  padding: 12px 16px 14px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  font-size: 14px;
  line-height: 1.45;
  text-align: left;
}
.about-body h2 { font-size: 18px; margin: 0 0 4px; }
.about-body p { margin: 6px 0 0; }
#title.leaving .title-card, #title.leaving .screen-foot { animation: leave 0.8s var(--ease) both; }

#ending { z-index: 30; background: radial-gradient(ellipse at 50% 40%, rgba(19, 32, 61, 0.15), rgba(19, 32, 61, 0.55)); opacity: 0; transition: opacity 0.6s var(--ease); }
#ending.show { opacity: 1; }
#ending .title-card { justify-content: center; gap: 12px; }
#ending h2 { margin: 0; font-size: clamp(38px, 6vw, 72px); font-weight: 800; color: var(--paper); line-height: 1; text-shadow: 0 4px 0 #7a3a1a, 0 12px 30px rgba(0, 0, 0, 0.35); }
#ending p { max-width: 40ch; margin: 0 0 12px; font-size: 19px; color: var(--paper); font-weight: 600; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4); }
#ending .actions { margin-top: 6px; }
#ending .stamp { animation: sway 4s ease-in-out infinite; }

@keyframes rise { from { opacity: 0; transform: translateY(18px) rotate(-2deg); } to { opacity: 1; } }
@keyframes leave { to { opacity: 0; transform: translateY(-24px) scale(0.98); } }
@keyframes sway { 0%, 100% { rotate: -4deg; } 50% { rotate: 4deg; } }

/* ---------------------------------------------------------------- HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; opacity: 0; transition: opacity 0.8s var(--ease); }
#hud.show { opacity: 1; }
#hud > * { pointer-events: auto; }
.topleft { position: absolute; left: 18px; top: calc(16px + var(--safe-t)); display: flex; flex-direction: column; align-items: flex-start; gap: 8px; pointer-events: none; }
.topleft > * { pointer-events: auto; }
.chip {
  position: relative;
  max-width: min(440px, calc(100vw - 200px));
  background: var(--paper);
  border-radius: 18px;
  padding: 9px 16px 8px;
  box-shadow: var(--shadow);
  display: grid;
  line-height: 1.2;
  border: 1.5px solid rgba(34, 56, 47, 0.12);
}
.obj-label { font-size: 12px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--red); }
#obj-text { font-size: 17px; font-weight: 700; }
#obj-item { font-size: 13px; color: var(--ink-soft); font-weight: 600; }
#obj-item:empty { display: none; }
.chip.swap { animation: swap 0.6s var(--ease); }
@keyframes swap { 0% { transform: translateY(-8px) scale(0.97); opacity: 0.3; } 100% { transform: none; opacity: 1; } }
.lanterns {
  display: flex;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(251, 243, 226, 0.72);
  box-shadow: 0 4px 14px rgba(24, 52, 44, 0.12);
}
/* one small baguette per order; it bakes golden when delivered */
.lantern { width: 20px; height: 9px; border-radius: 999px; background: #cdbb9c; position: relative; opacity: 0.6; transform: rotate(-18deg); transition: background 0.4s, opacity 0.4s, box-shadow 0.4s; }
.lantern::before, .lantern::after { content: ''; position: absolute; top: 2px; width: 4px; height: 4px; border-top: 1.5px solid rgba(90, 60, 30, 0.35); transform: skewX(-30deg); }
.lantern::before { left: 5px; }
.lantern::after { left: 11px; }
.lantern.lit { background: linear-gradient(180deg, #f6c56a, #d9973c 60%, #b8742a); opacity: 1; box-shadow: 0 0 9px rgba(255, 190, 80, 0.7); }
.lantern.lit::before, .lantern.lit::after { border-top-color: rgba(120, 70, 20, 0.65); }
.lantern.pop { animation: pop 0.9s var(--ease); }
@keyframes pop { 0% { transform: rotate(-18deg) scale(0.4); } 45% { transform: rotate(-18deg) scale(1.6); } 100% { transform: rotate(-18deg); } }

#tools { position: absolute; right: 18px; top: calc(16px + var(--safe-t)); display: flex; gap: 10px; }
.tool, .round {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 1.5px solid rgba(34, 56, 47, 0.12);
  background: var(--paper);
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.25s var(--ease), background 0.2s;
}
.tool:hover { transform: translateY(-2px); }
.tool[aria-expanded='true'] { background: var(--gold); }
.tool svg, .round svg { width: 24px; height: 24px; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#btn-music .slash { opacity: 0; transition: opacity 0.2s; stroke: var(--red); }
#btn-music.off .slash { opacity: 1; }

#prompt {
  position: absolute;
  left: 50%;
  bottom: calc(40px + var(--safe-b));
  transform: translate(-50%, 12px);
  opacity: 0;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--paper);
  border-radius: 999px;
  padding: 8px 18px 6px 10px;
  box-shadow: var(--shadow);
  font-weight: 700;
  font-size: 17px;
  pointer-events: none;
}
#prompt.show { opacity: 1; transform: translate(-50%, 0); }
#prompt kbd { background: var(--red); color: var(--paper); border-color: var(--red-deep); box-shadow: 0 2px 0 var(--red-deep); }

#compass {
  position: absolute;
  left: 0;
  top: 0;
  margin: -24px 0 0 -24px;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  will-change: transform;
}
#compass.show { opacity: 1; }
#compass-arrow { width: 48px; height: 48px; border-radius: 50%; background: var(--red); display: grid; place-items: center; box-shadow: 0 6px 18px rgba(120, 30, 16, 0.35); }
#compass-arrow svg { width: 26px; height: 26px; fill: none; stroke: var(--paper); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.compass-text { display: grid; background: var(--paper); border-radius: 12px; padding: 3px 10px 2px; font-size: 13px; line-height: 1.15; box-shadow: var(--shadow); white-space: nowrap; }
.compass-text b { font-size: 14px; }

#toasts { position: absolute; left: 50%; top: calc(18px + var(--safe-t)); transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast {
  background: var(--paper);
  border-radius: 999px;
  padding: 7px 18px 5px;
  font-weight: 700;
  font-size: 16px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(-12px) scale(0.96);
  transition: opacity 0.4s var(--ease), transform 0.5s var(--ease);
  white-space: nowrap;
}
.toast.in { opacity: 1; transform: none; }
.toast.out { opacity: 0; transform: translateY(-8px); }
.toast.good { background: #e8f4dc; }
.toast.gold { background: var(--gold); }

.hud-signature { position: absolute; left: 18px; bottom: calc(14px + var(--safe-b)); }
.hud-signature img { height: 26px; }

/* ---------------------------------------------------------------- dialogue */
#dialog {
  position: fixed;
  left: 50%;
  bottom: calc(26px + var(--safe-b));
  width: min(760px, calc(100vw - 28px));
  transform: translate(-50%, 24px);
  opacity: 0;
  transition: opacity 0.3s var(--ease), transform 0.4s var(--ease);
  background: var(--paper);
  border-radius: 22px;
  padding: 26px 64px 20px 26px;
  box-shadow: 0 18px 50px rgba(16, 40, 34, 0.3), 0 3px 8px rgba(16, 40, 34, 0.15);
  border: 2px solid rgba(34, 56, 47, 0.14);
  z-index: 20;
  cursor: pointer;
  min-height: 118px;
}
#dialog.show { opacity: 1; transform: translate(-50%, 0); }
.dlg-name {
  position: absolute;
  top: -18px;
  left: 22px;
  background: var(--red);
  color: var(--paper);
  font-weight: 800;
  font-size: 18px;
  padding: 4px 16px 2px;
  border-radius: 999px;
  box-shadow: 0 4px 0 var(--red-deep);
}
#dialog.self .dlg-name { background: var(--green); box-shadow: 0 4px 0 #1b4a3c; }
#dlg-text { margin: 0; font-size: clamp(17px, 1.5vw, 21px); font-weight: 600; line-height: 1.4; min-height: 2.8em; }
#dlg-next {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 0;
  background: var(--gold);
  display: grid;
  place-items: center;
  cursor: pointer;
  animation: nudge 1.4s ease-in-out infinite;
}
#dlg-next svg { width: 18px; height: 18px; fill: var(--ink); }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(4px); } }

/* ---------------------------------------------------------------- panels */
.panel {
  position: fixed;
  right: 18px;
  top: calc(78px + var(--safe-t));
  width: min(380px, calc(100vw - 36px));
  max-height: calc(100vh - 110px);
  overflow: auto;
  background: var(--paper);
  border-radius: 22px;
  box-shadow: 0 18px 50px rgba(16, 40, 34, 0.28);
  border: 2px solid rgba(34, 56, 47, 0.12);
  padding: 16px 18px 18px;
  z-index: 15;
  opacity: 0;
  transform: translateY(-10px) scale(0.98);
  transform-origin: top right;
  transition: opacity 0.25s var(--ease), transform 0.35s var(--ease);
}
.panel.show { opacity: 1; transform: none; }
.panel header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.panel h2 { margin: 0; font-size: 24px; font-weight: 800; }
#satchel-count { font-size: 14px; color: var(--ink-soft); font-weight: 700; margin-top: 3px; }
.close { margin-left: auto; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--paper-2); cursor: pointer; display: grid; place-items: center; }
.close svg { width: 18px; height: 18px; stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; }
#satchel-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
#satchel-list li > button, #satchel-list li.done {
  width: 100%;
  display: flex;
  gap: 12px;
  align-items: center;
  text-align: left;
  border: 1.5px solid rgba(34, 56, 47, 0.14);
  border-radius: 16px;
  background: #fffaf0;
  padding: 10px 12px;
  cursor: pointer;
  line-height: 1.2;
}
#satchel-list li.tracked > button { border-color: var(--red); background: #fff1e6; box-shadow: 0 0 0 2px rgba(217, 69, 47, 0.2); }
#satchel-list strong { display: block; font-size: 16px; }
#satchel-list small { display: block; font-size: 13px; color: var(--ink-soft); font-weight: 600; margin-top: 2px; }
#satchel-list .count { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--gold); font-weight: 800; font-size: 14px; }
#satchel-list li.done { cursor: default; opacity: 0.75; }
#satchel-list li.done strong { text-decoration: line-through; text-decoration-thickness: 2px; }
.tick { flex: none; width: 40px; height: 40px; border-radius: 50%; background: #cfe8c0; position: relative; }
.tick::after { content: ''; position: absolute; left: 14px; top: 10px; width: 9px; height: 16px; border: solid var(--green); border-width: 0 3px 3px 0; transform: rotate(45deg); }
#satchel-more { font-size: 14px; font-weight: 600; color: var(--ink-soft); margin: 12px 2px; }
.swatch-row { display: grid; gap: 6px; margin: 10px 0 14px; }
.swatch-label { font-weight: 700; font-size: 15px; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid var(--paper);
  background: var(--c);
  box-shadow: 0 0 0 1.5px rgba(34, 56, 47, 0.25), 0 4px 10px rgba(24, 52, 44, 0.15);
  cursor: pointer;
  transition: transform 0.25s var(--ease), box-shadow 0.2s;
}
.swatch:hover { transform: scale(1.08); }
.swatch[aria-checked='true'] { box-shadow: 0 0 0 3px var(--ink), 0 6px 14px rgba(24, 52, 44, 0.2); transform: scale(1.06); }

/* ---------------------------------------------------------------- touch */
#stick, #btn-talk, #btn-bell { display: none; }
body.touch #stick {
  display: block;
  position: absolute;
  left: calc(22px + env(safe-area-inset-left, 0px));
  bottom: calc(28px + var(--safe-b));
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: rgba(251, 243, 226, 0.4);
  border: 2px solid rgba(251, 243, 226, 0.85);
  box-shadow: inset 0 0 0 10px rgba(251, 243, 226, 0.18), var(--shadow);
  touch-action: none;
}
#knob { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%; background: var(--paper); box-shadow: var(--shadow); transition: transform 0.12s ease-out; }
body.touch #btn-bell { display: grid; position: absolute; right: calc(22px + env(safe-area-inset-right, 0px)); bottom: calc(40px + var(--safe-b)); width: 64px; height: 64px; }
body.touch #btn-talk {
  display: grid;
  position: absolute;
  right: calc(98px + env(safe-area-inset-right, 0px));
  bottom: calc(46px + var(--safe-b));
  width: auto;
  height: 52px;
  padding: 0 20px;
  border-radius: 999px;
  background: var(--red);
  color: var(--paper);
  font-weight: 800;
  font-size: 18px;
  opacity: 0;
  transform: scale(0.8);
  pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.3s var(--ease);
}
body.touch #btn-talk.show { opacity: 1; transform: none; pointer-events: auto; }
body.touch #prompt kbd { display: none; }
body.touch #prompt { bottom: calc(180px + var(--safe-b)); }
body.touch .hud-signature { display: none; }

@media (pointer: coarse) {
  .how li:not(.touch-only) { display: none; }
  .how .touch-only { display: inline-flex; white-space: normal; text-align: center; max-width: 92vw; }
}
@media (max-width: 640px) {
  .topleft { left: 12px; }
  .chip { max-width: calc(100vw - 132px); padding: 7px 12px 6px; }
  #obj-text { font-size: 15px; }
  /* four buttons in a 2 x 2 block, so the delivery card keeps its width */
  #tools { right: 12px; gap: 8px; flex-wrap: wrap; width: 96px; justify-content: flex-end; }
  .tool { width: 44px; height: 44px; }
  .lanterns { gap: 3px; padding: 5px 8px; }
  .lantern { width: 15px; height: 7px; }
  #dialog { padding: 24px 56px 16px 18px; bottom: calc(14px + var(--safe-b)); }
  .screen-foot { padding: 0 12px calc(12px + var(--safe-b)); flex-wrap: wrap; gap: 10px; }
  .foot-right { flex-wrap: wrap; justify-content: flex-end; }
  .privacy, .lang-link { white-space: nowrap; }
  .signature img { height: 28px; }
  .btn { font-size: 20px; }
  .toast { font-size: 14px; white-space: normal; text-align: center; max-width: 86vw; }
}

/* ---------------------------------------------------------------- fallbacks */
.no-webgl-note, .noscript { display: none; }
body.no-webgl .no-webgl-note { display: grid; position: fixed; inset: 0; place-content: center; gap: 16px; padding: 24px; text-align: center; z-index: 50; background: var(--paper); font-size: 18px; font-weight: 600; }
body.no-webgl .no-webgl-note img { max-width: min(720px, 90vw); height: auto; border-radius: 18px; box-shadow: var(--shadow); }
body.no-webgl #title .actions, body.no-webgl #hud { display: none; }
.noscript { display: block; position: fixed; left: 50%; bottom: 30%; transform: translateX(-50%); background: var(--paper); padding: 10px 18px; border-radius: 12px; }

#debug { position: fixed; left: 50%; bottom: 6px; transform: translateX(-50%); font: 12px/1.2 ui-monospace, monospace; background: rgba(0, 0, 0, 0.55); color: #fff; padding: 3px 8px; border-radius: 6px; z-index: 99; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
