/* Tinkerfair - paper-cut interface: cream cards, ink outlines, hard little shadows. */
:root {
  --ink: #2b3a4a; --ink2: #4c5b6c; --cream: #fff8ea; --card: #fffdf6; --table: #e9dfc9; --line: #e4d9bf;
  --red: #e86a6a; --yellow: #ffd35c; --teal: #7fd0c2; --blue: #6a8ee8; --green: #7cc86f; --orange: #f2a65a;
  --shadow: 0 3px 0 rgba(43, 58, 74, 0.9); --soft: 0 10px 28px rgba(43, 58, 74, 0.18);
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--table); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.35; overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; }
#park { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; touch-action: none; cursor: grab; }
body[data-tool="path"] #park, body[data-tool="ride"] #park, body[data-tool="stall"] #park, body[data-tool="scenery"] #park, body[data-tool="coaster"] #park { cursor: crosshair; }
body[data-tool="doze"] #park { cursor: not-allowed; }
#ui { position: fixed; inset: 0; pointer-events: none; user-select: none; -webkit-user-select: none; }
#ui > * { pointer-events: auto; }
.ic { display: inline-flex; width: 20px; height: 20px; flex: none; }
.ic svg { width: 100%; height: 100%; }
#fps { position: fixed; left: 12px; top: 70px; font: 12px ui-monospace, monospace; background: var(--ink); color: var(--cream); padding: 3px 8px; border-radius: 8px; opacity: 0.85; pointer-events: none; }

/* ------------------------------------------------------------ top bar */
#hud { position: absolute; top: 10px; left: 12px; right: 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; pointer-events: none; }
#hud > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 9px; background: var(--card); border: 2px solid var(--ink); border-radius: 16px; padding: 5px 14px 5px 7px; box-shadow: var(--shadow); min-width: 0; }
.brand .logo { width: 34px; height: 34px; display: block; animation: spin 14s linear infinite; }
body.paused .brand .logo { animation-play-state: paused; }
.brand strong { display: block; font-size: 17px; letter-spacing: 0.3px; line-height: 1.05; }
.brand .park { display: block; font-size: 13px; font-weight: 600; color: #46566a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.logo svg { width: 100%; height: 100%; display: block; }
@keyframes spin { to { transform: rotate(360deg); } }
.chips, .right { display: flex; align-items: center; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 44px; padding: 0 14px; background: var(--card); border: 2px solid var(--ink); border-radius: 14px; box-shadow: var(--shadow); font-size: 16px; font-weight: 700; transition: transform 0.08s; }
button.chip:hover { background: #fff; transform: translateY(-1px); }
button.chip:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.chip b { font-variant-numeric: tabular-nums; }
.chip.money .ic { color: #c98a12; }
.chip.money.neg b { color: #c43d3d; }
.chip.money.gain { animation: gain 0.7s; }
.chip.money.loss { animation: loss 0.7s; }
@keyframes gain { 30% { background: #c9f0bf; transform: scale(1.06); } }
@keyframes loss { 30% { background: #ffd1cc; transform: scale(0.96); } }
.chip.ring { --p: 50; width: 46px; padding: 0; justify-content: center; border-radius: 50%; font-size: 15px;
  background: radial-gradient(closest-side, var(--card) 70%, transparent 72%), conic-gradient(var(--green) calc(var(--p) * 1%), var(--line) 0); }
.chip.clock { gap: 8px; }
.chip.clock span { display: flex; flex-direction: column; line-height: 1.05; }
.chip.clock small { font-size: 12px; font-weight: 700; color: #46566a; }
.chip.clock b { font-size: 15px; }
body.paused .chip.clock { background: var(--yellow); }
.chip.menu { width: 46px; padding: 0; justify-content: center; }
.chip.cycle { display: none; }
.speeds { display: flex; background: var(--card); border: 2px solid var(--ink); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; height: 44px; }
.spd { border: 0; background: none; width: 42px; display: grid; place-items: center; color: var(--ink2); }
.spd + .spd { border-left: 1.5px solid var(--line); }
.spd:hover { background: #fff3d1; }
.spd.on { background: var(--ink); color: var(--cream); }

/* ------------------------------------------------------------ bottom dock */
#dock { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); width: min(880px, calc(100vw - 24px)); display: flex; flex-direction: column; gap: 7px; align-items: stretch; pointer-events: none; }
#dock > * { pointer-events: auto; }
#hint { align-self: center; max-width: 100%; background: var(--ink); color: #fff; padding: 7px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; text-align: center; margin-bottom: 5px; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25); }
#tray { display: flex; gap: 8px; align-items: stretch; justify-content: safe center; min-height: 112px; padding: 9px; background: var(--card); border: 2px solid var(--ink); border-radius: 18px; box-shadow: var(--shadow); overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
#tray.look, #tray.path, #tray.doze { min-height: 58px; }
.card { flex: none; width: 104px; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 5px 4px 6px; background: var(--cream); border: 2px solid var(--line); border-radius: 13px; text-align: center; transition: transform 0.08s, border-color 0.1s; }
.card:hover { border-color: var(--ink2); transform: translateY(-2px); }
.card.on { border-color: var(--ink); background: #fff1c2; box-shadow: 0 2px 0 var(--ink); }
.card .thumb { width: 56px; height: 56px; display: block; pointer-events: none; }
.card strong { font-size: 12px; line-height: 1.1; white-space: nowrap; }
.card em { font-style: normal; font-weight: 700; font-size: 12px; color: #8a5a00; }
.card small { font-size: 11px; color: #46566a; white-space: nowrap; }
.traynote { align-self: center; max-width: 330px; font-size: 13px; color: var(--ink2); padding: 0 8px; }
.traynote.big { max-width: none; display: flex; align-items: center; gap: 9px; font-size: 14.5px; font-weight: 600; color: var(--ink); }
.pieces { display: flex; gap: 6px; align-items: stretch; margin: auto; }
.piece { width: 68px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 6px 2px; background: var(--cream); border: 2px solid var(--ink); border-radius: 12px; box-shadow: 0 2px 0 var(--ink); }
.piece .ic { width: 28px; height: 28px; }
.piece small { font-size: 10.5px; line-height: 1.05; font-weight: 600; }
.piece:hover { background: #fff1c2; }
.piece:active { transform: translateY(2px); box-shadow: none; }
.piece.off { opacity: 0.38; border-color: var(--ink2); box-shadow: none; }
.piece.act { background: #e3ecff; }
.piece.done { background: #d5f2cd; }
#tabs { display: flex; gap: 0; background: var(--ink); border: 2px solid var(--ink); border-radius: 18px; box-shadow: var(--soft); padding: 4px; }
#tabs button { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 7px; height: 46px; border: 0; border-radius: 13px; background: none; color: #d9e2ec; font-weight: 700; font-size: 13.5px; }
#tabs button:hover { background: rgba(255, 255, 255, 0.1); }
#tabs button.on { background: var(--yellow); color: var(--ink); }
#tabs button[data-tab="doze"].on { background: var(--red); color: #fff; }

/* ------------------------------------------------------------ buttons, rows, meters */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 8px 16px; background: var(--cream); border: 2px solid var(--ink); border-radius: 13px; box-shadow: 0 2px 0 var(--ink); font-weight: 700; font-size: 14px; }
.btn:hover { background: #fff; }
.btn:active { transform: translateY(2px); box-shadow: none; }
.btn.primary { background: var(--yellow); }
.btn.primary:hover { background: #ffdf85; }
.btn.danger { background: #ffe1dc; color: #a12c2c; border-color: #a12c2c; box-shadow: 0 2px 0 #a12c2c; }
.btn.wide { align-self: center; white-space: nowrap; }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 4px 0; font-size: 13.5px; }
.row span { color: var(--ink2); }
.row b { font-variant-numeric: tabular-nums; text-align: right; }
.up, .row.up b { color: #2e8a3c; }
.down, .row.down b { color: #c43d3d; }
.row.total { border-top: 2px solid var(--line); margin-top: 4px; padding-top: 7px; font-size: 15px; }
.row.total span { color: var(--ink); font-weight: 700; }
.meters { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.meter { display: grid; grid-template-columns: minmax(0, 1fr) 104px 30px; align-items: center; gap: 8px; font-size: 12.5px; }
.meter span { color: var(--ink2); }
.meter .track { height: 11px; background: var(--line); border-radius: 99px; overflow: hidden; border: 1.5px solid var(--ink); }
.meter i { display: block; height: 100%; width: 0; background: var(--green); transition: width 0.3s; }
.meter.warm i { background: var(--orange); }
.meter.bad i { background: var(--red); }
.meter b { text-align: right; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.stepper { display: inline-flex; align-items: center; gap: 8px; }
.stepper button { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--ink); background: var(--cream); font-size: 19px; font-weight: 700; line-height: 1; box-shadow: 0 2px 0 var(--ink); padding: 0; }
.stepper button:active { transform: translateY(2px); box-shadow: none; }
.stepper b { min-width: 58px; text-align: center; font-size: 16px; font-variant-numeric: tabular-nums; }
.field { display: flex; justify-content: space-between; align-items: center; margin: 10px 0 4px; font-weight: 700; }
.toggle { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 0; border: 0; background: none; font-weight: 700; text-align: left; }
.toggle i { width: 42px; height: 24px; border-radius: 99px; background: var(--line); border: 2px solid var(--ink); position: relative; flex: none; transition: background 0.15s; }
.toggle i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink); transition: transform 0.15s; }
.toggle.on i { background: var(--green); }
.toggle.on i::after { transform: translateX(18px); }
.note { margin: 4px 0 8px; font-size: 12.5px; color: var(--ink2); }
.note:empty { display: none; }
.note.warn { color: #a3541a; background: #fff0d6; border-radius: 9px; padding: 6px 9px; }
.pair { display: flex; gap: 10px; flex-wrap: wrap; }
.pair .btn { flex: 1; white-space: nowrap; }
h4 { margin: 14px 0 6px; font-size: 12px; letter-spacing: 0.9px; text-transform: uppercase; color: var(--ink2); }

/* ------------------------------------------------------------ inspector drawer */
#drawer { position: absolute; top: 70px; right: 12px; width: 324px; max-height: calc(100vh - 70px - 16px); max-height: calc(100dvh - 70px - 16px); display: flex; flex-direction: column; background: var(--card); border: 2px solid var(--ink); border-radius: 18px; box-shadow: var(--shadow), var(--soft); overflow: hidden; animation: slidein 0.16s ease-out; }
#drawer[hidden], #modal[hidden] { display: none; }
@keyframes slidein { from { transform: translateX(16px); opacity: 0; } }
#drawer .head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 9px 9px 15px; background: var(--yellow); border-bottom: 2px solid var(--ink); }
#drawer h3 { margin: 0; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#drawer .x { width: 34px; height: 34px; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 50%; background: var(--cream); flex: none; }
#drawer .body { padding: 12px 15px 15px; overflow-y: auto; overscroll-behavior: contain; }
#drawer .body > div > .btn { width: 100%; margin-top: 9px; }
.hero { display: flex; gap: 12px; align-items: flex-start; }
.hero .thumb { width: 84px; height: 84px; flex: none; background: #eaf5df; border: 2px solid var(--line); border-radius: 14px; }
.hero > div { flex: 1; min-width: 0; }
.blurb { margin: 0 0 6px; font-size: 13px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 8px 0; }
.facts > div { background: var(--cream); border: 1.5px solid var(--line); border-radius: 11px; padding: 6px 9px; display: flex; flex-direction: column; }
.facts b { font-size: 15px; font-variant-numeric: tabular-nums; }
.facts span { font-size: 11px; color: var(--ink2); }
.thoughts, .tips { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.thoughts li, .tips li { font-size: 13px; padding: 6px 9px; background: var(--cream); border-radius: 10px; border-left: 4px solid var(--line); }
.thoughts li.up { border-left-color: var(--green); }
.thoughts li.down { border-left-color: var(--red); }
.thoughts.feed li { cursor: pointer; }
.tips li { border-left-color: var(--blue); }
.chart { display: flex; align-items: flex-end; gap: 4px; height: 92px; padding: 6px; background: var(--cream); border: 1.5px solid var(--line); border-radius: 11px; }
.chart .col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; min-width: 0; }
.chart .col i { display: block; width: 100%; max-width: 18px; border-radius: 4px 4px 2px 2px; background: var(--green); border: 1.5px solid var(--ink); }
.chart .col i.down { background: var(--red); }
.chart .col span { font-size: 9.5px; color: var(--ink2); }
.chart .note { margin: auto; }
.bigring { --p: 50; width: 120px; height: 120px; margin: 4px auto 12px; border-radius: 50%; display: grid; place-items: center; font-size: 38px; font-weight: 800; border: 2px solid var(--ink); box-shadow: var(--shadow);
  background: radial-gradient(closest-side, var(--card) 74%, transparent 76%), conic-gradient(var(--green) calc(var(--p) * 1%), var(--line) 0); }

/* ------------------------------------------------------------ toasts */
#toasts { position: absolute; top: 68px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; width: min(560px, calc(100vw - 24px)); pointer-events: none !important; }
.toast { background: var(--card); border: 2px solid var(--ink); border-left-width: 9px; border-radius: 12px; padding: 7px 14px; font-weight: 600; font-size: 13.5px; box-shadow: var(--soft); animation: drop 0.22s ease-out; transition: opacity 0.16s, transform 0.16s; max-width: 100%; }
.toast.good { border-left-color: #48a53a; }
.toast.warn { border-left-color: #e0862a; }
.toast.info { border-left-color: var(--blue); }
.toast.out { opacity: 0; transform: translateY(-8px); }
@keyframes drop { from { transform: translateY(-10px); opacity: 0; } }

/* ------------------------------------------------------------ dialogs */
#modal { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(43, 58, 74, 0.42); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); z-index: 10; }
.sheet { width: min(430px, 100%); max-height: 100%; overflow-y: auto; background: var(--card); border: 2.5px solid var(--ink); border-radius: 22px; box-shadow: 0 5px 0 var(--ink), var(--soft); padding: 22px; display: flex; flex-direction: column; gap: 10px; animation: pop 0.2s ease-out; }
@keyframes pop { from { transform: scale(0.94); opacity: 0; } }
.sheet.small { width: min(340px, 100%); }
.sheet.welcome { text-align: center; align-items: stretch; width: min(460px, 100%); }
.sheet h1 { margin: 0; font-size: 34px; letter-spacing: 0.5px; }
.sheet h2 { margin: 0; font-size: 21px; }
.sheet .tag { margin: 0 0 4px; color: var(--ink2); font-size: 14.5px; }
.logo.big { width: 84px; height: 84px; margin: 0 auto; animation: spin 14s linear infinite; }
.howto { list-style: none; margin: 4px 0 8px; padding: 0; display: flex; flex-direction: column; gap: 7px; text-align: left; }
.howto li { display: flex; gap: 11px; align-items: center; background: var(--cream); border: 1.5px solid var(--line); border-radius: 12px; padding: 8px 11px; font-size: 13.5px; }
.howto .ic { width: 24px; height: 24px; color: #b5562f; }
.fine { margin: 2px 0 0; font-size: 11.5px; color: var(--ink2); }
.ask { margin: 0 0 6px; font-size: 16px; font-weight: 700; }
.sheet.menu .btn { width: 100%; }

/* ------------------------------------------------------------ phone */
/* desktop: the drawer never sits on top of the dock */
@media (min-width: 721px) {
  #ui:has(#drawer:not([hidden])) #dock { left: calc((100vw - 348px) / 2); width: min(880px, calc(100vw - 348px - 24px)); }
  #ui:has(#drawer:not([hidden])) #toasts { left: calc((100vw - 348px) / 2); width: min(560px, calc(100vw - 348px - 24px)); }
}
@media (max-width: 720px) {
  html, body { font-size: 13.5px; }
  #hud { top: max(6px, env(safe-area-inset-top)); left: 6px; right: 6px; gap: 5px; }
  .brand { display: none; }
  .chips, .right { gap: 5px; }
  .chip { height: 40px; padding: 0 9px; font-size: 14px; gap: 5px; border-radius: 12px; }
  .chip .ic { width: 17px; height: 17px; }
  .chip.ring { width: 40px; font-size: 13.5px; }
  .chip.clock .ic { display: none; }
  .chip.clock b { font-size: 13.5px; }
  .chip.menu { width: 40px; }
  .speeds { display: none; }
  .chip.cycle { display: inline-flex; padding: 0 8px; gap: 3px; min-width: 54px; justify-content: center; }
  #dock { left: 0; right: 0; bottom: 0; transform: none; width: 100%; gap: 5px; padding: 0 6px max(6px, env(safe-area-inset-bottom)); }
  #hint { font-size: 13px; padding: 5px 12px; border-radius: 12px; margin-bottom: 2px; }
  #tray { min-height: 104px; padding: 7px; border-radius: 15px; justify-content: flex-start; }
  #tray.coaster { justify-content: center; flex-wrap: wrap; }
  #tray.look, #tray.path, #tray.doze { min-height: 50px; justify-content: center; }
  .traynote.big { font-size: 13px; }
  .card { width: 92px; }
  .pieces { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; width: 100%; }
  .piece { width: auto; min-height: 50px; padding: 4px 1px; }
  .piece .ic { width: 23px; height: 23px; }
  .piece small { font-size: 9.5px; }
  #tabs { border-radius: 15px; padding: 3px; }
  #tabs button { flex-direction: column; gap: 1px; height: 50px; font-size: 9.5px; border-radius: 11px; }
  #tabs button .ic { width: 21px; height: 21px; }
  #drawer { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 62vh; max-height: 62dvh; border-radius: 20px 20px 0 0; border-bottom: 0; animation: slideup 0.18s ease-out; z-index: 5; padding-bottom: env(safe-area-inset-bottom); }
  @keyframes slideup { from { transform: translateY(24px); opacity: 0; } }
  #toasts { top: 54px; }
  .toast { font-size: 12.5px; padding: 6px 11px; }
  .sheet { padding: 18px 16px; }
  .sheet h1 { font-size: 29px; }
  .logo.big { width: 66px; height: 66px; }
}
/* narrow phones: the whole top bar (money, guests, rating, clock, speed, menu) fits 360-430 px */
@media (max-width: 430px) {
  #hud { left: 5px; right: 5px; gap: 4px; }
  .chips, .right { gap: 4px; }
  .chip { padding: 0 7px; gap: 4px; font-size: 13.5px; }
  .chip .ic { width: 16px; height: 16px; }
  .chip.ring, .chip.menu { width: 38px; }
  .chip.cycle { padding: 0 6px; min-width: 48px; }
}
@media (max-width: 360px) { .chip.clock small { display: none; } .chip.money .ic { display: none; } }
@media (max-width: 340px) { .chip { padding: 0 6px; } .chips .chip:nth-child(2) .ic, .chip.cycle .ic { display: none; } .chip.cycle { min-width: 34px; } }
@media (prefers-reduced-motion: reduce) { .brand .logo, .logo.big { animation: none; } }

/* --- scenarios --- */
#tabs [hidden], .chip.scn[hidden], #tray [data-piece][hidden] { display: none; }
.chip.scn .ic { color: #c98a12; }
.chip.scn .short { display: none; }
.chip.scn.late { background: var(--yellow); }
.chip.scn.won { background: var(--green); }
.chip.scn.won.gold { background: var(--yellow); }
.chip.scn.won.silver { background: #dfe6ee; }
.chip.scn.won.bronze { background: #f0c9a4; }
.chip.scn.lost { background: #e9e2d2; }
.sheet.scn { width: min(800px, 100%); }
.scn-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.scn-card { position: relative; display: flex; gap: 12px; align-items: flex-start; min-height: 116px; padding: 10px; text-align: left; background: var(--cream); border: 2px solid var(--ink); border-radius: 16px; box-shadow: var(--shadow); }
.scn-card:hover:not([disabled]) { background: #fff; }
.scn-card:active:not([disabled]) { transform: translateY(2px); box-shadow: none; }
.scn-card:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.scn-card.locked { opacity: 0.62; cursor: not-allowed; filter: grayscale(0.7); }
.scn-card .pv { width: 132px; height: 96px; flex: none; border: 2px solid var(--ink); border-radius: 10px; background: #d3e4b4; }
.scn-card .free-pv { display: grid; place-items: center; background: #fff3d1; }
.scn-card .free-pv svg { width: 62px; height: 62px; }
.scn-card .tx { min-width: 0; display: flex; flex-direction: column; gap: 3px; padding-right: 24px; }
.scn-card strong { font-size: 16px; }
.scn-card p { margin: 0; font-size: 12.5px; color: var(--ink2); }
.scn-card small { font-size: 12px; font-weight: 700; }
.scn-card .lock { font-style: normal; font-size: 12px; font-weight: 700; color: #a3541a; }
.scn-card .got { position: absolute; top: 6px; right: 8px; line-height: 0; }
.pips { display: inline-flex; gap: 3px; }
.pips i { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--ink); background: var(--cream); }
.pips i.on { background: var(--orange); }
.sheet.win { text-align: center; align-items: stretch; }
.sheet.win .medal { margin: 0 auto; line-height: 0; animation: pop 0.45s ease-out; }
.sheet.win h2 { font-size: 28px; }
.wins { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.wins > div { display: flex; flex-direction: column; background: var(--cream); border: 1.5px solid var(--line); border-radius: 12px; padding: 8px 4px; }
.wins b { font-size: 20px; font-variant-numeric: tabular-nums; }
.wins span { font-size: 11.5px; color: var(--ink2); }
.sheet.brief { text-align: left; }
.goallist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.goallist li { display: flex; gap: 9px; align-items: center; background: var(--cream); border: 1.5px solid var(--line); border-radius: 11px; padding: 8px 10px; font-size: 13.5px; font-weight: 600; }
.goallist .ic { color: #48a53a; }
.goals .scn-days { margin: 0 0 6px; font-weight: 700; }
.goal { margin: 8px 0; padding: 9px 11px; background: var(--cream); border: 1.5px solid var(--line); border-radius: 12px; }
.goal .gn { display: flex; gap: 8px; align-items: flex-start; font-weight: 700; font-size: 13.5px; }
.goal .mk { width: 20px; height: 20px; flex: none; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 50%; background: #fff; font-size: 12px; line-height: 1; }
.goal.done .mk { background: var(--green); }
.goal .gb { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; margin-top: 7px; }
.goal .track { height: 11px; background: var(--line); border-radius: 99px; overflow: hidden; border: 1.5px solid var(--ink); }
.goal .track i { display: block; height: 100%; width: 0; background: var(--green); transition: width 0.3s; }
.goal .v { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--ink2); text-align: right; }
.medalrow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.md { display: flex; flex-direction: column; align-items: center; padding: 6px 2px; background: var(--cream); border: 1.5px solid var(--line); border-radius: 11px; }
.md span { line-height: 0; }
.md small { font-size: 11px; color: var(--ink2); }
.md.past { opacity: 0.4; }
.md.got { background: var(--yellow); border-color: var(--ink); }
@media (max-width: 720px) {
  .scn-list { grid-template-columns: 1fr; }
  .scn-card { min-height: 100px; padding: 8px; gap: 10px; }
  .scn-card .pv { width: 96px; height: 70px; }
  .scn-card .free-pv svg { width: 46px; height: 46px; }
  .chip.scn .long { display: none; }
  .chip.scn .short { display: inline; }
  #hud .chip.scn { position: absolute; left: 0; top: 46px; }
  body.scn #toasts { top: 98px; }
}

/* --- rides (coaster pieces, lap chart, upkeep, mechanics) --- */
@media (min-width: 721px) { .pieces { flex-wrap: wrap; justify-content: center; max-width: 100%; } .piece { width: 60px; } .piece small { font-size: 10px; } }
.toast.act { display: flex; align-items: center; gap: 12px; pointer-events: auto !important; }
.toast-btn { flex: none; min-height: 40px; min-width: 88px; padding: 6px 12px; background: var(--yellow); border: 2px solid var(--ink); border-radius: 11px; box-shadow: 0 2px 0 var(--ink); font-weight: 800; font-size: 13px; }
.toast-btn:active { transform: translateY(2px); box-shadow: none; }
.lapchart { display: block; width: 100%; height: auto; aspect-ratio: 620 / 220; margin-top: 6px; border: 2px solid var(--line); border-radius: 12px; background: #fffaf0; touch-action: manipulation; cursor: pointer; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; margin: 4px 0 2px; font-size: 11.5px; color: var(--ink2); }
.legend i { display: inline-block; width: 16px; height: 4px; border-radius: 3px; }
.legend .lv { background: #3b8fd9; } .legend .lg { background: #e2574c; } .legend .ll { background: #2fa58a; }
.picked .field { margin: 4px 0; }
.advice li { border-left-color: var(--orange); }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.swatch { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--ink); box-shadow: 0 2px 0 var(--ink); }
.swatch.on { outline: 3px solid var(--yellow); outline-offset: 1px; transform: translateY(-1px); }
.nameIn { flex: 1; min-width: 0; max-width: 210px; min-height: 42px; margin-left: 12px; padding: 6px 10px; font: inherit; font-weight: 700; color: var(--ink); background: #fffdf6; border: 2px solid var(--ink); border-radius: 11px; }
.namef { margin-top: 2px; }
.ops h4 { margin-top: 14px; }
#drawer .body > div > .btn[hidden], .ops .btn[hidden] { display: none; }
@media (max-width: 720px) {
  .pieces { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
  .piece { width: auto; min-height: 52px; padding: 4px 0; border-radius: 10px; }
  .piece .ic { width: 22px; height: 22px; }
  .piece small { font-size: 8.5px; letter-spacing: -0.2px; }
  .toast.act { gap: 8px; }
}
/* --- interface: tokens, focus, status shapes, panels, guide, settings, sharing, photo mode --- */
:root { --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --t-sm: 12.5px; --t-md: 14px; --t-lg: 17px; --dur: 0.16s; --ease: cubic-bezier(0.2, 0.8, 0.2, 1); --focus: #1f5fe0; --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px); --sb: env(safe-area-inset-bottom, 0px); --st: env(safe-area-inset-top, 0px); }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
#tabs button:focus-visible { outline: 3px solid #fff; outline-offset: -4px; }
.card:focus-visible, .piece:focus-visible, .toggle:focus-visible { outline-offset: 1px; }
.btn.small { min-height: 40px; padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: 0.45; cursor: default; box-shadow: none; }
.spd, .stepper button, #drawer .x { min-width: 40px; }
.stepper button { width: 40px; height: 40px; }
/* status is never colour alone: every state also has a word, a glyph or a shape */
.toggle::after { content: "Off"; margin-left: auto; font-size: 12px; font-weight: 800; color: var(--ink2); min-width: 26px; text-align: right; }
.toggle.on::after { content: "On"; color: #2e6b3a; }
.meter b::before { content: "• "; color: var(--ink2); }
.meter.good b::before { content: "✓ "; color: #2e8a3c; }
.meter.bad b::before { content: "! "; color: #c43d3d; }
.meter { grid-template-columns: minmax(0, 1fr) 96px 46px; }
.toast::before { font-weight: 800; margin-right: 6px; }
.toast.good::before { content: "✓"; color: #2e8a3c; }
.toast.warn::before { content: "!"; color: #c4631a; }
.toast.info::before { content: "i"; color: #3a62c9; }
.thoughts:not(.talk) li.up::before { content: "▲ "; color: #2e8a3c; font-size: 10px; }
.thoughts:not(.talk) li.down::before { content: "▼ "; color: #c43d3d; font-size: 10px; }
.thoughts.talk li { display: flex; justify-content: space-between; gap: 10px; }
.thoughts.talk li b { flex: none; font-variant-numeric: tabular-nums; color: var(--ink2); }
.thoughts.talk li.up span { color: #1f6b30; }
.thoughts.talk li.down span { color: #a12c2c; }
/* panels that explain */
canvas.chart { display: block; width: 100%; height: auto; aspect-ratio: 640 / 260; padding: 0; background: var(--card); gap: 0; }
.insight h4:first-child { margin-top: 12px; }
.pc { font-weight: 800; }
.pc.dear { color: #a12c2c; } .pc.more { color: #8a5a00; } .pc.fair { color: #2e6b3a; }
.moodline { display: flex; align-items: baseline; gap: 10px; margin: 2px 0 6px; }
.moodline b { font-size: 22px; } .moodline span { color: var(--ink2); font-size: 13px; }
.parts { display: flex; flex-direction: column; gap: 4px; margin: 6px 0 10px; }
.part .meter { margin: 0; }
.note.advice { margin: 2px 0 6px; color: var(--ink); background: #eef4ff; border-radius: 9px; padding: 5px 9px; }
.msglog { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.msg { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 7px 9px; background: var(--cream); border-radius: 10px; border-left: 4px solid var(--line); font-size: 13px; }
.msg i { font-style: normal; font-weight: 800; text-align: center; }
.msg.good { border-left-color: #48a53a; } .msg.warn { border-left-color: #e0862a; } .msg.info { border-left-color: var(--blue); }
.msg small { display: block; color: var(--ink2); font-size: 11.5px; margin-top: 1px; }
/* bell, pause state, drawer grip, tooltips */
.chip.bell { position: relative; width: 46px; padding: 0; justify-content: center; }
.chip.bell b { position: absolute; top: -7px; right: -7px; min-width: 21px; height: 21px; padding: 0 4px; border-radius: 11px; background: var(--red); color: #fff; border: 2px solid var(--ink); font-size: 11px; display: grid; place-items: center; line-height: 1; }
.chip.bell.has { animation: bellring 0.7s var(--ease); }
@keyframes bellring { 25% { transform: rotate(-14deg); } 55% { transform: rotate(11deg); } 80% { transform: rotate(-5deg); } }
#ui > #pausebar { position: absolute; top: 70px; left: 12px; display: none; align-items: center; gap: 8px; padding: 6px 14px 6px 10px; background: var(--yellow); border: 2px solid var(--ink); border-radius: 999px; box-shadow: var(--shadow); font-size: 13.5px; pointer-events: none; }
#pausebar b { font-size: 14px; letter-spacing: 0.4px; text-transform: uppercase; } #pausebar span { color: var(--ink2); font-size: 12px; } #pausebar .ic { width: 16px; height: 16px; }
body.paused #ui > #pausebar { display: inline-flex; }
body.paused #toasts { top: 112px; }
#drawer .grab { display: none; }
#tip { position: fixed; z-index: 12; max-width: min(330px, calc(100vw - 16px)); background: var(--ink); color: #fff; font-size: 12.5px; line-height: 1.35; padding: 7px 11px; border-radius: 10px; pointer-events: none !important; box-shadow: var(--soft); }
/* the guide */
#coach { position: fixed; z-index: 6; width: min(320px, calc(100vw - 16px)); background: #fff; border: 2.5px solid var(--ink); border-radius: 16px; box-shadow: 0 4px 0 var(--ink), var(--soft); padding: 9px 12px 10px; }
#coach::after { content: ""; position: absolute; left: var(--ax, 50%); width: 14px; height: 14px; background: #fff; border: 2.5px solid var(--ink); transform: translateX(-50%) rotate(45deg); display: none; }
#coach[data-side="a"]::after { display: block; bottom: -9px; border-left: 0; border-top: 0; }
#coach[data-side="b"]::after { display: block; top: -9px; border-right: 0; border-bottom: 0; }
#coach.ok { background: #e8f8e1; }
#coach .ctop { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 11.5px; color: var(--ink2); }
#coach .dots { letter-spacing: 1px; font-size: 10px; color: var(--ink2); } #coach .dots .c { color: var(--ink); }
#coach h5 { margin: 3px 0 2px; font-size: 16px; }
#coach p { margin: 0 0 7px; font-size: 13.5px; line-height: 1.35; }
#coach .cbtn { display: flex; gap: 6px; flex-wrap: wrap; }
#coach .cbtn .btn { flex: 1; white-space: nowrap; padding: 6px 8px; }
#ui > #coachring { position: fixed; z-index: 5; pointer-events: none; border: 3px dashed var(--ink); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.92), 0 0 0 7px rgba(255, 190, 40, 0.75); animation: ringpulse 1.3s ease-in-out infinite; }
@keyframes ringpulse { 50% { box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.92), 0 0 0 11px rgba(255, 190, 40, 0.35); } }
/* settings, keys, sharing */
.sheet.settings, .sheet.share, .sheet.keys { width: min(470px, 100%); }
.slider { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0 12px; font-weight: 700; }
.slider > span { grid-column: 1; grid-row: 1; } .slider > output { grid-column: 2; grid-row: 1; font-variant-numeric: tabular-nums; color: var(--ink2); }
.slider > input[type="range"] { grid-column: 1 / 3; grid-row: 2; width: 100%; height: 40px; margin: 0; accent-color: var(--ink); }
.slider.name { grid-template-columns: 1fr; gap: 4px; } .slider.name > span, .slider.name > input { grid-column: 1; grid-row: auto; }
.textin, .codebox { width: 100%; font: inherit; font-size: 14px; color: var(--ink); background: #fff; border: 2px solid var(--ink); border-radius: 12px; padding: 8px 11px; }
.textin { min-height: 42px; }
.codebox { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; resize: vertical; word-break: break-all; min-height: 72px; }
.msg.bad, p.msg.bad { color: #a12c2c; font-weight: 700; margin: 0; } p.msg { margin: 0; min-height: 0; font-size: 13px; } p.msg:empty { display: none; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 2px 0; align-items: center; font-size: 13.5px; }
.keys dt, .keys dd { margin: 0; } kbd { font: 700 12.5px ui-monospace, Menlo, Consolas, monospace; background: var(--cream); border: 1.5px solid var(--ink); border-radius: 7px; padding: 2px 7px; box-shadow: 0 2px 0 var(--ink); white-space: nowrap; }
.menugrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; } .menugrid .btn { padding: 8px 10px; font-size: 13.5px; }
.pair.more .btn { font-size: 13.5px; padding: 8px 8px; }
.sheet.sum, .howto.sum { margin: 0; } .howto.sum li { font-weight: 600; }
.titlelogo { display: block; width: 132px; height: 116px; margin: 0 auto -2px; }
/* photo mode: only the picture, and a small bar */
#ui > #photobar { position: absolute; left: 50%; bottom: max(14px, var(--sb)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 4; width: max-content; max-width: calc(100vw - 16px); pointer-events: none; }
#photobar > * { pointer-events: auto; }
#photobar .phint, #photobar .pmsg { background: var(--ink); color: #fff; padding: 5px 13px; border-radius: 999px; font-size: 13px; font-weight: 600; text-align: center; }
#photobar .pmsg:empty { display: none; } #photobar .pmsg .btn { margin-left: 6px; }
#photobar .pair { flex-wrap: nowrap; } #photobar .pair .btn { min-height: 46px; padding: 8px 18px; }
body.photo #hud, body.photo #dock, body.photo #drawer, body.photo #toasts, body.photo #pausebar, body.photo #coach, body.photo #coachring, body.photo #tip, body.photo .chip.bell { display: none !important; }
.flashfx { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none !important; }
.flashfx.go { animation: flashgo 0.35s ease-out; }
@keyframes flashgo { 0% { opacity: 0.85; } 100% { opacity: 0; } }
/* large text: the words grow, the layout makes room */
body.big .row, body.big .note, body.big .blurb, body.big .thoughts li, body.big .tips li, body.big .meter, body.big .msg, body.big .facts span, body.big .insight li, body.big .keys, body.big .howto li { font-size: 16.5px; }
body.big .meter b, body.big .toggle, body.big .btn, body.big .field, body.big .slider { font-size: 16px; }
body.big .fine, body.big .msg small, body.big .traynote, body.big #coach p, body.big #tip { font-size: 15px; }
body.big #hint, body.big .toast, body.big .ask { font-size: 16.5px; }
body.big #coach h5, body.big h4 { font-size: 15px; } body.big .facts b { font-size: 17px; }
body.big .card { width: 122px; } body.big .card strong, body.big .card em { font-size: 14px; } body.big .card small { font-size: 12.5px; } body.big .piece small { font-size: 12px; }
body.big #tabs button { font-size: 15px; } body.big #drawer { width: 372px; }
body.big #drawer h3 { font-size: 18px; } body.big .sheet h2 { font-size: 24px; }
/* calm: nothing moves unless the player moves it */
body.calm *, body.calm *::before, body.calm *::after { animation-duration: 0.001s !important; animation-iteration-count: 1 !important; transition-duration: 0.001s !important; scroll-behavior: auto !important; }
body.nohints #hint { display: none; }

@media (min-width: 721px) {
  #ui:has(#drawer:not([hidden])) #pausebar { left: 12px; }
}
@media (max-width: 720px) {
  #hud { left: max(6px, var(--sl)); right: max(6px, var(--sr)); }
  .chip.ring, .chip.menu { width: 40px; }
  .chip.bell { position: fixed; top: calc(max(6px, var(--st)) + 46px); right: max(6px, var(--sr)); width: 44px; height: 44px; z-index: 3; }
  #ui > #pausebar { top: calc(max(6px, var(--st)) + 48px); left: max(6px, var(--sl)); }
  #toasts { left: max(6px, var(--sl)); transform: none; width: calc(100vw - 66px); align-items: flex-start; }
  body.paused #toasts { top: calc(max(6px, var(--st)) + 96px); }
  #drawer .grab { display: block; position: absolute; left: 0; right: 0; top: 5px; height: 6px; z-index: 1; pointer-events: none; }
  #drawer .grab i { display: block; width: 46px; height: 5px; border-radius: 9px; background: rgba(43, 58, 74, 0.5); margin: 0 auto; }
  #drawer .head { position: relative; padding-top: 17px; touch-action: none; cursor: grab; }
  #drawer.tall { max-height: 88vh; max-height: 88dvh; }
  #dock { padding-left: max(6px, var(--sl)); padding-right: max(6px, var(--sr)); }
  .sheet { max-height: calc(100dvh - 24px); }
  #coach { width: min(330px, calc(100vw - 16px)); }
  body.big #tabs button { font-size: 10.5px; } body.big .card { width: 112px; } body.big #drawer { width: 100%; }
}
@media (max-width: 430px) {
  .chip.ring, .chip.menu { width: 40px; }
  #hud { gap: 3px; }
  .menugrid .btn { padding: 8px 6px; font-size: 13px; }
}
/* a phone on its side: the dock shrinks so the park stays in view */
@media (max-height: 520px) and (orientation: landscape) {
  .brand { display: none; }
  #hud { top: max(4px, var(--st)); left: max(8px, var(--sl)); right: max(8px, var(--sr)); }
  .chip, .speeds { height: 38px; } .chip.ring, .chip.menu, .chip.bell { width: 42px; height: 38px; }
  .chip.bell { top: calc(max(4px, var(--st)) + 42px); right: max(8px, var(--sr)); height: 42px; width: 42px; }
  #ui > #pausebar { top: calc(max(4px, var(--st)) + 44px); left: max(8px, var(--sl)); }
  #toasts { top: 48px; } body.paused #toasts { top: 92px; }
  #dock { width: min(880px, calc(100vw - 16px - var(--sl) - var(--sr))); bottom: max(4px, var(--sb)); gap: 3px; padding: 0; }
  #hint { font-size: 12px; padding: 3px 12px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #tray { min-height: 74px; padding: 5px; } #tray.look, #tray.path, #tray.doze { min-height: 42px; } #tray.coaster { flex-wrap: nowrap; }
  .card { width: 82px; padding: 3px 3px 4px; } .card .thumb { width: 38px; height: 38px; } .card small { display: none; }
  .pieces { display: flex; gap: 5px; width: auto; } .piece { width: 56px; min-height: 0; padding: 3px 1px; } .piece .ic { width: 20px; height: 20px; } .piece small { font-size: 9.5px; }
  #tabs { padding: 3px; border-radius: 13px; } #tabs button { flex-direction: row; height: 38px; font-size: 12px; gap: 4px; } #tabs button .ic { width: 16px; height: 16px; }
  #drawer { top: calc(max(4px, var(--st)) + 46px); right: max(8px, var(--sr)); max-height: calc(100dvh - 54px); width: 300px; border-radius: 16px; border-bottom: 2px solid var(--ink); }
  #drawer .grab { display: none; } #drawer .head { padding-top: 9px; }
  #ui:has(#drawer:not([hidden])) #dock { left: calc((100vw - 320px) / 2); width: min(880px, calc(100vw - 320px - 16px)); }
  .sheet { padding: 14px; gap: 7px; } .sheet h1 { font-size: 24px; } .sheet.welcome .howto { display: none; } .titlelogo { width: 90px; height: 79px; }
  #coach { padding: 7px 10px 8px; } #coach p { font-size: 12.5px; margin-bottom: 5px; } #coach h5 { font-size: 14.5px; }
  body.big #tabs button { font-size: 12px; } body.big .card { width: 100px; }
}
/* --- interface: size fixes found by the layout sweep --- */
#drawer .x { width: 40px; height: 40px; }
.card { width: 112px; } .card strong { font-size: 11.5px; letter-spacing: -0.1px; }
@media (max-width: 720px) { .card { width: 100px; } }
body.big .card { width: 134px; } body.big .card strong, body.big .card em { font-size: 14px; }
@media (max-width: 720px) { body.big .card { width: 124px; } }
@media (max-height: 520px) and (orientation: landscape) { .card { width: 96px; } body.big .card { width: 112px; } #tabs button { height: 40px; } .chip, .speeds { height: 40px; } .chip.ring, .chip.menu { height: 40px; } .chip.bell { height: 42px; } }
.card strong { white-space: normal; line-height: 1.1; }
@media (max-width: 720px) { body.big #tabs button { font-size: 10px; padding: 0; letter-spacing: -0.2px; min-width: 0; } }
@media (max-height: 520px) and (orientation: landscape) { .speeds { height: 44px; } .spd { height: 40px; } }
@media (max-height: 520px) and (orientation: landscape) { #ui:has(#drawer:not([hidden])) #tabs button { position: relative; } #ui:has(#drawer:not([hidden])) #tabs button > span:not(.ic) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } }
@media (max-height: 520px) and (orientation: landscape) { body.big #drawer { width: 300px; } }
/* --- rides: staff cards --- */
#tray.staff .card { width: 128px; }
#tray.staff .card strong { white-space: nowrap; font-size: 12.5px; }
