/* =====================================================================
   Winterize It! (style.css holds the parts shared with Back It In!).
   The first part is Hook It Up!'s game.css as-is (same HUD, tray, toasts,
   hotspots, hint card); Winterize It! additions are at the end.
   ===================================================================== */
: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: 292px;
}

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

/* ---------- 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 b { font-weight: 700; }
#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; }
#hud #topbtns[hidden] { display: none; }
#topbtns .hbtn.gloves.on { background: var(--good); color: #fff; }
#topbtns .hbtn.gloves.dirty { background: #8a6a3a; color: #fff; }
#topbtns .hbtn.hint-glow { outline: 4px solid var(--yellow); outline-offset: 2px; }
/* Touch: Back It In!'s big 56px buttons and a 64px bar */
#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; }
}
/* Narrow phones: buttons get the first row, the stats a slim second row. */
@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; }
}
/* Home (opens the pause menu), left of the level code. */
#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, .hotspot:focus-visible, .gear-card:focus-visible, .action-menu button:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 2px;
}

/* ---------- Play area: scene + tray ---------- */
#play { position: relative; flex: 1; min-height: 0; display: flex; }
#play[hidden] { display: none; }
#scene-wrap { position: relative; flex: 1; min-width: 0; min-height: 0; overflow: hidden; background: #cfe6ef; }
/* Scrolls sideways only when the scene is wider than the screen (upright phones, two-outlet rigs). */
#scene-scroll { position: absolute; inset: 0; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scrollbar-width: none; }
#scene-scroll::-webkit-scrollbar { display: none; }
#scene-wrap .pan {
  position: absolute; top: 58%; z-index: 4; width: 40px; height: 56px; margin-top: -28px;
  border: 0; border-radius: 12px; background: rgba(43, 51, 59, 0.82); color: #fff; font-size: 18px; cursor: pointer;
}
#scene-wrap .pan[hidden] { display: none; }
#scene-wrap .pan-left { left: 6px; }
#scene-wrap .pan-right { right: 6px; }
#scene { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; }
#hotspots { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; }
@media (orientation: portrait) {
  #play { flex-direction: column; }
}

/* ---------- Hotspots ---------- */
.hotspot {
  position: absolute;
  min-width: 44px;
  min-height: 44px;
  transform: translate(-50%, -50%);
  padding: 0;
  background: transparent;
  border: 3px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
}
.hotspot.has-action { border-color: rgba(255, 255, 255, 0.7); border-style: dashed; }
.hotspot.target { border: 3px solid var(--focus); background: rgba(63, 224, 255, 0.18); animation: glow 1.1s ease-in-out infinite; }
.hotspot.drop-over { background: rgba(63, 224, 255, 0.45); }
.hotspot.hint { border: 4px solid var(--yellow); background: rgba(242, 194, 48, 0.25); animation: glow 0.8s ease-in-out infinite; }
.hotspot .tag {
  position: absolute;
  left: 50%;
  top: calc(100% + 4px);
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 3px 9px;
  font: 800 12px/1.2 var(--font);
  color: #fff;
  background: var(--bar);
  border-radius: 999px;
  pointer-events: none;
}
.hotspot .tag[hidden] { display: none; }
.hotspot.tag-above .tag { top: auto; bottom: calc(100% + 4px); }
@keyframes glow { 50% { box-shadow: 0 0 0 6px rgba(63, 224, 255, 0.3); } }

/* Hotspot action menu (cream card, same buttons as the menus) */
.action-menu {
  position: absolute;
  z-index: 4;
  width: 230px;
  max-width: calc(100% - 20px);
  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: bottom-center of the scene, same cream card */
.hint-card {
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  width: min(400px, calc(100% - 20px));
}
.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 p b { display: block; margin-top: 4px; color: #c54818; font-weight: 800; }
.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; }

/* ---------- Gauges (dark rounded panels, like the HITCH gauge) ---------- */
#gauges {
  position: absolute;
  left: 14px;
  top: 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  pointer-events: none;
  z-index: 2;
}
.gauge {
  background: var(--bar);
  border-radius: 14px;
  padding: 8px 12px 10px;
  color: #c9d3da;
  font: 700 14px var(--font);
  text-align: center;
  min-width: 120px;
}
.gauge[hidden] { display: none; }
.gauge .lbl { text-transform: uppercase; letter-spacing: 0.3px; white-space: nowrap; }
.gauge .lcd {
  margin-top: 6px;
  padding: 5px 8px;
  background: #1d252c;
  border-radius: 8px;
  font: 800 15px ui-monospace, Consolas, monospace;
  color: #6f7c86;
  white-space: nowrap;
}
.gauge .lcd.ok { color: var(--good); }
.gauge .lcd.fault { color: var(--bad); animation: blink 0.7s steps(2) infinite; }
.gauge .lcd.checking { color: var(--yellow); }
.gauge svg { display: block; margin: 2px auto 0; }
.gauge.tanks { text-align: left; min-width: 190px; }
.gauge .tank { display: grid; grid-template-columns: 44px 1fr 30px 34px; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; }
.gauge .bar { height: 10px; border-radius: 5px; background: #1d252c; overflow: hidden; }
.gauge .bar i { display: block; height: 100%; background: var(--good); border-radius: 5px; transition: width 0.4s; }
.gauge .bar i.mid { background: var(--yellow); }
.gauge .bar i.high { background: var(--bad); }
.gauge .valve { font-size: 10px; font-weight: 900; color: #8fa0ab; text-align: right; }
.gauge .valve.open { color: var(--yellow); }
.gauge .pyr { margin-top: 6px; font-size: 11px; color: var(--yellow); }
.gauge .pyr[hidden] { display: none; }
@keyframes blink { 50% { opacity: 0.35; } }
@media (max-width: 600px), (max-height: 520px) {
  #gauges { left: 8px; bottom: 8px; gap: 6px; }
  .gauge { min-width: 0; padding: 6px 8px 8px; font-size: 11px; }
  .gauge .lcd { font-size: 11px; padding: 4px 6px; }
  .gauge.tanks { min-width: 0; }
  .gauge .tank { grid-template-columns: 34px 30px 24px 26px; gap: 4px; font-size: 10px; }
  .gauge .valve { font-size: 9px; }
  .hotspot .tag { font-size: 10px; padding: 2px 6px; }
  .gauge svg { width: 84px; height: 46px; }
}

/* ---------- Toasts ---------- */
/* Wide scenes: toasts top-right beside the gauges. Narrow: below the gauges. */
#toasts {
  position: absolute;
  top: 14px;
  right: 14px;
  width: min(440px, calc(100% - 560px));
  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;
}
.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.waste .ico, .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: 1080px) {
  #toasts { top: 150px; right: auto; left: 50%; transform: translateX(-50%); width: min(520px, calc(100% - 24px)); }
}
@media (max-width: 1080px) and (max-height: 520px) {
  #toasts { top: 104px; }
}
@media (max-width: 600px) {
  #toasts { top: 112px; }
  .toast { font-size: 14px; padding: 7px 12px 7px 8px; }
  .toast .why { font-size: 12.5px; }
}

/* ---------- Gear 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 .sel { letter-spacing: 0; color: var(--orange); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tray .cards {
  display: grid;
  gap: 10px 8px;
  padding: 10px 12px 12px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.gear-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
  padding: 6px 4px 7px;
  font: 800 12px/1.15 var(--font);
  color: var(--ink);
  background: #fffaf0;
  border: 3px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 4px 0 #1a2127;
  cursor: grab;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
}
.gear-card img { width: 56px; height: 56px; pointer-events: none; }
.gear-card span { pointer-events: none; text-align: center; }
.gear-card .count {
  position: absolute;
  top: -8px;
  right: -6px;
  min-width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--orange);
  color: #fff;
  font-size: 12px;
}
.gear-card.selected { background: #ffe6c7; outline: 4px solid var(--orange); outline-offset: 1px; }
.gear-card.hint { outline: 4px solid var(--yellow); outline-offset: 1px; animation: glow 0.8s ease-in-out infinite; }
.gear-card:disabled { opacity: 0.38; cursor: default; box-shadow: 0 2px 0 #1a2127; }
.gear-card:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 #1a2127; }
.gear-card.instant { background: #e8f1e3; }
.gear-card.worn { background: #c9efd2; outline: 4px solid var(--good); outline-offset: 1px; }
.gear-card.worn.dirty { background: #e8d9bf; outline-color: #8a6a3a; }

/* Landscape / desktop: tray docks on the right */
@media (orientation: landscape) {
  #tray { width: var(--tray-w); border-left: 3px solid #1f262c; }
  #tray .cards { grid-template-columns: 1fr 1fr 1fr; align-content: start; flex: 1; }
}
@media (orientation: landscape) and (max-height: 520px) {
  :root { --tray-w: 240px; }
  .gear-card img { width: 40px; height: 40px; }
  .gear-card { font-size: 10.5px; }
  #tray .cards { gap: 8px 6px; padding: 8px; }
}
/* Portrait: tray under the scene, one scrolling shelf */
@media (orientation: portrait) {
  #tray { border-top: 3px solid #1f262c; padding-bottom: env(safe-area-inset-bottom); }
  .gear-card { touch-action: pan-x; }
  #tray .cards { grid-auto-flow: column; grid-auto-columns: 92px; overflow-x: auto; overflow-y: hidden; height: 132px; box-sizing: border-box; }
}

/* Drag ghost */
#ghost {
  position: fixed;
  z-index: 10;
  width: 72px;
  height: 72px;
  margin: -36px 0 0 -36px;
  pointer-events: none;
  filter: drop-shadow(0 6px 0 rgba(0,0,0,0.3));
}
#ghost[hidden] { display: none; }

/* ---------- Scene effects ---------- */
.fx-pop { transform-box: fill-box; transform-origin: center; animation: pop 0.9s ease-out forwards; }
@keyframes pop {
  0% { transform: scale(0.2); opacity: 0; }
  20% { transform: scale(1.15); opacity: 1; }
  75% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1) translateY(-14px); opacity: 0; }
}
.fx-spark line { stroke-dasharray: 14 30; animation: spark 0.7s ease-out forwards; }
@keyframes spark { from { stroke-dashoffset: 14; opacity: 1; } to { stroke-dashoffset: -30; opacity: 0; } }
.fx-grow { transform-box: fill-box; transform-origin: center; animation: grow 1.2s ease-out forwards; }
@keyframes grow { from { transform: scale(0.1); } to { transform: scale(1); } }
.fx-fade { animation: fade 2.8s ease-in forwards; }
@keyframes fade { 0%, 60% { opacity: 1; } 100% { opacity: 0; } }
.fx-rise { animation: rise 1.6s ease-out infinite; }
@keyframes rise { from { transform: translateY(0); opacity: 0.9; } to { transform: translateY(-40px); opacity: 0; } }
.fx-jet { stroke-dasharray: 260; stroke-dashoffset: 260; animation: jet 0.5s ease-out forwards; }
@keyframes jet { to { stroke-dashoffset: 0; } }
.fx-wobble { animation: wobble 1.4s ease-in-out infinite alternate; }
@keyframes wobble { from { transform: translate(-4px, 0) rotate(-8deg); } to { transform: translate(4px, -22px) rotate(8deg); } }
.fx-drop { animation: drop 1s ease-in infinite; }
@keyframes drop { from { transform: translateY(0); opacity: 1; } 90% { opacity: 1; } to { transform: translateY(var(--fall, 60px)); opacity: 0; } }
#scene-wrap.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); } }
.flow { stroke-dasharray: 10 12; animation: flow 0.6s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -22; } }
.ems-wait { animation: blink 0.6s steps(2) infinite; }
.rain { animation: rain 0.5s linear infinite; }
@keyframes rain { from { transform: translate(0, -60px); } to { transform: translate(-18px, 60px); } }

/* ---------- Menus: Hook It Up! 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 .notes li.tip b { color: #b8860b; }
#overlay .amps { margin: -2px 0 8px; font-size: 14px; font-weight: 700; color: #4a5866; }
#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 .rig-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); margin-top: 8px; }
#overlay .rig-card { text-align: left; }
#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) {
  .fx-pop, .fx-grow, .fx-fade, .fx-rise, .fx-spark line, .fx-jet, .fx-wobble, .fx-drop, #scene-wrap.shake, .flow, .hotspot.target, .hotspot.hint, .gear-card.hint, .ems-wait, .gauge .lcd.fault, .rain {
    animation: none !important;
  }
  #overlay .stars.pop .star.on { animation: none; }
  .fx-jet { stroke-dashoffset: 0; }
}

/* =====================================================================
   Winterize It! additions
   ===================================================================== */

/* Title: "WINTERIZE" is nine letters, so it runs smaller than "HOOK IT" to fit the same card */
#overlay .wordmark.long .w1 { font-size: 40px; }
@media (max-width: 480px) {
  #overlay .wordmark.long .w1 { font-size: 30px; }
}

/* X-ray takes Back It In!'s G slot: yellow when on */
#topbtns .hbtn { position: relative; }
#topbtns .hbtn.xray .g { font-weight: 900; font-size: 22px; }
#topbtns .hbtn.xray.on { background: var(--yellow); color: var(--ink); }
#topbtns .hbtn.xray.costly::after { content: '★'; position: absolute; right: 3px; top: 1px; font-size: 11px; color: var(--yellow); }
#topbtns .hbtn.xray.on.costly::after { color: var(--ink); }

/* Nav spots: doors, rooms and compartments you can step into */
.hotspot.nav { border: 3px solid rgba(255, 255, 255, 0.55); background: rgba(255, 255, 255, 0.06); }
.hotspot.nav .tag { background: rgba(31, 58, 39, 0.92); }
.hotspot.nav:hover { background: rgba(255, 255, 255, 0.16); }
.hotspot.nav.has-action, .hotspot.nav.target { border-style: solid; }

/* Back button and the view title, bottom left of the scene */
#viewnav { position: absolute; left: 12px; bottom: 12px; z-index: 3; display: flex; align-items: center; gap: 8px; pointer-events: none; }
#viewnav[hidden] { display: none; }
#viewnav .vbtn {
  pointer-events: auto; display: flex; align-items: center; gap: 6px; min-height: 48px; padding: 0 16px 0 12px;
  font: 900 17px var(--font); color: var(--ink); background: #fffaf0;
  border: 4px solid var(--ink); border-radius: 16px; box-shadow: 0 4px 0 var(--ink); cursor: pointer;
}
#viewnav .vbtn[hidden] { display: none; }
#viewnav .vbtn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
#viewnav .vbtn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
#viewnav .vbtn.hint { outline: 4px solid var(--yellow); outline-offset: 2px; animation: glow 0.8s ease-in-out infinite; }
#viewnav .vbtn.target { outline: 3px solid var(--focus); outline-offset: 2px; }
#viewnav .vtitle { padding: 7px 14px; font: 800 15px var(--font); color: #fff; background: var(--bar); border-radius: 999px; white-space: nowrap; }

/* I'm done (the freeze night), bottom right of the scene */
#done {
  position: absolute; right: 12px; bottom: 12px; z-index: 3;
  min-height: 52px; padding: 0 20px; font: 900 18px var(--font); color: #fff; background: var(--orange);
  border: 4px solid var(--ink); border-radius: 16px; box-shadow: 0 5px 0 var(--ink); cursor: pointer;
}
#done[hidden] { display: none; }
#done:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
#done:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
#done.hint-glow { outline: 4px solid var(--yellow); outline-offset: 3px; }
@media (max-width: 600px) {
  #viewnav .vbtn span { display: none; }
  #viewnav .vtitle { font-size: 13px; padding: 6px 10px; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }
  #done { font-size: 15px; padding: 0 12px; min-height: 46px; }
}

/* Gauges: temperature, jug, heater, pump, compressor (wraps to a second row so the toasts keep their space) */
#gauges { flex-wrap: wrap; max-width: 560px; }
.gauge { min-width: 92px; }
.gauge .big { margin-top: 2px; font: 900 22px var(--font); color: #fff; font-variant-numeric: tabular-nums; }
.gauge.temp.cold .big { color: #9fd8f0; }
.gauge.jug { min-width: 128px; }
.gauge .jugrow { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.gauge .jugbar { flex: 1; height: 12px; border-radius: 6px; background: #1d252c; overflow: hidden; min-width: 40px; }
.gauge .jugbar i { display: block; height: 100%; background: #f06ba8; border-radius: 6px; transition: width 0.3s; }
.gauge .jugtxt { font-size: 12px; color: #fff; white-space: nowrap; font-variant-numeric: tabular-nums; }
.gauge.jug.low .jugtxt { color: var(--bad); }
.gauge .lcd { font-size: 13px; }
@media (max-width: 600px), (max-height: 520px) {
  #gauges { top: 8px; left: 8px; bottom: auto; flex-wrap: wrap; max-width: calc(100% - 16px); }
  .gauge { min-width: 0; }
  .gauge .big { font-size: 16px; }
  .gauge.jug { min-width: 96px; }
  .gauge .jugtxt { font-size: 10px; }
  .gauge .lcd { font-size: 10px; }
}
@media (max-width: 1080px) {
  #toasts { top: 96px; }
}
/* Short landscape phones: two small toasts, top right beside the gauges */
@media (max-height: 520px) and (orientation: landscape) {
  #toasts { top: 8px; right: 8px; left: auto; transform: none; width: min(360px, 44%); gap: 6px; }
  .toast { font-size: 13px; padding: 6px 10px 6px 7px; border-radius: 16px; }
  .toast .why { font-size: 11.5px; }
  .toast .ico { width: 20px; height: 20px; font-size: 12px; }
  #toasts .toast:nth-child(n+3) { display: none; }
}

/* Step checklist under the gear cards */
#steps { padding: 0 12px 12px; color: #dfe6eb; overflow: auto; min-height: 0; }
#steps[hidden] { display: none; }
#steps .steps-head {
  display: flex; justify-content: space-between; width: 100%; padding: 8px 2px 6px; background: none; border: 0;
  border-top: 2px solid #1f262c; font: 800 13px var(--font); letter-spacing: 1px; color: #b9c4cc; cursor: pointer;
}
#steps ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
#steps li { display: flex; gap: 8px; align-items: flex-start; font: 700 13.5px/1.3 var(--font); color: #c9d3da; }
#steps li b {
  flex: none; width: 18px; height: 18px; margin-top: 1px; border-radius: 5px; border: 2px solid #55616b;
  display: grid; place-items: center; font-size: 12px; color: #fff;
}
#steps li.done { color: #8fa0ab; }
#steps li.done b { background: var(--good); border-color: var(--good); }
#steps li.next { color: #fff; }
#steps li.next b { border-color: var(--yellow); }
#steps li em { font-style: normal; color: var(--yellow); }
@media (orientation: landscape) {
  #tray .cards { flex: none; }
  #steps { flex: 1; }
}
@media (orientation: portrait) {
  #steps { max-height: 30vh; padding-bottom: 8px; }
}

/* Toasts: freeze-night cracks */
.toast.crack .ico { background: #9fd8f0; color: var(--ink); }

/* Results: the repair bill and the cracked list */
#overlay .bill { margin: 6px 0 4px; font-size: 17px; font-weight: 700; }
#overlay .bill b { color: #c0392b; }
#overlay .bill small { display: block; font-size: 12px; font-weight: 600; color: #8a96a0; }
#overlay .notes li.crack span { display: flex; justify-content: space-between; gap: 8px; width: 100%; }
#overlay .notes li.crack em { font-style: normal; color: #c0392b; font-weight: 800; white-space: nowrap; }

/* Scene effects */
.fx-drip path { animation: drip 0.9s ease-in infinite; }
@keyframes drip { from { transform: translateY(0); opacity: 1; } to { transform: translateY(34px); opacity: 0; } }
.fx-stay { transform-box: fill-box; transform-origin: center; animation: stay 0.45s ease-out both; }
@keyframes stay { from { transform: scale(0.2); opacity: 0; } 70% { transform: scale(1.12); opacity: 1; } to { transform: scale(1); opacity: 1; } }
.fx-steam path { animation: steam 2.2s ease-out infinite; }
@keyframes steam { 0% { opacity: 0; transform: translateY(8px); } 30% { opacity: 0.85; } 100% { opacity: 0; transform: translateY(-26px); } }
.fx-puff circle { animation: puff 0.7s ease-out infinite; }
@keyframes puff { from { opacity: 0.9; transform: translateY(0); } to { opacity: 0; transform: translateY(22px); } }
.flow-stream { opacity: 0.92; }
.fx-hum path { animation: blink 0.5s steps(2) infinite; }
.night-fall { opacity: 0.4; animation: night 2s ease-in forwards; }
@keyframes night { from { opacity: 0; } to { opacity: 0.4; } }
.snowfall { animation: snow 3s linear infinite; }
@keyframes snow { from { transform: translateY(-40px); } to { transform: translateY(40px); } }

@media (prefers-reduced-motion: reduce) {
  .fx-steam path, .fx-puff circle, .fx-hum path, .night-fall, .snowfall, #viewnav .vbtn.hint, .fx-stay, .fx-drip path { animation: none !important; }
}

/* The dark storage lot: the flashlight lights a cone where you point */
#dark { position: absolute; inset: 0; z-index: 1; pointer-events: none; background: rgba(6, 12, 22, 0.93); }
#dark[hidden] { display: none; }
#dark.light { background: radial-gradient(circle 170px at var(--x, 50%) var(--y, 55%), rgba(6, 12, 22, 0) 0, rgba(6, 12, 22, 0.05) 60%, rgba(6, 12, 22, 0.93) 100%); }
.morning { opacity: 0.35; }
#overlay .seg.wrap { flex-wrap: wrap; justify-content: flex-end; }

/* ---------- Phone fit (Oct 16 2026): the scene gets the room ---------- */
/* Upright phones: home + buttons always own the first row, so the level code and stats share the second. */
@media (max-width: 600px) {
  #hud #topbtns { flex: 1 0 calc(100% - 64px); }
}
/* 320px phones: smaller buttons so they fit one row (otherwise the HUD takes three). */
@media (max-width: 359px) {
  #hud.touch .hbtn.home { width: 42px; height: 42px; }
  #hud.touch #topbtns .hbtn { width: 40px; height: 40px; }
  #hud.touch #topbtns .hbtn svg { width: 22px; height: 22px; }
  #hud.touch #topbtns { gap: 5px; }
  #hud .title { padding-left: 10px; padding-right: 8px; }
  #hud .stats { gap: 8px; }
  #hud .hstars { padding-right: 10px; }
}
/* Short landscape phones: one bar that fits (the pause button was running off the edge). */
@media (orientation: landscape) and (max-height: 520px) and (max-width: 900px) {
  #hud.touch { min-height: 54px; }
  #hud.touch .hbtn.home { width: 44px; height: 44px; }
  #hud.touch #topbtns .hbtn { width: 44px; height: 44px; }
  #hud.touch #topbtns .hbtn svg { width: 24px; height: 24px; }
  #hud.touch #topbtns { gap: 6px; }
  #hud .stats { gap: 10px; }
  #hud .stat.t small { display: none; }
  #hud .hstars { margin: 0 4px 0 8px; }
}
/* Toasts go just under the gauges (main.js measures them: they wrap to two rows on phones). */
@media (max-width: 1080px) {
  #toasts { top: var(--gauges-b, 96px); }
}
@media (orientation: landscape) and (max-height: 520px) {
  #toasts { top: var(--gauges-b, 96px); right: auto; left: 50%; transform: translateX(-50%); width: min(420px, calc(100% - 24px)); }
  #toasts .toast:nth-child(n+2) { display: none; }
  /* Beside the gauges when there's room, two at a time. */
  #scene-wrap.toasts-side #toasts { top: 8px; right: 8px; left: auto; transform: none; width: min(360px, var(--side-room, 44%)); }
  #scene-wrap.toasts-side #toasts .toast:nth-child(2) { display: flex; }
}
@media (orientation: portrait) and (max-width: 600px) {
  #toasts .toast:nth-child(n+3) { display: none; }
}
@media (orientation: portrait) and (max-height: 720px) {
  #toasts .toast:nth-child(n+2) { display: none; }
}
/* Upright phones: a slimmer gear shelf and a one-line steps bar. */
@media (orientation: portrait) and (max-height: 900px) {
  #tray .tray-head { padding: 6px 12px 0; font-size: 11px; }
  #tray .cards { grid-auto-columns: 78px; height: 104px; padding: 8px 10px 10px; gap: 8px 6px; }
  .gear-card { padding: 4px 3px 5px; font-size: 10.5px; border-radius: 12px; }
  .gear-card img { width: 40px; height: 40px; }
  #steps .steps-head { padding: 6px 2px 4px; font-size: 11px; }
  #steps { padding-bottom: 4px; max-height: 26vh; }
}
@media (max-width: 600px), (max-height: 520px) {
  .gauge svg { width: 64px; height: 35px; }
}
