:root {
  --bg: #14161b; --panel: #1d2028; --panel2: #262a34; --line: #333846;
  --text: #e6e8ee; --muted: #9aa0ae; --accent: #ffcf5a; --danger: #e85a5a; --ok: #5ad48a;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.4 system-ui, sans-serif; }
h1, h2, h3 { margin: 0 0 .5em; font-weight: 650; }
h1 { font-size: 22px; } h2 { font-size: 16px; } h3 { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
button, input, select { font: inherit; color: inherit; }
button {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; cursor: pointer;
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: #1a1a1a; border-color: var(--accent); font-weight: 600; }
button.danger { border-color: var(--danger); color: var(--danger); }
button:disabled { opacity: .45; cursor: not-allowed; }
input, select { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }
input:focus, select:focus { outline: 1px solid var(--accent); }
.muted { color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hidden { display: none !important; }

/* lobby */
.lobby { max-width: 900px; margin: 0 auto; padding: 32px 16px; }
.maps { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-top: 16px; }
.map-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px; cursor: pointer; }
.map-card:hover { border-color: var(--accent); }
.map-card canvas { width: 100%; border-radius: 6px; display: block; margin-bottom: 8px; }

.auth, #profile { margin-top: 16px; }
.err-text { color: var(--danger); min-height: 1.4em; margin-top: 6px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.kpis > div { background: var(--bg); border-radius: 6px; padding: 6px 10px; }
.kpis b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.map-card .saved { color: var(--accent); font-size: 13px; margin-top: 4px; }
.maps.locked .map-card { opacity: .5; cursor: not-allowed; }


.obj-types { display: grid; gap: 6px; font-size: 13px; }

.perk-pick { display: grid; gap: 6px; }
.perk-pick button { text-align: left; padding: 6px 8px; white-space: normal; }
.perk-pick button b { color: var(--accent); }
.perk-ready { color: var(--accent); font-weight: bold; margin: 0 0 6px; }

.boards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.boards ol { margin: 0; padding-left: 1.6em; font-variant-numeric: tabular-nums; }
.boards li { padding: 2px 0; }
.boards li span { float: right; color: var(--muted, #999); }
.boards li.me { color: var(--accent); font-weight: bold; }
.map-card .record { font-size: 13px; color: #ffd24a; }
@media (max-width: 700px) { .boards { grid-template-columns: 1fr; } }

.quick-chat { display: flex; flex-wrap: wrap; gap: 4px; }
.quick-chat button { padding: 3px 7px; font-size: 12px; }
.chat-log { margin-top: 8px; font-size: 13px; display: grid; gap: 2px; min-height: 1em; }

.sound { gap: 6px; flex-wrap: nowrap; }
.sound #mute { padding: 4px 8px; }
.sound #volume { width: 80px; accent-color: var(--accent); }
.music-box { position: relative; }
.music-box #music-btn.off { opacity: .45; }
.music-panel { position: absolute; top: calc(100% + 4px); right: 0; z-index: 30; display: grid; gap: 6px; width: 130px; padding: 8px 10px; background: var(--panel2); border: 1px solid #3a4150; border-radius: 8px; font-size: 13px; }
.music-panel label { display: flex; align-items: center; gap: 6px; }
.music-panel #music-volume { width: 100%; accent-color: var(--accent); }

/* game */
.game { display: grid; grid-template-columns: 1fr 340px; height: 100vh; }
.stage { display: flex; align-items: center; justify-content: center; padding: 12px; min-width: 0; min-height: 0; }
.stage canvas { border-radius: 6px; box-shadow: 0 6px 30px rgba(0,0,0,.5); cursor: crosshair; }
.side { background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; display: flex; flex-direction: column; }
.card { background: var(--panel2); border-radius: 8px; padding: 10px; }
.types { display: grid; gap: 6px; }
.type-btn { text-align: left; display: flex; gap: 8px; align-items: center; }
.type-btn.sel { border-color: var(--accent); background: #34302a; }
.dot { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.bar { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; margin: 6px 0; }
.bar > div { height: 100%; background: #7cf; transition: width .2s; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; }
.stats b { font-variant-numeric: tabular-nums; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
td, th { padding: 4px 6px; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.me td { color: var(--accent); }
.legend { display: flex; gap: 4px; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; }

.toast {
  position: fixed; left: 50%; top: 16px; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--line);
  padding: 8px 14px; border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,.5); z-index: 10; transition: opacity .3s;
}
.toast.err { border-color: var(--danger); }

.stage canvas { touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

/* phones and narrow tablets: the map stays pinned at the top while the sidebar scrolls under it */
@media (max-width: 800px) {
  .game { grid-template-columns: 1fr; grid-template-rows: auto auto; height: auto; }
  .stage { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 6px; }
  .side { border-left: 0; border-top: 1px solid var(--line); padding: 12px; }
  .lobby { padding: 20px 12px; }
  button { min-height: 36px; }
  .quick-chat button { min-height: 34px; }
  .toast { max-width: calc(100vw - 32px); top: auto; bottom: 16px; } /* keep the pinned map visible */
}

/* next wave preview */
.lw-rows { display: grid; gap: 4px; margin-top: 8px; }
.lw-rows > div { display: flex; justify-content: space-between; gap: 8px; }
.lw-rows > .me b { color: var(--accent); }
.lw-mine { margin: 8px 0 0; color: var(--accent); }
.lw-mine:empty { display: none; }
.nw-list { display: grid; gap: 4px; }
.nw-list > div { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 6px; }
#next-wave.boss { border-color: #ffd24a; box-shadow: 0 0 0 1px #ffd24a55; }
#next-wave.boss #nw-title { color: #ffd24a; }
.el-icon { width: 18px; height: 18px; flex: none; vertical-align: middle; }

/* move tower */
.move-row { gap: 8px; flex-wrap: wrap; padding: 0 2px; }
#move-btn.sel { background: var(--accent); color: #111; }

/* achievements */
.achievements { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; }
.achievements > div { border: 1px solid #ffffff1a; border-radius: 6px; padding: 6px 8px; opacity: .45; }
.achievements > div.got { opacity: 1; border-color: var(--accent); background: #ffcf5a12; }
.achievements b { font-size: .9em; }
.achievements span { font-size: .78em; }

/* account settings */
.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-top: 12px; }
.settings form { display: grid; gap: 6px; align-content: start; border: 1px solid #ffffff1a; border-radius: 8px; padding: 10px; }
.settings h3 { margin: 0 0 2px; }
.settings p { margin: 0; font-size: .85em; }

/* active ability */
#ability-btn { width: 100%; font-weight: 700; padding: 10px; font-size: 15px; }
#ability-btn.ready { background: var(--accent); color: #111; border-color: var(--accent); }
#ability-btn.aiming { background: #ff8c3c; color: #111; border-color: #ff8c3c; }
#ability-btn:disabled { opacity: .6; cursor: default; }
.ability p { margin: 6px 0 0; }


/* ---------------------------------------------------------------- game sidebar */
/* header: map name, sound, the HUD tiles and the tabs; stays at the top while the panel scrolls */
.side-head { position: sticky; top: 0; z-index: 2; background: var(--panel); padding: 12px 14px 0; border-bottom: 1px solid var(--line); }
.head-row { justify-content: space-between; flex-wrap: nowrap; }
.head-row h2 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud { display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: 6px; margin: 10px 0; }
.hud > div { background: var(--panel2); border-radius: 8px; padding: 6px 8px; min-width: 0; }
.hud span, .chips span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.hud b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hud b.word { font-size: 12px; line-height: 25px; }
.load-bar { height: 4px; background: var(--bg); border-radius: 2px; margin-top: 3px; overflow: hidden; }
.load-bar > div { height: 100%; width: 0; background: var(--ok); transition: width .3s; }
.load-bar > div.danger { background: var(--danger); }

.tabs { display: grid; grid-template-columns: repeat(4, 1fr); }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 8px 4px; color: var(--muted); font-weight: 600; position: relative; }
.tabs button:hover { color: var(--text); }
.tabs button.sel { color: var(--accent); border-bottom-color: var(--accent); }
.badge { position: absolute; top: 6px; margin-left: 3px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); }
.badge.boss { background: #ffd24a; }
#tower-badge { background: var(--accent); }

.tab-panel { padding: 12px 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.tab-panel .card h3 { margin-bottom: 8px; }
.small { font-size: 12px; }
.note { margin: 8px 0 0; }
.card > p.small { margin: 6px 0 0; }

/* your tower */
.tower-head .big { font-size: 16px; }
.tower-head .stars { color: #ffd24a; }
.tower-head .lv { margin-left: auto; color: var(--muted); }
.tower-head .lv b { color: var(--text); font-size: 16px; }
.chips { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
.chips > div { background: var(--bg); border-radius: 6px; padding: 5px 8px; }
.chips b { font-variant-numeric: tabular-nums; }

/* Element and Focus dropdowns */
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.field em { font-style: normal; text-transform: none; letter-spacing: 0; font-weight: 400; margin-left: 4px; }
.field select { width: 100%; padding: 7px 8px; background: var(--bg); cursor: pointer; }

/* folding reference sections in the Wave tab */
details.card > summary { cursor: pointer; font-size: 13px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
details.card[open] > summary { margin-bottom: 8px; }

@media (max-width: 800px) {
  .side-head { position: static; padding: 10px 12px 0; }
  .tab-panel { padding: 10px 12px 14px; }
}
.head-row h2 { flex: 1; min-width: 0; }
.side-head .sound #volume { width: 56px; }

/* call the next wave early (in the Next wave tile) */
.call-btn { display: block; width: 100%; margin-top: 4px; padding: 2px 4px; font-size: 11px; font-weight: 600; min-height: 0; }
.call-btn.sel { background: var(--accent); color: #111; border-color: var(--accent); }
@media (max-width: 800px) { .call-btn { min-height: 28px; } }

/* first-time tour */
.coach {
  position: fixed; left: 16px; bottom: 16px; z-index: 20; width: min(340px, calc(100vw - 32px));
  background: var(--panel2); border: 1px solid var(--accent); border-radius: 10px; padding: 12px 14px;
  box-shadow: 0 8px 30px rgba(0,0,0,.6);
}
.coach p { margin: 4px 0 10px; line-height: 1.45; }
.coach-step { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.coach-actions { justify-content: flex-end; }
.coach-actions #coach-skip { background: none; border-color: transparent; color: var(--muted); }
/* the part of the screen the current tip is about */
.coach-hl { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; animation: coach-pulse 1.4s ease-in-out infinite; }
@keyframes coach-pulse { 50% { outline-color: rgba(255, 207, 90, .25); } }
#help-btn { padding: 4px 9px; font-weight: 700; }
@media (max-width: 800px) {
  .coach { left: 12px; right: 12px; width: auto; bottom: 12px; }
}
.side-head .sound { gap: 4px; }
.side-head .sound button { padding: 4px 8px; }
.side-head .sound #volume { width: 44px; }

/* daily challenge card: full width at the top of the map list */
.daily-card { grid-column: 1 / -1; display: grid; grid-template-columns: 240px 1fr; gap: 16px; align-items: start;
  border-color: #ffd24a; background: linear-gradient(135deg, #2a2618, var(--panel) 60%); }
.daily-card canvas { margin: 0; }
.daily-tag { color: #ffd24a; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.daily-card h2 { margin: 4px 0 2px; font-size: 18px; }
.daily-meta { font-size: 13px; margin: 0 0 6px; }
.daily-top { margin: 0 0 10px; padding-left: 1.5em; font-size: 13px; columns: 2; }
.daily-top li { padding: 1px 0; }
.daily-top li b { float: right; font-weight: 500; color: var(--muted); margin-right: 12px; }
.daily-top li.me { color: var(--accent); }
@media (max-width: 700px) { .daily-card { grid-template-columns: 1fr; } .daily-top { columns: 1; } }

/* watching a map from the lobby */
.watch-btn { margin-top: 8px; padding: 4px 10px; font-size: 13px; }
.daily-body .row .watch-btn { margin-top: 0; }
.watch-card { border: 1px solid #7cf; }
.watch-card .row { margin-top: 8px; }
.game.watching #quick-chat, .game.watching #call-btn, .game.watching #ping-help, .game.watching #help-btn { display: none; }
/* a map name gets its own line when the buttons leave it too little room */
.head-row { flex-wrap: wrap; }
.head-row #map-name { flex: 1 1 110px; min-width: 110px; }
/* Start before wave 1, New game after a game over */
.stage { position: relative; }
.start-btn { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); padding: 10px 22px; font-size: 16px; font-weight: 700; white-space: nowrap; }
.game.watching .start-btn { display: none; }
/* phones: under the map, so it does not cover tiles a tower could go on */
@media (max-width: 800px) { .stage { flex-direction: column; } .start-btn { position: static; transform: none; margin: 8px 0 0; } }
/* question mark icons, and the one tooltip they share (help.js) */
.help, .hud span.help, .chips span.help { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 15px; height: 15px; margin: 0 1px; border-radius: 50%; border: 1px solid var(--muted); color: var(--muted); background: none; font: 700 10px/1 system-ui, sans-serif; letter-spacing: 0; text-transform: none; cursor: help; vertical-align: 1px; user-select: none; }
.help:hover, .help:focus-visible { color: var(--accent); border-color: var(--accent); outline: none; }
/* easier to hit with a finger */
@media (pointer: coarse) { .help, .hud span.help, .chips span.help { width: 20px; height: 20px; font-size: 12px; } }
.help-tip { position: fixed; z-index: 1000; max-width: min(280px, calc(100vw - 16px)); padding: 8px 10px; background: #0d0f14; color: var(--text); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.5); font-size: 12.5px; line-height: 1.45; pointer-events: none; }
.with-help { display: flex; align-items: center; gap: 6px; }
.with-help > button { flex: 1; min-width: 0; }
.call-row { gap: 3px; margin-top: 4px; }
.call-row .call-btn { margin-top: 0; }
.call-row .call-btn { white-space: nowrap; padding-left: 2px; padding-right: 2px; }
/* the towers a player owns */
.roster-list { display: grid; gap: 4px; margin-bottom: 6px; }
.roster-list button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; }
.roster-list button.playing { border-color: var(--accent); opacity: 1; }
.roster-list .roster-tag { margin-left: auto; color: var(--accent); font-size: 12px; }
#roster-note:empty { display: none; }
.lobby-title img { height: 64px; width: auto; vertical-align: middle; }
/* picking a map background */
.head-row #map-name { flex-basis: 70%; }
.bg-box { position: relative; order: 0; margin-left: auto; }
.head-row .sound { order: 1; }
#bg-btn { padding: 3px 8px; }
.bg-panel { position: absolute; top: calc(100% + 4px); right: 0; z-index: 30; width: min(290px, calc(100vw - 32px)); padding: 10px; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.45); }
.bg-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.bg-list + h3 { margin-top: 10px; }
.bg-list button { padding: 3px; text-align: center; font-size: 11px; background: var(--bg); line-height: 1.25; }
.bg-list button canvas { display: block; width: 100%; border-radius: 4px; margin-bottom: 2px; }
.bg-list button.sel { border-color: var(--accent); color: var(--accent); }

/* a shorter lobby: small map cards, with achievements and leaderboards folded away */
.lobby { max-width: 1160px; padding: 16px; }
.lobby-title img { height: 46px; }
.lobby-title { margin-bottom: 0; }
.auth, #profile { margin-top: 10px; }
.card.auth, #profile { padding: 8px 10px; }
#profile h2 { margin: 0; }
#profile .kpis { margin-top: 6px; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 6px; }
#profile .kpis > div { padding: 3px 8px; font-size: 12px; }
#profile .kpis b { font-size: 15px; }
.lobby-more > summary { cursor: pointer; font-size: 13px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.lobby-more > summary .muted { text-transform: none; letter-spacing: 0; font-weight: 400; }
.lobby-more[open] > summary { margin-bottom: 8px; }
#profile .lobby-more { margin-top: 8px; }
.lobby > .lobby-more { margin-top: 10px; }
.maps { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 8px; margin-top: 10px; }
.map-card { position: relative; padding: 6px; font-size: 12px; }
.map-card canvas { margin-bottom: 4px; }
.map-card > .row { display: block; }
.map-card > .row b { display: block; font-size: 13px; }
.map-card .saved, .map-card .record { font-size: 11.5px; margin-top: 0; }
.map-card > .watch-btn { position: absolute; top: 10px; right: 10px; margin: 0; padding: 2px 6px; font-size: 11px; background: rgba(15, 17, 22, .82); }
.daily-card { grid-template-columns: 170px 1fr; gap: 10px; padding: 8px; font-size: 13px; }
.daily-card h2 { margin: 1px 0; font-size: 15px; }
.daily-tag { font-size: 11px; }
.daily-meta { margin: 0 0 3px; font-size: 12px; }
.daily-top { margin: 0 0 4px; font-size: 12px; columns: 3; }
.daily-card .row button { padding: 3px 10px; font-size: 13px; }
@media (max-width: 700px) {
  .daily-card { grid-template-columns: 110px 1fr; }
  .daily-top { columns: 1; }
  .maps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Element: one image button per element type, with its shortcut key */
.priority-list { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 3px; }
.priority-list button { position: relative; display: flex; align-items: center; justify-content: center; height: 38px; padding: 0; background: var(--bg); }
.priority-list button.sel { border-color: var(--accent); background: #34302a; box-shadow: inset 0 0 0 1px var(--accent); }
.priority-list .el-icon { width: 26px; height: 26px; }
.priority-list .none-icon { font-size: 18px; color: var(--muted); line-height: 1; }
.priority-list kbd { position: absolute; right: 2px; bottom: 1px; font: 700 9px/1 system-ui, sans-serif; color: var(--text); text-shadow: 0 0 3px #000, 0 0 2px #000; }
@media (pointer: coarse) { .priority-list kbd { display: none; } }

/* Focus: one drawn image per mode, with its name and shortcut key */
.mode-list { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; }
.mode-list button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 4px 1px 3px; background: var(--bg); font-size: 11px; line-height: 1.2; }
.mode-list button.sel { border-color: var(--accent); background: #34302a; box-shadow: inset 0 0 0 1px var(--accent); color: var(--accent); }
.mode-list svg { width: 24px; height: 24px; display: block; }
.mode-list kbd { position: absolute; top: 2px; right: 3px; font: 700 9px/1 system-ui, sans-serif; color: var(--muted); }
@media (pointer: coarse) { .mode-list kbd { display: none; } }


/* the ability's icon on its button */
#ability-btn { display: flex; align-items: center; justify-content: center; gap: 8px; }
#ability-icon { width: 22px; height: 22px; flex: none; }

/* tables in tooltips */
.help-tip.with-table { max-width: min(340px, calc(100vw - 16px)); }
.help-tip p { margin: 0 0 7px; }
.help-tip p:last-child { margin: 7px 0 0; }
.help-tip table { width: 100%; border-collapse: collapse; font-size: 12px; }
.help-tip th { color: var(--muted); font-weight: 600; text-align: left; padding: 2px 8px 3px 0; border-bottom: 1px solid var(--line); }
.help-tip td { padding: 3px 8px 3px 0; vertical-align: top; border-bottom: 1px solid rgba(255,255,255,.06); }
.help-tip th:last-child, .help-tip td:last-child { padding-right: 0; }
.help-tip tr.now td { color: var(--accent); font-weight: 650; }
.mode-list.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* music on/off on the marketing page and lobby */
.music-toggle { white-space: nowrap; font-size: 13px; padding: 6px 10px; }
.music-toggle.off { opacity: .65; }
.lobby-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
/* the place of a chosen element in the Element order */
.priority-list .order { position: absolute; left: 1px; top: 1px; min-width: 13px; height: 13px; border-radius: 50%; background: var(--accent); color: #111; font: 700 9.5px/13px system-ui, sans-serif; text-align: center; font-style: normal; }

/* ---------------------------------------------------------------- the sky, on the marketing and play pages */
.sky, .twinkles { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.sky { opacity: .72; }
.twinkles { overflow: hidden; opacity: .7; }
.twinkles i { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #fff; box-shadow: 0 0 7px 1px rgba(190, 215, 255, .9); animation: twinkle 4s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: .1; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .twinkles i { animation: none; opacity: .6; } }

/* ---------------------------------------------------------------- the play page, in the marketing page's look */
body.play {
  --bg: #080a1c; --panel: rgba(16, 19, 44, .82); --panel2: rgba(27, 32, 68, .78); --line: rgba(150, 170, 255, .22);
  --text: #e9ecf6; --muted: #aeb5ca; --ice: #8fe9ff; --solid: #111432; --selected: rgba(255, 207, 90, .14);
  background: #05060f;
}
.play .lobby, .play .game { position: relative; z-index: 1; }
.play .toast { background: var(--solid); z-index: 40; }

/* one set of corners */
.play .card, .play .map-card, .play .hud > div, .play .bg-panel, .play .music-panel, .play .coach { border-radius: 10px; }
.play button, .play input, .play select, .play .kpis > div, .play .chips > div { border-radius: 8px; }
.play .tabs button { border-radius: 0; }

/* one kind of panel */
.play .card, .play .map-card, .play .hud > div { background: var(--panel); border: 1px solid var(--line); }
.play .tab-panel .card, .play .hud > div { background: var(--panel2); }
.play .side { background: rgba(10, 12, 30, .86); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.play .side-head, .play .bg-panel, .play .music-panel, .play .coach { background: var(--solid); }
.play .stage { background: none; }
.play .stage canvas { box-shadow: 0 0 60px rgba(90, 120, 255, .28), 0 18px 50px rgba(0, 0, 0, .6), 0 0 0 1px var(--line); border-radius: 10px; }
@media (max-width: 800px) { .play .stage { background: rgba(5, 6, 15, .94); } }
.play .map-card:hover { border-color: var(--accent); box-shadow: 0 0 26px rgba(120, 150, 255, .3); }
.play .daily-card { border-color: rgba(255, 207, 90, .45); background: linear-gradient(135deg, rgba(70, 58, 22, .75), var(--panel) 60%); box-shadow: 0 0 40px rgba(255, 207, 90, .08); }
.play .settings form, .play .achievements > div { border-color: var(--line); }

/* one kind of heading */
.play .card h3, .play .field > span, .play .lobby-more > summary, .play details.card > summary, .play .bg-panel h3 {
  color: #fff; font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em;
}
.play .daily-tag { color: var(--ice); }
.play .daily-tag .muted { color: var(--muted); }
.welcome-row { justify-content: space-between; }

/* one kind of button, and one way of showing what is selected */
.play button { background: rgba(32, 38, 78, .85); }
.play button:hover:not(:disabled) { border-color: var(--accent); }
.play button.primary, .play #ability-btn.ready, .play .start-btn:not(:disabled) { background: var(--accent); color: #1a1a1a; border-color: var(--accent); box-shadow: 0 0 22px rgba(255, 207, 90, .28); font-weight: 700; }
.play .priority-list button, .play .mode-list button, .play .bg-list button { background: var(--bg); }
.play .type-btn.sel, .play .roster-list button.playing, .play .priority-list button.sel, .play .mode-list button.sel, .play .bg-list button.sel {
  background: var(--selected); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent);
}
.play .mode-list button.sel, .play .bg-list button.sel, .play .roster-list .roster-tag { color: var(--accent); }
.play .tabs button { background: none; box-shadow: none; }
.play .map-card > .watch-btn { background: rgba(8, 10, 28, .85); }
.play input, .play select { background: var(--bg); }

/* small phones: the top buttons wrap instead of running off the screen, and Call now has room */
@media (max-width: 400px) {
  .side-head .sound { flex-wrap: wrap; }
  .hud { grid-template-columns: .75fr 1.35fr 1.3fr; }
}

/* tabs as icons; the name shows when pointed at, and always on touch screens, which cannot point */
.tabs button { display: flex; align-items: center; justify-content: center; }
.tabs button svg { width: 24px; height: 24px; display: block; }
.tabs .tab-name { position: absolute; top: calc(100% + 3px); left: 50%; transform: translateX(-50%); z-index: 5; padding: 3px 8px; border-radius: 6px; background: #0d0f14; border: 1px solid var(--line); color: var(--text); font-size: 12px; font-weight: 600; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .1s; }
.tabs button:hover .tab-name, .tabs button:focus-visible .tab-name { opacity: 1; }
.tabs .badge { top: 5px; margin-left: 28px; }
@media (pointer: coarse) {
  .tabs button { flex-direction: column; gap: 1px; padding: 6px 2px; }
  .tabs .tab-name { position: static; transform: none; padding: 0; border: 0; background: none; color: inherit; font-size: 10.5px; opacity: 1; }
  .tabs .badge { margin-left: 30px; }
}

/* saved element orders */
.templates { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.templates h4 { margin: 0 0 6px; font-size: 12px; font-weight: 650; color: #fff; }
.templates h4 .muted { font-weight: 400; }
.tpl-form { display: flex; gap: 4px; }
.tpl-form input { flex: 1; min-width: 0; }
.tpl-list { display: grid; gap: 4px; margin-top: 6px; max-height: 190px; overflow-y: auto; }
.tpl-list:empty { display: none; }
.tpl-row { display: flex; gap: 4px; }
.tpl-row .tpl-use { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 4px 8px; text-align: left; }
.tpl-use .tpl-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.tpl-use .tpl-icons { display: flex; flex: none; gap: 1px; }
.tpl-use .el-icon { width: 16px; height: 16px; }
.tpl-row .tpl-del { flex: none; padding: 2px 9px; color: var(--muted); }
.play .tpl-row .tpl-use.sel { background: var(--selected); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

/* the ability and Move tower as icon buttons side by side; the name shows when pointed at, and always on touch screens */
.action-row { display: flex; align-items: center; gap: 8px; }
.icon-btn { position: relative; display: flex; align-items: center; justify-content: center; width: 56px; height: 50px; padding: 0; }
.play #ability-btn { width: 56px; padding: 0; }
.icon-btn svg { width: 28px; height: 28px; display: block; }
.icon-btn .cool { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 800; color: #fff; text-shadow: 0 0 4px #000, 0 0 2px #000; pointer-events: none; }
.icon-btn .cool:empty { display: none; }
.icon-btn:has(.cool:not(:empty)) svg, .icon-btn:has(.cool:not(:empty)) kbd { opacity: .35; }
.icon-btn kbd { position: absolute; top: 2px; right: 4px; font: 700 9px/1 system-ui, sans-serif; opacity: .75; }
.icon-btn .icon-name { position: absolute; bottom: calc(100% + 5px); left: 50%; transform: translateX(-50%); z-index: 6; padding: 3px 8px; border-radius: 6px; background: #0d0f14; border: 1px solid var(--line); color: var(--text); font-size: 12px; font-weight: 600; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .1s; }
.icon-btn:hover .icon-name, .icon-btn:focus-visible .icon-name { opacity: 1; }
.play #ability-btn.ready .icon-name, .play #ability-btn.aiming .icon-name { color: var(--text); }
.action-row .help { margin-left: auto; }
#move-hint:empty { display: none; }
@media (pointer: coarse) {
  .icon-btn { flex-direction: column; width: auto; min-width: 74px; height: auto; padding: 6px 8px; gap: 2px; }
  .play #ability-btn { width: auto; padding: 6px 8px; }
  .icon-btn .icon-name { position: static; transform: none; padding: 0; border: 0; background: none; color: inherit; font-size: 11px; opacity: 1; white-space: normal; max-width: 120px; text-align: center; }
  .icon-btn kbd { display: none; }
  .icon-btn .cool { inset: 6px 0 auto; height: 28px; } /* over the icon, not the name under it */
}

/* the shop */
.tabs { grid-template-columns: repeat(5, 1fr); }
.stardust { display: flex; align-items: center; gap: 8px; font-size: 26px; font-weight: 800; color: #fff; }
.stardust .star { color: var(--accent); text-shadow: 0 0 10px rgba(255, 207, 90, .6); }
.shop-list { display: grid; gap: 8px; }
.shop-item { display: grid; grid-template-columns: 40px 1fr; gap: 4px 10px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: rgba(0, 0, 0, .18); }
.shop-item.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.shop-item .item-icon { grid-row: span 2; width: 40px; height: 40px; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, .06); }
.shop-item .item-icon svg { width: 26px; height: 26px; }
.shop-item .item-top { display: flex; align-items: baseline; gap: 6px; }
.shop-item .item-top b { color: #fff; }
.shop-item .item-owned { margin-left: auto; font-weight: 700; }
.shop-item .item-desc { margin: 0; font-size: 12px; color: var(--muted); }
.shop-item .item-buttons { grid-column: 2; display: flex; gap: 6px; margin-top: 4px; }
.shop-item .item-buttons button { flex: 1; padding: 5px 8px; }
#shop-note:empty { display: none; }

/* gear from bosses */
.gear-worn { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 8px; }
.gear-slot { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border: 1px dashed var(--line); border-radius: 8px; text-align: center; font-size: 11px; color: var(--muted); }
.gear-slot.worn { border-style: solid; background: rgba(0, 0, 0, .18); }
.gear-slot b { font-size: 13px; }
.gear-bag { display: grid; gap: 6px; max-height: 260px; overflow-y: auto; }
.gear-piece { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: rgba(0, 0, 0, .18); font-size: 12px; }
.gear-piece.worn { box-shadow: inset 0 0 0 1px var(--accent); border-color: var(--accent); }
.gear-piece .gear-buttons { display: flex; gap: 4px; }
.gear-piece .gear-buttons button { padding: 4px 7px; font-size: 12px; }
.gear-piece small { display: block; color: var(--muted); }
#gear-note:empty { display: none; }
