  /* Layout: full-bleed 3D site model; one stone-paper control panel floats top-left, becomes a bottom sheet on phones */
  :root {
    --paper: #eef0ed;
    --panel: rgba(238, 240, 237, 0.88);
    --ink: #1d2124;
    --muted: #5a6066;
    --line: rgba(29, 33, 36, 0.14);
    --accent: #2c4a6e;
    --accent-ink: #f4f6f8;
    --accent-soft: rgba(44, 74, 110, 0.10);
    --tag: rgba(238, 240, 237, 0.92);
    --display: "Shippori Mincho", "Hiragino Mincho ProN", "Yu Mincho", Georgia, serif;
    --body: "Zen Kaku Gothic New", "Hiragino Sans", "Segoe UI", system-ui, sans-serif;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --paper: #121518; --panel: rgba(18, 21, 24, 0.84); --ink: #e9ebe7; --muted: #9aa1a6;
      --line: rgba(233, 235, 231, 0.14); --accent: #9db8d9; --accent-ink: #10161d;
      --accent-soft: rgba(157, 184, 217, 0.14); --tag: rgba(18, 21, 24, 0.86); color-scheme: dark;
    }
  }
  :root[data-theme="dark"] {
    --paper: #121518; --panel: rgba(18, 21, 24, 0.84); --ink: #e9ebe7; --muted: #9aa1a6;
    --line: rgba(233, 235, 231, 0.14); --accent: #9db8d9; --accent-ink: #10161d;
    --accent-soft: rgba(157, 184, 217, 0.14); --tag: rgba(18, 21, 24, 0.86); color-scheme: dark;
  }

  html, body { height: 100%; }
  body { background: var(--paper); color: var(--ink); font-family: var(--body); overflow: hidden; }
  #scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
  #labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }

  .tag {
    position: absolute; left: 0; top: 0; white-space: nowrap;
    font: 500 12px/1 var(--body); letter-spacing: 0.02em; color: var(--ink);
    background: var(--tag); border: 1px solid var(--line); padding: 5px 8px 6px; border-radius: 2px;
    transform: translate(-50%, calc(-100% - 8px));
  }
  .tag::after {
    content: ""; position: absolute; left: 50%; top: 100%; width: 1px; height: 8px; background: var(--ink); opacity: 0.5;
  }

  .panel {
    position: fixed; top: calc(16px + env(safe-area-inset-top, 0px)); left: 16px; width: 316px;
    max-height: calc(100% - 32px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 3px;
    backdrop-filter: blur(14px) saturate(1.1); -webkit-backdrop-filter: blur(14px) saturate(1.1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
  }
  .panel header { padding: 18px 18px 14px; border-bottom: 1px solid var(--line); position: relative; }
  .eyebrow { margin: 0 0 6px; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
  h1 { margin: 0; font: 600 26px/1.1 var(--display); letter-spacing: 0.01em; text-wrap: balance; }
  .lede { margin: 8px 0 0; font-size: 13px; line-height: 1.55; color: var(--muted); }
  .collapse {
    position: absolute; top: 14px; right: 14px; font: 500 12px var(--body); color: var(--muted);
    background: transparent; border: 1px solid var(--line); border-radius: 2px; padding: 4px 8px; cursor: pointer;
  }
  .collapse:hover { color: var(--ink); }
  .pbody { display: grid; gap: 0; }
  .pbody section { padding: 14px 18px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
  .pbody section:last-child { border-bottom: 0; }
  h2 { margin: 0; font: 500 11px var(--body); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
  .row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
  .clock { font: 600 20px var(--display); font-variant-numeric: tabular-nums; }
  .meta { margin: 0; font-size: 12px; line-height: 1.5; color: var(--muted); font-variant-numeric: tabular-nums; }

  .seg { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 2px; overflow: hidden; }
  .seg button {
    font: 500 13px var(--body); color: var(--ink); background: transparent; border: 0; padding: 8px 4px 7px; cursor: pointer;
    display: grid; gap: 2px; border-left: 1px solid var(--line);
  }
  .seg button:first-child { border-left: 0; }
  .seg button span { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
  .seg button[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); }
  .seg button[aria-checked="true"] span { color: var(--accent-ink); opacity: 0.8; }

  input[type="range"] { width: 100%; accent-color: var(--accent); margin: 0; }
  .btn {
    font: 500 12.5px var(--body); color: var(--ink); background: transparent; border: 1px solid var(--line);
    border-radius: 2px; padding: 7px 10px; cursor: pointer; text-align: left;
  }
  .btn:hover { background: var(--accent-soft); }
  .btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
  .views { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

  .program { list-style: none; margin: 0; padding: 0; display: grid; }
  .program button {
    width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: baseline;
    background: transparent; border: 0; border-top: 1px solid var(--line); padding: 9px 0; cursor: pointer;
    color: var(--ink); text-align: left; font-family: var(--body);
  }
  .program li:first-child button { border-top: 0; padding-top: 2px; }
  .program b { font: 600 15px var(--display); }
  .program i { font-style: normal; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
  .program small { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
  .program button:hover b { color: var(--accent); }
  .note { margin: 0; font-size: 12px; line-height: 1.55; color: var(--muted); }
  .toggle { display: flex; align-items: center; gap: 8px; font-size: 12.5px; cursor: pointer; }
  .toggle input { accent-color: var(--accent); }

  button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

  .hud {
    position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    width: min(560px, calc(100% - 32px)); display: grid; justify-items: center; gap: 10px; pointer-events: none;
  }
  .hud[hidden] { display: none; }
  .hud > * { pointer-events: auto; }
  .hint {
    margin: 0; padding: 8px 12px; font-size: 12.5px; line-height: 1.45; text-align: center; color: var(--ink);
    background: var(--panel); border: 1px solid var(--line); border-radius: 3px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  }
  .hud .btn { background: var(--panel); }
  .pad { display: none; grid-template-areas: ". up ." "l dn r"; grid-template-columns: repeat(3, 56px); gap: 6px; }
  .pad button {
    height: 52px; font-size: 18px; color: var(--ink); background: var(--panel); border: 1px solid var(--line);
    border-radius: 3px; touch-action: none; user-select: none; -webkit-user-select: none;
  }
  @media (pointer: coarse) { .pad { display: grid; } .kb { display: none; } }
  .fail { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--muted); }

  @media (max-width: 640px) {
    .panel {
      top: auto; left: 12px; right: 12px; width: auto;
      bottom: calc(12px + env(safe-area-inset-bottom, 0px)); max-height: 48%;
    }
    .panel header { padding: 14px 16px 12px; }
    h1 { font-size: 22px; }
    .lede { display: none; }
    .pbody section { padding: 12px 16px; }
    .views { grid-template-columns: 1fr 1fr 1fr; }
    body.walking .panel { display: none; }
  }
