* { box-sizing: border-box; }
* { scrollbar-color: color-mix(in srgb, var(--line) 72%, var(--ink)) var(--card); scrollbar-width: thin; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: var(--card); }
*::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--line) 72%, var(--ink)); border: 2px solid var(--card); border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: var(--sea); }
*::-webkit-scrollbar-button { display: none; }
*::-webkit-scrollbar-corner { background: var(--card); }
/* Beach theme: sky, sand and sea. */
:root { --ink: #24384a; --muted: #6b7f90; --card: #fffaf0ee; --line: #e6cf9c; --sea: #1f9fc7; --gold: #e69500; --coral: #ff7f6e; --page: #9fe3ff; --btn: #ffffff; --btn-hover: #fff4d6; --overlay-scrim: #071724b8; --overlay-shadow: 0 24px 64px #0006; --hud-height: 44px; }
/* The menu sets these per map theme (ui/menu.js applyUiTheme). */
html, body { margin: 0; height: 100%; background: var(--page); color: var(--ink); font: 14px/1.3 "Trebuchet MS", system-ui, sans-serif; overflow: hidden; }
#stage { position: fixed; inset: var(--hud-height) 0 0 0; }
#stage canvas { display: block; }
#hud { position: fixed; top: 0; left: 0; right: 0; height: var(--hud-height); display: flex; gap: 14px; align-items: center; padding: 0 12px; background: var(--card); border-bottom: 3px solid var(--line); z-index: 2; }
#hud .stat { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; background: color-mix(in srgb, var(--line) 22%, var(--btn)); border: 2px solid var(--line); border-radius: 999px; font-weight: bold; }
#hud .stat b { color: var(--ink); font-size: 16px; font-variant-numeric: tabular-nums; }
#hud .stat.gold b { color: var(--gold); }
#hud .stat.lives b { color: var(--coral); }
#hud #h-timer:empty, #hud #h-seed:empty { display: none; }
#hud #h-seed { font-size: 12px; color: var(--muted); }
#hud .spacer { flex: 1; }
button { font: inherit; font-weight: bold; color: var(--ink); background: var(--btn); border: 2px solid var(--line); border-radius: 10px; padding: 4px 12px; cursor: pointer; box-shadow: 0 2px 0 var(--line); }
button:hover:not(:disabled) { background: var(--btn-hover); }
button:active:not(:disabled) { transform: translateY(1px); box-shadow: 0 1px 0 var(--line); }
button:disabled { opacity: 0.45; cursor: default; }
button.on { border-color: var(--gold); }
#b-launch { background: var(--sea); color: #fff; border-color: #0003; box-shadow: 0 2px 0 #0003; }
#b-launch:hover:not(:disabled) { background: var(--sea); filter: brightness(1.1); }
#shop { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 6px; padding: 6px 10px; background: var(--card); border-top: 3px solid var(--line); z-index: 2; }
#shop { align-items: stretch; }
#shop .bar-item { position: relative; display: flex; flex-direction: column; align-items: center; min-width: 84px; padding: 8px 8px 4px; border-radius: 12px; overflow: hidden; transition: transform 0.12s, box-shadow 0.12s; }
#shop .bar-item::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: var(--c, var(--line)); }
#shop .bar-item i { width: 22px; height: 22px; display: block; margin-bottom: 2px; border-radius: 7px; border: 2px solid #fff; background: var(--c); box-shadow: 0 0 0 1px var(--line), 0 0 8px color-mix(in srgb, var(--c) 60%, transparent); }
#shop .bar-item .cost { color: var(--gold); font-weight: bold; }
#shop .bar-item .cooldown, .sh-item .cooldown { color: #b04422; font-size: 11px; font-weight: bold; }
#shop .bar-item kbd { position: absolute; top: 7px; right: 5px; font-weight: bold; font-size: 10px; line-height: 1; color: var(--muted); background: color-mix(in srgb, var(--line) 40%, transparent); border-radius: 4px; padding: 1px 4px; }
#shop .bar-item:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 4px 0 var(--line); }
#shop .bar-item .poor-cover { display: none; }
#shop .bar-item.poor .poor-cover { position: absolute; inset: 5px 0 0; z-index: 1; display: grid; place-items: center; padding: 4px; background: rgba(25, 30, 42, 0.72); color: #fff; font-size: 11px; line-height: 1.15; text-align: center; pointer-events: none; }
#shop .bar-item.poor .cost { position: relative; z-index: 2; padding: 1px 5px; border-radius: 5px; background: #fff; color: #a51f18; }
#shop .bar-item.sel { border-color: #34c759; background: #34c75926; box-shadow: 0 0 0 3px #34c75966, 0 4px 0 #34c759; transform: translateY(-3px); }
/* Inspector: a drawer that slides in from the right edge; its edge tab slides it away and back. */
#panel { position: fixed; right: 0; top: calc((100vh + var(--hud-height) - 50px) / 2); display: flex; flex-direction: column; width: min(300px, calc(100vw - 44px)); min-width: 230px; max-height: calc(100vh - var(--hud-height) - 150px); padding: 10px; background: var(--card); border: 3px solid var(--line); border-right: 0; border-radius: 14px 0 0 14px; z-index: 2; box-shadow: 0 4px 14px #0002; transform: translate(110%, -50%); visibility: hidden; transition: transform .3s ease, visibility 0s .3s; }
#panel.shown { transform: translate(0, -50%); visibility: visible; transition: transform .3s ease; }
#panel.shown.folded { transform: translate(100%, -50%); }
#panel #p-fold { position: absolute; left: -44px; top: 14px; width: 40px; height: 64px; border-radius: 14px 0 0 14px; font-size: 26px; line-height: 1; cursor: pointer; background: var(--card); border: 3px solid var(--line); border-right: 0; visibility: hidden; }
#panel.shown #p-fold { visibility: visible; }
#panel #p-tabs { display: flex; gap: 4px; margin: 8px 0 2px; }
#panel #p-tabs button { flex: 1; padding: 6px 4px; font-size: 13px; border-radius: 9px; cursor: pointer; }
#panel #p-tabs button.sel { background: var(--sea); color: #fff; border-color: transparent; }
#panel.plain #p-tabs { display: none; }
#panel #p-body { overflow: auto; min-height: 0; }
#panel:not(.plain) .pane { display: none; }
#panel.t-basic .pane-basic, #panel.t-more .pane-more, #panel.t-adv .pane-adv, #panel.t-upgrades .pane-upgrades { display: block; }
@media (prefers-reduced-motion: reduce) { #panel, #panel.shown { transition: none; } }
#panel #p-view { display: block; width: 100%; height: 110px; border-radius: 10px; background: radial-gradient(circle at 50% 40%, #e9fbff, #a9e6f7); }
#panel #p-lv { position: absolute; left: 18px; top: 18px; padding: 2px 9px; border-radius: 10px; background: #1b2a3acc; color: #ffd84a; font: 700 12px/1.5 system-ui, sans-serif; letter-spacing: .3px; pointer-events: none; }
#panel #p-lv[hidden] { display: none; }
#panel h3 { margin: 8px 0 2px; }
#panel .stars { color: #ffbf00; letter-spacing: 1px; text-shadow: 0 1px 0 #b07a00; }
#panel .kind { margin: 0 0 6px; color: var(--muted); font-size: 12px; }
#panel .row { display: flex; justify-content: space-between; margin: 2px 0; }
#panel .skill span { color: var(--muted); font-size: 12px; }
#panel .status { margin: 6px 0 0; color: #c0392b; font-size: 12px; }
#panel small { color: var(--muted); }
#panel .mods { display: flex; gap: 4px; margin: 4px 0; }
#panel .mods button { flex: 1; }
#panel .mods button.on { background: #2a9bc4; color: #fff; }
#panel .btns { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
#toast { position: fixed; top: 100px; left: 50%; transform: translateX(-50%); padding: 6px 14px; color: #fff; background: #e0533f; border-radius: 10px; opacity: 0; transition: opacity 0.2s; pointer-events: none; z-index: 4; font-weight: bold; }
#toast.show { opacity: 1; }
#overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--overlay-scrim); color: var(--ink); z-index: 5; backdrop-filter: blur(9px) saturate(0.82); -webkit-backdrop-filter: blur(9px) saturate(0.82); }
#overlay[hidden] { display: none; }
#pause-overlay { position: fixed; inset: var(--hud-height) 0 0 0; z-index: 7; display: grid; place-items: center; background: color-mix(in srgb, var(--pause-tint, #071724) 28%, transparent); backdrop-filter: blur(var(--pause-blur, 10px)) saturate(0.75); -webkit-backdrop-filter: blur(var(--pause-blur, 10px)) saturate(0.75); }
#pause-overlay[hidden] { display: none; }
#pause-overlay .pause-card { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 28px 48px; border: 2px solid var(--line); border-radius: 20px; background: color-mix(in srgb, var(--card) 92%, transparent); box-shadow: 0 18px 50px #0005; }
#pause-overlay h1 { margin: 0; font-size: clamp(30px, 6vw, 54px); letter-spacing: 3px; }
#pause-overlay .primary { min-width: 140px; min-height: 44px; border-color: var(--sea); background: var(--sea); color: #fff; }
#pause-overlay .pause-freeze { margin: -8px 0 0; color: var(--muted); font-size: 14px; }
body.game-break #hud, body.game-break #shop, body.game-break #panel, body.game-break #incoming,
body.game-break #scroll, body.game-break #counter-tip, body.game-break #slots-mini,
body.game-break .tower-shortcuts, body.game-break #toast { opacity: 0.18; pointer-events: none; }
body.game-pause #hud, body.game-pause #shop, body.game-pause #panel, body.game-pause #incoming,
body.game-pause #scroll, body.game-pause #counter-tip, body.game-pause #slots-mini,
body.game-pause .tower-shortcuts, body.game-pause #toast { pointer-events: none; }
body.game-pause #b-pause { pointer-events: auto; }
#stage.paused canvas { filter: blur(calc(var(--pause-blur, 10px) * 0.8)) saturate(0.72); }
#overlay .end-card { width: min(440px, calc(100vw - 32px)); display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 28px; border: 2px solid color-mix(in srgb, var(--btn) 70%, var(--line)); border-radius: 24px; background: color-mix(in srgb, var(--card) 94%, transparent); box-shadow: var(--overlay-shadow); text-align: center; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
#overlay .end-mark { display: grid; width: 64px; height: 64px; place-items: center; border: 2px solid var(--line); border-radius: 50%; background: color-mix(in srgb, var(--coral) 18%, var(--card)); color: var(--coral); font-size: 32px; }
#overlay.is-win .end-mark { background: color-mix(in srgb, var(--gold) 18%, var(--card)); color: var(--gold); }
#overlay .end-kicker { margin: 4px 0 0; color: var(--muted); font-size: 12px; font-weight: bold; letter-spacing: 2px; }
#overlay .end-card h1 { margin: 0; color: var(--ink); font-size: clamp(28px, 5vw, 36px); line-height: 1.1; text-wrap: balance; }
#overlay .end-copy { margin: 0 0 6px; color: var(--muted); font-size: 16px; line-height: 1.5; }
#overlay .end-wave { display: flex; width: 100%; align-items: center; justify-content: space-between; padding: 12px 16px; border: 2px solid var(--line); border-radius: 12px; background: color-mix(in srgb, var(--line) 20%, var(--btn)); }
#overlay .end-wave span { color: var(--muted); font-size: 13px; font-weight: bold; }
#overlay .end-wave strong { color: var(--ink); font-size: 20px; font-variant-numeric: tabular-nums; }
#overlay .o-btns { display: grid; width: 100%; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
#overlay .o-btns button { min-height: 44px; padding: 8px 12px; }
#overlay .o-btns button.primary { border-color: color-mix(in srgb, var(--sea) 75%, var(--ink)); background: var(--sea); color: #fff; box-shadow: 0 2px 0 color-mix(in srgb, var(--sea) 75%, var(--ink)); }
#overlay .o-btns button.primary:hover { filter: brightness(1.08); }
@media (max-width: 480px) { #overlay .end-card { padding: 24px 20px; border-radius: 20px; } #overlay .o-btns { grid-template-columns: 1fr; } }

/* Incoming strip: the wave, its enemies and where they arrive. */
#incoming { position: fixed; top: calc(var(--hud-height) + 8px); left: 50%; transform: translateX(-50%); max-width: calc(100vw - 24px); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; padding: 5px 12px; background: var(--card); border: 3px solid var(--line); border-radius: 999px; box-shadow: 0 3px 10px #0002; z-index: 2; pointer-events: none; font-size: 13px; }
#incoming[hidden] { display: none; }
#incoming .in-title { color: var(--sea); }
#incoming .in-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; background: var(--btn); border: 2px solid var(--line); border-radius: 999px; font-weight: bold; }
#incoming .in-chip i { width: 10px; height: 10px; border-radius: 3px; border: 1px solid #0004; }
#incoming .in-chip .in-el { font-size: 9px; line-height: 1; padding: 1px 4px; border-radius: 6px; color: #1b2230; background: var(--t); }
#incoming .in-from { color: var(--muted); font-size: 12px; }

/* Wave scroll: rods top and bottom, the paper unrolls between them. */
#scroll { position: fixed; top: calc(var(--hud-height) + 10px); right: 10px; width: min(390px, calc(100vw - 20px)); z-index: 3; cursor: pointer; filter: drop-shadow(0 4px 6px #0003); }
#scroll[hidden] { display: none; }
#scroll-toggle { position: fixed; top: calc(var(--hud-height) + 10px); right: 10px; z-index: 3; padding: 4px 12px; color: #fff4d6; border-color: #8a5a2b; background: linear-gradient(#c58b4c, #8a5a2b); }
#scroll-toggle:hover:not(:disabled) { background: linear-gradient(#d49b5c, #996637); }
#scroll-toggle[hidden] { display: none; }
#scroll .rod { height: 14px; margin: 0 -10px; border-radius: 7px; background: linear-gradient(#c58b4c, #8a5a2b 60%, #6b431e); position: relative; z-index: 1; }
#scroll .paper { overflow: hidden; max-height: 0; padding: 0 20px; background: linear-gradient(90deg, #f3dfb0, #fff4d6 15%, #fff4d6 85%, #f3dfb0); color: #4a3418; transition: max-height 0.45s ease, padding 0.45s ease; }
#scroll.open .paper { max-height: 420px; padding: 12px 20px; }
#scroll.closing .paper { max-height: 0; padding: 0 16px; }
#scroll h3 { margin: 0 0 4px; text-align: center; color: #8a3b12; }
#scroll ul { margin: 0 0 8px; padding-left: 22px; padding-right: 8px; columns: 2; column-gap: 28px; }
#scroll li { margin: 2px 0; }
#scroll .new { margin: 4px 0; padding: 4px 6px; background: #ffe7a8; border-radius: 6px; }
#scroll .tip { margin: 6px 0 2px; font-style: italic; }
#scroll small { display: block; text-align: center; color: #9a7a4a; }

/* Dev console: a themed card like the inspect window, with a close button. */
#devconsole { position: fixed; left: 10px; top: calc(var(--hud-height) + 10px); width: 340px; max-height: calc(100vh - 140px); overflow: auto; padding: 10px 12px; background: var(--card); color: var(--ink); border: 3px solid var(--line); border-radius: 14px; box-shadow: 0 4px 14px #0003; z-index: 6; font-size: 13px; }
#devconsole[hidden] { display: none; }
#devconsole .dc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
#devconsole .dc-head b { font-size: 15px; }
#devconsole .dc-head span { flex: 1; color: var(--muted); font-size: 12px; text-align: right; }
#devconsole #dc-close { width: 28px; height: 28px; padding: 0; border-radius: 50%; font-size: 18px; line-height: 1; }
#devconsole fieldset { border: 2px solid var(--line); border-radius: 10px; margin: 0 0 8px; padding: 6px 8px; }
#devconsole legend { padding: 0 4px; color: var(--muted); font-weight: bold; }
#devconsole .dc-field { display: flex; justify-content: space-between; align-items: center; margin: 3px 0; }
#devconsole input[type=number], #devconsole #dc-line { width: 110px; font: inherit; color: var(--ink); background: var(--btn); border: 2px solid var(--line); border-radius: 8px; padding: 2px 6px; }
#devconsole input:focus { outline: 2px solid var(--sea); outline-offset: 0; }
#devconsole #dc-line { width: 100%; }
#devconsole .dc-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
#devconsole #dc-log { height: 90px; overflow: auto; white-space: pre-wrap; background: color-mix(in srgb, var(--line) 22%, transparent); border: 2px solid var(--line); border-radius: 8px; padding: 4px 6px; margin-bottom: 6px; font: 12px/1.35 ui-monospace, Consolas, monospace; color: var(--ink); }

/* Main menu over the live island. */
#menu { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: #0b2a3a55; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); z-index: 8; overflow: auto; }
#menu[hidden] { display: none; }
#menu .m-card { width: min(980px, 100%); padding: 18px 20px; background: var(--card); border: 3px solid var(--line); border-radius: 18px; box-shadow: 0 8px 30px #0004; }
#menu h1 { margin: 0; text-align: center; font-size: 40px; color: var(--sea); letter-spacing: 1px; text-shadow: 0 3px 0 var(--line); }
#menu .m-sub { margin: 2px 0 10px; text-align: center; color: var(--muted); }
#menu h4 { margin: 12px 0 6px; color: var(--muted); text-transform: uppercase; font-size: 12px; letter-spacing: 1px; }
#menu .m-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#menu .m-modes button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 12px; text-align: left; }
#menu .m-modes b { font-size: 17px; }
#menu .m-modes small { color: var(--muted); font-weight: normal; }
#menu .m-modes em { color: var(--gold); font-style: normal; font-size: 12px; }
#menu .m-difficulties { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#menu .m-difficulties button { min-height: 58px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 7px 10px; text-align: left; }
#menu .m-difficulties b { font-size: 15px; }
#menu .m-difficulties small { color: var(--muted); font-size: 11px; }
#menu .m-difficulties em { color: var(--muted); font-style: normal; font-size: 11px; }
#menu .m-difficulties button.locked { opacity: 0.58; filter: grayscale(0.35); }
#menu .m-themes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
#menu .m-themes button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; font-size: 12px; }
#menu .m-themes i { display: block; width: 100%; height: 44px; border-radius: 8px; border: 2px solid #fff8; }
#menu button.sel { border-color: var(--gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 45%, transparent); }
#menu .m-seed { display: flex; gap: 8px; }
#menu .m-seed input { flex: 1; min-width: 0; padding: 8px 10px; border: 2px solid var(--line); border-radius: 8px; background: var(--btn); color: var(--ink); font: inherit; }
#menu .m-go { display: flex; justify-content: center; gap: 10px; margin-top: 16px; }
#menu #m-play, #menu #m-resume { min-width: 130px; padding: 8px 18px; font-size: 18px; }
#menu #m-play { background: var(--sea); color: #fff; border-color: #0003; box-shadow: 0 3px 0 #0003; }
@media (max-width: 480px) { #menu .m-themes { grid-template-columns: repeat(2, 1fr); } #menu .m-modes { grid-template-columns: 1fr; } }

/* Dev inspector: same card look as the console, on the right. */
#inspector { position: fixed; right: 320px; bottom: 100px; width: 300px; max-height: calc(100vh - 300px); overflow: auto; padding: 10px 12px; background: var(--card); color: var(--ink); border: 3px solid var(--line); border-radius: 14px; box-shadow: 0 4px 14px #0003; z-index: 6; font-size: 13px; }
#inspector[hidden] { display: none; }
#inspector .dc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
#inspector #in-console { padding: 2px 10px; font-size: 12px; }
#inspector .dc-head b { font-size: 15px; }
#inspector .dc-head span { flex: 1; color: var(--muted); font-size: 12px; text-align: right; }
#inspector .in-field { display: grid; grid-template-columns: 1fr 44px; gap: 2px 8px; margin: 6px 0; }
#inspector .in-field input { grid-column: 1 / 2; width: 100%; }
#inspector .in-field output { text-align: right; font-variant-numeric: tabular-nums; }

/* HUD icon buttons */
#hud button.ico { padding: 2px 8px; min-width: 34px; font-size: 16px; line-height: 1.4; }
.locked-cursor { position: fixed; top: 0; left: 0; z-index: 2147483647; width: 18px; height: 24px; pointer-events: none; background: #1b2230; clip-path: polygon(0 0, 0 90%, 28% 66%, 48% 100%, 62% 93%, 43% 59%, 81% 59%); }
.locked-cursor::before { content: ''; position: absolute; inset: 2px; background: #fff; clip-path: polygon(0 0, 0 90%, 28% 66%, 48% 100%, 62% 93%, 43% 59%, 81% 59%); }
#hud { gap: 8px; }
#hud .hud-counters, #hud .hud-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
#hud .hud-middle { display: grid; flex: 1 1 auto; min-width: 0; grid-template-columns: minmax(0, 1fr); align-items: center; }
#hud .hud-strip { grid-column: 1; display: flex; align-items: center; justify-self: stretch; gap: 6px; min-width: 0; }
#hud .hud-center { position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); z-index: 3; box-shadow: 0 2px 8px #0003; display: flex; align-items: center; justify-self: center; gap: 8px; min-width: 0; padding: 2px 6px; border-radius: 12px; background: var(--card); }
#hud .hud-scrollport { flex: 1 1 auto; min-width: 0; overflow-x: auto; overscroll-behavior-x: contain; scroll-behavior: smooth; scrollbar-width: none; cursor: grab; touch-action: pan-x; }
#hud .hud-scrollport::-webkit-scrollbar { display: none; }
#hud .hud-scrollport.dragging { cursor: grabbing; scroll-behavior: auto; user-select: none; }
#hud .hud-scroll-items { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
#hud .hud-scroll-items > * { flex: 0 0 auto; white-space: nowrap; }
#hud #h-timer::before { content: "⏱"; }
#hud #h-seed { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#hud #h-seed::before { content: "🗺"; margin-right: 5px; }
#hud #b-launch { padding: 4px 10px; white-space: nowrap; }
#hud .hud-center .stat { white-space: nowrap; }
#hud .scroll-nav { flex: 0 0 34px; width: 34px; height: 34px; margin: 4px 0; padding: 0 0 3px; border-radius: 12px; font-size: 24px; line-height: 1; }
#hud .scroll-nav:disabled { opacity: 0.35; cursor: default; }
#hud .action-icon { display: none; }
@media (max-width: 1400px) {
  :root { --hud-height: 82px; }
  #hud { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: 36px 36px; gap: 2px 6px; align-content: center; padding: 2px 8px; }
  #hud .hud-counters { grid-column: 1; grid-row: 1; }
  #hud .hud-actions { grid-column: 3; grid-row: 1; }
  #hud .hud-middle { display: contents; }
  #hud .hud-strip { grid-column: 2; grid-row: 1; }
  #hud .hud-center { position: static; transform: none; grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 720px) {
  :root { --hud-height: 124px; }
  #hud { grid-template-rows: 32px 44px 36px; gap: 2px 4px; padding: 2px 6px; }
  #hud .hud-counters, #hud .hud-actions { gap: 4px; }
  #hud .stat { gap: 3px; padding: 2px 6px; border-width: 1px; }
  #hud .stat b { font-size: 13px; }
  #hud .hud-strip { grid-column: 1 / -1; grid-row: 2; width: 100%; max-width: calc(100vw - 12px); gap: 3px; }
  #hud .hud-center { grid-column: 1 / -1; grid-row: 3; }
  #hud .hud-center { gap: 4px; }
  #hud #b-launch { padding: 3px 7px; font-size: 12px; }
  #hud .scroll-nav { flex-basis: 30px; width: 30px; }
  #hud .hud-actions button { padding: 2px 6px; }
  #hud .action-label { display: none; }
  #hud .action-icon { display: inline; }
  #hud #b-speed { padding: 2px 5px; }
}
@media (max-width: 560px) {
  :root { --hud-height: 144px; }
  #hud { grid-template-rows: 32px 44px auto; }
  #hud .hud-counters { grid-column: 1; grid-row: 1; }
  #hud .hud-actions { grid-column: 3; grid-row: 1; }
  #hud .hud-strip { grid-column: 1 / -1; grid-row: 2; }
  #hud .hud-center { grid-column: 1 / -1; grid-row: 3; flex-wrap: wrap; justify-content: center; width: 100%; padding: 2px 0; }
  #hud .hud-center .stat { white-space: normal; text-align: center; }
  #hud #b-launch { white-space: normal; }
}
@media (max-width: 420px) {
  #hud { padding: 2px 3px; }
  #hud .hud-counters, #hud .hud-actions, #hud .hud-scroll-items { gap: 3px; }
  #hud .stat { padding: 2px 4px; }
  #hud .hud-actions button { padding: 2px 4px; }
}

/* Pop-up window: tower book, shop, keys, settings, exit */
#modal { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 56px 16px 16px; background: #0006; }
#modal[hidden] { display: none; }
#modal.side-modal { inset: auto auto 110px 10px; top: calc((100vh + var(--hud-height) + 50px - var(--shop-height, 100px)) / 2); width: min(420px, calc(100vw - 20px)); height: fit-content; transform: translateY(-50%); align-items: stretch; justify-content: flex-start; padding: 0; background: transparent; pointer-events: none; }
#modal.side-modal .side-card { width: 100%; max-height: min(520px, calc(100vh - var(--hud-height) - 120px)); pointer-events: auto; }
#modal .md-card { width: min(460px, 100%); max-height: 100%; display: flex; flex-direction: column; background: var(--card); color: var(--ink); border: 3px solid var(--line); border-radius: 16px; box-shadow: 0 6px 0 var(--line), 0 12px 30px #0005; }
#modal .md-card.wide { width: min(860px, 100%); }
#modal .md-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 2px solid var(--line); font-size: 17px; }
#modal #md-x { width: 30px; height: 30px; padding: 0; border-radius: 50%; font-size: 20px; line-height: 1; }
#modal #md-body { overflow: auto; padding: 12px 14px 14px; }
#modal h4 { margin: 10px 0 6px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
#modal h4:first-child { margin-top: 0; }
#modal button.primary, #inspector button.primary { background: var(--sea); color: #fff; border-color: color-mix(in srgb, var(--sea), #000 25%); box-shadow: 0 2px 0 color-mix(in srgb, var(--sea), #000 25%); }
#modal button.danger { background: #d4442f; border-color: #a4301f; box-shadow: 0 2px 0 #a4301f; }
#modal kbd { display: inline-block; min-width: 20px; padding: 1px 5px; margin-right: 6px; border: 2px solid var(--line); border-radius: 6px; background: var(--btn); font: bold 11px/1.4 inherit; text-align: center; }

/* Tower book */
.bk { display: grid; grid-template-columns: 1fr 250px; gap: 14px; }
.bk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; align-content: start; }
.bk-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px 8px; border-top: 5px solid var(--c, var(--line)); }
.bk-card img { width: 100%; max-width: 96px; aspect-ratio: 190 / 120; object-fit: contain; filter: grayscale(0.85) opacity(0.7); }
.bk-card.seen img, .bk-card:hover img, .bk-card.sel img { filter: none; }
.bk-card.sel { border-color: #34c759; box-shadow: 0 0 0 3px #34c75966; }
.bk-card .bk-no { position: absolute; top: 3px; left: 6px; color: var(--muted); font-size: 10px; }
.bk-card em { position: absolute; top: 2px; right: 6px; color: #34c759; font-style: normal; }
.bk-card i { width: 40px; height: 40px; border-radius: 10px; margin: 8px 0; }
.bk-card b { font-size: 12px; }
.bk-detail { position: sticky; top: 0; }
.bk-pic { height: 130px; display: flex; align-items: center; justify-content: center; border-radius: 12px; background: radial-gradient(circle at 50% 40%, #fff8, transparent 70%), color-mix(in srgb, var(--line) 30%, transparent); }
.bk-pic img { height: 100%; }
.bk-detail .bk-no { margin-top: 8px; color: var(--muted); font-size: 12px; }
.bk-detail h3 { margin: 0; }
.bk-detail p { margin: 4px 0; }
.bk-kind { color: var(--muted); font-size: 12px; }
.bk-tags span { display: inline-block; margin: 0 4px 4px 0; padding: 1px 8px; border-radius: 10px; background: color-mix(in srgb, var(--sea) 20%, transparent); font-size: 11px; }
.bk-detail table { width: 100%; margin: 6px 0 10px; border-collapse: collapse; font-size: 12px; text-align: right; }
.bk-detail th, .bk-detail td { padding: 2px 4px; border-bottom: 1px solid var(--line); }
.bk-detail th:first-child, .bk-detail td:first-child { text-align: left; color: #ffbf00; }
.bk-detail button { width: 100%; }

/* Shop window */
.sh-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; align-items: stretch; }
.sh-item { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; padding: 10px 10px 8px; text-align: center; border-top: 5px solid var(--c, var(--line)); }
.sh-item:hover:not(:disabled) { background: var(--btn); } /* no hover effect on shop cards */
.sh-item img, .sh-item i { width: 56px; height: 56px; object-fit: contain; border-radius: 10px; flex: none; }
.sh-item b { min-width: 0; overflow-wrap: anywhere; line-height: 1.15; }
.sh-item p { flex: 1; margin: 0; color: var(--muted); font-size: 11px; font-weight: normal; line-height: 1.3; }
.sh-foot { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 6px; margin-top: 2px; padding-top: 5px; border-top: 1px solid var(--line); }
.sh-item small { color: var(--muted); font-weight: normal; }
.sh-item .cost { color: var(--gold); white-space: nowrap; font-weight: bold; }
.sh-item.poor { opacity: 0.55; }
.sh-item.poor .cost { color: #d4442f; }

/* Shortcut keys and settings */
.kb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.kb { text-align: left; }
.keys ul { margin: 0; padding-left: 18px; }
.keys li { margin: 3px 0; font-size: 13px; }
.st-themes { display: flex; flex-wrap: wrap; gap: 6px; }
.st-themes .sel { border-color: #34c759; background: #34c75926; }
.st-rules label { display: flex; justify-content: space-between; align-items: center; margin: 4px 0; }
.st-rules input { width: 110px; font: inherit; color: var(--ink); background: var(--btn); border: 2px solid var(--line); border-radius: 8px; padding: 2px 6px; }
.st-btns { display: flex; gap: 8px; margin-top: 12px; }
@media (max-width: 720px) { .bk { grid-template-columns: 1fr; } .bk-detail { position: static; } }

/* Dev panel tabs */
#inspector { width: 360px; }
#inspector .in-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
#inspector .in-tabs button { padding: 2px 10px; font-size: 12px; }
#inspector .in-tabs button.sel { border-color: var(--sea); background: color-mix(in srgb, var(--sea) 22%, var(--btn)); }
#inspector fieldset { border: 2px solid var(--line); border-radius: 10px; margin: 0 0 8px; padding: 6px 8px; }
#inspector legend { padding: 0 4px; color: var(--muted); font-weight: bold; }
#inspector .dc-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
#inspector .in-note { margin: 4px 0; color: var(--muted); font-size: 12px; }
#inspector .in-check { display: flex; gap: 6px; align-items: center; margin: 6px 0 2px; font-size: 12px; }
#inspector input[type=number], #inspector input[type=text], #inspector select { font: inherit; color: var(--ink); background: var(--btn); border: 2px solid var(--line); border-radius: 8px; padding: 2px 6px; min-width: 0; }
#inspector .wv-nav { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
#inspector .wv-n { width: 56px; }
#inspector .wv-row { display: grid; grid-template-columns: 1fr 56px 60px 28px; gap: 4px; margin: 4px 0; }
#inspector .wv-row button { padding: 0; }
#inspector .mp-seed { display: flex; gap: 6px; margin-bottom: 6px; }
#inspector .mp-seed input { flex: 1; }
#inspector .mp-view { display: block; width: 100%; border-radius: 8px; border: 2px solid var(--line); image-rendering: pixelated; }
#inspector .mp-recent { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
#inspector .mp-recent button { padding: 0 6px; font-size: 11px; box-shadow: none; }

/* Garden items (fruit and veg) and the hide/show tab for the tower bar */
#shop[hidden] { display: none; }
#bar-tab { position: fixed; left: 50%; transform: translateX(-50%); z-index: 3; padding: 6px 22px; min-height: 36px; border-radius: 14px 14px 0 0; font-size: 15px; font-weight: bold; background: var(--card); border: 2px solid var(--line); border-bottom: 0; cursor: pointer; }
#shop .bar-item i:not(:empty), .sh-item i:not(:empty) { display: grid; place-items: center; font-style: normal; font-size: 16px; line-height: 1; background: color-mix(in srgb, var(--c) 25%, #fff); }
#shop .bar-item i:not(:empty) { width: 26px; height: 26px; }
.sh-item i:not(:empty) { font-size: 32px; }

/* Status chips on the inspect cards: debuffs (slow, burn, shock) and buffs/boosts */
#p-body .status { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 0; }
.chip { padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: bold; border: 1.5px solid; }
.chip.debuff { background: #ffe4e0; color: #b3261e; border-color: #f0a79f; }
.chip.buff, .chip.good { background: #e0f5e4; color: #1e7a34; border-color: #9fd7ab; }
#p-body .row.next { color: var(--accent, #1f9fc7); }

/* Tower bar: tabs on the left, 10 buttons a page, arrows either side, Upgrades tab for the selected tower */
#shop { align-items: center; }
.bar-tabs { display: flex; flex-direction: column; gap: 3px; flex: none; }
.bar-tab { padding: 3px 10px; font-size: 12px; border-radius: 8px; text-align: left; }
.bar-tab.sel { background: var(--accent, #1f9fc7); color: #fff; border-color: transparent; }
.bar-arrow { flex: none; width: 34px; align-self: stretch; margin: 4px 0; font-size: 24px; font-weight: bold; padding: 0 0 3px; border-radius: 12px; transition: opacity 0.15s, transform 0.1s; }
.bar-arrow:active:not(:disabled) { transform: scale(0.92); }
.bar-arrow:disabled { opacity: 0.3; }
.bar-arrow[hidden] { display: none; }
/* One strip with every card: scrolls sideways (the arrows and wheel scroll smoothly), snaps to card edges, no scrollbar. Top padding leaves room for the hover lift. */
.bar-track { flex: 1; display: flex; gap: 8px; min-width: 0; align-items: stretch; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; scrollbar-width: none; padding: 6px 2px 6px; overscroll-behavior-x: contain; }
.bar-track::-webkit-scrollbar { display: none; }
.bar-track { cursor: grab; }
.bar-track.dragging { cursor: grabbing; scroll-snap-type: none; user-select: none; }
.bar-track > * { scroll-snap-align: start; }
.bar-track.fade-r { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); }
.bar-track.fade-l { -webkit-mask-image: linear-gradient(90deg, transparent, #000 36px); mask-image: linear-gradient(90deg, transparent, #000 36px); }
.bar-track.fade-l.fade-r { -webkit-mask-image: linear-gradient(90deg, transparent, #000 36px, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, transparent, #000 36px, #000 calc(100% - 36px), transparent); }
#shop .bar-track .bar-item { flex: 0 0 118px; min-width: 0; }
#shop .bar-track .bar-upgrade { flex: 1; }
.bar-hint { margin: 0; padding: 18px 8px; color: var(--muted); }
.bar-upgrade { display: flex; align-items: center; gap: 16px; padding: 6px 10px; flex-wrap: wrap; }
.bar-up-name { display: flex; align-items: center; gap: 6px; }
.bar-up-name i { width: 18px; height: 18px; border-radius: 6px; background: var(--c); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.bar-up-name .stars { color: #f5b800; }
.bar-up-stats { display: flex; gap: 14px; }
.bar-up-stats b { color: #16803a; }
.bar-up-buy { padding: 8px 16px; font-weight: bold; }

/* Button states for the bar (UI check): every state stays readable; pressed sinks; keyboard focus shows a ring. */
.bar-tab.sel, .bar-tab.sel:hover:not(:disabled) { background: #1683a6; color: #fff; border-color: #116a87; box-shadow: 0 2px 0 #116a87; }
.bar-tab:not(.sel):hover:not(:disabled) { border-color: #1683a6; }
#shop .bar-item .cost { color: #9a5b00; }
#shop .bar-item:active:not(:disabled) { transform: translateY(1px) scale(0.97); box-shadow: 0 1px 0 var(--line); transition-duration: 0.05s; }
#shop .bar-item.sel:hover:not(:disabled) { transform: translateY(-4px); box-shadow: 0 0 0 3px #34c75966, 0 5px 0 #34c759; }
#shop .bar-item.sel:active:not(:disabled) { transform: translateY(-1px) scale(0.97); box-shadow: 0 0 0 3px #34c75966, 0 1px 0 #34c759; }
button:focus-visible { outline: 3px solid #1683a6; outline-offset: 2px; }
/* What a Garden item is used on: a tower, the road, or the enemies around where it lands */
.tgt { display: block; margin-top: 3px; font-style: normal; font-weight: bold; font-size: 9px; line-height: 1; padding: 2px 5px; border-radius: 5px; letter-spacing: 0.02em; text-transform: uppercase; }
.tgt-tower { background: #dcEFFb; color: #0f5c78; }
.tgt-road { background: #f3e6d2; color: #6b4a1f; }
.tgt-enemies { background: #ffe0db; color: #a3261c; }
.sh-item .tgt { margin: 0; }
.sh-item .cost { color: #9a5b00; }

/* Sky Bomb colour picker above the bar */
.bomber-picker { position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); margin-bottom: 8px; display: flex; gap: 6px; padding: 6px; background: var(--card); border: 3px solid var(--line); border-radius: 14px; }
.bomber-picker[hidden] { display: none; }
.bomber-sw { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 92px; padding: 6px 8px; border-radius: 10px; border: 2px solid var(--line); background: var(--card); color: var(--text, inherit); cursor: pointer; }
.bomber-sw i { width: 24px; height: 24px; border-radius: 50%; background: var(--c); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.bomber-sw small { font-size: 10px; opacity: 0.75; }
.bomber-sw.sel { border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 40%, transparent); }

/* Tower labels in the shop: where it hits and its element */
#shop .bar-item .tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; margin-top: 2px; max-width: 80px; }
#shop .bar-item .tags b { font-size: 8px; line-height: 1; padding: 1px 4px; border-radius: 6px; color: #1b2230; background: var(--t); font-weight: 700; }
#inspector .dd-form { display: grid; gap: 4px; margin: 6px 0; }
#inspector .dd-row { display: grid; grid-template-columns: 90px 90px 1fr; align-items: center; gap: 6px; font-size: 12px; }
#inspector .dd-row em { color: var(--muted); font-style: normal; }
#inspector .dd-row input, #inspector select { min-width: 0; }
#menu .m-layouts { grid-template-columns: repeat(2, 1fr); }
#menu .m-ends { display: flex; align-items: center; gap: 8px; }
#menu .m-ends button { min-width: 44px; }
#menu .m-ends small { color: var(--muted); font-size: 12px; margin-left: 4px; }
#menu .m-preview { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 10px 0 4px; }
#menu .m-preview canvas { width: 100%; max-width: 280px; height: auto; border: 2px solid var(--line); border-radius: 8px; image-rendering: pixelated; }
#menu .m-preview small { color: var(--muted); font-size: 12px; }

/* Start screen: two columns side by side; one column on a narrow screen */
#menu .m-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; align-items: start; }
#menu .m-col > h4:first-child { margin-top: 4px; }
@media (max-width: 760px) { #menu .m-cols { grid-template-columns: 1fr; } }

/* Shop window cards: keep the name, price and tag apart on narrow screens too */
@media (max-width: 560px) { .sh-grid { grid-template-columns: 1fr 1fr; } }

/* Pirate ship: "Friend or foe?" */
.pi { max-width: 520px; }
.pi-say { margin: 0 0 10px; font-size: 14px; }
.pi-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pi-pick { display: flex; flex-direction: column; gap: 6px; padding: 12px; text-align: left; }
.pi-pick b { font-size: 16px; }
.pi-pick small { color: var(--muted); font-weight: normal; line-height: 1.3; }
.pi-friend { border-color: #2f7fd8; }
.pi-foe { border-color: #b0302a; }
.pi-note { margin: 10px 0 0; color: var(--muted); font-size: 12px; }
#incoming .in-pirates { border-color: #2f7fd8; }
@media (max-width: 560px) { .pi-choices { grid-template-columns: 1fr; } }
#inspector .wave-plus { color: #2a9d4a; font-style: normal; font-weight: bold; font-size: 12px; }

/* Wave panel: a vertical list on the left, under the version label; the dev console slides right of it while it shows. */
#incoming { top: calc(var(--hud-height) + 8px); left: 10px; right: auto; transform: none; width: max-content; min-width: 200px; max-width: min(360px, calc(100vw - 24px)); max-height: calc(100vh - 162px); overflow: auto; flex-direction: column; flex-wrap: nowrap; align-items: stretch; justify-content: flex-start; gap: 5px; padding: 8px 10px; border-radius: 14px; pointer-events: auto; }
#incoming .in-title { text-align: center; font-size: 14px; }
#incoming .in-chip { width: 100%; justify-content: flex-start; flex-wrap: nowrap; white-space: nowrap; cursor: pointer; font: inherit; font-weight: bold; font-size: 12px; color: var(--ink); text-align: left; }
#incoming .in-chip.sel { border-color: #ff7a2a; background: color-mix(in srgb, #ff7a2a 22%, var(--btn)); }
#incoming .in-chip .in-el { margin-left: auto; }
#incoming .in-from { text-align: center; line-height: 1.25; }
body.has-incoming #devconsole { left: min(384px, calc(100vw - 220px)); }

#version { position: fixed; left: 8px; top: calc(var(--hud-height) + 4px); z-index: 1; font-size: 11px; color: var(--muted); opacity: 0.8; pointer-events: none; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
#menu .m-ver { display: inline-block; margin-left: 6px; padding: 0 6px; font-size: 11px; border: 1px solid var(--line); border-radius: 999px; }
#incoming .in-pirates { cursor: pointer; }
#incoming .in-pirates.dim { opacity: 0.6; }
/* Shop tabs: roomier buttons and a gap before the scroll arrow and the cards. */
.bar-tabs { gap: 6px; min-width: 104px; padding: 2px 6px 2px 2px; margin-right: 6px; justify-content: center; }
.bar-tab { padding: 5px 14px; font-size: 13px; }
.bar-arrow { margin-left: 4px; margin-right: 2px; }

/* Counter tip: how to beat a stealth, digger or teleporter enemy, the first time it shows up. */
#counter-tip { position: fixed; bottom: 172px; left: 12px; width: min(440px, calc(100vw - 24px)); display: grid; grid-template-columns: minmax(0, 1fr) 26px; align-items: start; gap: 8px; padding: 10px 12px; background: var(--card); border: 3px solid var(--line); border-radius: 12px; box-shadow: 0 3px 10px #0003; font-size: 13px; opacity: 0; transform: translate(-120%, 24px); visibility: hidden; pointer-events: none; transition: transform 0.6s cubic-bezier(.42, 0, .58, 1), opacity 0.35s ease, visibility 0s linear 0.6s; z-index: 4; }
#counter-tip.show { opacity: 1; transform: translate(0, 0); visibility: visible; pointer-events: auto; transition: transform 0.6s cubic-bezier(.42, 0, .58, 1), opacity 0.35s ease, visibility 0s; }
#counter-tip.show.dimmed { opacity: 0.5; }
#counter-tip.show.dimmed:hover, #counter-tip.show.dimmed:focus-within { opacity: 1; }
#counter-tip .counter-tip-content { display: grid; gap: 2px; min-width: 0; }
#counter-tip .counter-tip-close { display: grid; width: 26px; height: 26px; place-items: center; padding: 0; border-radius: 50%; box-shadow: none; font-size: 20px; line-height: 1; }
@media (prefers-reduced-motion: reduce) { #counter-tip, #counter-tip.show { transition: none; } }

/* Lucky Slots window */
.sl { display: grid; gap: 10px; text-align: center; }
.sl-reels { display: flex; justify-content: center; gap: 8px; }
.sl-reel { width: 76px; height: 86px; display: grid; place-items: center; font-size: 42px; background: #fff8; border: 3px solid #c9a227; border-radius: 12px; box-shadow: inset 0 3px 8px #0004; }
.sl-reel.spin { filter: blur(1px); }
.sl-reel.win { animation: sl-win 0.5s ease-in-out 4; border-color: #ffd23a; }
@keyframes sl-win { 50% { transform: scale(1.12); box-shadow: 0 0 18px #ffd23a; } }
.sl-say { min-height: 2.6em; margin: 0; font-weight: 600; }
.sl-say.triple { color: #2e8b2e; }
.sl-lever { padding: 10px 14px; font-size: 1rem; font-weight: 700; border-radius: 10px; cursor: pointer; }
.sl-lever:disabled { opacity: 0.5; cursor: default; }
.sl-note { margin: 0; font-size: 0.85em; opacity: 0.75; }
.sl-table { width: 100%; border-collapse: collapse; font-size: 0.88em; text-align: left; }
.sl-table td { padding: 3px 6px; border-top: 1px solid #8884; }
.sl-table td:first-child { white-space: nowrap; }

/* Minified slots: compact lever above the tower bar */
#slots-mini { position: fixed; left: 50%; transform: translateX(-50%); bottom: 218px; display: none; align-items: center; gap: 12px; padding: 8px 14px; background: var(--card); border: 3px solid var(--line); border-radius: 12px; box-shadow: 0 3px 10px #0002; z-index: 2; }
#slots-mini.shown { display: flex; }
#slots-mini .sm-lever { padding: 6px 10px; font-size: 12px; font-weight: bold; min-width: 140px; }
#slots-mini .sm-close { width: 28px; height: 28px; padding: 0; border-radius: 50%; font-size: 18px; line-height: 1; }
@media (prefers-reduced-motion: reduce) { .sl-reel.win { animation: none; } }

/* FAQ window */
.faq-find { width: 100%; box-sizing: border-box; margin-bottom: 10px; padding: 7px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,.25); background: rgba(0,0,0,.25); color: inherit; font: inherit; }
.faq h4 { margin: 14px 0 6px; color: #ffc928; }
.faq-q { border-bottom: 1px solid rgba(255,255,255,.1); padding: 6px 0; }
.faq-q summary { cursor: pointer; font-weight: 600; }
.faq-q p { margin: 6px 0; line-height: 1.45; }
.faq-q ul { margin: 6px 0 6px 18px; padding: 0; line-height: 1.4; }

/* Tower icons in the shop: the tower's own model */
#shop .bar-item i:has(img) { width: 44px; height: 44px; border: 0; border-radius: 0; background: none; box-shadow: none; }
#shop .bar-item i img { width: 100%; height: 100%; display: block; filter: drop-shadow(0 2px 2px rgba(0,0,0,.25)); }
.st-water { display: flex; align-items: center; gap: 8px; }
.st-water input { flex: 1; }
.st-water b { min-width: 3em; text-align: right; }

#bar-tab.away {
  bottom:-10px !important;min-height: 52px; padding: 8px 34px; font-size: 20px; background: var(--sea); color: #fff; border-color: #fff; box-shadow: 0 -4px 14px #0004; animation: tabBounce 1.6s ease-in-out infinite; }
@keyframes tabBounce { 50% { transform: translateX(-50%) translateY(-5px); } }
@media (prefers-reduced-motion: reduce) { #bar-tab.away { animation: none; } }
#shop .bar-track .bar-sep { flex: 0 0 3px; align-self: stretch; margin: 6px 8px; border-radius: 2px; background: linear-gradient(#ffffff00, #ffffff66, #ffffff00); }
.bk-mod { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; }
.bk-mod small { opacity: 0.75; }
