/* Odd One Out: styles for everything inside the stage (HUD, menus, overlays). The page shell is kit/shell.css.
   The stage is a size container, so layouts below adapt to the stage itself (cqw units, @container), which also
   covers full screen. The in-stage UI is always "night" coloured, whatever theme the page uses. */
.stage { --stage-ratio: 16 / 9; --stage-ratio-n: 1.7778; background: #1b1525; container-type: size; container-name: stage; }
@media (max-width: 700px), (orientation: portrait) and (max-width: 1000px) { .stage { --stage-ratio: 9 / 14; --stage-ratio-n: 0.6429; } }
.stage canvas { touch-action: none; cursor: crosshair; }

.ui { position: absolute; inset: 0; pointer-events: none; color: #fbf6ec; font: 400 16px/1.4 var(--font-body);
  --paper: #fbf6ec; --ink: #17131f; --edge: #17131f; --surface: #fffdf8; --muted: #a79db5; --ink-2: #d5ccdf; --deep: #0c0912; --panel: #241c31; --rule: #3a2f4d; }
.ui [hidden] { display: none !important; }
.stage .ui canvas { position: static; inset: auto; flex: none; cursor: inherit; } /* icons, not the game canvas */
.ui :focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
.ui h2 { font-size: clamp(30px, 8.5cqw, 58px); color: var(--paper); text-shadow: 3px 3px 0 var(--deep); }
.ui h3 { font-size: 22px; color: var(--paper); margin-top: 6px; justify-self: start; }
.ui .btn { box-shadow: 4px 4px 0 var(--deep); white-space: nowrap; }
.ui .btn:hover { box-shadow: 6px 6px 0 var(--deep); background: var(--yellow); }
.ui .btn.primary:hover { background: #ff7a55; }
.ui .btn:active { box-shadow: 1px 1px 0 var(--deep); }
.ui .btn.big { font-size: 20px; padding: 15px 34px; }
.ui .btn.poor { background: #b9b1c4; }
.ui .btn.danger { background: var(--pink); }
.ui .btn kbd { margin-left: 2px; }
.scrap-ico { display: inline-block; width: 0.82em; height: 0.82em; background: var(--orange); clip-path: polygon(25% 4%, 75% 4%, 100% 50%, 75% 96%, 25% 96%, 0 50%); flex: none; }
.btn.primary .scrap-ico { background: var(--ink); }
.ui .scrap { display: inline-flex; align-items: center; gap: 4px; font: 500 13px/1 var(--font-mono); background: var(--ink); color: var(--paper); padding: 4px 8px; border-radius: 999px; }
.pips { display: inline-flex; gap: 3px; vertical-align: middle; }
.pips i { width: 9px; height: 9px; border: 1.5px solid var(--muted); border-radius: 2px; }
.pips i.on { background: var(--yellow); border-color: var(--yellow); }

/* ---------------------------------------------------------------- HUD */
.hud { position: absolute; inset: 0; }
.xp { position: absolute; top: 0; left: 0; right: 0; height: 16px; background: #2b2339; border-bottom: 2px solid var(--deep); }
.xp i { display: block; height: 100%; width: 0; background: var(--blue); box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.18); transition: width 0.12s linear; }
.xp .lv { position: absolute; right: 8px; top: 0; font: 500 11px/14px var(--font-mono); letter-spacing: 0.08em; text-shadow: 1px 1px 0 var(--deep); }
.hud-row { position: absolute; top: 24px; left: 10px; right: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hp { position: relative; width: clamp(92px, 24cqw, 230px); height: 20px; background: var(--deep); border: 2px solid var(--paper); border-radius: 999px; overflow: hidden; }
.hp i { display: block; height: 100%; background: var(--orange); transition: width 0.15s ease-out; }
.hp span { position: absolute; inset: 0; text-align: center; font: 500 11.5px/16px var(--font-mono); text-shadow: 1px 1px 0 var(--deep), -1px -1px 0 var(--deep), 1px -1px 0 var(--deep), -1px 1px 0 var(--deep); }
.timer { position: absolute; left: 50%; top: -5px; transform: translateX(-50%); font: 800 clamp(24px, 6cqw, 34px)/1 var(--font-display); font-variation-settings: "SOFT" 100, "WONK" 1; letter-spacing: -0.02em; text-shadow: 2px 2px 0 var(--deep); font-variant-numeric: tabular-nums; }
.timer.late { color: var(--yellow); }
.hud-right { display: flex; align-items: center; gap: 8px; }
.kills { display: inline-flex; align-items: center; gap: 6px; font: 500 13px/1 var(--font-mono); text-shadow: 1px 1px 0 var(--deep); }
.kills em { font-style: normal; }
.kills b { position: relative; width: 15px; height: 14px; background: #93a1c9; border: 2px solid var(--deep); border-radius: 3px; }
.kills b::before, .kills b::after { content: ""; position: absolute; top: 2px; width: 3px; height: 3px; background: var(--deep); }
.kills b::before { left: 1.5px; } .kills b::after { right: 1.5px; }
.pause-btn { pointer-events: auto; width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--ink); background: var(--paper); box-shadow: 2px 2px 0 var(--deep); display: inline-flex; align-items: center; justify-content: center; gap: 4px; cursor: pointer; padding: 0; }
.pause-btn i { width: 4px; height: 13px; background: var(--ink); border-radius: 1px; }
.pause-btn:hover { background: var(--yellow); }
.bossbar { position: absolute; top: 60px; left: 50%; transform: translateX(-50%); width: min(70cqw, 440px); text-align: center; }
.bossbar span { font: 800 italic 16px/1.2 var(--font-display); text-shadow: 2px 2px 0 var(--deep); }
.bossbar div { height: 12px; margin-top: 3px; background: var(--deep); border: 2px solid var(--paper); border-radius: 999px; overflow: hidden; }
.bossbar i { display: block; height: 100%; background: var(--pink); transition: width 0.15s; }
.banner { position: absolute; top: 27%; left: 0; right: 0; text-align: center; font: 800 italic clamp(24px, 7cqw, 50px)/1 var(--font-display); font-variation-settings: "SOFT" 100, "WONK" 1; color: var(--yellow); text-shadow: 3px 3px 0 var(--deep), -1px -1px 0 var(--deep); animation: banner 0.35s cubic-bezier(0.3, 1.6, 0.5, 1); }
.ui:has(.ov:not([hidden])) .banner { display: none; }
@keyframes banner { from { transform: scale(0.6) rotate(-4deg); opacity: 0; } to { transform: none; opacity: 1; } }
.build { position: absolute; left: 8px; bottom: 8px; display: grid; gap: 4px; opacity: 0.92; }
.build-row, .bl-parts { display: flex; gap: 4px; flex-wrap: wrap; }
.slot { position: relative; display: inline-block; width: 26px; height: 26px; }
.slot canvas { display: block; }
.slot b { position: absolute; right: -4px; bottom: -4px; min-width: 14px; height: 14px; padding: 0 2px; border-radius: 7px; background: var(--deep); color: var(--paper); font: 500 9.5px/14px var(--font-mono); text-align: center; }
.lowhp { position: absolute; inset: 0; box-shadow: inset 0 0 70px 12px rgba(255, 60, 40, 0.55); opacity: 0; transition: opacity 0.3s; }
.lowhp.on { opacity: 1; animation: lowhp 0.9s ease-in-out infinite alternate; }
@keyframes lowhp { from { opacity: 0.45; } to { opacity: 1; } }

/* ---------------------------------------------------------------- overlays */
.ov { position: absolute; inset: 0; display: flex; overflow-y: auto; overscroll-behavior: contain; pointer-events: auto; padding: clamp(12px, 3cqw, 28px); touch-action: pan-y; }
.ov.dim { background: rgba(18, 13, 26, 0.8); }
.ov.solid { background: #1b1525; }
.panel { width: min(100%, 760px); margin: auto; display: grid; gap: 12px; justify-items: center; text-align: center; }
.hint { color: var(--ink-2); font-size: 15px; max-width: 34em; }
.row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; align-items: center; margin-top: 4px; }

/* title */
.ov-title { background: linear-gradient(to bottom, rgba(18, 13, 26, 0.94) 0%, rgba(18, 13, 26, 0.6) 26%, rgba(18, 13, 26, 0) 38%, rgba(18, 13, 26, 0) 50%, rgba(18, 13, 26, 0.8) 64%, rgba(18, 13, 26, 0.96) 100%); }
.ov-title .panel { min-height: 100%; align-content: space-between; width: 100%; }
.title-top, .title-bottom { display: grid; gap: 8px; justify-items: center; }
.logo-big { font-size: clamp(44px, 13cqw, 104px) !important; transform: rotate(-2deg); text-shadow: 5px 5px 0 var(--deep) !important; }
.sub { color: var(--paper); font-size: clamp(14.5px, 2.2cqw, 19px); max-width: 40em; text-shadow: 1px 1px 0 var(--deep); }
.best { font: 500 12px/1 var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--yellow); }
.chars { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.char { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px 5px 6px; border-radius: 999px; border: 2px solid rgba(251, 246, 236, 0.4); background: rgba(18, 13, 26, 0.7); color: var(--paper); font: 650 13.5px/1 var(--font-body); cursor: pointer; }
.char i { width: 20px; height: 20px; border-radius: 7px; border: 2px solid var(--ink); box-shadow: inset -5px -5px 0 -3px var(--orange); }
.char.sel { background: var(--paper); color: var(--ink); border-color: var(--ink); box-shadow: 3px 3px 0 var(--deep); }
.char.locked { border-style: dashed; color: var(--muted); }
.char.locked i { filter: grayscale(1) brightness(0.6); }
.blurb { font-size: 14px; color: var(--ink-2); text-shadow: 1px 1px 0 var(--deep); }
.howto { font-size: 13.5px; color: var(--ink-2); }

/* upgrade cards */
.picks { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 14px; width: 100%; }
.picks.one { max-width: 300px; }
.pick { position: relative; display: grid; gap: 8px; justify-items: center; align-content: start; text-align: center; padding: 16px 12px 14px; background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: 18px; box-shadow: 5px 5px 0 var(--deep); cursor: pointer; font: inherit; transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.1s; animation: pick-in 0.28s cubic-bezier(0.3, 1.5, 0.5, 1) backwards; }
.pick:nth-child(odd) { transform: rotate(-1deg); } .pick:nth-child(even) { transform: rotate(0.8deg); }
.pick:nth-child(2) { animation-delay: 0.05s; } .pick:nth-child(3) { animation-delay: 0.1s; } .pick:nth-child(4) { animation-delay: 0.15s; }
@keyframes pick-in { from { translate: 0 22px; } to { translate: 0 0; } }
button.pick:hover, button.pick:focus-visible { transform: translate(-2px, -3px); box-shadow: 8px 8px 0 var(--deep); background: #fff3c9; }
.pick[disabled] { cursor: default; opacity: 1; color: var(--ink); }
.pick-text { display: grid; gap: 5px; justify-items: inherit; min-width: 0; }
.pick .tag { font: 500 10.5px/1 var(--font-mono); letter-spacing: 0.1em; padding: 4px 7px; border-radius: 999px; background: var(--ink); color: var(--paper); }
.pick.new .tag { background: var(--orange); color: var(--ink); }
.pick b { font: 800 21px/1.05 var(--font-display); font-variation-settings: "SOFT" 100, "WONK" 1; letter-spacing: -0.02em; }
.pick .txt { font-size: 14px; line-height: 1.3; color: #453e52; }
.pick kbd { position: absolute; top: 8px; right: 8px; }
@media (hover: none) { .pick kbd, .btn kbd, .howto .kb { display: none; } }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; width: 100%; max-width: 620px; }
.stats > div { display: grid; gap: 2px; padding: 9px 8px 10px; background: var(--panel); border: 2px solid var(--rule); border-radius: 14px; }
.stats span { font: 500 10.5px/1.2 var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.stats b { font: 800 26px/1 var(--font-display); font-variation-settings: "SOFT" 100; }
.stats .rec { justify-self: center; font: 500 10px/1 var(--font-mono); font-style: normal; letter-spacing: 0.08em; text-transform: uppercase; background: var(--yellow); color: var(--ink); padding: 3px 6px; border-radius: 999px; }
.stats .scrap-stat b { color: var(--orange); }
.ach-new { font-size: 14px; background: var(--mint); color: var(--ink); border: 2px solid var(--ink); border-radius: 12px; padding: 7px 12px; box-shadow: 3px 3px 0 var(--deep); }
.ach-new em { font-style: normal; font-weight: 700; }

/* build list (pause, game over) */
.buildlist { display: grid; gap: 6px; width: 100%; max-width: 540px; text-align: left; }
.bl-main b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bl-row { display: flex; align-items: center; gap: 10px; }
.bl-row > div { flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 3px 10px; align-items: center; }
.bl-main { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14.5px; }
.bl-dmg { position: relative; height: 14px; background: var(--panel); border-radius: 4px; overflow: hidden; }
.bl-dmg i { position: absolute; inset: 0 auto 0 0; background: #5a4a7a; }
.bl-dmg span { position: relative; display: block; padding-left: 6px; font: 500 10px/14px var(--font-mono); color: var(--paper); }
.bl-parts { margin-top: 4px; gap: 8px; }
.toggles { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.toggle { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 7px; border-radius: 999px; border: 2px solid var(--rule); background: var(--panel); color: var(--paper); font: 600 13.5px/1 var(--font-body); cursor: pointer; }
.toggle i { position: relative; width: 30px; height: 18px; border-radius: 999px; background: #4a3f5e; }
.toggle i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--paper); transition: left 0.12s; }
.toggle[aria-checked="true"] i { background: var(--mint); }
.toggle[aria-checked="true"] i::after { left: 15px; background: var(--ink); }

/* workshop + records */
.ov-shop .panel, .ov-records .panel { justify-items: stretch; text-align: left; }
.ov-shop .hint { margin-top: -6px; }
.shop-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.wallet { display: inline-flex; align-items: center; gap: 6px; font: 500 14px/1 var(--font-mono); background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: 999px; padding: 7px 12px; box-shadow: 3px 3px 0 var(--deep); }
.shop-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.shop-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px 9px 12px; background: var(--panel); border: 2px solid var(--rule); border-radius: 14px; }
.shop-info { flex: 1; min-width: 0; display: grid; gap: 3px; }
.shop-info b { font-size: 15px; line-height: 1.15; }
.shop-info span:not(.pips) { font-size: 13px; line-height: 1.25; color: var(--ink-2); }
.swatch { width: 26px; height: 26px; border-radius: 9px; border: 2px solid var(--ink); box-shadow: inset -6px -6px 0 -3px var(--orange), 2px 2px 0 var(--deep); flex: none; }
.lock-note { font-size: 12px; line-height: 1.2; color: var(--muted); max-width: 9em; text-align: right; }
.ach-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.ach { display: flex; align-items: center; gap: 9px; padding: 7px 10px; background: var(--panel); border: 2px solid var(--rule); border-radius: 12px; }
.ach > div { flex: 1; min-width: 0; display: grid; }
.ach b { font-size: 14px; } .ach span { font-size: 12.5px; line-height: 1.25; color: var(--ink-2); }
.ach i { width: 18px; height: 18px; border-radius: 5px; border: 2px solid var(--muted); flex: none; display: grid; place-items: center; font: 700 12px/1 var(--font-body); font-style: normal; }
.ach.got i { background: var(--mint); border-color: var(--mint); color: var(--ink); } .ach.got i::before { content: "✓"; }
.ach em { font: 500 10px/1 var(--font-mono); font-style: normal; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.ach.got em { color: var(--mint); }
.ov-records .stats { max-width: none; grid-template-columns: repeat(3, minmax(0, 1fr)); text-align: center; }

/* ---------------------------------------------------------------- narrow stage (phones, portrait) */
@container stage (max-width: 620px) {
  .hud-row { top: 22px; left: 7px; right: 7px; }
  .kills { font-size: 12px; }
  .pause-btn { width: 42px; height: 42px; }
  .bl-row > div { grid-template-columns: minmax(0, 1fr); }
  .picks { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .pick { grid-template-columns: auto minmax(0, 1fr); justify-items: start; text-align: left; align-items: center; gap: 11px; padding: 10px 12px; transform: none !important; }
  .pick b { font-size: 18px; } .pick .txt { font-size: 13px; }
  .shop-list, .ach-list { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats b { font-size: 22px; }
  .char:not(.sel) span { display: none; } .char:not(.sel) { padding: 5px 6px; }
  .ui .btn { padding: 11px 16px; font-size: 15px; }
  .ui .btn.big { flex-basis: 100%; font-size: 19px; padding: 14px 20px; }
  .ui .btn.small { padding: 8px 12px; font-size: 13.5px; min-height: 42px; min-width: 64px; }
  .panel { gap: 10px; }
}
/* short stage (a phone on its side, not in full screen) */
@container stage (max-height: 430px) {
  .ov { padding: 8px 12px; }
  .panel { gap: 6px; }
  .ui h2 { font-size: clamp(22px, 9cqh, 34px); }
  .logo-big { font-size: clamp(30px, 15cqh, 60px) !important; }
  .sub, .howto, .blurb, .best, .ov-level .hint, .ov-crate .hint { display: none; }
  .title-top, .title-bottom { gap: 6px; }
  .ui .btn, .ui .btn.big { flex-basis: auto; padding: 9px 18px; font-size: 15px; }
  .row { gap: 8px; margin-top: 0; }
  .picks { gap: 6px; }
  .pick { padding: 6px 10px; gap: 3px 10px; }
  .pick b { font-size: 16px; } .pick .txt { font-size: 12.5px; line-height: 1.2; }
  .pick .tag { font-size: 9.5px; padding: 3px 6px; }
  .stats > div { padding: 5px 6px 6px; } .stats b { font-size: 19px; }
  .bossbar { top: 50px; }
}
@media (prefers-reduced-motion: reduce) { .lowhp.on { opacity: 0.7; } }
