:root { --ink: #2a2420; --paper: #f4f1ea; --wood: #c9a36b; --warn: #b8860b; --line: #d8d0c2; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--paper); color: var(--ink); font: 14px/1.35 system-ui, sans-serif; }
#view { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; }
#bar { position: fixed; top: 0; left: 0; right: 0; display: flex; gap: 12px; align-items: baseline; padding: 10px 14px; background: #f4f1eae6; border-bottom: 1px solid var(--line); }
#bar span { color: #6b6158; font-size: 13px; }
#bom { margin-left: auto; font-variant-numeric: tabular-nums; }
#tools { position: fixed; left: 14px; bottom: 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
#tools button[hidden], #tools .slider[hidden] { display: none; }
#steps { position: fixed; left: 14px; top: 56px; max-width: min(560px, calc(100vw - 320px)); display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 4px 16px #0001; }
#steps[hidden], #rails[hidden], #play[hidden], #phone[hidden], #alert[hidden] { display: none; }
#play { position: fixed; left: 14px; top: 56px; width: min(340px, calc(100vw - 28px)); padding: 10px 12px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 4px 16px #0001; }
#play-list { display: flex; flex-wrap: wrap; gap: 6px; }
#play-list button { font: inherit; font-size: 13px; min-height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; }
#play-list button[aria-pressed="true"] { background: #2a2420; color: #fff; }
#play-now { margin-top: 8px; }
#play-now p { margin: 4px 0 0; }
#play-beat { color: #6b6158; font-size: 12px; }
#play-waits { color: #9a3412; font-size: 13px; }
#play .illus { margin: 8px 0 0; color: #6b6158; font-size: 12px; }
#phone { position: fixed; right: 14px; bottom: 76px; width: 150px; height: 230px; border: 6px solid #2a2420; border-radius: 22px; background: #fff; display: flex; align-items: center; justify-content: center; padding: 12px; text-align: center; box-shadow: 0 4px 16px #0002; }
#alert { position: fixed; left: 50%; top: 56px; transform: translateX(-50%); padding: 8px 14px; border-radius: 18px; background: #c1121f; color: #fff; font-weight: 600; }
#rails { position: fixed; left: 14px; top: 56px; display: flex; flex-wrap: wrap; gap: 6px; max-width: calc(100vw - 320px); }
#rails button { font: inherit; display: flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 18px; background: #fff; cursor: pointer; }
#rails button[aria-pressed="false"] { opacity: 0.4; text-decoration: line-through; }
#rails i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
#steps button { font: inherit; min-width: 40px; min-height: 40px; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; }
#steps button:disabled { opacity: 0.35; cursor: default; }
#steps div { flex: 1; }
#step-of { color: #6b6158; font-size: 12px; margin-right: 6px; }
#steps p { margin: 4px 0 0; }
#tools button, .slider { font: inherit; padding: 8px 12px; min-height: 40px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); cursor: pointer; }
#tools button[aria-pressed="true"] { background: var(--ink); color: #fff; }
#tools button.primary { background: #c2410c; border-color: #c2410c; color: #fff; font-weight: 600; }   /* GM7: the first click shows the inside; white on it 5.2:1 */
#tools button.primary[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); }
.slider { display: flex; gap: 8px; align-items: center; cursor: default; }
#card { position: fixed; right: 14px; top: 56px; width: 280px; padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 4px 16px #0001; }
#card h3 { margin: 0 0 4px; font-size: 16px; }
#card .id { font-family: ui-monospace, monospace; color: #6b6158; }
#card .zoom { font: inherit; margin-top: 8px; min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; }
#card dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 8px 0 0; }
#card dt { color: #6b6158; }
#card dd { margin: 0; }
.badge { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.badge.PLACEHOLDER { background: #fde8b0; color: #7a5600; }
.badge.TYPICAL { background: #dceefc; color: #1d4f7a; }
.badge.ASSUMED { background: #ece7df; color: #5a5048; }
.badge.tier1 { background: #e2f0dc; color: #2d5a1e; }
.badge.tier2 { background: #e8e0f5; color: #4b2d7a; }
#card .src { color: #6b6158; font-size: 12px; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  #card { left: 8px; right: 8px; top: auto; bottom: 64px; width: auto; padding: 8px 12px; }
  #steps { left: 8px; right: 8px; top: auto; bottom: 64px; max-width: none; padding: 8px; }
  #rails { left: 8px; right: 8px; top: 64px; max-width: none; }
  #play { left: 8px; right: 8px; top: auto; bottom: 64px; width: auto; padding: 8px; }
  #play-list { flex-wrap: nowrap; overflow-x: auto; }   /* one swipeable row: the scene keeps its height */
  #play-list button { min-height: 30px; font-size: 12px; padding: 0 8px; flex: none; white-space: nowrap; }
  #phone { right: 8px; top: 96px; bottom: auto; width: 110px; height: 160px; font-size: 13px; }
  #alert { top: 100px; }
  #card h3 { font-size: 15px; display: inline; margin-right: 8px; }
  #card .id { display: inline; }
  #card dl { grid-template-columns: auto 1fr auto 1fr; margin-top: 4px; font-size: 13px; }
  #tools { left: 8px; right: 8px; bottom: 8px; flex-wrap: nowrap; overflow-x: auto; }   /* one row, swipe for more */
  #tools button, .slider { flex: none; }
  .slider input { width: 90px; }
  #bar { flex-wrap: wrap; gap: 2px 10px; }
  #bom { margin-left: 0; width: 100%; }
}
