:root {
  --bg: #0f1b2b;
  --panel: rgba(12, 20, 32, 0.82);
  --text: #eef2f7;
  --muted: #9fb0c4;
  --accent: #f2b33d;
  --accent-text: #1b1405;
  --danger: #ff7a6b;
  --line: rgba(255, 255, 255, 0.12);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans JP", "Noto Sans KR", "Noto Sans Devanagari", "Hiragino Sans", "Malgun Gothic", "Nirmala UI", sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

canvas#map {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

[hidden] { display: none !important; }

.screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: radial-gradient(circle at 50% 30%, rgba(15, 27, 43, 0.55), rgba(5, 10, 18, 0.9));
  z-index: 10;
}

.card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  backdrop-filter: blur(8px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

h1 {
  margin: 0;
  font-size: 40px;
  letter-spacing: 0.02em;
  color: var(--accent);
}

h2 { margin: 0 0 8px; }

.tagline { margin: 4px 0 20px; color: var(--muted); }

.field { display: grid; gap: 6px; margin-bottom: 16px; color: var(--muted); font-size: 13px; }

input#name {
  font: inherit;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  -webkit-user-select: text;
  user-select: text;
}

.maps { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }

button {
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
}

.map-btn { display: grid; gap: 2px; text-align: left; }
.map-btn small { color: var(--muted); font-size: 12px; }
.map-btn.selected { border-color: var(--accent); background: rgba(242, 179, 61, 0.14); }

button.primary {
  width: 100%;
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  font-weight: 700;
  font-size: 17px;
  padding: 14px;
}
button.primary:disabled { opacity: 0.6; }

#end-actions { display: grid; gap: 8px; }

.levels { display: grid; grid-template-columns: auto 1fr 1fr 1fr auto; gap: 6px; align-items: center; margin-top: 8px; }
.team-btn { padding: 7px 8px; font-size: 13px; }
.team-btn.selected { border-color: var(--accent); background: rgba(242, 179, 61, 0.14); }
#team-row { font-size: 13px; }
#team-row[hidden] { display: none; }
#training-row { max-width: 160px; color: var(--accent); font-weight: 600; font-size: 12px; }
.room-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.room-mode { padding: 8px 4px; font-size: 14px; }
.room-mode.selected { border-color: var(--accent); background: rgba(242, 179, 61, 0.14); }
.levels span { color: var(--muted); font-size: 13px; margin-right: 4px; }
.level-btn { padding: 7px 4px; font-size: 13px; }
.level-btn.selected { border-color: var(--accent); background: rgba(242, 179, 61, 0.14); }
.menu-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.badge { font-style: normal; font-size: 11px; font-weight: 700; background: var(--accent); color: var(--accent-text); border-radius: 999px; padding: 1px 7px; margin-left: 4px; }
.badge[hidden] { display: none; }

.howto { margin-top: 16px; color: var(--muted); font-size: 13px; }
.howto summary { cursor: pointer; color: var(--text); }
.howto ul { padding-left: 18px; margin: 8px 0 0; }

.error { color: var(--danger); min-height: 1em; margin: 10px 0 0; font-size: 13px; }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud > * { pointer-events: auto; }

#banner {
  position: absolute;
  top: calc(10px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 18px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
}
#banner:empty { display: none; }

/* Private room: code, share and start while waiting for friends. */
#room-bar {
  position: absolute;
  top: calc(10px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  width: min(340px, calc(100% - 120px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  display: grid;
  gap: 8px;
  text-align: center;
}
#room-bar[hidden] { display: none; }
.room-line { display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; }
#room-code-show { font-size: 24px; letter-spacing: 4px; color: var(--accent); }
#room-share { font-size: 13px; padding: 6px 10px; }
#room-status { font-size: 13px; color: var(--muted); }
#room-start { font-size: 16px; padding: 10px; }
.friends-btn { width: 100%; margin-top: 10px; }
.noads-box { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.noads-box[hidden] { display: none; }
.noads-btn { flex: 1 1 auto; font-size: 14px; padding: 8px 10px; }
.noads-btn.owned { background: none; border-color: transparent; color: var(--muted); flex: 0 1 auto; }
.noads-box .link { padding: 0; }
.room-bots { display: flex; align-items: center; gap: 8px; margin: 10px 2px; font-size: 14px; }
.room-bots input { width: 18px; height: 18px; }
#room-create { width: 100%; }
.room-or { text-align: center; color: var(--muted); font-size: 12px; margin: 10px 0 6px; }
.room-join { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
#room-code { font-size: 22px; letter-spacing: 6px; text-align: center; padding: 8px; }
#room-join { padding: 8px 18px; font-weight: 600; }

#stats b { color: var(--text); font-size: 16px; }
#stats small { color: var(--muted); margin-left: 4px; }

#leaderboard {
  position: absolute;
  top: calc(10px + var(--safe-top));
  right: 10px;
  margin: 0;
  padding: 8px 12px 8px 30px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 12px;
  min-width: 150px;
  max-width: 44vw;
  pointer-events: none;
}
#leaderboard li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#leaderboard li.me { color: var(--accent); font-weight: 700; }
#leaderboard .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }

#hover:empty { display: none; }

#toast {
  position: absolute;
  left: 50%;
  top: calc(56px + var(--safe-top));
  transform: translateX(-50%);
  background: rgba(120, 30, 20, 0.9);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
#toast.show { opacity: 1; }

/* Legal links and the KVKK ad consent sheet. */
.legal-links { margin: 6px 0 0; font-size: 12px; color: var(--muted); text-align: center; }
.legal-links a { color: var(--muted); }
#ad-consent { position: fixed; inset: 0; z-index: 30; display: grid; place-items: end center; background: rgba(0, 0, 0, 0.35); padding: 10px; padding-bottom: calc(10px + var(--safe-bottom)); }
#ad-consent[hidden] { display: none; }
.adc-card { width: min(460px, 100%); background: #13202f; border: 1px solid var(--line); border-radius: 16px; padding: 12px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); }
.adc-title { display: block; margin-bottom: 4px; }
.adc-text { font-size: 14px; line-height: 1.5; margin: 6px 2px 8px; }
#adc-more { color: var(--muted); }
.adc-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.adc-btns button { font-size: 15px; padding: 12px 6px; font-weight: 600; }

/* Looks sheet. */
.looks-preview { display: flex; align-items: center; gap: 12px; margin: 4px 2px 6px; }
.look-land { width: 64px; height: 64px; image-rendering: pixelated; border-radius: 8px; }
.look-tag { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.look-flag { width: 36px; height: 24px; border-radius: 2px; }
.looks-h { font-size: 13px; color: var(--muted); font-weight: 600; margin: 10px 2px 6px; }
.looks-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.look-item { display: grid; justify-items: center; gap: 4px; padding: 7px 2px; }
.look-item small { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.look-item.selected { border-color: var(--accent); background: rgba(242, 179, 61, 0.14); }
.look-item.locked canvas, .look-item.locked .look-frame { opacity: 0.45; }
.look-item.locked small { color: #f2c14e; }
.look-swatch { width: 30px; height: 30px; image-rendering: pixelated; border-radius: 4px; }
.look-frame { width: 30px; height: 20px; border: 3px solid; border-radius: 3px; background: linear-gradient(#c8102e 50%, #fff 50%); }
#end-summary .bonus-btn { width: 100%; margin: 0 0 10px; background: #3f9b5a; color: #fff; border: none; font-weight: 700; }

/* Alliance request from another nation. */
#ally-ask {
  position: absolute;
  left: 50%;
  top: calc(60px + var(--safe-top));
  transform: translateX(-50%);
  width: min(92vw, 380px);
  background: #13202f;
  border: 1px solid #3f9b5a;
  border-radius: 12px;
  padding: 10px 12px;
  display: grid;
  gap: 8px;
  z-index: 12;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  font-size: 14px;
}
#ally-ask[hidden] { display: none; }
#ally-ask > div { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#ally-ask button { padding: 9px; }
#ally-yes { background: #3f9b5a; color: #fff; }

/* League badge on the menu and the stats sheet. */
.league-btn { width: 100%; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; row-gap: 6px; align-items: center; text-align: left; padding: 9px 12px; margin-bottom: 12px; }
.lg-icon { grid-row: span 2; font-size: 26px; line-height: 1; }
.lg-text { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.lg-text small { color: var(--muted); font-size: 12px; }
.lg-bar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.lg-bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; }
.stats-league { display: flex; gap: 12px; align-items: center; font-size: 15px; margin: 6px 2px 12px; }
.stats-league .lg-icon { font-size: 34px; }
.stats-list { display: grid; grid-template-columns: 1fr auto; gap: 7px 12px; margin: 0 2px 10px; font-size: 14px; }
.stats-list dt { color: var(--muted); }
.stats-list dd { margin: 0; font-weight: 700; text-align: right; }
.muted-note { color: var(--muted); font-size: 12px; margin: 0 2px; }
#end-summary .lp-up dd { color: #8fe08a; }
#end-summary .lp-down dd { color: #ff8a70; }
#end-summary .promo { text-align: center; font-weight: 700; color: #ffe9a8; margin: 0 0 10px; }
#clock.low { color: #ff8a70; }

/* Match alerts, newest on top. */
#feed {
  position: absolute;
  left: 50%;
  top: calc(92px + var(--safe-top));
  transform: translateX(-50%);
  display: grid;
  gap: 4px;
  justify-items: center;
  pointer-events: none;
  width: min(92vw, 420px);
  z-index: 5;
}
.feed-row {
  background: rgba(12, 20, 32, 0.86);
  border-left: 3px solid #8aa0b8;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 13px;
  transition: opacity 0.8s;
  animation: feed-in 0.25s ease-out;
}
.feed-row.bad { border-left-color: #e5533d; }
.feed-row.good { border-left-color: #f2b33d; color: #ffe9a8; }
.feed-row.fade { opacity: 0; }
@keyframes feed-in { from { transform: translateY(-6px); opacity: 0; } }

#end-summary dl { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 0 0 10px; font-size: 14px; }
#end-summary dt { color: var(--muted); }
#end-summary dd { margin: 0; font-weight: 700; text-align: right; }
#end-summary .tip { font-size: 13px; background: rgba(242, 179, 61, 0.12); border-radius: 8px; padding: 8px 10px; margin: 0 0 12px; }



@media (max-width: 520px) {
  #leaderboard { font-size: 11px; min-width: 0; }
  #leaderboard li:nth-child(n + 6) { display: none; }
  h1 { font-size: 34px; }
}

/* Top left: exit + stats */
#top-left {
  position: absolute;
  top: calc(10px + var(--safe-top));
  left: 10px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
#exit { width: 44px; height: 44px; padding: 0; font-size: 18px; background: var(--panel); }
#stats {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--muted);
  pointer-events: none;
}

#leaderboard { pointer-events: auto; cursor: pointer; }
#leaderboard.collapsed li:nth-child(n + 4):not(.me) { display: none; }

#hover {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(150px + var(--safe-bottom));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 13px;
  pointer-events: none;
  white-space: nowrap;
}

/* Bottom: attacks + troop share */
#bottom {
  position: absolute;
  left: 50%;
  bottom: calc(10px + var(--safe-bottom));
  transform: translateX(-50%);
  width: min(440px, calc(100% - 20px));
  display: grid;
  gap: 6px;
  pointer-events: none;
}
#bottom > * { pointer-events: auto; }
#attacks { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
#attacks:empty { display: none; }
.atk {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--c, #fff);
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 12px;
  white-space: nowrap;
}
#ratio-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px 12px 4px;
}
.ratio-head { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.ratio-head b { color: var(--text); }
#ratio-chips { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
#ratio-chips button { padding: 9px 0; font-size: 14px; font-weight: 600; min-height: 40px; }
#ratio-chips button.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
#ratio { width: 100%; accent-color: var(--accent); height: 26px; margin: 4px 0 0; }

#zoom-btns {
  position: absolute;
  right: 10px;
  bottom: calc(150px + var(--safe-bottom));
  display: grid;
  gap: 6px;
}
#zoom-btns button { width: 44px; height: 44px; padding: 0; font-size: 20px; background: var(--panel); }

/* Tutorial coach */
#coach {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: calc(64px + var(--safe-top));
  width: min(440px, calc(100% - 20px));
  background: rgba(20, 32, 50, 0.95);
  border: 1px solid var(--accent);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  z-index: 2;
}
#coach p { margin: 0; font-size: 15px; }
#coach-actions { display: flex; gap: 8px; margin-top: 10px; }
#coach-actions:empty { display: none; }
#coach-actions button { flex: 1; }
#coach-actions button.primary { font-size: 15px; padding: 10px; }
.pulse { animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(242, 179, 61, 0.9); }
  50% { box-shadow: 0 0 0 6px rgba(242, 179, 61, 0); }
}

@media (max-width: 520px) {
  #stats { font-size: 12px; padding: 5px 10px; }
  #stats b { font-size: 15px; }
  #leaderboard { max-width: 40vw; }
}
@media (max-height: 520px) {
  #ratio { display: none; }
  #zoom-btns, #hover { bottom: calc(110px + var(--safe-bottom)); }
}

button.link { background: none; border: none; color: var(--muted); text-decoration: underline; font-size: 13px; padding: 6px 0 0; }
/* Leave room for the menu banner ad in the app. */
#menu { padding-bottom: calc(70px + var(--safe-bottom)); }

/* ---------- flags, emoji, chat ---------- */
.name-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 6px; align-items: stretch; }
.name-row input#name { min-width: 0; }
.flag-btn { padding: 6px 8px; display: grid; place-items: center; }
.icon-btn { padding: 0 10px; font-size: 18px; }
img.flag { width: 24px; height: 16px; border-radius: 3px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35); vertical-align: -3px; object-fit: cover; }
img.flag.big { width: 42px; height: 28px; }
.flag-btn img.flag { width: 36px; height: 24px; }
#leaderboard img.flag { width: 16px; height: 11px; margin-right: 5px; vertical-align: -1px; }

#social-btns {
  position: absolute;
  left: 10px;
  bottom: calc(150px + var(--safe-bottom));
  display: grid;
  gap: 6px;
}
#social-btns button { width: 44px; height: 44px; padding: 0; font-size: 20px; background: var(--panel); position: relative; }
#chat-dot { position: absolute; top: 6px; right: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--danger); }
#chat-dot[hidden] { display: none; }
#social-btns button[hidden] { display: none; }
#build-btn.on { border-color: var(--accent); background: rgba(242, 179, 61, 0.25); }

/* Build menu: two buildings, their cost and what they do. */
#build-menu {
  position: absolute;
  left: 62px;
  bottom: calc(150px + var(--safe-bottom));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px;
  width: min(300px, calc(100% - 80px));
  display: grid;
  gap: 6px;
}
#build-menu[hidden] { display: none; }
.build-opt { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 8px; text-align: left; padding: 8px 10px; }
.build-opt b { display: block; font-size: 14px; }
.build-opt small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 400; }
.bo-icon { font-size: 22px; }
.bo-cost { font-style: normal; font-weight: 700; font-size: 13px; color: var(--accent); white-space: nowrap; }
.build-opt:disabled { opacity: 0.5; }
.build-opt:disabled .bo-cost { color: var(--muted); }

#emoji-bar {
  position: absolute;
  left: 62px;
  bottom: calc(150px + var(--safe-bottom));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px;
  width: min(300px, calc(100% - 80px));
}
#emoji-to { font-size: 12px; color: var(--muted); margin: 0 4px 6px; display: flex; justify-content: space-between; gap: 6px; }
#emoji-to button { padding: 2px 8px; font-size: 12px; }
#emoji-grid, .emoji-row { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
#emoji-grid button, .emoji-row button { padding: 6px 0; font-size: 20px; background: none; border-color: transparent; }
#emoji-grid button:active, .emoji-row button:active { background: rgba(255, 255, 255, 0.12); }

.sheet { position: fixed; inset: 0; z-index: 20; display: grid; place-items: end center; background: rgba(0, 0, 0, 0.35); padding: 10px; padding-bottom: calc(10px + var(--safe-bottom)); }
.sheet[hidden] { display: none; }
.sheet-card { width: min(460px, 100%); background: #13202f; border: 1px solid var(--line); border-radius: 16px; padding: 12px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); }
.close { width: 36px; height: 36px; padding: 0; flex: none; }
.pcard-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.pcard-head > div { flex: 1; display: grid; min-width: 0; }
.pcard-head small { color: var(--muted); }
.pcard-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 6px; margin-top: 10px; }
.pcard-actions .ally-btn { grid-column: 1 / -1; background: #3f9b5a; color: #fff; }
.pcard-actions button.primary { font-size: 14px; padding: 12px 6px; }
.pcard-actions button { font-size: 14px; padding: 10px 6px; }

.chat-card { display: grid; grid-template-rows: auto auto 1fr auto auto; height: min(70vh, 560px); }
.chat-mode { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin: 4px 0 6px; }
.chat-mode button { padding: 6px 4px; font-size: 13px; }
.chat-mode button.selected { border-color: var(--accent); background: rgba(242, 179, 61, 0.14); }
#chat-form[hidden] { display: none; }
.chat-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
#chat-log { list-style: none; margin: 0; padding: 4px; overflow-y: auto; min-height: 0; display: grid; align-content: start; gap: 6px; font-size: 14px; }
#chat-log li { line-height: 1.35; word-wrap: break-word; cursor: pointer; }
#chat-log li b { margin-right: 4px; }
#chat-log li.dm { color: #ffd68a; }
#chat-log li.sys { color: var(--muted); font-size: 12px; cursor: default; }
#chat-log li .to { color: var(--muted); font-size: 12px; }
.chat-note { color: var(--muted); font-size: 12px; margin: 4px 2px; min-height: 1em; }
#chat-form { display: grid; grid-template-columns: auto 1fr auto; gap: 6px; }
#chat-form select, #chat-form input, #picker-search {
  font: inherit; font-size: 15px; color: var(--text); background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); border-radius: 10px; padding: 10px; min-width: 0;
}
#chat-form select { max-width: 120px; }
#chat-form select[hidden] { display: none; }
#chat-form button.primary { width: auto; font-size: 15px; padding: 10px 14px; }
#chat-form:has(select[hidden]) { grid-template-columns: 1fr auto; }
select option { background: #13202f; }

.picker-card { display: grid; grid-template-rows: auto auto 1fr; height: min(75vh, 620px); gap: 8px; }
#picker-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; min-height: 0; }
#picker-list li { display: flex; align-items: center; gap: 10px; padding: 9px 6px; border-bottom: 1px solid var(--line); cursor: pointer; }
#picker-list li.on { color: var(--accent); font-weight: 700; }
#picker-list li.group { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; cursor: default; padding-top: 14px; }
@media (max-height: 520px) {
  #social-btns, #emoji-bar, #build-menu { bottom: calc(110px + var(--safe-bottom)); }
}
#end { z-index: 30; }

/* Narrow screens: the status line, room bar and messages sit below the troop box and the
   leaderboard instead of under them, and an open menu takes the place of the zoom buttons. */
@media (max-width: 820px) {
  #banner { top: calc(104px + var(--safe-top)); white-space: normal; text-align: center; width: max-content; max-width: calc(100% - 20px); border-radius: 14px; }
  #room-bar { top: calc(104px + var(--safe-top)); width: min(340px, calc(100% - 20px)); }
  #toast { top: calc(152px + var(--safe-top)); }
  #feed { top: calc(156px + var(--safe-top)); }
  #coach { top: calc(104px + var(--safe-top)); }
  #ally-ask { top: calc(104px + var(--safe-top)); }
}
@media (max-width: 520px) {
  #hud:has(#build-menu:not([hidden])) #zoom-btns,
  #hud:has(#emoji-bar:not([hidden])) #zoom-btns { visibility: hidden; }
}
