/* =====================================================================
   Level It! only (style.css holds the parts shared with Back It In! and
   Hook It Up!; the HUD, toasts, hint card and tray follow Hook It Up!)
   ===================================================================== */
:root {
  --ink: #26313a;
  --bar: rgba(38, 49, 58, 0.92);
  --hbtn: #3a464f;
  --orange: #f28c28;
  --yellow: #f2c230;
  --good: #4cc764;
  --bad: #e5483b;
  --focus: #3fe0ff;
  --font: ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, sans-serif;
  --tray-w: 300px;
}

#stage { display: flex; flex-direction: column; font-family: var(--font); background: #7cb555; }

/* ---------- HUD bar (same look as the Back It In! canvas top bar) ---------- */
#hud {
  position: relative; z-index: 3; display: flex; align-items: center; gap: 8px; min-height: 56px;
  padding: 0 max(10px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  background: var(--bar); color: #fff; flex-shrink: 0;
}
#hud[hidden] { display: none; }
#hud .title { font-weight: 700; font-size: 20px; white-space: nowrap; }
#hud .stats { display: flex; gap: 26px; margin-left: auto; align-items: baseline; white-space: nowrap; }
#hud .stat { font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; }
#hud .stat small { font-weight: 600; font-size: 15px; color: #b9c4cc; margin-right: 5px; }
#hud .stat.warn b { color: #ff8a7a; }
#hud .stat .short { display: none; }
#hud .hstars { display: flex; gap: 4px; margin: 0 6px 0 16px; }
#hud .hstars svg { width: 22px; height: 22px; }
#hud #topbtns { position: static; display: flex; gap: 8px; }
#topbtns .hbtn.hint-glow, .ctl.hint-glow { outline: 4px solid var(--yellow); outline-offset: 2px; }
#hud.touch { min-height: 64px; }
#overlay .wordmark .w1 { white-space: nowrap; }
@media (max-width: 480px) {
  #overlay .app-icon { width: 84px; height: 84px; }
  #overlay .wordmark .w1 { font-size: 40px; }
  #overlay .wordmark .w2 { font-size: 48px; }
}
@media (max-width: 900px) {
  #hud .stats { gap: 12px; }
  #hud .title { font-size: 15px; }
  #hud .stat { font-size: 14px; }
  #hud .stat small { font-size: 11px; }
  #hud .hstars svg { width: 16px; height: 16px; }
}
@media (max-width: 760px) {
  #hud .stat .long { display: none; }
  #hud .stat .short { display: inline; }
}
@media (max-width: 600px) {
  #hud { flex-wrap: wrap; padding: 0; gap: 0; }
  #hud #topbtns { order: 1; width: 100%; justify-content: flex-end; padding: 6px max(10px, env(safe-area-inset-right)); box-sizing: border-box; }
  #hud .title, #hud .stats, #hud .hstars { order: 2; height: 30px; display: flex; align-items: center; background: rgba(0,0,0,0.18); }
  #hud .title { padding-left: 16px; padding-right: 14px; font-size: 14px; font-weight: 800; }
  #hud .stats { margin: 0; }
  #hud .hstars { flex: 1; justify-content: flex-end; padding-right: 16px; margin: 0; }
  #hud .stat.t small { display: none; }
}
#hud .hbtn.home {
  flex: none; width: 40px; height: 40px; display: grid; place-items: center; padding: 0; margin-right: 4px;
  color: #dfe6eb; background: #3a464f; border: 0; border-radius: 10px; cursor: pointer; touch-action: none;
}
#hud .hbtn.home svg { width: 22px; height: 22px; }
#hud .hbtn.home:active { transform: translateY(1px); filter: brightness(0.9); }
#hud.touch .hbtn.home { width: 48px; height: 48px; border-radius: 12px; }
#hud.touch .hbtn.home svg { width: 26px; height: 26px; }
@media (max-width: 600px) {
  #hud .hbtn.home { order: 1; margin: 6px 0 6px max(10px, env(safe-area-inset-left)); }
  #hud #topbtns { width: auto; flex: 1; padding-left: 8px; }
  #hud.touch #topbtns .hbtn { width: 46px; height: 46px; }
  #hud.touch #topbtns { gap: 6px; }
}
#hud .hbtn.home:focus-visible, #topbtns .hbtn:focus-visible, .ctl:focus-visible, .sec-head:focus-visible, .action-menu button:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 2px;
}

/* ---------- Play area: two views + tray ---------- */
#play { position: relative; flex: 1; min-height: 0; display: flex; }
#play[hidden] { display: none; }
/* The views sit on Back It In!'s speckled grass, like its campsites. */
#views-wrap {
  position: relative; flex: 1; min-width: 0; min-height: 0; overflow: hidden; background-color: #7cb555;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='128' height='128'%3E%3Cg fill='rgba(60,110,40,0.35)'%3E%3Ccircle cx='12' cy='20' r='1.6'/%3E%3Ccircle cx='54' cy='9' r='1.3'/%3E%3Ccircle cx='97' cy='31' r='1.8'/%3E%3Ccircle cx='33' cy='61' r='1.2'/%3E%3Ccircle cx='78' cy='70' r='1.7'/%3E%3Ccircle cx='118' cy='88' r='1.4'/%3E%3Ccircle cx='21' cy='104' r='1.6'/%3E%3Ccircle cx='63' cy='117' r='1.3'/%3E%3Ccircle cx='104' cy='122' r='1.2'/%3E%3C/g%3E%3Cg fill='rgba(170,215,120,0.35)'%3E%3Ccircle cx='40' cy='34' r='1.2'/%3E%3Ccircle cx='86' cy='50' r='1.1'/%3E%3Ccircle cx='8' cy='80' r='1.2'/%3E%3Ccircle cx='50' cy='92' r='1'/%3E%3Ccircle cx='120' cy='12' r='1.1'/%3E%3C/g%3E%3C/svg%3E");
}
#views-wrap { display: flex; flex-direction: column; }
#views {
  flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 8px;
  box-sizing: border-box; align-content: center;
}
.view { margin: 0; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 6px; }
.view svg {
  display: block; width: 100%; flex: 1; min-height: 0; aspect-ratio: 400 / 250; border-radius: 14px; background: #cfe6ef;
  box-shadow: 4px 6px 0 rgba(20, 35, 20, 0.28); /* Back It In!'s soft offset shadow, sun top-left */
}
@media (orientation: portrait) {
  #play { flex-direction: column; }
  #views-wrap { flex: none; height: auto; }
  #views { flex: none; }
}

/* ---------- Bubble gauges (dark rounded panels, like the HITCH gauge) ---------- */
.gauge.vial-gauge {
  background: var(--bar); border-radius: 14px; padding: 7px 12px 9px; color: #c9d3da;
  font: 700 14px var(--font); display: grid; gap: 6px; flex-shrink: 0;
}
.vial-gauge .gtop { display: flex; align-items: baseline; justify-content: center; gap: 8px; color: #fff; } /* like HITCH 0°: label and value centered */
.vial-gauge .lbl { text-transform: uppercase; letter-spacing: 0.3px; white-space: nowrap; }
.vial-gauge .v { font: 800 20px var(--font); font-variant-numeric: tabular-nums; color: #fff; }
.vial-gauge .v.ok { color: var(--good); }
.vial-gauge .v.meh { color: var(--yellow); }
.vial-gauge .v.off { color: #ff8a7a; }
.vial-gauge .fridge { font-size: 10px; font-weight: 900; color: #fff; background: var(--bad); border-radius: 6px; padding: 2px 6px; animation: blink 0.8s steps(2) infinite; }
.vial-gauge .fridge[hidden] { display: none; }
.vrow { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: #b9c4cc; }
.vial {
  position: relative; height: 26px; border-radius: 13px; overflow: hidden;
  background: linear-gradient(180deg, #e9f59a 0%, #c6de45 50%, #9db72c 100%);
  box-shadow: inset 0 0 0 3px #1d252c;
}
.vial .tick { position: absolute; top: 0; bottom: 0; width: 3px; background: #1d252c; }
.vial .tick.a { left: calc(50% - 19px); }
.vial .tick.b { left: calc(50% + 16px); }
.vial .bubble {
  position: absolute; top: 5px; left: 50%; width: 30px; height: 16px; margin-left: -15px; border-radius: 50%;
  background: radial-gradient(ellipse at 35% 35%, #fff 0%, #f8fce6 55%, #ddeba6 100%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: left 0.55s cubic-bezier(0.3, 1.45, 0.5, 1);
}
.vial-gauge .gsub { text-align: center; font-size: 13px; font-weight: 700; color: #dfe6eb; min-height: 1.2em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes blink { 50% { opacity: 0.35; } }
@media (max-width: 600px), (max-height: 520px) {
  .gauge.vial-gauge { padding: 5px 8px 7px; font-size: 11px; gap: 4px; }
  .vial-gauge .v { font-size: 16px; }
  .vial { height: 20px; }
  .vial .bubble { top: 3px; height: 14px; width: 26px; margin-left: -13px; }
  .vrow { font-size: 9px; gap: 4px; }
  .vial-gauge .gsub { font-size: 11px; }
}

/* ---------- Toasts ---------- */
#toasts {
  position: absolute; bottom: 12px; left: 50%; /* low, so they never cover the Guide */ transform: translateX(-50%); width: min(520px, calc(100% - 24px));
  display: flex; flex-direction: column; gap: 8px; pointer-events: none; z-index: 3;
}
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 9px 16px 9px 10px;
  background: rgba(38, 49, 58, 0.95); color: #fff; border-radius: 20px;
  font: 700 17px/1.25 var(--font); transition: opacity 0.4s, transform 0.4s;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.toast.out { opacity: 0; transform: translateY(-6px); }
.toast .ico { flex-shrink: 0; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font: 900 15px/1 var(--font); color: #fff; background: #55616b; }
.toast.ok .ico { background: var(--good); }
.toast.mistake .ico, .toast.fail .ico { background: var(--bad); }
.toast.bonus .ico { background: var(--yellow); color: var(--ink); }
.toast.warn .ico { background: var(--orange); }
.toast .why { display: block; margin-top: 2px; font-weight: 600; font-size: 14px; color: #c9d3da; }
.toast .why b { color: #fff; }
@media (max-width: 600px) {
  .toast { font-size: 14px; padding: 7px 12px 7px 8px; }
  .toast .why { font-size: 12.5px; }
}

/* ---------- Hint card (cream card, same buttons as the menus) ---------- */
.action-menu {
  position: absolute; z-index: 4; box-sizing: border-box; padding: 10px;
  background: #fffaf0; border: 4px solid var(--ink); border-radius: 18px; box-shadow: 0 6px 0 var(--ink);
  display: flex; flex-direction: column; gap: 8px;
}
.action-menu[hidden] { display: none; }
.action-menu h3 { margin: 0 4px 2px; font: 900 15px var(--font); color: var(--ink); }
.action-menu button {
  min-height: 46px; padding: 0 14px; font: 800 16px var(--font); color: var(--ink); text-align: left;
  background: #fff; border: 3px solid var(--ink); border-radius: 12px; box-shadow: 0 3px 0 var(--ink); cursor: pointer;
}
.action-menu button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.action-menu button.cancel { color: #4a5866; text-align: center; }
.hint-card { left: 50%; bottom: 14px; transform: translateX(-50%); width: min(420px, calc(100% - 20px)); max-height: calc(100% - 28px); overflow: auto; }
.hint-card p { margin: 0 4px; font: 600 15px/1.35 var(--font); color: var(--ink); }
.hint-card p.said { padding: 8px 10px; background: #fff; border: 3px dashed #e6dccb; border-radius: 12px; }
.hint-card .hint-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.hint-card .hint-btns button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px 4px; text-align: center; line-height: 1.1; }
.hint-card .hint-btns button b { font-size: 14px; }
.hint-card .hint-btns button span { font-size: 13px; font-weight: 900; color: #c0392b; }
.hint-card .hint-btns button[data-level="do"] { background: #ffe6c7; }
.hint-card .app-read { display: grid; gap: 6px; background: #1d252c; border-radius: 12px; padding: 10px 12px; }
.hint-card .app-read div { display: flex; gap: 10px; align-items: baseline; }
.hint-card .app-read small { color: #8fa0ab; font: 800 11px var(--font); letter-spacing: 1px; width: 44px; }
.hint-card .app-read b { color: var(--good); font: 800 15px var(--font); }
.hint-card .app-buy { display: flex; justify-content: space-between; align-items: center; }
.hint-card .app-buy span { font-size: 13px; font-weight: 900; color: #c0392b; }
.hint-card .app-off { color: #4a5866 !important; }

/* ---------- Controls tray ---------- */
#tray { position: relative; z-index: 2; flex-shrink: 0; display: flex; flex-direction: column; min-height: 0; background: #2f3a42; color: #fff; }
#tray .tray-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 14px 4px; font: 800 13px var(--font); letter-spacing: 1px; color: #b9c4cc; }
#tray .tray-head .stock { letter-spacing: 0; color: var(--yellow); }
#tray .sections { overflow: auto; overscroll-behavior: contain; padding: 4px 10px 14px; display: flex; flex-direction: column; gap: 8px; scrollbar-width: thin; }
.sec { background: #26313a; border-radius: 14px; }
.sec-head {
  width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px 10px; min-height: 44px;
  font: 900 15px var(--font); color: #fff; background: transparent; border: 0; cursor: pointer; text-align: left;
}
.sec-head .n { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--orange); font-size: 13px; flex: none; }
.sec-head .chev { margin-left: auto; color: #8fa0ab; transition: transform 0.2s; }
.sec.closed .chev { transform: rotate(-90deg); }
.sec.closed .sec-body { display: none; }
.sec.closed .sec-head .n { background: #55616b; }
.sec-body { padding: 0 10px 10px; display: flex; flex-direction: column; gap: 8px; }
.sec-body .row { display: flex; gap: 8px; }
.sec-body .row > .ctl { flex: 1; min-width: 0; }
.ctl {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 4px 10px;
  font: 800 15px/1.1 var(--font); color: var(--ink); background: #fffaf0;
  border: 3px solid #1a2127; border-radius: 12px; box-shadow: 0 3px 0 #1a2127; cursor: pointer; touch-action: manipulation;
}
.ctl[hidden] { display: none; }
.ctl img { width: 28px; height: 28px; flex: none; margin: -4px 0; pointer-events: none; }
.ctl .lbl { pointer-events: none; }
.ctl:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #1a2127; }
.ctl:disabled { opacity: 0.4; cursor: default; }
.ctl.wide { width: 100%; }
.ctl.primary { background: var(--orange); color: #fff; }
.ctl.on { background: #ffe6c7; outline: 3px solid var(--orange); outline-offset: 1px; }
.ctl.quiet { background: transparent; color: #c9d3da; border-color: #55616b; box-shadow: none; font-size: 13px; min-height: 38px; }
.ctl.hold { min-height: 56px; font-size: 16px; }
.ctl.step { width: 46px; flex: none; font-size: 24px; padding: 0; }
.ctl.mini { padding: 4px 8px; font-size: 13px; min-height: 42px; }
.ctl.mini img { width: 22px; height: 22px; }
.side-block { background: #1f282f; border-radius: 12px; padding: 6px 8px 8px; display: flex; flex-direction: column; gap: 6px; }
.side-name { font: 900 12px var(--font); letter-spacing: 1px; text-transform: uppercase; color: #b9c4cc; }
.tire-row { display: flex; align-items: center; gap: 6px; }
.tire-row .tname { flex: 1; min-width: 0; font: 700 14px/1.1 var(--font); color: #dfe6eb; } /* wraps ("Jack / foot") in a narrow tray instead of pushing + off the edge */
.tire-row .count { min-width: 34px; text-align: center; font: 900 18px var(--font); color: #fff; font-variant-numeric: tabular-nums; }
.tire-row .ctl.mini { margin-left: 4px; }
#tray .sections { overflow-x: hidden; }
@media (orientation: landscape) {
  .tire-row .ctl.mini .lbl { display: none; } /* icon only; the button has an aria-label */
  .tire-row .ctl.step { width: 40px; min-height: 40px; }
  .tire-row .count { min-width: 26px; }
}
.jack-row { background: #1f282f; border-radius: 12px; padding: 6px 8px; }
.jack-meter { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; font: 800 13px var(--font); color: #b9c4cc; }
.jack-meter .meter { height: 12px; border-radius: 6px; background: #1d252c; overflow: hidden; }
.jack-meter .meter i { display: block; height: 100%; background: var(--orange); transition: width 0.2s; }
.jack-meter.max .meter i { background: var(--bad); }
.jack-meter b { color: #fff; font-variant-numeric: tabular-nums; min-width: 58px; text-align: right; }

/* Landscape / desktop: tray docks on the right */
@media (orientation: landscape) {
  #tray { width: var(--tray-w); border-left: 3px solid #1f262c; }
}
@media (orientation: landscape) and (max-height: 520px) {
  :root { --tray-w: 260px; }
  .ctl { min-height: 40px; font-size: 13px; }
  .ctl.hold { min-height: 46px; }
  .ctl.step { width: 40px; }
  #views { gap: 6px; padding: 6px; }
}
/* Portrait: views on top, tray below and scrolling */
@media (orientation: portrait) {
  #tray { flex: 1; border-top: 3px solid #1f262c; padding-bottom: env(safe-area-inset-bottom); }
  /* Upright phones: messages sit low over the views (never over the tray's buttons). */
  #toasts { bottom: 8px; }
}
@media (orientation: portrait) and (max-width: 600px) {
  #views { gap: 6px; padding: 6px; }
}

/* ---------- Effects ---------- */
/* Dashed "chock here" outlines the guide draws in the views. */
.ghost-chock { animation: ghost-pulse 1s ease-in-out infinite alternate; }
@keyframes ghost-pulse { from { opacity: 1; } to { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .ghost-chock { animation: none; } }
#views.shake { animation: shake 0.4s ease-out; }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
#views.fx-roll .view:last-child .world, #views.fx-roll .view:first-child .world { animation: roll 1.3s ease-in forwards; }
@keyframes roll { to { transform: translateX(60px); } }
#views.fx-lift .view:last-child .world { animation: lift 1s ease-out forwards; transform-origin: 75% 80%; }
@keyframes lift { to { transform: rotate(-4deg); } }
#views.fx-drop .view:first-child .world { animation: drop 0.6s ease-in forwards; }
@keyframes drop { 60% { transform: translateY(14px) rotate(2deg); } to { transform: translateY(10px) rotate(3deg); } }

/* ---------- Menus: Level It! extras ---------- */
#overlay .notes { margin: 12px 0 0; padding: 0; list-style: none; text-align: left; font-size: 15px; font-weight: 600; }
#overlay .notes li { display: flex; gap: 8px; padding: 5px 0; border-bottom: 2px dashed #e6dccb; }
#overlay .notes li b { flex-shrink: 0; width: 20px; text-align: center; }
#overlay .notes li.bad b { color: #c0392b; }
#overlay .notes li.good b { color: #2f8f45; }
#overlay .protip { margin-top: 14px; padding: 12px 14px; text-align: left; background: #fff; border: 3px solid var(--ink); border-radius: 14px; font-size: 15px; font-weight: 600; line-height: 1.35; }
#overlay .protip strong { display: block; font-weight: 900; color: #c54818; letter-spacing: 1px; font-size: 13px; margin-bottom: 2px; }
#overlay .share { margin: 6px 0 0; font-size: 13px; font-weight: 600; color: #4a5866; }
#overlay .share a { color: #c54818; font-weight: 800; }
#overlay .world-head { display: flex; justify-content: space-between; align-items: baseline; }
#overlay .level .meta { font-size: 13px; font-weight: 700; color: #8a96a0; }
#overlay .level .rigtag { font-size: 11px; }
#overlay .kit-line { margin: 10px 0 0; font-size: 14px; font-weight: 700; color: #4a5866; }
#overlay .readout { display: flex; justify-content: center; gap: 28px; margin: 2px 0 6px; }
#overlay .readout div { display: flex; flex-direction: column; align-items: center; }
#overlay .readout small { font-size: 12px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: #8a96a0; }
#overlay .readout b { font-size: 28px; font-weight: 900; font-variant-numeric: tabular-nums; }
#overlay .readout b.ok { color: #2f8f45; }
#overlay .readout b.miss { color: #c0392b; }
#overlay .rig-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); margin-top: 8px; }
#overlay .rig-card { text-align: left; padding: 8px 12px 10px; }
#overlay .rig-card svg { width: 100%; height: auto; display: block; margin-bottom: 4px; background: #cfe6ef; border-radius: 8px; }
#overlay .rig-card.on { outline: 4px solid var(--orange); outline-offset: 2px; }
#overlay .rig-card .specs { font-size: 13px; font-weight: 700; color: #4a5866; }

@media (prefers-reduced-motion: reduce) {
  .vial .bubble, .jack-meter .meter i { transition: none; }
  #views.shake, #views .world, .vial-gauge .fridge { animation: none !important; }
  #overlay .stars.pop .star.on { animation: none; }
}

/* ---------- Guide: where you are, what's next, why ---------- */
.guide {
  flex: none; margin: 8px 8px 0; padding: 8px 10px 10px; background: #fffaf0; color: var(--ink);
  border: 3px solid var(--ink); border-radius: 16px; box-shadow: 0 4px 0 var(--ink); font-family: var(--font);
}
.guide[hidden] { display: none; }
.g-steps { list-style: none; margin: 0 0 6px; padding: 0; display: flex; gap: 4px; flex-wrap: wrap; }
.g-steps li { display: flex; align-items: center; gap: 4px; padding: 2px 8px 2px 2px; border-radius: 999px; background: #efe6d4; font: 800 12px var(--font); color: #8a96a0; }
.g-steps .dot { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: #d8cdb8; color: #fff; font-size: 11px; }
.g-steps li.done { color: #2f8f45; }
.g-steps li.done .dot { background: var(--good); }
.g-steps li.now { background: var(--orange); color: #fff; }
.g-steps li.now .dot { background: #fff; color: var(--orange); }
.g-main { display: flex; gap: 10px; align-items: center; }
.g-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font: 600 14px/1.3 var(--font); }
.g-title { font: 900 16px var(--font); }
.g-what { color: #4a5866; }
.g-next { font-weight: 800; color: #c54818; }
.g-next b { color: var(--ink); }
.g-btns { display: flex; gap: 6px; flex: none; }
.g-btn {
  min-width: 44px; min-height: 44px; padding: 0 10px; font: 900 16px var(--font); color: var(--ink); background: #fff;
  border: 3px solid var(--ink); border-radius: 12px; box-shadow: 0 3px 0 var(--ink); cursor: pointer;
}
.g-btn.show { background: var(--orange); color: #fff; }
.g-btn.x { font-size: 14px; color: #4a5866; }
.g-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.g-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
/* Phones: names show only on the current step, text tightens. */
@media (max-width: 760px), (max-height: 520px) {
  .g-steps li:not(.now) .nm { display: none; }
  .g-steps li { padding-right: 2px; }
  .g-steps li.now { padding-right: 8px; }
  .g-title { font-size: 14px; }
  .g-text { font-size: 12.5px; }
  .g-btn { min-height: 40px; min-width: 40px; font-size: 14px; }
}
/* Short landscape phones: the guide is one tight block, the views crop their sky to fit. */
@media (orientation: landscape) and (max-height: 520px) {
  .guide { margin: 6px 6px 0; padding: 5px 8px 6px; }
  .g-steps { margin-bottom: 3px; }
  .g-what { display: none; }
  #views { align-content: stretch; grid-template-rows: minmax(0, 1fr); }
  .view svg { aspect-ratio: auto; height: 100%; }
}
#overlay .job { margin: 12px 0 0; padding: 10px 12px; background: #fff; border: 3px dashed #e6dccb; border-radius: 14px; text-align: left; font-size: 14px; font-weight: 600; color: #4a5866; }
#overlay .job > b { display: block; color: var(--ink); font-weight: 900; margin-bottom: 4px; }
#overlay .job ol { margin: 0 0 6px; padding-left: 22px; columns: 2; column-gap: 18px; color: var(--ink); font-weight: 800; }
@media (max-width: 600px) and (orientation: portrait) {
  .g-main { flex-direction: column; align-items: stretch; gap: 8px; }
  .g-btns .g-btn.show { flex: 1; }
}

/* ---------- Park It (top-down driving before the leveling) ---------- */
#views-wrap[hidden], #tray[hidden] { display: none; }
#park { position: relative; flex: 1; min-width: 0; min-height: 0; display: flex; }
#park[hidden] { display: none; }
#park .park-stage { position: relative; flex: 1; min-width: 0; min-height: 0; overflow: hidden; background: #7cb555; touch-action: none; }
#park .park-canvas { position: absolute; inset: 0; display: block; }
#park .park-coach {
  position: absolute; left: 50%; top: 12px; transform: translate(-50%, -8px); max-width: min(560px, calc(100% - 24px));
  padding: 9px 16px; border-radius: 18px; background: rgba(38, 49, 58, 0.9); color: #fff;
  font: 800 15px/1.3 var(--font); text-align: center; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
}
#park .park-coach.on { opacity: 1; transform: translate(-50%, 0); }
#park .park-panel {
  z-index: 2; flex-shrink: 0; display: flex; flex-direction: column; min-height: 0; background: #2f3a42; color: #fff;
}
#park .pk-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px 4px; font: 800 13px var(--font); letter-spacing: 1px; color: #b9c4cc; }
#park .pk-head b { color: #fff; }
#park .pk-pu { letter-spacing: 0.5px; }
#park .pk-pu b { color: #fff; font-size: 15px; margin-left: 4px; }
#park .pk-pu b.warn { color: #ff8a7a; }
#park .pk-body { flex: 1; min-height: 0; overflow: auto; padding: 2px 12px 8px; scrollbar-width: thin; }
#park .pk-tip { margin: 2px 0 8px; font: 700 14px/1.35 var(--font); color: #dfe6eb; }
#park h4 { margin: 10px 0 4px; font: 900 12px var(--font); letter-spacing: 1px; text-transform: uppercase; color: #b9c4cc; }
#park .pk-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
#park .pk-list li {
  display: grid; grid-template-columns: 22px 1fr auto; grid-template-rows: auto auto; column-gap: 8px; align-items: center;
  padding: 6px 10px; border-radius: 10px; background: #26313a; border-left: 5px solid var(--good);
}
#park .pk-list li.bad { border-left-color: var(--bad); background: #3a2b2e; }
#park .pk-list li i { grid-row: span 2; font-style: normal; font: 900 18px var(--font); color: var(--good); text-align: center; }
#park .pk-list li.bad i { color: #ff8a7a; }
#park .pk-list li span { font: 800 14px var(--font); }
#park .pk-list li b { font: 900 15px var(--font); font-variant-numeric: tabular-nums; text-align: right; }
#park .pk-list li small { grid-column: 2 / 4; font: 700 12px var(--font); color: #b9c4cc; }
#park .pk-warn { margin: 8px 0 0; padding: 8px 10px; border-radius: 10px; background: var(--bad); font: 800 13px/1.3 var(--font); }
#park .pk-note { margin: 10px 0 0; font: 800 13px/1.3 var(--font); color: var(--yellow); }
#park .pk-ground { margin: 0; font: 800 14px var(--font); color: #fff; }
#park .pk-btns { display: flex; gap: 8px; padding: 8px 12px max(12px, env(safe-area-inset-bottom)); border-top: 2px solid #26313a; }
#park .pk-btns .ctl { flex: 1; }
#park .pk-btns .pk-here { flex: 2; background: var(--orange); color: #fff; }
#park .pk-btns .ctl[hidden] { display: none; }
@media (orientation: landscape) {
  #park .park-panel { width: var(--tray-w); border-left: 3px solid #1f262c; }
}
@media (orientation: portrait) {
  #park { flex-direction: column; }
  #park .park-panel { max-height: 42%; border-top: 3px solid #1f262c; }
}
/* Upright phones: a slim strip under the campsite, so the driving area gets
   the screen. Pull-ups are in the top bar; the hookups are one row of chips. */
@media (orientation: portrait) and (max-width: 600px) {
  #park .park-panel { max-height: 30%; }
  #park .pk-head { display: none; }
  #park .pk-body { padding: 6px 10px 4px; }
  #park .pk-tip { margin: 0 0 6px; font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  #park h4 { display: none; }
  #park .pk-list { flex-direction: row; gap: 4px; margin-bottom: 4px; }
  #park .pk-list li { flex: 1 1 0; min-width: 0; grid-template-columns: 14px 1fr auto; column-gap: 4px; padding: 4px 6px; border-left-width: 4px; }
  #park .pk-list li i { font-size: 14px; }
  #park .pk-list li span { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #park .pk-list li b { font-size: 12px; }
  #park .pk-list li small { display: none; }
  #park .pk-warn { margin: 2px 0 0; padding: 5px 8px; font-size: 12px; }
  #park .pk-note, #park .pk-ground { margin: 2px 0 0; font-size: 12px; }
  #park .pk-btns { padding: 6px 10px max(8px, env(safe-area-inset-bottom)); }
  #park .pk-btns .ctl { min-height: 44px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  #park .pk-tip { font-size: 12px; }
  #park .pk-list li { padding: 3px 8px; }
  #park .pk-list li small { display: none; }
  #park h4 { margin-top: 6px; }
}

/* ---------- Gear Shed ---------- */
#overlay .card.shed { text-align: left; }
#overlay .card.shed h1, #overlay .card.shed .tip { text-align: center; }
.gs-slots { display: flex; align-items: center; justify-content: center; gap: 4px; margin: 6px 0 10px; }
.gs-slots i { width: 22px; height: 14px; border-radius: 4px; background: #e6e1d6; border: 2px solid #a39a88; }
.gs-slots i.on { background: var(--orange); border-color: #b9621a; }
.gs-slots b { margin-left: 8px; font: 900 16px var(--font); color: var(--ink); }
.gs-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 6px; }
.gs-list li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 14px; background: #f3efe6; border: 2px solid #e1dbcf; }
.gs-list li.in { background: #fff1de; border-color: var(--orange); }
.gs-list img { flex: none; }
.gs-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.gs-name b { font: 800 14px/1.2 var(--font); color: var(--ink); }
.gs-name small { font: 700 12px/1.25 var(--font); color: #5b6670; }
.gs-qty { display: flex; align-items: center; gap: 4px; }
.gs-qty span { min-width: 30px; text-align: center; font: 900 15px var(--font); color: var(--ink); }
#overlay .btn.gs-step { min-width: 40px; width: 40px; height: 40px; min-height: 40px; padding: 0; font-size: 22px; }
.gs-note { margin: 10px 0 0; font: 700 13px var(--font); color: #b05a10; text-align: center; }
#park .pk-list li.wait { border-left-color: #55616b; }
#park .pk-list li.wait i { color: #8fa0ab; }
/* Upright phones: the Guide already ticks off each step, so skip the green
   "done" pop-ups that would pile up; mistakes, warnings and bonuses still
   show. */
@media (orientation: portrait) and (max-width: 600px) {
  #toasts .toast.ok, #toasts .toast.note, #toasts .toast.info { display: none; }
}

/* Intro card: today's curveballs */
#overlay .curves { margin: 12px 0 0; padding: 10px 12px; background: #fff6e8; border: 3px solid #f2c230; border-radius: 14px; text-align: left; }
#overlay .curves b { display: block; font-size: 13px; font-weight: 900; letter-spacing: 1px; text-transform: uppercase; color: #8a4b0f; margin-bottom: 2px; }
#overlay .curves p { margin: 2px 0; font-size: 14px; font-weight: 600; color: #4a5866; }
#overlay .curves p span { font-weight: 900; color: #26313a; }
#overlay .protip.curve { margin-top: 8px; }

/* Upright phones: a shorter Guide (title + Next, buttons beside it) so the
   views and the controls get the room. */
@media (orientation: portrait) and (max-width: 600px) {
  .guide { padding: 6px 8px 8px; margin: 6px 6px 0; }
  .g-steps { margin-bottom: 4px; }
  .g-what { display: none; }
  .g-main { flex-direction: row; align-items: center; gap: 6px; }
  .g-btns .g-btn.show { flex: none; padding: 0 10px; }
  .g-title { font-size: 13px; }
  .g-text { font-size: 12.5px; }
}

/* ---------- Auto-level panel ---------- */
.al-panel { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 12px; background: #1d252c; }
.al-lbl { font: 900 11px var(--font); letter-spacing: 1px; color: #8fa0ab; }
.al-lcd { font: 800 15px ui-monospace, Consolas, monospace; color: #6f7c86; text-align: right; }
.al-lcd.ok { color: var(--good); }
.al-lcd.checking { color: var(--yellow); }
.al-lcd.fault { color: var(--bad); animation: blink 0.7s steps(2) infinite; }
.ctl.al-go { min-height: 56px; font-size: 18px; letter-spacing: 1px; }
.al-jog { display: grid; grid-template-columns: 1fr auto auto; gap: 6px 8px; align-items: center; }
.al-jog[hidden] { display: none; }
.al-jn { font: 700 14px var(--font); color: #dfe6eb; }
@media (prefers-reduced-motion: reduce) { .al-lcd.fault { animation: none; } }

/* Phones: the campsite gets the screen. The level tip shows on the campsite
   at the start, so the strip is just the hookup chips and the two buttons. */
#park .pk-list li span em { font-style: normal; }
@media (orientation: portrait) and (max-width: 600px) {
  #park .park-panel { max-height: 24%; }
  #park .pk-tip, #park .pk-note, #park .pk-ground, #park .pk-head { display: none; }
  #park .pk-body { padding: 5px 8px 2px; }
  #park .pk-list { margin-bottom: 3px; }
  #park .pk-list li { padding: 3px 6px; }
  #park .pk-btns { padding: 4px 8px max(6px, env(safe-area-inset-bottom)); gap: 6px; }
  #park .pk-btns .ctl { min-height: 40px; padding-top: 4px; padding-bottom: 4px; }
  #park .pk-btns .ctl .lbl { font-size: 15px; }
}
@media (orientation: portrait) and (max-width: 380px) {
  #park .pk-list li span em { display: none; }
}
@media (orientation: landscape) and (max-height: 520px) {
  #park .park-panel { width: 220px; }
  #park .pk-tip, #park .pk-note, #park h4 { display: none; }
  #park .pk-head { padding: 6px 10px 2px; }
  #park .pk-body { padding: 4px 8px; }
  #park .pk-btns { flex-direction: column; gap: 6px; padding: 6px 8px max(6px, env(safe-area-inset-bottom)); }
  #park .pk-btns .ctl { min-height: 38px; flex: none; }
}

/* ---------- World 5 ---------- */
/* Checkout morning: the hitch height marked on the jack meter. */
.jack-meter .meter { position: relative; }
.jack-meter .meter s { position: absolute; top: 0; bottom: 0; width: 3px; margin-left: -1px; background: #fff; box-shadow: 0 0 0 1px #1d252c; }
.hh-note { margin: 4px 0 0; font: 700 12px var(--font); color: #b9c4cc; }

/* Night: the views go dark except a flashlight circle (it follows your finger
   or the mouse). The bubble vials stay lit, but without the numbers. */
#views-wrap.night .view { position: relative; }
#views-wrap.night .view::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: 12px;
  background: radial-gradient(circle at var(--fx, 50%) var(--fy, 62%), rgba(4, 8, 22, 0) 0, rgba(4, 8, 22, 0.15) 70px, rgba(4, 8, 22, 0.9) 150px);
}
#views-wrap.night .view > div { position: relative; z-index: 1; }
#views-wrap.night .gtop .v { visibility: hidden; }

/* Practice Lot sliders */
.practice-set { display: grid; gap: 8px; margin: 10px 0 4px; text-align: left; }
.practice-set label { display: grid; grid-template-columns: 7.5em 1fr; align-items: center; gap: 4px 10px; font: 800 14px var(--font); }
.practice-set input[type=range] { width: 100%; accent-color: var(--orange); }
.practice-set output { grid-column: 2; font: 700 12px var(--font); opacity: 0.75; margin-top: -4px; }
.practice-set select { font: 700 14px var(--font); padding: 6px 8px; border-radius: 8px; border: 2px solid rgba(0,0,0,0.15); background: #fff; color: #26313a; }
@media (max-width: 420px) { .practice-set label { grid-template-columns: 1fr; } .practice-set output { grid-column: 1; } }
