:root {
  --panel: linear-gradient(180deg, rgba(56, 98, 142, .93), rgba(30, 56, 90, .93));
  --panel-flat: rgba(30, 56, 90, .9);
  --rim: rgba(255, 255, 255, .18);
  --drop: 0 3px 0 rgba(12, 26, 44, .55), 0 8px 18px rgba(0, 0, 0, .16);
  --ink: #16263a;
  --text: #fff;
  --cream: #fff8e8;
  --cream-2: #f2e0b8;
  --brown: #5b3a1c;
  --orange: #ffb13b;
  --orange-dark: #c96a00;
  --gold: #ffd23f;
  --green: #5fd16f;
  --red: #ff5a4e;
  --font: 'Nunito', system-ui, sans-serif;
  --title: 'Lilita One', 'Nunito', system-ui, sans-serif;
  --outline: 0 2px 0 var(--ink), 0 0 3px var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #cfe3e6; color: var(--text); font-family: var(--font); font-weight: 700; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
#game { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; }
body.removing #game { cursor: crosshair; }
#vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 48%, rgba(0,0,0,0) 58%, rgba(14,40,52,.26) 100%); }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.panel { background: var(--panel); border: 2px solid var(--rim); border-radius: 14px; padding: 8px 12px; box-shadow: var(--drop); }
.outline { text-shadow: var(--outline); }

/* ---------- top HUD ---------- */
#hud { position: fixed; inset: 0 0 auto 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: max(10px, env(safe-area-inset-top)) 12px 0; pointer-events: none; }
#hud > * { pointer-events: auto; }
/* the hints under the wave panel are only text: a touch on them goes through to the map (on a phone they cover a good part of it) */
#hud > .hud-mid { pointer-events: none; }
#hud > .hud-mid > .wave, #hud > .hud-mid > .keepbar { pointer-events: auto; }
.hud-left { max-width: 300px; display: flex; flex-direction: column; gap: 8px; }
.logo { font-family: var(--title); font-size: 32px; letter-spacing: .5px; color: #fff; line-height: 1;
  text-shadow: 0 3px 0 #23507e, 2px 0 0 #23507e, -2px 0 0 #23507e, 0 -2px 0 #23507e, 0 6px 8px rgba(0,0,0,.25); }
#goals { font-size: 13px; line-height: 1.3; min-width: 220px; }
.goal-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.goal-head span { opacity: .75; }
.goal-head b { color: var(--gold); font-size: 12px; }
.goal-bar { height: 5px; margin: 4px 0 6px; border-radius: 3px; background: rgba(0,0,0,.3); overflow: hidden; }
.goal-bar i { display: block; height: 100%; background: linear-gradient(90deg, #ffd23f, #ffb13b); border-radius: 3px; transition: width .4s; }
.goal { padding-left: 22px; position: relative; margin: 4px 0; }
.goal .box { position: absolute; left: 1px; top: 2px; width: 13px; height: 13px; border-radius: 4px; border: 2px solid var(--gold); background: rgba(0,0,0,.2); }
.goal.later { opacity: .6; font-size: 12px; }
.goal.later .box { border-color: rgba(255,255,255,.5); }

.hud-mid { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 0 1 auto; min-width: 0; }
.wave { display: flex; align-items: center; gap: 10px; white-space: nowrap; padding: 6px 8px 6px 10px; }
.wave-ico { width: 26px; height: 26px; flex: 0 0 auto; background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cg stroke='%2316263a' stroke-width='1.6' stroke-linejoin='round'%3E%3Cpath d='M5 4l14 14-3 3L2 7V4z' fill='%23dfe6ec'/%3E%3Cpath d='M27 4L13 18l3 3L30 7V4z' fill='%23dfe6ec'/%3E%3Cpath d='M8 20l4 4-3 3-4-4zM24 20l-4 4 3 3 4-4z' fill='%23c98f55'/%3E%3Cpath d='M10 22l-5 5M22 22l5 5' stroke-width='3'/%3E%3C/g%3E%3C/svg%3E"); }
#waveText { display: flex; flex-direction: column; line-height: 1.05; }
#waveText b { font-family: var(--title); font-weight: 400; font-size: 18px; letter-spacing: .3px; text-shadow: 0 2px 0 var(--ink); }
#waveText span { font-size: 12px; opacity: .85; }
#callWave { background: linear-gradient(#ffd166, #ffa928); border: 0; border-radius: 10px; padding: 5px 11px; color: #5a2d00; box-shadow: 0 3px 0 var(--orange-dark); font-size: 12px; font-weight: 800; }
.keepbar { display: flex; align-items: center; gap: 6px; }
.keep-ico { width: 22px; height: 22px; background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cg stroke='%2316263a' stroke-width='1.6' stroke-linejoin='round'%3E%3Cpath d='M6 13h20v15H6z' fill='%23e4ded3'/%3E%3Cpath d='M6 13V8h3v2h3V8h3v2h2V8h3v2h3V8h3v5' fill='%23fff'/%3E%3Cpath d='M13 28v-6a3 3 0 0 1 6 0v6z' fill='%237a4a28'/%3E%3C/g%3E%3C/svg%3E"); filter: drop-shadow(0 1px 0 rgba(0,0,0,.4)); }
.kb-track { width: 200px; max-width: 50vw; height: 13px; background: rgba(10, 22, 36, .6); border: 2px solid rgba(255,255,255,.35); border-radius: 8px; overflow: hidden; box-shadow: 0 2px 0 rgba(12,26,44,.4); }
#keepHp { height: 100%; width: 100%; background: linear-gradient(#a4f59a, #3cc455 60%, #2ea845); border-radius: 6px; transition: width .2s; }
#keepHp.low { background: linear-gradient(#ffb0a0, #ff5a4e 60%, #d63a30); }
#keepNum { font-size: 12px; min-width: 30px; text-shadow: var(--outline); }
#heroDead { font-family: var(--title); font-size: 18px; color: #ffe; text-shadow: 0 2px 0 var(--ink); }

.hud-right { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; }
.coins { display: flex; align-items: center; gap: 7px; background: rgba(16, 30, 48, .62); border: 2px solid rgba(255,255,255,.14); padding: 3px 5px 3px 16px; border-radius: 24px; font-size: 27px; font-family: var(--title); text-shadow: 0 2px 0 var(--ink); }
.coin-ico { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 32%, #fff6b8, #ffd23f 42%, #e0a000 80%); box-shadow: inset 0 0 0 2px #b97f00, 0 1px 0 rgba(0,0,0,.25); vertical-align: -2px; margin-right: 3px; }
.coin-ico.big { width: 30px; height: 30px; margin: 0; box-shadow: inset 0 0 0 3px #c58800, inset 0 0 0 6px #ffe680, 0 2px 0 rgba(0,0,0,.3); }
.btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: 250px; }
.icon-btn { width: 38px; height: 38px; border-radius: 11px; border: 2px solid rgba(255,255,255,.28); background: linear-gradient(#5a92cf, #2f6299); display: grid; place-items: center; font-size: 18px; box-shadow: 0 3px 0 #1b3a5e, 0 5px 10px rgba(0,0,0,.15); text-shadow: 0 1px 0 var(--ink); }
.icon-btn svg { filter: drop-shadow(0 1px 0 rgba(10,25,45,.6)); }
.icon-btn:hover { background: linear-gradient(#6aa2df, #3a70a9); }
#stored { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; max-width: 260px; }
#stored:empty { display: none; }
.sc { display: inline-flex; align-items: center; gap: 2px; padding: 1px 8px 1px 2px; border-radius: 12px; background: rgba(16, 30, 48, .6); border: 1px solid rgba(255,255,255,.14); font-size: 13px; text-shadow: 0 1px 0 var(--ink); }
.ii { width: 22px; height: 22px; display: inline-block; flex: 0 0 auto; }
.ii.dot { width: 12px; height: 12px; margin: 5px; border-radius: 50%; background: var(--c); }

/* ---------- build bar: a blue tray of cream cards ---------- */
#buildwrap { position: fixed; left: 8px; right: 8px; bottom: max(10px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; pointer-events: none; }
#buildwrap > * { pointer-events: auto; }
#buildtabs { display: flex; gap: 5px; margin-bottom: -2px; }
.tab { border: 2px solid var(--rim); border-bottom: 0; border-radius: 12px 12px 0 0; padding: 5px 16px 4px; background: rgba(30, 56, 90, .75); font-size: 13px; text-shadow: 0 1px 0 var(--ink); }
.tab.on { background: rgb(56, 98, 142); color: var(--gold); }
#buildbar { display: flex; gap: 7px; padding: 7px; background: var(--panel); border: 2px solid var(--rim); border-radius: 18px; box-shadow: var(--drop); max-width: calc(100vw - 16px); overflow-x: auto; scrollbar-width: none; }
.slot { position: relative; width: 78px; flex: 0 0 auto; border: 0; border-radius: 13px; padding: 4px 2px 5px; display: flex; flex-direction: column; align-items: center; gap: 1px;
  background: linear-gradient(#fffdf6, #f3e3bf); color: var(--brown); box-shadow: 0 3px 0 #b7925c, inset 0 0 0 2px rgba(255,255,255,.7); }
.slot:hover { background: linear-gradient(#ffffff, #f8ebcc); }
.slot.on { background: linear-gradient(#ffd77a, #ffa928); color: #4a2600; box-shadow: 0 3px 0 var(--orange-dark), inset 0 0 0 2px rgba(255,255,255,.55), 0 0 0 3px #fff; }
.slot img { width: 52px; height: 52px; filter: drop-shadow(0 2px 1px rgba(80,50,20,.25)); }
.slot .big { width: 52px; height: 52px; display: grid; place-items: center; font-size: 26px; }
.slot .key { position: absolute; top: 4px; left: 5px; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 5px; font-size: 10px; line-height: 15px; text-align: center; background: rgba(91,58,28,.14); }
.slot .name { font-size: 11px; line-height: 1.1; text-align: center; font-weight: 800; }
.slot .cost { font-size: 12px; margin-top: 1px; padding: 0 7px 0 3px; border-radius: 9px; background: #2c4a70; color: #fff; display: inline-flex; align-items: center; }
.slot .cost .coin-ico { width: 12px; height: 12px; }
.slot.remove .big { color: var(--red); font-weight: 900; }
.slot.remove.on { background: linear-gradient(#ff8a7c, #ff5a4e); color: #fff; box-shadow: 0 3px 0 #a52a2a, inset 0 0 0 2px rgba(255,255,255,.45), 0 0 0 3px #fff; }
.slot.remove.on .big { color: #fff; }
.slot.pick .big { color: #2a8ab8; }
.slot.pick.on { background: linear-gradient(#9de6ff, #5ad1ff); color: #08324a; box-shadow: 0 3px 0 #2a8ab8, inset 0 0 0 2px rgba(255,255,255,.5), 0 0 0 3px #fff; }
.slot .lock { display: none; position: absolute; top: 16px; left: 50%; transform: translateX(-50%); font-size: 20px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.5)); }
.slot.locked { background: linear-gradient(#e9e4d8, #d6cdb9); box-shadow: 0 3px 0 #9d9180, inset 0 0 0 2px rgba(255,255,255,.4); }
.slot.locked img { filter: grayscale(1) brightness(.75) opacity(.7); }
.slot.locked .lock { display: block; }
.slot.locked .name { opacity: .6; }
.slot.locked .cost { background: #8a8478; }
body.picking #game { cursor: copy; }

.picks { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 2px; }
.picks button { border: 0; border-radius: 8px; padding: 3px 7px; background: rgba(255, 255, 255, .12); font-size: 11px; display: flex; align-items: center; gap: 4px; }
.picks button i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 1px rgba(0,0,0,.3); }
.picks button.on { background: var(--orange); color: #3c1f00; }

#indicators { position: fixed; inset: 0; pointer-events: none; }
.ind { position: absolute; left: 0; top: 0; width: 0; height: 0; }
.ind i { position: absolute; left: -15px; top: -15px; width: 30px; height: 30px; background: #ff4b3e; clip-path: polygon(100% 50%, 15% 5%, 32% 50%, 15% 95%); filter: drop-shadow(0 0 3px #400); }
.ind b { position: absolute; left: -12px; top: -9px; width: 24px; text-align: center; font-size: 13px; text-shadow: 0 1px 0 #400, 0 0 3px #400; }
.ind.boss i { background: #b04aff; transform-origin: center; }
.ind.road i { background: #ffb13b; filter: drop-shadow(0 0 3px #630); }

#tip { position: fixed; width: 270px; background: var(--panel); border: 2px solid var(--rim); box-shadow: var(--drop); border-radius: 14px; padding: 10px 12px; font-size: 13px; line-height: 1.35; pointer-events: none; }
#tip .cost { float: right; }
.small { font-size: 12px; opacity: .78; margin-top: 4px; }
.lockline { color: #ffd2a0; opacity: 1; margin: 0 0 4px; }

#toast { position: fixed; top: 25%; left: 50%; transform: translate(-50%, -10px); font-family: var(--title); font-size: 26px; text-shadow: 0 3px 0 var(--ink), 0 0 4px var(--ink); opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; text-align: center; padding: 0 16px; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- inspect panel ---------- */
#inspect { position: fixed; right: 12px; bottom: 150px; width: 270px; font-size: 13px; line-height: 1.35; padding: 10px 12px 12px; }
#inspect .row { display: flex; justify-content: space-between; align-items: center; font-size: 17px; margin-bottom: 4px; }
#inspectTitle { display: flex; align-items: center; gap: 8px; font-family: var(--title); font-weight: 400; text-shadow: 0 2px 0 var(--ink); }
#inspectTitle img { width: 40px; height: 40px; margin: -6px 0 -6px -4px; }
#inspect .status { padding: 5px 8px; border-radius: 9px; background: rgba(0,0,0,.2); margin: 4px 0; }
#inspect .hp { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 11px; }
#inspect .hp span { opacity: .75; }
#inspect .hpbar { flex: 1; height: 8px; border-radius: 4px; background: rgba(0,0,0,.35); overflow: hidden; }
#inspect .hpbar i { display: block; height: 100%; background: linear-gradient(#a4f59a, #3cc455); }
#inspect .hpbar i.low { background: linear-gradient(#ffb0a0, #ff5a4e); }
.x { background: rgba(0,0,0,.2); border: 0; border-radius: 8px; width: 28px; height: 28px; font-size: 14px; opacity: .85; }
.x:hover { background: rgba(0,0,0,.35); }

/* ---------- buttons, joystick, overlays ---------- */
.btn { background: linear-gradient(#ffd77a, #ffa928); border: 0; border-radius: 12px; padding: 8px 20px; color: #4a2600; box-shadow: 0 4px 0 var(--orange-dark), 0 6px 12px rgba(0,0,0,.15); font-family: var(--title); font-size: 18px; text-shadow: 0 1px 0 rgba(255,255,255,.45); }
.btn:hover { background: linear-gradient(#ffe08f, #ffb43c); }
.small-btn { font-size: 13px; padding: 5px 12px; margin-top: 8px; font-family: var(--font); font-weight: 800; box-shadow: 0 3px 0 var(--orange-dark); }
#joy { position: fixed; width: 110px; height: 110px; margin: -55px 0 0 -55px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .75); background: rgba(255, 255, 255, .16); pointer-events: none; box-shadow: 0 4px 12px rgba(0,0,0,.15); }
#joyKnob { position: absolute; left: 30px; top: 30px; width: 44px; height: 44px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #fff, #dfe9f2); box-shadow: 0 3px 0 rgba(0,0,0,.2); }

.overlay { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(16, 36, 48, .4); padding: 16px; }
.card { background: linear-gradient(180deg, rgba(48, 86, 128, .97), rgba(24, 44, 72, .97)); border: 3px solid rgba(255,255,255,.2); border-radius: 22px; padding: 20px 24px; max-width: 470px; font-size: 14px; line-height: 1.45; box-shadow: 0 5px 0 rgba(10, 22, 38, .6), 0 18px 50px rgba(0, 0, 0, .35); max-height: calc(100vh - 32px); overflow: auto; animation: cardin .22s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes cardin { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.card h2 { font-family: var(--title); font-weight: 400; font-size: 32px; margin: 0 0 8px; text-shadow: 0 3px 0 var(--ink); }
.card .row { display: flex; justify-content: space-between; align-items: center; }
.card ul { padding-left: 18px; }
.card li { margin: 6px 0; }
.card li b { display: inline-block; padding: 0 6px; border-radius: 6px; background: rgba(255,255,255,.14); box-shadow: 0 2px 0 rgba(0,0,0,.3); line-height: 1.35; }
.card > .btn { display: block; margin: 12px auto 0; min-width: 140px; }
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 14px 0 4px; font-size: 15px; }
.set-row .small-btn { margin: 0; }
.seg { display: flex; padding: 3px; border-radius: 12px; background: rgba(0,0,0,.3); }
.seg button { border: 0; border-radius: 9px; padding: 6px 14px; background: none; font-weight: 800; }
.set-row.vol input { flex: 1; max-width: 190px; accent-color: #ffa928; height: 22px; cursor: pointer; }
.set-row.vol input:disabled { opacity: .4; cursor: default; }
#soundBtn .snd-off, #soundBtn.muted .snd-on { display: none; }
#soundBtn.muted .snd-off { display: inline; }
#soundBtn.muted { opacity: .8; }
.seg button.on { background: linear-gradient(#ffd77a, #ffa928); color: #4a2600; box-shadow: 0 2px 0 var(--orange-dark); }
/* saved games (settings): one row per slot */
#settings { z-index: 6; } /* above the game-over card, which opens it to load a save */
.slots { display: grid; gap: 6px; margin: 6px 0 2px; }
.slot-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 12px; background: rgba(0,0,0,.22); }
.slot-row b { display: block; font-size: 14px; }
.slot-row span { font-size: 12px; opacity: .85; }
.slot-row .empty { opacity: .55; }
.sbtns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.sbtns .small-btn { margin: 0; }
.slot-row button { border: 0; border-radius: 9px; padding: 5px 11px; font-weight: 800; background: linear-gradient(#ffd77a, #ffa928); color: #4a2600; box-shadow: 0 2px 0 var(--orange-dark); }
.slot-row button:disabled { opacity: .4; }
.slot-row button.danger, .small-btn.danger { background: linear-gradient(#ff8a7c, #ff5a4e); color: #3c0b06; box-shadow: 0 2px 0 #a52a2a; }
#over .card > .small-btn { display: block; margin: 10px auto 0; }

#loading { position: fixed; inset: 0; display: grid; place-items: center; font-family: var(--title); font-size: 30px; color: #fff; text-shadow: 0 3px 0 #23507e; background: radial-gradient(circle at 50% 40%, #e4f2e8, #bfd9de); }

/* ---------- touch confirm bar ---------- */
#confirm { position: fixed; left: 50%; bottom: calc(max(10px, env(safe-area-inset-bottom)) + 128px); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 10px; background: var(--panel); border: 2px solid var(--rim); border-radius: 18px; box-shadow: var(--drop); max-width: calc(100vw - 24px); animation: cfin .18s ease-out; }
#cfText { font-size: 13px; text-align: center; }
.cfBtns { display: flex; gap: 8px; }
.cf { border: 0; border-radius: 12px; min-width: 52px; min-height: 46px; padding: 0 14px; font-family: var(--title); font-size: 18px; background: rgba(255,255,255,.14); box-shadow: 0 3px 0 rgba(0,0,0,.25); }
.cf.ok { background: linear-gradient(#7fe08f, #46c066); color: #0b3518; box-shadow: 0 3px 0 #2a8a45; min-width: 110px; }
.cf.ok.danger { background: linear-gradient(#ff8a7c, #ff5a4e); color: #3c0b06; box-shadow: 0 3px 0 #a52a2a; }
@keyframes cfin { from { transform: translate(-50%, 8px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

#selbox { position: fixed; border: 2px dashed #ff6a5a; background: rgba(255, 70, 60, .12); border-radius: 6px; pointer-events: none; }
#selbox::after { content: attr(data-n); position: absolute; right: -10px; top: -12px; min-width: 22px; padding: 1px 6px; border-radius: 10px; background: #ff6a5a; color: #fff; font-size: 12px; text-align: center; }
#selbox[data-n=""]::after { display: none; }

/* ---------- scouted wave, tech badge, minimap ---------- */
#wavePlan { font-size: 12px; max-width: 420px; text-align: center; padding: 3px 10px; border-radius: 10px; background: rgba(16,30,48,.55); }
#wavePlan:empty { display: none; }
#techBtn { position: relative; }
#techBtn.badge::after { content: ''; position: absolute; top: -4px; right: -4px; width: 12px; height: 12px; border-radius: 50%; background: #7dff9a; box-shadow: 0 0 0 2px var(--ink), 0 0 8px #7dff9a; animation: badge 1.2s ease-in-out infinite; }
@keyframes badge { 50% { transform: scale(1.25); } }
#minimap { width: 150px; height: 150px; border-radius: 50%; box-shadow: 0 0 0 3px rgba(255,255,255,.6), 0 4px 0 rgba(12,26,44,.45), 0 8px 18px rgba(0,0,0,.2); background: rgba(18,34,52,.5); }

/* ---------- the tech tree: a Mindustry-style screen of its own ---------- */
#tech { position: fixed; inset: 0; z-index: 5; overflow: hidden; color: #f3ead2;
  background: radial-gradient(ellipse at 50% 50%, rgba(60, 74, 96, .97), rgba(14, 18, 26, .98) 75%); }
#tech::before { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.035) 0 1px, transparent 1px 40px), repeating-linear-gradient(90deg, rgba(255,255,255,.035) 0 1px, transparent 1px 40px); }
#techTree { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: grab; }
#techTree:active { cursor: grabbing; }
#techPlane { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
#techPlane svg { position: absolute; left: 0; top: 0; overflow: visible; }
.ln { fill: none; stroke: #464c58; stroke-width: 3; stroke-linejoin: round; }
.ln.done { stroke: #e3bb5c; }
.ln.ready { stroke: #ffd23f; }
.ln.open { stroke: #9a8657; }
.tn { position: absolute; width: 54px; height: 54px; border-radius: 10px; border: 3px solid #9a8657; background: #222a36; padding: 0; display: grid; place-items: center; box-shadow: 0 3px 0 rgba(0,0,0,.45); transition: transform .12s; }
.tn:hover { transform: scale(1.08); z-index: 2; }
.tn img { width: 42px; height: 42px; pointer-events: none; }
.tn .pi { width: 34px; height: 34px; pointer-events: none; }
.tn::after { content: attr(data-name); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); white-space: nowrap; padding: 3px 8px; border-radius: 7px; background: rgba(10,14,20,.92); border: 1px solid #9a8657; font-size: 12px; color: #fff; opacity: 0; pointer-events: none; transition: opacity .12s; }
.tn:hover::after { opacity: 1; }
.tn.root { width: 54px; height: 54px; border-color: #ffd23f; background: #3a3220; box-shadow: 0 0 0 4px rgba(255,210,63,.18), 0 3px 0 rgba(0,0,0,.45); }
.tn.root .pi { width: 40px; height: 40px; }
.tn.done { border-color: #e3bb5c; background: #34301f; }
.tn.ready { border-color: #ffd23f; background: #3d3a20; animation: tnpulse 1.4s ease-out infinite; }
.tn.open { border-color: #9a8657; }
.tn.open img, .tn.open .pi { filter: grayscale(.7) brightness(.7); }
.tn.locked { border-color: #c8463e; background: #2a1e22; }
.tn.locked .pi { width: 28px; height: 28px; opacity: .85; }
.tn.sel { outline: 3px solid #fff; outline-offset: 3px; }
.tn.just { animation: techpop .6s cubic-bezier(.2, 1.8, .4, 1); }
.tn .pb { position: absolute; left: 5px; right: 5px; bottom: 4px; height: 5px; border-radius: 3px; background: rgba(0,0,0,.55); overflow: hidden; }
.tn .pb i { display: block; height: 100%; background: #ffd23f; }
@keyframes tnpulse { 0% { box-shadow: 0 0 0 0 rgba(255,210,63,.7), 0 3px 0 rgba(0,0,0,.45); } 100% { box-shadow: 0 0 0 14px rgba(255,210,63,0), 0 3px 0 rgba(0,0,0,.45); } }
@keyframes techpop { 0% { transform: scale(1); } 35% { transform: scale(1.35); box-shadow: 0 0 30px 6px rgba(255,210,63,.8); } 100% { transform: scale(1); } }
.tb { position: absolute; font-family: var(--title); font-size: 20px; color: rgba(227, 187, 92, .75); white-space: nowrap; pointer-events: none; letter-spacing: .5px; }
.tb.c { transform: translate(-50%, -50%); }
.tb.r { transform: translate(-100%, -50%); }
.tb.l { transform: translate(0, -50%); }

.tt-title { position: absolute; top: max(12px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); padding: 6px 30px; border: 3px solid #9a8657; border-radius: 12px; background: rgba(14,18,26,.9); font-family: var(--title); font-size: 22px; color: #ffd23f; pointer-events: none; }
.tt-store { position: absolute; left: 12px; top: max(12px, env(safe-area-inset-top)); min-width: 180px; border: 3px solid #9a8657; border-radius: 12px; background: rgba(14,18,26,.9); padding: 4px 0 6px; font-size: 14px; }
.ts-head { display: flex; justify-content: space-between; width: 100%; border: 0; background: none; padding: 4px 12px 6px; font-family: var(--title); font-size: 17px; color: #ffd23f; }
.ts-row { display: flex; align-items: center; gap: 6px; padding: 1px 12px; }
.ts-row b { min-width: 28px; text-align: right; }
.ts-row span { opacity: .85; }
.ts-row.none { opacity: .4; }
.ts-row.need { background: rgba(200,70,62,.3); }
.ts-row.need.ok { background: rgba(95,209,111,.25); }
.tt-store.shut .ts-list { display: none; }
.tt-bottom { position: absolute; left: 50%; bottom: max(12px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 10px; }
.tt-btn { min-width: 120px; min-height: 46px; padding: 0 18px; border: 3px solid #9a8657; border-radius: 12px; background: rgba(14,18,26,.92); font-family: var(--title); font-size: 19px; color: #f3ead2; }
.tt-btn:hover { border-color: #ffd23f; color: #fff; }
#techInfo { position: absolute; width: 290px; padding: 12px 14px 14px; border: 3px solid #e3bb5c; border-radius: 14px; background: rgba(14,18,26,.96); box-shadow: 0 10px 30px rgba(0,0,0,.5); font-size: 13px; line-height: 1.4; z-index: 3; }
.ti-head { display: flex; gap: 10px; align-items: center; }
.ti-ico { width: 48px; height: 48px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; background: #2a2f3a; border: 2px solid #9a8657; }
.ti-ico img { width: 44px; height: 44px; }
.ti-ico .pi { width: 34px; height: 34px; }
.ti-name { flex: 1; }
.ti-name b { font-family: var(--title); font-weight: 400; font-size: 19px; }
.ti-state { font-size: 12px; }
.ti-state.done { color: #7be39a; }
.ti-state.ready { color: #ffd23f; }
.ti-state.open { color: #e3bb5c; }
.ti-state.locked { color: #ff8a7c; }
#techInfo .desc { margin: 8px 0 6px; opacity: .9; }
#techInfo .unl { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
#techInfo .unl span { display: flex; align-items: center; gap: 4px; padding: 2px 8px 2px 2px; border-radius: 9px; background: rgba(255,255,255,.08); font-size: 12px; }
#techInfo .unl img { width: 28px; height: 28px; }
.reqs { display: flex; flex-direction: column; gap: 2px; margin: 6px 0 8px; padding: 6px 8px; border-radius: 10px; background: rgba(255,255,255,.05); }
.req { display: flex; align-items: center; gap: 6px; color: #ff9a8c; }
.req b { min-width: 52px; }
.req span { color: #f3ead2; opacity: .85; }
.req.ok { color: #7be39a; }
#techInfo .needs { color: #ffc6a0; margin-top: 6px; }
#techGo { width: 100%; }
#techGo[disabled] { opacity: .5; filter: grayscale(.7); cursor: default; }

/* ---------- phones ---------- */
@media (max-width: 700px) {
  .logo { font-size: 22px; }
  #goals { font-size: 11px; max-width: 46vw; min-width: 0; }
  .goal.later { display: none; }
  .wave { gap: 6px; padding: 4px 6px 4px 8px; white-space: normal; }
  .wave-ico { width: 20px; height: 20px; }
  #waveText b { font-size: 15px; }
  #waveText span { font-size: 11px; }
  .hud-mid { position: fixed; top: calc(max(10px, env(safe-area-inset-top)) + 104px); left: 50%; transform: translateX(-50%); }
  .kb-track { width: 150px; }
  .coins { font-size: 19px; padding: 2px 4px 2px 11px; }
  .coin-ico.big { width: 22px; height: 22px; box-shadow: inset 0 0 0 2px #c58800, inset 0 0 0 4px #ffe680; }
  .btns { flex-wrap: nowrap; max-width: none; gap: 4px; }
  .icon-btn { width: 32px; height: 32px; font-size: 16px; border-radius: 9px; }
  .icon-btn svg { width: 17px; height: 17px; }
  #stored { max-width: 52vw; }
  .sc { font-size: 11px; }
  .ii { width: 18px; height: 18px; }
  #buildbar { flex-wrap: wrap; justify-content: center; overflow: visible; gap: 5px; padding: 6px; max-width: 100%; }
  .slot { width: 56px; padding: 3px 1px 4px; }
  .slot img, .slot .big { width: 34px; height: 34px; }
  .slot .big svg { width: 22px; height: 22px; }
  .slot .name { font-size: 10px; }
  .slot .cost { font-size: 10px; }
  .slot .key { display: none; }
  .slot .lock { top: 10px; font-size: 16px; }
  #inspect { left: 12px; right: 12px; width: auto; bottom: 140px; }
  #confirm { bottom: calc(max(10px, env(safe-area-inset-bottom)) + 112px); }
  #minimap { width: 110px; height: 110px; }
  .tt-title { font-size: 17px; padding: 4px 16px; left: auto; right: 12px; transform: none; }
  .tt-store { min-width: 0; font-size: 12px; }
  .ts-head { font-size: 15px; gap: 8px; }
  #techInfo { position: absolute; left: 10px !important; right: 10px; top: auto !important; bottom: calc(max(12px, env(safe-area-inset-bottom)) + 62px); width: auto; max-height: 52vh; overflow: auto; }
  .tt-btn { min-width: 100px; min-height: 42px; font-size: 17px; }
}
@media (max-height: 500px) and (min-width: 701px) {
  .slot { width: 58px; padding: 2px 1px 3px; }
  .slot img, .slot .big { width: 32px; height: 32px; }
  .slot .name { font-size: 10px; }
  .slot .cost { font-size: 10px; }
  .slot .key { display: none; }
  .tab { padding: 2px 12px 2px; font-size: 12px; }
  .goal.later { display: none; }
  #goals { font-size: 11px; }
  .logo { font-size: 22px; }
  #minimap { width: 100px; height: 100px; }
  .tt-store { font-size: 12px; }
}

/* ---------- motion: anim.js toggles these classes; hover and press feedback ---------- */
.coins { transform-origin: 85% 50%; }
.coins.punch { animation: coin-punch .3s cubic-bezier(.2, 1.6, .4, 1); }
.coins.punch .coin-ico { animation: coin-flip .3s ease-out; }
.coins.dip { animation: coin-dip .22s ease-out; }
@keyframes coin-punch { 0% { transform: scale(1); } 35% { transform: scale(1.24) rotate(-3deg); color: #fff3a6; } 100% { transform: scale(1); } }
@keyframes coin-flip { 0% { transform: scaleX(1); } 50% { transform: scaleX(.15) scaleY(1.15); } 100% { transform: scaleX(1); } }
@keyframes coin-dip { 0% { transform: scale(1); } 40% { transform: scale(.9) translateY(2px); color: #ffd9c2; } 100% { transform: scale(1); } }

.slot { transition: background .12s, transform .14s cubic-bezier(.2, 1.8, .4, 1); }
.slot img, .slot .big { transition: transform .22s cubic-bezier(.2, 2.2, .4, 1); }
.slot:hover img, .slot:hover .big { transform: translateY(-3px) scale(1.16) rotate(-4deg); }
.slot:active { transform: scale(.93); }
.slot.on img, .slot.on .big { animation: slot-bob 1s ease-in-out infinite; }
@keyframes slot-bob { 0%, 100% { transform: translateY(0) scale(1.08); } 50% { transform: translateY(-4px) scale(1.14); } }
#callWave, .icon-btn, .btn, .tt-btn, .cf { transition: transform .14s cubic-bezier(.2, 1.8, .4, 1); }
#callWave:hover, .icon-btn:hover { transform: scale(1.08); }
#callWave:active, .btn:active, .icon-btn:active, .tt-btn:active, .cf:active { transform: scale(.92); }

/* a wave arrives: the toast becomes a horn banner, the screen edge glows red */
#toast.horn { font-size: 44px; color: #ffe9a8; letter-spacing: 1px; text-shadow: 0 4px 0 #7a1f12, 0 0 14px rgba(255, 90, 50, .9); }
#toast.horn.show { animation: horn 2.3s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes horn {
  0% { transform: translate(-50%, 0) scale(.3) rotate(-6deg); opacity: 0; }
  9% { transform: translate(-50%, 0) scale(1.25) rotate(2deg); opacity: 1; }
  14% { transform: translate(-50%, 0) scale(.95) rotate(-1deg); }
  19%, 85% { transform: translate(-50%, 0) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -14px) scale(1.04); opacity: 1; }
}
#vignette.alarm { animation: alarm 1.8s ease-out; }
#vignette.hurt { animation: hurt .4s ease-out; }
@keyframes alarm { 0% { box-shadow: inset 0 0 0 0 rgba(255, 60, 40, 0); } 12% { box-shadow: inset 0 0 140px 40px rgba(255, 60, 40, .55); } 40% { box-shadow: inset 0 0 90px 20px rgba(255, 60, 40, .25); } 55% { box-shadow: inset 0 0 130px 34px rgba(255, 60, 40, .45); } 100% { box-shadow: inset 0 0 0 0 rgba(255, 60, 40, 0); } }
@keyframes hurt { 0% { box-shadow: inset 0 0 110px 30px rgba(255, 40, 40, .5); } 100% { box-shadow: inset 0 0 0 0 rgba(255, 40, 40, 0); } }
.wave.punch { animation: wave-punch .55s cubic-bezier(.2, 1.6, .4, 1); }
.wave.tick { animation: wave-tick .3s ease-out; }
@keyframes wave-punch { 0% { transform: scale(1); } 25% { transform: scale(1.18) rotate(-2deg); background: rgba(190, 50, 30, .9); } 100% { transform: scale(1); } }
@keyframes wave-tick { 0% { transform: scale(1.09); background: rgba(160, 60, 30, .85); } 100% { transform: scale(1); } }
.keepbar.hurt { animation: bar-shake .32s linear; }
@keyframes bar-shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-5px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }

/* off-screen raider arrows throb; the boss one faster (scale is separate from the inline rotate) */
.ind i { animation: ind-pulse .9s ease-in-out infinite; }
.ind.boss i { animation-duration: .5s; }
.ind b { animation: ind-pop .9s ease-in-out infinite; }
@keyframes ind-pulse { 0%, 100% { scale: 1; opacity: .85; } 50% { scale: 1.28; opacity: 1; filter: drop-shadow(0 0 8px #ff2a1a); } }
@keyframes ind-pop { 0%, 100% { scale: 1; } 50% { scale: 1.15; } }

@media (prefers-reduced-motion: reduce) {
  .coins.punch, .coins.dip, .coins.punch .coin-ico, .slot.on img, .slot.on .big, #toast.horn.show, #vignette.alarm, #vignette.hurt, .wave.punch, .wave.tick, .keepbar.hurt, .ind i, .ind b, .tn.ready, .tn.just, .card, #techBtn.badge::after { animation: none; }
  .slot, .slot img, .slot .big { transition: none; }
}

/* ready to research: a green badge so it stands out from what is already done */
.tn.ready::before { content: '!'; position: absolute; top: -9px; right: -9px; width: 20px; height: 20px; border-radius: 50%; background: #5fd16f; color: #0b3518; font: 900 13px/20px var(--font); text-align: center; box-shadow: 0 0 0 2px #16263a; }
.tn.done:not(.root) { border-color: #c9a24f; background: #302b1f; }
@media (max-width: 700px) {
  .goal-bar { display: none; }
  .goal-head { margin-bottom: 2px; }
  .goal { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 2px 0; }
}

/* difficulty: the New game dialog and the picker on the controls card */
.diff-pick { margin: 10px 0 0; padding: 10px 12px; border-radius: 14px; background: rgba(0,0,0,.22); }
.diff-pick > b { display: block; margin-bottom: 6px; }
.diff-pick .seg { flex-wrap: wrap; }
.diff-pick .small { margin: 6px 0 0; }
.diff-now { font-weight: 800; }
.diff-list { display: grid; gap: 8px; margin-top: 10px; }
.diff-opt { display: block; text-align: left; border: 0; border-radius: 14px; padding: 10px 14px; background: rgba(255,255,255,.1); color: inherit; font-family: var(--font); box-shadow: 0 3px 0 rgba(0,0,0,.3); cursor: pointer; }
.diff-opt:hover { background: rgba(255,255,255,.18); }
.diff-opt b { display: block; font-size: 16px; }
.diff-opt span { font-size: 12.5px; opacity: .85; }
.diff-opt.on { box-shadow: 0 3px 0 rgba(0,0,0,.3), inset 0 0 0 2px #ffd77a; }
.diff-opt.d-easy b { color: #9be68a; }
.diff-opt.d-normal b { color: #ffe08a; }
.diff-opt.d-hard b { color: #ffad6b; }
.diff-opt.d-extreme b { color: #ff7f72; }

/* ---- Realm style (realm.js): iron, soot and old timber instead of glossy toy blue ---- */
body.realm {
  --panel: linear-gradient(180deg, rgba(58, 52, 46, .95), rgba(34, 30, 27, .95));
  --panel-flat: rgba(36, 32, 28, .94);
  --rim: rgba(190, 160, 110, .28);
  --drop: 0 3px 0 rgba(0, 0, 0, .55), 0 8px 18px rgba(0, 0, 0, .3);
  --ink: #0e0b08;
  --cream: #e9dfc8;
  --cream-2: #cdbd98;
  --orange: #d79a3c;
  --orange-dark: #8a5a1c;
  --gold: #e0b450;
  background: #a9aa9c;
}
body.realm #vignette { background: radial-gradient(ellipse at 50% 48%, rgba(0,0,0,0) 55%, rgba(10,8,6,.38) 100%); }
body.realm .icon-btn { background: linear-gradient(#5a5248, #34302a); border-color: rgba(200, 170, 120, .3); box-shadow: 0 3px 0 #15120f, 0 5px 10px rgba(0,0,0,.3); }
body.realm .card { background: linear-gradient(180deg, rgba(56, 50, 44, .98), rgba(30, 27, 24, .98)); border-color: rgba(190, 160, 110, .3); box-shadow: 0 5px 0 rgba(0, 0, 0, .6), 0 18px 50px rgba(0, 0, 0, .45); }
body.realm .slot { filter: sepia(.18) saturate(.85); }
/* v20: seven build tabs share a phone's width instead of scrolling off the side */
@media (max-width: 700px) {
  #buildtabs { gap: 2px; overflow: visible; width: 100%; }
  #buildtabs .tab { flex: 1 1 0; min-width: 0; padding: 4px 1px 3px; font-size: 11px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  /* six slots a row: a full tab (10 buildings + remove + pipette) is two rows, not three, so the bar keeps off the map */
  #buildbar { gap: 4px; }
  .slot { width: 54px; }
}

/* ---------- the campaign (campui.js): charter, beacon, speed, map, boons, victory ---------- */
.ch { margin-bottom: 6px; }
.ch .goal-head b { letter-spacing: 0; }
.goal.ok { opacity: .7; }
.goal.ok .box { background: var(--gold); }
.goal.ok .box::after { content: '✓'; position: absolute; inset: -4px 0 0 1px; color: #4a2600; font-size: 12px; }
.goal b { color: var(--gold); margin-left: 3px; }
.ch-sup, .reg-ch { display: flex; flex-wrap: wrap; gap: 4px; margin: 3px 0 2px 22px; }
.reg-ch { margin-left: 0; }
.sup { display: inline-flex; align-items: center; gap: 2px; padding: 1px 7px 1px 3px; border-radius: 10px; background: rgba(0,0,0,.28); font-size: 12px; }
.sup .ii { width: 18px; height: 18px; }
.sup.ok { background: rgba(120, 210, 120, .3); }
.sup.hold { padding-left: 7px; color: var(--gold); }
.sup.mini { display: none; }
.ch-state { margin: 5px 0 0; padding: 3px 8px; border-radius: 8px; font-size: 12px; background: rgba(0,0,0,.28); }
.ch-state.ready { background: rgba(255, 190, 60, .3); color: #fff3c4; }
.ch-state.lit { background: rgba(255, 110, 70, .35); }
.ch-state.won { background: rgba(120, 210, 120, .3); }
#beaconBtn { pointer-events: auto; align-self: flex-start; animation: beacon 1.2s ease-in-out infinite alternate; }
#beaconBtn.calm { animation: none; font-size: 15px; padding: 6px 14px; }
@keyframes beacon { from { box-shadow: 0 4px 0 var(--orange-dark), 0 0 0 0 rgba(255, 190, 60, .7); } to { box-shadow: 0 4px 0 var(--orange-dark), 0 0 0 9px rgba(255, 190, 60, 0); } }
#speedBtn { margin-left: 6px; min-width: 34px; border: 0; border-radius: 10px; padding: 5px 7px; background: rgba(255,255,255,.16); color: inherit; box-shadow: 0 3px 0 rgba(0,0,0,.3); font-size: 12px; font-weight: 800; }
#speedBtn.on { background: linear-gradient(#9be68a, #55b85a); color: #123a14; }
.card.wide { width: min(560px, 100%); max-width: 560px; }
#campList, #boonList, #hallList { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.land { margin-top: 10px; padding: 0 2px; }
.land b { display: block; font-family: var(--title); font-weight: 400; font-size: 20px; text-shadow: 0 2px 0 var(--ink); }
.land span { font-size: 12px; opacity: .8; }
.l-greenwood b { color: #a8e890; } .l-stonefells b { color: #d6d2c8; } .l-ashlands b { color: #f0b087; } .l-frostmarch b { color: #b4e4ff; }
.reg, .boon { display: flex; flex-direction: column; gap: 3px; text-align: left; border: 0; border-radius: 14px; padding: 10px 14px; min-height: 56px; background: rgba(255,255,255,.1); color: inherit; font-family: var(--font); font-weight: 700; box-shadow: 0 3px 0 rgba(0,0,0,.3); cursor: pointer; }
.reg:hover, .boon:hover { background: rgba(255,255,255,.17); }
.reg-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.reg-top b { font-size: 16px; }
.reg .stars { font-style: normal; color: var(--gold); letter-spacing: 1px; }
.reg-blurb { font-size: 12.5px; opacity: .85; }
.reg.locked { opacity: .55; }
.reg.done { background: rgba(120, 210, 120, .16); }
.reg.sel { box-shadow: 0 3px 0 rgba(0,0,0,.3), inset 0 0 0 2px #ffd77a; }
.reg.here .reg-top b::after { content: ' · here now'; font-size: 11px; opacity: .7; }
.reg-go { padding: 4px 4px 8px; }
.reg-go .seg { display: flex; }
.reg-go .seg button { flex: 1; }
.reg-go .btn { display: block; margin: 8px auto 0; min-width: 160px; }
.btn.danger { background: linear-gradient(#ff9a8a, #e8584a); color: #3a0a04; }
.boon { padding: 12px 16px; min-height: 76px; }
.boon i { font-style: normal; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; opacity: .8; }
.boon b { font-family: var(--title); font-weight: 400; font-size: 20px; text-shadow: 0 2px 0 var(--ink); }
.boon span { font-size: 13px; opacity: .9; }
.boon.f-logistics i { color: #ffd77a; } .boon.f-industry i { color: #f0b087; } .boon.f-arms i { color: #ff9a8a; } .boon.f-hero i { color: #9fdcff; }
#winStars { margin: 6px 0 10px; }
.star-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; opacity: .55; }
.star-row i { font-style: normal; font-size: 24px; color: var(--gold); text-shadow: 0 2px 0 var(--ink); }
.star-row.got { opacity: 1; }
#winDlg .card > .small-btn, #help .card > #helpCampaign + .btn { display: block; margin: 10px auto 0; }
@media (max-width: 700px) {
  .sup { font-size: 10.5px; padding: 0 5px 0 2px; }
  .sup .ii { width: 14px; height: 14px; }
  .ch-sup { margin-left: 0; }
  .ch .goal, .ch-state.ready, .ch + .goal-head { display: none; }
  .ch .sup.mini { display: inline-flex; }
  .ch { margin-bottom: 3px; }
  .ch-state { margin-top: 3px; padding: 2px 6px; font-size: 10.5px; }
  .ch .goal-head b { display: none; }
  #callWave { white-space: nowrap; }
  #beaconBtn { position: fixed; top: calc(max(10px, env(safe-area-inset-top)) + 196px); left: 50%; transform: translateX(-50%); white-space: nowrap; }
  #beaconBtn { font-size: 15px; padding: 7px 14px; }
  #speedBtn { padding: 5px 6px; }
}
@media (max-width: 700px) { #beaconBtn:active { transform: translateX(-50%) scale(.92); } }
.l-daily b { color: #ffd77a; } .l-trials b { color: #ff9a8a; }
.sup.rule { padding-left: 7px; color: #ffb4a8; }
.sup.best { padding-left: 7px; color: #b4e4ff; }
.sup.find { padding-left: 7px; color: #ffe08a; }
.boon.f-edict { background: rgba(255, 110, 70, .16); }
.boon.f-edict i { color: #ff9a8a; }

/* ---------- the Gauntlet (gauntui.js): the Hall, the research draft ---------- */
#hallList > .small { margin: 0; }
#oathSeg { flex-wrap: wrap; }
#oathSeg button { flex: 1 0 15%; min-height: 36px; }
.boon.f-tech { background: rgba(120, 190, 255, .14); }
.boon.f-tech i { color: #b4e4ff; }
.reroll { align-self: center; margin-top: 2px; }
.reg.danger, .reg .stars { transition: none; }
.reg.danger .stars { color: #ffb4a8; }

/* ---------- touch screens ----------
   touch.js puts .touch on <body> on a phone or tablet (or at the first touch); ui.js adds .building while a
   building, Remove or Pipette is picked. --bar-h is how much of the screen's bottom the build bar covers (ui.js). */
html, body { overscroll-behavior: none; -webkit-touch-callout: none; }
button { touch-action: manipulation; }
#hud, #buildwrap, #confirm, #inspect { touch-action: none; }
#buildbar { touch-action: pan-x; }
.card, #techInfo { overscroll-behavior: contain; touch-action: pan-y; }
.slot img { -webkit-user-drag: none; pointer-events: none; }
/* notches and rounded corners in landscape */
#hud { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
#buildwrap { left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right)); }
#confirm { bottom: calc(var(--bar-h, 118px) + 10px); }
/* thumb-sized targets: 40-44 px */
body.touch .icon-btn { width: 42px; height: 42px; border-radius: 11px; }
body.touch .icon-btn svg { width: 20px; height: 20px; }
body.touch .tab { min-height: 36px; padding-top: 7px; padding-bottom: 6px; }
body.touch #callWave { min-height: 34px; padding: 6px 12px; }
body.touch .x { width: 40px; height: 40px; font-size: 16px; }
body.touch .small-btn, body.touch .seg button { min-height: 40px; }
body.touch .slot-row button { min-height: 40px; min-width: 44px; }
body.touch .cf { min-height: 48px; }
body.touch #inspect { bottom: calc(var(--bar-h, 140px) + 10px); }
body.touch #inspectRemove { min-height: 42px; width: 100%; }
body.touch input[type=range] { height: 32px; }
/* sound and controls live in Settings too: a phone's top row keeps room for the bigger buttons */
@media (max-width: 700px) { body.touch #soundBtn, body.touch #helpBtn { display: none; } }
/* while building, the bar folds down to what you are placing (plus Turn, Remove, Pipette, Done): more map */
body:not(.touch) .slot.tool, body:not(.building) .slot.tool { display: none; }
body.touch.building #buildbar .slot[data-type]:not(.on) { display: none; }
body.touch.building #buildbar { flex-wrap: nowrap; }
.slot.tool .big svg { transition: transform .15s; }
.slot.done .big { color: #2e9a48; font-size: 26px; line-height: 34px; }
/* the walk ring: while building, a finger on it walks instead of aiming */
#joyDock { display: none; position: fixed; left: calc(max(14px, env(safe-area-inset-left)) + 6px); bottom: calc(var(--bar-h, 120px) + 18px); width: 92px; height: 92px; border-radius: 50%;
  border: 3px dashed rgba(255, 255, 255, .75); background: rgba(255, 255, 255, .12); pointer-events: none; place-items: center; font-size: 13px; text-shadow: var(--outline); }
body.touch.building #joyDock { display: grid; }
body.touch.building #joy:not([hidden]) ~ #joyDock { opacity: 0; }
/* narrow screens: the confirm bar is nearly full width, so the ring steps up out of its way */
@media (max-width: 700px) { body.touch.building.confirming #joyDock { bottom: calc(var(--bar-h, 120px) + 132px); } }
/* HUD text over the map (the wave plan, the keep bar, "respawning") lets fingers through to the map below;
   only the wave panel and its buttons take touches */
#hud > .hud-mid { pointer-events: none; }
.hud-mid .wave, .hud-mid button { pointer-events: auto; }
body.touch #speedBtn { min-height: 34px; min-width: 40px; }
/* a phone's wave panel holds Send now and the speed button too: keep "Wave 3" on one line */
@media (max-width: 700px) { body.touch #waveText b, body.touch #waveText span { white-space: nowrap; } }
