
  /* The scene is the page. One glass capsule and one caption float above it. */
  :root {
    --ink: #1e1a16; --ink-soft: #5c544b;
    --glass: rgba(255, 252, 247, .62); --glass-edge: rgba(255, 255, 255, .7); --glass-shadow: 0 10px 34px rgba(40, 28, 16, .18);
    --accent: #e8731c;
    --ui: -apple-system, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
    --display: "New York", "Iowan Old Style", Georgia, serif;
  }
  body[data-setting="table"], body[data-setting="porch"] {
    --ink: #fbf3e8; --ink-soft: #cdbba6;
    --glass: rgba(34, 24, 16, .5); --glass-edge: rgba(255, 236, 214, .18); --glass-shadow: 0 10px 34px rgba(0, 0, 0, .45);
  }
  html, body { height: 100%; margin: 0; }
  body { background: #f6f4ef; color: var(--ink); font: 15px/1.3 var(--ui); overflow: hidden; -webkit-tap-highlight-color: transparent; transition: background .9s; }
  body[data-setting="table"] { background: #1b130d; }
  body[data-setting="porch"] { background: #0c1018; }
  #stage { position: fixed; inset: 0; }
  #stage canvas { width: 100% !important; height: 100% !important; display: block; touch-action: none; }
  #chrome { position: fixed; inset: 0; pointer-events: none; }
  .caption {
    position: absolute; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 7vh); transform: translate(-50%, 6px);
    margin: 0; font: 400 clamp(22px, 4.6vw, 34px)/1.15 var(--display); letter-spacing: -.01em; text-align: center; color: var(--ink);
    opacity: 0; transition: opacity .7s ease, transform .7s ease; max-width: min(90vw, 22ch); text-wrap: balance;
  }
  .caption.shown { opacity: 1; transform: translate(-50%, 0); }
  .caption.gone { opacity: 0; }
  .capsule {
    position: absolute; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 22px); transform: translateX(-50%);
    display: flex; gap: 6px; padding: 6px; border-radius: 999px; pointer-events: auto;
    background: var(--glass); border: 1px solid var(--glass-edge); box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255,255,255,.35);
    -webkit-backdrop-filter: blur(22px) saturate(160%); backdrop-filter: blur(22px) saturate(160%);
  }
  .cap-btn {
    min-width: 64px; min-height: 52px; padding: 6px 14px; border: 0; border-radius: 999px; background: transparent; color: var(--ink);
    display: grid; justify-items: center; align-content: center; gap: 3px; font: 600 11.5px/1 var(--ui); letter-spacing: .01em; white-space: nowrap; cursor: pointer;
    transition: background .2s, transform .12s;
  }
  .cap-btn svg { width: 22px; height: 22px; }
  .cap-btn:hover { background: rgba(127, 110, 90, .12); }
  .cap-btn:active { transform: scale(.96); }
  .cap-btn.primary { background: var(--accent); color: #fff; }
  .cap-btn.primary:hover { background: #d9640f; }
  .cap-btn:disabled { opacity: .38; cursor: default; }
  .cap-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  #loading { position: fixed; inset: 0; display: grid; place-items: center; font: 400 22px var(--display); color: var(--ink-soft); }
  @media (prefers-reduced-motion: reduce) { .caption, .cap-btn, body { transition: none; } }
/* P1: bounded translucency keeps labels legible even over a bright scene highlight.
   UI_PRACTICE §2: composite the glass with the scene before measuring contrast. */
:root { --glass: rgba(255,252,247,.88); --accent: #ae460e; }
body[data-setting="table"], body[data-setting="porch"] {
  --glass: rgba(26,20,16,.90);
}
.capsule {
  box-sizing: border-box; border: 0; display: block; width: max-content;
  max-width: calc(100vw - 24px); isolation: isolate;
  box-shadow: var(--glass-shadow), inset 0 1px 2px rgba(255,255,255,.52), inset 0 -1px 3px rgba(255,255,255,.12);
}
.capsule[hidden] { display: none; }
.cap-items { display: flex; gap: 6px; }
.cap-outgoing { position: absolute; left: 6px; top: 6px; pointer-events: none; }
.cap-btn { box-sizing: border-box; min-width: 68px; min-height: 56px; padding: 7px 13px; }
.cap-btn:active:not(:disabled) { transform: translateY(1px) scale(.96); box-shadow: inset 0 2px 5px #0002; }
.cap-btn.primary:hover { background: #963b0b; }
.cap-btn:disabled { opacity: .72; }
.cap-btn:disabled:hover { background: transparent; }
.cap-btn.primary:disabled:hover { background: var(--accent); }
.cap-btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.caption { pointer-events: none; width: max-content; max-height: 16vh; }
@media (prefers-reduced-motion: reduce) {
  .caption, .caption.shown { transform: translateX(-50%); }
  .caption, .cap-btn, body { transition: none; animation: none; }
}
/* Primary disabled state dims the fill while retaining opaque, readable text. */
.cap-btn.primary:disabled, .cap-btn.primary:disabled:hover { opacity: 1; background: #805039; }
/* History and the way on, in the top corners (ui.js createCapsule: place 'start' | 'end').
   The same glass as the capsule; icon beside the label so the pill stays short. */
.corner {
  position: absolute; top: calc(env(safe-area-inset-top, 0px) + 14px); pointer-events: auto;
  display: flex; border-radius: 999px; padding: 4px;
  background: var(--glass); box-shadow: var(--glass-shadow), inset 0 1px 2px rgba(255,255,255,.4);
  -webkit-backdrop-filter: blur(22px) saturate(160%); backdrop-filter: blur(22px) saturate(160%);
  animation: corner-in .26s ease both;
}
.corner[hidden] { display: none; }
.corner.start { left: calc(env(safe-area-inset-left, 0px) + 14px); }
.corner.end { right: calc(env(safe-area-inset-right, 0px) + 14px); }
.corner .cap-btn { display: flex; gap: 6px; min-width: 0; min-height: 44px; padding: 0 16px 0 12px; font-size: 13px; }
.corner .cap-btn svg { width: 20px; height: 20px; }
@keyframes corner-in { from { opacity: 0; } to { opacity: 1; } }
/* A chosen tool: filled like a held chip, so which tool is in your hand is never in doubt. */
.cap-btn.pressed { background: rgba(232, 140, 50, .22); box-shadow: inset 0 0 0 1.5px rgba(232, 140, 50, .75); }
.cap-btn.pressed:hover { background: rgba(232, 140, 50, .3); }
@media (prefers-reduced-motion: reduce) { .corner { animation: none; } }
/* At the table the room falls dark away from the pumpkin, as a still life is lit: the bench and
   paper frame it and never compete with it. */
#stage::after { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .9s;
  background: radial-gradient(ellipse 62% 58% at 50% 52%, transparent 45%, rgba(12, 7, 3, .62) 100%); }
body[data-setting="table"] #stage::after, body[data-setting="porch"] #stage::after { opacity: 1; }
@media (prefers-reduced-motion: reduce) { #stage::after { transition: none; } }
.corner .cap-btn { align-items: center; align-content: normal; justify-content: center; height: 44px; }
.corner.end .cap-btn { flex-direction: row-reverse; padding: 0 12px 0 16px; } /* "Next ›", "Done ✓" */
.caption { top: calc(env(safe-area-inset-top, 0px) + max(7vh, 74px)); } /* clear of the corner pills */
