/* The demo: the clock stays in view, every control beside it. */
body.demo { overflow-x: clip; touch-action: pan-y pinch-zoom; }
body.demo .foot-small { margin-top: 0; }
.demo-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); column-gap: var(--gap); padding: 0 var(--margin) 80px; align-items: start; }
.stage { position: sticky; top: 16px; z-index: 5; background: var(--ground); display: flex; flex-direction: column; align-items: center; padding-top: 8px; }
.stage h1 { font-size: 22px; font-weight: 700; color: var(--amber); margin-bottom: 10px; }
.stage #clock { min-height: 320px; display: flex; justify-content: center; }
.stage #clock .overclock { padding: 0; gap: 18px; }
.stage #clock .overclock-dial { box-shadow: none !important; } /* removes the widget's own: taste-skill-ignore */
.stage .status { text-align: center; max-width: 44ch; }
.stage .hint { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin-top: 12px; font-size: 15px; color: var(--muted); transition: opacity .8s var(--ease); }
.stage .hint b { color: var(--amber); font-weight: 700; margin-right: 4px; }
.stage .hint.gone { opacity: 0; pointer-events: none; }
.stage .hint .phone { display: none; }
@media (hover: none) and (pointer: coarse) { .stage .hint .desk { display: none; } .stage .hint .phone { display: inline; } }
.panel.guide ul { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 15px; color: var(--muted); }
.panel.guide b { color: var(--ink); }
.panels .fine { color: var(--muted); font-size: 13px; padding: 4px 24px; }
.chips.camp[hidden] { display: none; }
.chips .btn[data-view][aria-pressed="true"], #camp-block[aria-pressed="true"], #pw-on[aria-pressed="true"], #pw-off[aria-pressed="true"], .chips .btn[data-press][aria-pressed="true"], .chips .btn[data-spl][aria-pressed="true"] { background: var(--amber); color: #000; }
.panel .panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel .panel-head h2 { margin: 0; }
.btn.reset { background: var(--red); color: #fff; letter-spacing: .08em; padding: 0 20px; }
.btn.reset:hover { background: #ef4a30; }
.panel h3.group { margin-top: 18px; font-size: 13px; font-weight: 700; letter-spacing: .14em; color: var(--muted); text-transform: uppercase; }
.panel h3.group + .chips { margin-top: 8px; }
.chips.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.chips.grid.three { grid-template-columns: repeat(3, 1fr); }
.chips.grid .btn { width: 100%; padding: 0 8px; white-space: nowrap; }
.panels { display: flex; flex-direction: column; gap: 14px; padding-top: 8px; }
.panel { background: var(--panel); padding: 24px 24px 22px; }
.panel:nth-child(even) { background: var(--panel-2); }
.panel h2 { color: var(--amber); font-size: 26px; font-weight: 700; line-height: 1; }
.panel p { margin-top: 10px; font-size: 16px; max-width: 48ch; }
.panel p span { color: var(--green); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chips .btn { min-height: 44px; padding: 0 16px; font-size: 16px; }
#faults .chips .btn { background: var(--panel-3); color: var(--ink); }
#faults .chips .btn:hover { background: #2a2a2a; }
#faults .chips .btn.running { background: var(--amber); color: #000; }
.chips.presets .btn[aria-pressed="true"] { background: var(--amber); color: #000; }
#truck3d { position: relative; width: 100%; aspect-ratio: 16 / 10; background: #14171b; margin-top: 16px; touch-action: none; cursor: grab; }
#truck3d.grabbing { cursor: grabbing; }
#truck3d canvas { position: absolute; inset: 0; }
#readout { position: absolute; left: 16px; bottom: 12px; color: var(--green); font-size: 15px; }
@media (max-width: 900px) {
  .demo-grid { display: block; padding: 0 12px 60px; }
  .stage { position: sticky; top: 0; z-index: 5; background: var(--ground); padding: 6px 0 8px; }
  .stage h1 { font-size: 16px; margin-bottom: 4px; }
  .stage .tabs { margin-bottom: 4px; }
  .stage .tabs button { padding: 6px 0; font-size: 16px; }
  .stage #clock { min-height: 0; }
  .stage #clock .overclock { gap: 10px; }
  .stage #clock .overclock-dial { width: 48px !important; height: 48px !important; }
  .stage .status { display: none; }
  .stage .demo-note { display: none; }
  .stage .hint { margin-top: 6px; font-size: 13px; gap: 4px 12px; }
  .panels { padding-top: 12px; }
  .panel { padding: 18px 16px 16px; }
  .panel h2 { font-size: 22px; }
  .chips .btn { flex: 1 1 auto; }
}

/* the jog wheel: a big thumb-sized ring with a click button in the middle */
.jog { position: relative; width: min(100%, 300px); aspect-ratio: 1; margin: 18px auto 0; touch-action: none; user-select: none; -webkit-user-select: none; }
.jog-ring { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle at 50% 42%, #2c2c2c, #141414 72%); border: 2px solid #333; cursor: grab; overflow: hidden; outline-offset: 4px; }
.jog-ring.grabbing { cursor: grabbing; }
.jog-ticks { position: absolute; inset: 0; border-radius: 50%; will-change: transform; }
.jog-ticks i { position: absolute; left: 50%; top: 6%; width: 3px; height: 9%; margin-left: -1.5px; background: #5a5a5a; border-radius: 2px; transform-origin: 50% calc(100% / 0.09 * 0.44); }
.jog-ticks i:first-child { background: var(--amber); height: 12%; }   /* one pointer line, turns with the knob */
.jog-btn { position: absolute; left: 50%; top: 50%; width: 44%; height: 44%; transform: translate(-50%, -50%); border-radius: 50%; border: 2px solid #3a3a3a; background: radial-gradient(circle at 40% 35%, #4a4a4a, #1a1a1a 75%); color: var(--ink); font-weight: 700; font-size: 20px; letter-spacing: .08em; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; touch-action: none; -webkit-tap-highlight-color: transparent; }
.jog-btn small { font-size: 11px; font-weight: 400; letter-spacing: 0; color: var(--muted); }
.jog-btn.down { background: radial-gradient(circle at 40% 35%, #ffd264, var(--amber) 75%); color: #000; border-color: var(--amber); }
.jog-btn.down small { color: #3a2a00; }
.jog-btn.held { box-shadow: 0 0 0 6px rgba(255, 176, 0, .35); }
@media (max-width: 900px) {
  .jog { width: min(52vw, 200px); }
  .stage .fine { display: none; }
  .stage h1 { font-size: 18px; margin-bottom: 6px; }
  .stage #clock { min-height: 0; }
  .panel .learn.phone-only { margin: 0 0 6px; justify-content: center; }
  .panel .learn.phone-only .btn.big { min-height: 44px; padding: 0 20px; font-size: 16px; }
  .stage #clock .overclock-dial { display: none !important; }
}

/* learn the knob: the one big button under the clock */
.learn { display: flex; align-items: center; gap: 16px; margin-top: 16px; flex-wrap: wrap; }
.learn span { color: var(--muted); font-size: var(--t-small); max-width: 36ch; }

/* phones: the tilt panel is the 3D truck, tall, with its buttons laid over it,
   so the model gets the room (Derek 2026-10-28: too tight under the sticky stage) */
@media (max-width: 900px) {
  #truck { position: relative; }
  #truck > p:first-of-type { display: none; }
  #truck3d { aspect-ratio: auto; height: clamp(240px, calc(100svh - 350px), 420px); margin-top: 10px; }
  #readout { left: 12px; top: 12px; bottom: auto; font-size: 14px; }
  #truck .chips { position: absolute; margin: 0; gap: 6px; }
  #truck .chips .btn { flex: 0 1 auto; min-height: 36px; padding: 0 10px; font-size: 13px; }
  #truck .chips .btn.ghost { background: rgba(0, 0, 0, .6); }
  #truck .chips .btn.ghost[aria-pressed="true"] { background: var(--amber); color: #000; }
  #truck .chips.presets { left: 12px; right: 12px; bottom: 56px; justify-content: center; }
  #truck .chips.views { position: static; margin-top: 10px; justify-content: flex-start; }
  #truck .chips.views .btn { flex: 0 0 auto; min-height: 40px; }
  #truck { display: flex; flex-direction: column; }
  #truck > h2 { order: 0; } #truck .chips.views { order: 1; } #truck3d { order: 2; }
  #truck .chips.presets, #truck .chips.camp, #truck > p { order: 3; z-index: 2; }
  #truck .chips.presets { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; scrollbar-width: none; }
  #truck .chips.presets::-webkit-scrollbar { display: none; }
  #truck .chips.presets .btn { flex: 0 0 auto; min-height: 40px; }
  #truck .chips.camp { left: 24px; right: 24px; bottom: 16px; justify-content: center; }
  #truck .chips.camp .btn { font-size: 13px; white-space: normal; text-align: center; line-height: 1.2; padding: 6px 12px; }
  #truck > p:last-child { position: absolute; left: 12px; right: 12px; bottom: 104px; margin: 0; text-align: center; font-size: 13px; color: var(--amber); pointer-events: none; text-shadow: 0 1px 4px #000; }
}
.phone-only { display: none; }
@media (max-width: 900px) { .phone-only { display: flex; } }

/* phones, scrolled into the panels: the stage shrinks to the clock alone, so a
   panel (the 3D truck most of all) gets the screen */
@media (max-width: 900px) {
  .stage.compact h1, .stage.compact .tabs, .stage.compact .hint { display: none; }
  .stage.compact { padding-top: 4px; }
  .stage.compact #clock { transform: scale(.68); transform-origin: top center; transition: transform .25s; margin-bottom: -28%; }
  .panels { padding-bottom: 36svh; }                /* room to bring the last panel up under the shrunken stage */
}

/* THE KNOB stays at the top of the right column on desktop; the other panels scroll under it */
.learn-btn { min-height: 40px; padding: 0 16px; font-size: 16px; }
@media (min-width: 901px) {
  #knob { position: sticky; top: 16px; z-index: 4; box-shadow: 0 -16px 0 var(--ground), 0 18px 24px -12px rgba(0, 0, 0, .9); padding-top: 18px; padding-bottom: 16px; }
  #knob .jog { width: min(100%, 230px); margin-top: 10px; }
  #knob .chips { margin-top: 12px; }
}

/* the four knob buttons: one centered row under the ring, turns on the outside */
.chips.knob-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; max-width: 440px; margin: 16px auto 0; }
.chips.knob-row .btn { width: 100%; padding: 0 8px; white-space: nowrap; }

.chips.knob-row .home-btn { grid-column: 1 / -1; }
.chips.knob-row .home-btn span { font-weight: 400; color: var(--muted); margin-left: 6px; }

@media (min-width: 901px) { #knob.let-go { position: relative; top: auto; box-shadow: none; } }

/* "See it on your phone": the clock's phone pages in an iframe (phone_demo/) */
.pv-open { margin-top: 12px; }
.pv[hidden] { display: none !important; }
.pv-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pv-close { background: none; border: 0; color: var(--amber); font: 700 17px var(--font, inherit); cursor: pointer; padding: 8px 0; }
.pv-bar span { color: var(--muted); font-size: 14px; }
.pv-scr iframe { border: 0; display: block; background: #000; }
.pv-note { color: var(--muted); font-size: 14px; text-align: center; max-width: 34ch; margin: 10px auto 0; }
@media (min-width: 901px) {
  /* a phone over the right-hand column, beside the clock */
  .pv { position: fixed; z-index: 20; top: 0; bottom: 0; right: 0; left: calc(var(--margin) + (100vw - 2 * var(--margin) - var(--gap)) * 7 / 12 + var(--gap) / 2); background: var(--ground); justify-content: center; display: flex; flex-direction: column; align-items: center; padding: 4px 8px; box-shadow: -24px 0 32px -8px rgba(0, 0, 0, .9); }
  .pv-bar { width: 100%; max-width: 360px; }
  .pv-phone { --s: .8; width: calc(390px * var(--s) + 24px); height: calc(844px * var(--s) + 24px); border-radius: 46px; background: #0d0d0d; box-shadow: inset 0 0 0 2px #2b2b2b; padding: 12px; box-sizing: border-box; flex: 0 0 auto; }
  .pv-scr { width: calc(390px * var(--s)); height: calc(844px * var(--s)); border-radius: 34px; overflow: hidden; }
  .pv-scr iframe { width: 390px; height: 844px; transform: scale(var(--s)); transform-origin: 0 0; }
}
@media (max-width: 900px) {
  /* on a phone, no phone-in-a-phone: the pages fill the screen */
  .pv { position: fixed; inset: 0; z-index: 1000; background: #000; display: flex; flex-direction: column; }
  .pv-bar { flex: 0 0 auto; padding: max(env(safe-area-inset-top), 4px) 14px 4px; border-bottom: 1px solid #222; }
  .pv-phone, .pv-scr { flex: 1 1 auto; display: flex; min-height: 0; }
  .pv-scr iframe { width: 100%; height: 100%; }
  .pv-note { display: none; }
  body.pv-on { overflow: hidden; }
  .pv-open { margin-top: 6px; min-height: 36px; padding: 0 14px; font-size: 15px; }
  .stage.compact .pv-open { display: none; }
}

.demo-games { margin-top: 10px; }
@media (max-width: 900px) { .stage.compact .demo-games { display: none; } }
