/* Ironclad Tactics — steel-and-brass war room */

:root {
  --bg: #141a26;
  --panel: rgba(18, 24, 38, .9);
  --panel-solid: #182033;
  --line: rgba(160, 180, 220, .18);
  --ink: #e9edf6;
  --muted: #95a1bb;
  --brass: #e8b04a;
  --brass-2: #ffd27a;
  --red: #e2483d;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
#board { position: fixed; inset: 0; display: block; touch-action: none; z-index: 0; }

button { font: inherit; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  background: #888; flex: 0 0 auto; box-shadow: 0 0 0 1.5px rgba(0,0,0,.4); }

/* ── HUD ───────────────────────────────────────────────────────────── */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 3; }
#hud > * { pointer-events: auto; }
#hud > .banner, #hud > .toast, #hud > .spec-chip { pointer-events: none; }

.turn-bar {
  position: absolute; top: calc(8px + env(safe-area-inset-top)); left: 50%;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px;
  background: var(--panel); border: 2px solid #888; border-radius: 14px;
  padding: 6px 8px 6px 14px; min-width: 330px; max-width: calc(100vw - 16px);
  box-shadow: 0 6px 22px rgba(0,0,0,.35); backdrop-filter: blur(6px);
}
.tb-left { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.tb-day { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--brass); font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-who { display: flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-who b { color: var(--brass-2); letter-spacing: .04em; }
.tb-line { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tb-clock { position: relative; width: 64px; height: 26px; border-radius: 8px; overflow: hidden;
  background: rgba(255,255,255,.08); display: flex; align-items: center; justify-content: center;
  font-variant-numeric: tabular-nums; font-weight: 700; font-size: 13px; }
#turnClockFill { position: absolute; left: 0; top: 0; bottom: 0; width: 100%;
  background: linear-gradient(90deg, #2f8f5a, #4fd18a); opacity: .45; transition: width .25s linear; }
#turnClockFill.low { background: linear-gradient(90deg, #a2261d, #ff5a4a); opacity: .7; }
.tb-clock span { position: relative; }
.icon-btn { background: rgba(255,255,255,.08); color: var(--ink); border: 1px solid var(--line);
  border-radius: 9px; width: 34px; height: 30px; cursor: pointer; font-size: 15px; }
.icon-btn:hover { background: rgba(255,255,255,.16); }

.funds-box {
  position: absolute; top: calc(8px + env(safe-area-inset-top)); right: 10px;
  display: flex; align-items: baseline; gap: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 7px 12px;
}
.fb-label { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
#fundsVal { font-size: 18px; font-weight: 800; color: var(--brass-2); font-variant-numeric: tabular-nums; }
.fb-income { font-size: 11px; color: #8fe0a6; }

.player-panel {
  position: absolute; top: calc(8px + env(safe-area-inset-top)); left: 10px;
  display: flex; flex-direction: column; gap: 4px; width: 200px;
}
.pp-row { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--pc, #888);
  border-radius: 10px; padding: 5px 8px; font-size: 12px; }
.pp-row.active { box-shadow: 0 0 0 2px var(--pc, #fff), 0 4px 14px rgba(0,0,0,.3); }
.pp-row.out { opacity: .45; }
.pp-row.out .pname { text-decoration: line-through; }
.pp-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pp-top .pname { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pp-stats { color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.tag { font-size: 10px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px;
  padding: 0 4px; white-space: nowrap; }
.tag.warn { color: #ffb27a; border-color: rgba(255,150,90,.4); }

.spec-chip { position: absolute; top: calc(62px + env(safe-area-inset-top)); left: 50%;
  transform: translateX(-50%); background: rgba(60,90,160,.85); border-radius: 999px;
  padding: 4px 12px; font-size: 12px; letter-spacing: .06em; }

.info-panel {
  position: absolute; left: 10px; bottom: calc(60px + env(safe-area-inset-bottom));
  display: flex; gap: 10px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 8px 12px; max-width: min(380px, calc(100vw - 20px));
}
.ip-col { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ip-title { font-weight: 800; font-size: 14px; }
.ip-hp { color: #8fe0a6; font-weight: 700; margin-left: 4px; }
.ip-sub { font-size: 12px; color: var(--muted); display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.ip-blurb { font-size: 11px; color: #c3cbe0; }

.action-menu {
  position: absolute; left: 50%; bottom: calc(52px + env(safe-area-inset-bottom));
  transform: translateX(-50%); display: flex; gap: 6px; flex-wrap: wrap; justify-content: center;
  align-items: center; background: var(--panel); border: 1px solid rgba(232,176,74,.45);
  border-radius: 14px; padding: 8px; max-width: calc(100vw - 16px);
  box-shadow: 0 8px 26px rgba(0,0,0,.45);
}
.am-btn { background: #27324d; color: var(--ink); border: 1px solid #3a4870; border-radius: 10px;
  padding: 9px 14px; cursor: pointer; font-weight: 700; font-size: 14px; display: flex; gap: 8px;
  align-items: center; min-height: 40px; }
.am-btn:hover { background: #33416a; }
.am-btn.primary { background: linear-gradient(180deg, #f0b94f, #c98a1d); color: #1d1405; border-color: #ffd27a; }
.am-btn.ghost { background: transparent; color: var(--muted); }
.am-btn .key { font-size: 10px; opacity: .55; border: 1px solid currentColor; border-radius: 4px; padding: 0 3px; }
.action-menu .hint { font-size: 13px; color: var(--muted); padding: 0 6px; }
.preview { display: flex; flex-direction: column; gap: 3px; padding: 2px 8px; font-size: 13px; }
.pv-row { display: flex; gap: 8px; align-items: baseline; }
.pv-row > span:first-child { width: 58px; color: var(--muted); }
.pv-dmg { color: #ff8f80; font-size: 16px; }
.pv-ctr { color: #ffd27a; }

.end-turn {
  position: absolute; right: 12px; bottom: calc(52px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, #3d4c75, #27324d); color: var(--ink);
  border: 1px solid #56689c; border-radius: 12px; padding: 12px 20px; font-weight: 800;
  letter-spacing: .04em; cursor: pointer; min-height: 46px; font-size: 15px;
}
.end-turn.ready { background: linear-gradient(180deg, #f0b94f, #c98a1d); color: #1d1405; border-color: #ffd27a;
  animation: glow 1.4s ease-in-out infinite; }
.end-turn.confirm { background: linear-gradient(180deg, #d9584c, #a0281e); border-color: #ff8f80; }
@keyframes glow { 50% { box-shadow: 0 0 18px rgba(255,200,90,.6); } }

.build-menu {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(420px, calc(100vw - 16px)); max-height: calc(100vh - 140px);
  flex-direction: column; background: var(--panel-solid); border: 1px solid rgba(232,176,74,.5);
  border-radius: 16px; box-shadow: 0 18px 50px rgba(0,0,0,.55); overflow: hidden; z-index: 5;
}
.bm-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px;
  font-weight: 800; letter-spacing: .06em; border-bottom: 1px solid var(--line); color: var(--brass-2); }
.bm-list { overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.bm-card { display: flex; gap: 10px; align-items: center; text-align: left; background: #222c45;
  border: 1px solid #34426a; border-radius: 12px; padding: 6px 10px; color: var(--ink); cursor: pointer; }
.bm-card:hover:not(:disabled) { background: #2c3858; border-color: var(--brass); }
.bm-card:disabled { opacity: .4; cursor: not-allowed; }
.bm-col { min-width: 0; }
.bm-name { font-weight: 800; display: flex; justify-content: space-between; gap: 10px; }
.bm-cost { color: var(--brass-2); font-variant-numeric: tabular-nums; }
.bm-sub { font-size: 12px; color: var(--muted); }
.bm-blurb { font-size: 11px; color: #c3cbe0; }

.game-menu {
  position: absolute; top: calc(58px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  flex-direction: column; gap: 6px; background: var(--panel-solid); border: 1px solid var(--line);
  border-radius: 14px; padding: 10px; width: min(320px, calc(100vw - 16px)); z-index: 6;
}
.game-menu button { background: #27324d; color: var(--ink); border: 1px solid #3a4870; border-radius: 10px;
  padding: 9px; cursor: pointer; font-weight: 600; }
.game-menu button.danger { background: #5a1f1a; border-color: #a0362c; }
.game-menu .keys { font-size: 11px; color: var(--muted); line-height: 1.5; }

.banner {
  position: absolute; left: 0; right: 0; top: 38%; text-align: center; opacity: 0;
  transform: translateX(-30px); transition: none;
}
.banner.show { animation: banner 1.5s ease forwards; }
@keyframes banner {
  0% { opacity: 0; transform: translateX(-60px); }
  15% { opacity: 1; transform: translateX(0); }
  80% { opacity: 1; transform: translateX(0); }
  100% { opacity: 0; transform: translateX(60px); }
}
.bn-title { display: inline-block; font-size: clamp(26px, 6vw, 46px); font-weight: 900; letter-spacing: .08em;
  padding: 6px 28px; background: linear-gradient(90deg, transparent, rgba(10,14,24,.85) 18%, rgba(10,14,24,.85) 82%, transparent);
  border-top: 3px solid var(--bc, #fff); border-bottom: 3px solid var(--bc, #fff);
  text-shadow: 0 2px 0 rgba(0,0,0,.5); }
.bn-sub { margin-top: 6px; color: #dfe6f6; font-weight: 600; text-shadow: 0 1px 3px #000; }

.toast { position: absolute; left: 50%; top: calc(70px + env(safe-area-inset-top));
  transform: translate(-50%, -10px); background: rgba(10,14,24,.92); border: 1px solid var(--line);
  border-radius: 10px; padding: 7px 14px; font-size: 13px; opacity: 0; transition: all .25s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* audio strip in the HUD — bottom-centre, below the action bar */
#hudAudio {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(4px + env(safe-area-inset-bottom)); width: max-content; max-width: 100vw;
}
.audio-controls { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: center; padding: 2px 0; }
.audio-controls button { background: #1d2740; color: #c6cffa; border: 1px solid #2f3b60;
  border-radius: 8px; padding: 5px 10px; font-size: 12px; cursor: pointer; }
.audio-controls input[type="range"] { width: 80px; accent-color: var(--brass); }
/* web/style.css pins .volume-slider position:fixed top:12px — undo it here
   (CLAUDE.md contract item 5). */
.volume-slider { position: static !important; top: auto !important; }

/* ── lobby overlay ─────────────────────────────────────────────────── */
#lobbyOverlay {
  position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(232,176,74,.12), transparent 55%),
    repeating-linear-gradient(0deg, rgba(255,255,255,.025) 0 1px, transparent 1px 32px),
    repeating-linear-gradient(90deg, rgba(255,255,255,.025) 0 1px, transparent 1px 32px),
    #121826;
  overflow-y: auto; padding: 16px;
}
.card {
  width: min(460px, 100%); background: var(--panel-solid); border: 1px solid rgba(232,176,74,.35);
  border-radius: 18px; padding: 22px; box-shadow: 0 24px 70px rgba(0,0,0,.55);
  margin: auto; text-align: center;
}
.card.wide { width: min(880px, 100%); }
.title { margin: 4px 0 6px; font-size: 38px; font-weight: 900; letter-spacing: .12em; color: #dfe4ee; }
.title span { display: block; font-size: .55em; letter-spacing: .5em; color: var(--brass); margin-top: -2px; }
.title.small { font-size: 28px; }
.title span.pname { display: inline; font-size: 1em; letter-spacing: .04em; color: inherit; margin: 0; }
.tagline { color: var(--muted); margin: 0 0 16px; line-height: 1.45; }
#nameInput, select {
  background: #0f1522; color: var(--ink); border: 1px solid #34426a; border-radius: 10px;
  padding: 9px 10px; font-size: 15px;
}
#nameInput { width: 100%; margin-bottom: 12px; text-align: center; }
select { padding: 6px 8px; font-size: 14px; }
.solo-box { background: rgba(232,176,74,.07); border: 1px solid rgba(232,176,74,.25); border-radius: 14px;
  padding: 12px; margin-bottom: 10px; }
.solo-box.compact { margin-top: 14px; padding: 10px; }
.solo-box .row { display: flex; gap: 10px; justify-content: center; margin-bottom: 10px; flex-wrap: wrap; }
.solo-box label, .settings-box label { display: flex; flex-direction: column; gap: 3px; font-size: 11px;
  color: var(--muted); letter-spacing: .06em; text-transform: uppercase; text-align: left; }
button.primary, button.secondary {
  width: 100%; border-radius: 12px; padding: 12px; font-size: 16px; font-weight: 800; cursor: pointer;
  letter-spacing: .04em; border: 1px solid transparent;
}
button.primary { background: linear-gradient(180deg, #f0b94f, #c98a1d); color: #1d1405; border-color: #ffd27a; }
button.primary:hover { filter: brightness(1.08); }
button.secondary { background: #27324d; color: var(--ink); border-color: #3a4870; margin-bottom: 8px; }
button.secondary:hover { background: #33416a; }
button:disabled { opacity: .5; cursor: default; }
.link-btn { background: none; border: none; color: var(--brass-2); cursor: pointer; font-weight: 700;
  padding: 8px; font-size: 14px; }
.back-link { display: inline-block; margin-top: 12px; color: var(--muted); text-decoration: none; font-size: 13px; }
.back-link:hover { color: var(--ink); }

.lobby-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; text-align: left; }
.lobby-col h3 { margin: 4px 0 8px; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--brass); }
.player-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.player-row { display: flex; align-items: center; gap: 8px; background: #111827; border: 1px solid var(--line);
  border-radius: 10px; padding: 7px 10px; }
.player-row .dot { background: #4fd18a; }
.player-row.me { border-color: rgba(232,176,74,.55); }
.player-name { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-row .tag { margin-left: auto; }
.settings-box { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; margin-bottom: 6px; }
#seatNote { margin: 4px 0 10px; }
#waitHost { text-align: center; }
.briefing { margin-top: 12px; background: #111827; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.briefing summary { cursor: pointer; font-weight: 700; color: var(--brass-2); }
.briefing ul { padding-left: 18px; margin: 8px 0 2px; color: #c3cbe0; font-size: 13px; line-height: 1.45; }
.briefing li { margin-bottom: 5px; }
#lobbyChat { margin-top: 12px; }

/* leaderboard theming — the five --lb-* tokens, on panel AND card (the
   overlay's close button is a sibling of the panel) */
.lb-panel, .lb-card {
  --lb-accent: #e8b04a;
  --lb-text: #e9edf6;
  --lb-dim: #95a1bb;
  --lb-edge: rgba(232,176,74,.28);
  --lb-panel: rgba(255,255,255,.03);
}

/* ── results ───────────────────────────────────────────────────────── */
#resultReason { margin-top: -2px; }
#resultTable { overflow-x: auto; }
#resultTable .fs-table { width: max-content; min-width: 100%; font-size: .88rem; }
#resultTable .fs-table th, #resultTable .fs-table td { padding: 6px 9px; }

/* wide screens: the left column under the player list, the right column for
   End turn — both off the board (hudInsets in the client reserves them) */
@media (min-width: 1000px) {
  .info-panel { max-width: 204px; flex-direction: column; align-items: flex-start; }
  .end-turn { width: 124px; right: 8px; padding: 12px 8px; }
}

/* ── phones ────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .lobby-cols { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .title { font-size: 30px; }
  .turn-bar { min-width: 0; width: calc(100vw - 12px); top: calc(4px + env(safe-area-inset-top)); padding: 4px 6px 4px 10px; }
  .tb-who { font-size: 13px; }
  .player-panel { top: calc(52px + env(safe-area-inset-top)); left: 6px; right: 86px; width: auto;
    flex-direction: row; flex-wrap: nowrap; overflow-x: auto; gap: 4px; scrollbar-width: none; }
  .player-panel::-webkit-scrollbar { display: none; }
  .pp-row { flex: 0 0 auto; padding: 3px 7px; font-size: 11px; max-width: 150px; }
  .pp-stats { font-size: 10px; }
  .funds-box { top: calc(52px + env(safe-area-inset-top)); right: 6px; padding: 5px 9px; flex-direction: column; gap: 0; align-items: flex-end; }
  .fb-label { display: none; }
  #fundsVal { font-size: 15px; }
  .spec-chip { top: auto; bottom: calc(96px + env(safe-area-inset-bottom)); }
  .info-panel { left: 6px; right: 6px; max-width: none; bottom: calc(84px + env(safe-area-inset-bottom)); padding: 6px 10px; }
  .ip-blurb { display: none; }
  #hud.acting .info-panel { display: none !important; }
  .action-menu { bottom: calc(84px + env(safe-area-inset-bottom)); width: calc(100vw - 12px); }
  .am-btn { flex: 1 1 28%; justify-content: center; padding: 10px 6px; }
  .am-btn .key { display: none; }
  .end-turn { right: 6px; bottom: calc(40px + env(safe-area-inset-bottom)); padding: 8px 14px; min-height: 40px; font-size: 14px; }
  /* stop short of End turn (it overlapped the skip-track button by 21x12 px at
     390 px); a narrower strip wraps upward, still below the info panel */
  #hudAudio { left: 6px; right: 98px; width: auto; max-width: none; transform: none;
    bottom: calc(4px + env(safe-area-inset-bottom)); }
  #hudAudio .audio-controls { justify-content: flex-start; }
  .audio-controls button { padding: 4px 7px; font-size: 11px; }
  .audio-controls input[type="range"] { width: 54px; }
}

/* ── tutorial: coach panel, focus rings, lesson card, tips ───────────────
   (web/tactics/js/tutorial.js; the board is laid out BELOW the coach, see
   hudInsets in tactics_client.js, so the coach never covers a target) */
.tut-coach {
  position: fixed; z-index: 4; top: 64px; left: 50%; transform: translateX(-50%);
  width: min(620px, calc(100vw - 12px));
  background: linear-gradient(180deg, rgba(34, 44, 70, .97), rgba(22, 29, 47, .97));
  border: 2px solid var(--brass); border-radius: 14px; padding: 8px 12px 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5); color: var(--ink);
}
@media (min-width: 1000px) { .tut-coach { width: min(620px, calc(100vw - 390px)); } }
.tut-coach.shake { animation: tcShake .4s; }
@keyframes tcShake { 20%, 60% { transform: translateX(calc(-50% - 6px)); } 40%, 80% { transform: translateX(calc(-50% + 6px)); } }
.tc-head { display: flex; align-items: center; gap: 6px; }
.tc-badge { font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: #1d1405; background: var(--brass); border-radius: 6px; padding: 2px 6px; white-space: nowrap; }
.tc-pick { flex: 1 1 auto; min-width: 0; font-size: 13px; padding: 3px 20px 3px 6px; font-weight: 700;
  -webkit-appearance: none; appearance: none; border-color: transparent; color: var(--brass-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0h10L5 6z' fill='%23ffd27a'/%3E%3C/svg%3E") no-repeat right 6px center; }
.tc-pick option { background: #0f1522; color: var(--ink); }
.tc-pick:hover, .tc-pick:focus { border-color: #34426a; background-color: #0f1522; }
.tc-tools { display: flex; gap: 3px; flex: 0 0 auto; }
.tc-tools button { width: 30px; height: 28px; border-radius: 8px; border: 1px solid var(--line);
  background: rgba(255,255,255,.07); color: var(--ink); cursor: pointer; font-size: 12px; padding: 0; }
.tc-tools button:hover:not(:disabled) { background: rgba(255,255,255,.16); }
.tc-say { font-size: 14px; line-height: 1.42; margin: 6px 0 4px; color: #e6ebf6; }
.tc-task { display: flex; gap: 8px; align-items: flex-start; background: rgba(232,176,74,.12);
  border: 1px solid rgba(232,176,74,.35); border-radius: 10px; padding: 5px 10px; margin-top: 4px; }
.tc-arrow { color: var(--brass-2); font-weight: 900; line-height: 1.35; animation: tcNudgeArrow 1s ease-in-out infinite; }
@keyframes tcNudgeArrow { 50% { transform: translateX(3px); } }
.tc-do { font-weight: 800; color: var(--brass-2); font-size: 14px; line-height: 1.35; }
.tc-hint { font-size: 13px; color: #d6deef; line-height: 1.35; }
.tc-nudge { margin-top: 5px; font-size: 13px; color: #ffb4a8; background: rgba(226,72,61,.16);
  border: 1px solid rgba(255,120,100,.4); border-radius: 8px; padding: 4px 8px; }
.tc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; min-height: 8px; }
.tc-dots { display: flex; gap: 4px; flex-wrap: wrap; }
.tc-dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.18); }
.tc-dot.on { background: var(--brass); }
.tc-dot.cur { background: #fff; box-shadow: 0 0 0 2px rgba(232,176,74,.6); }
.tc-next { background: linear-gradient(180deg, #f0b94f, #c98a1d); color: #1d1405; border: 1px solid #ffd27a;
  border-radius: 10px; padding: 8px 18px; font-weight: 800; cursor: pointer; font-size: 14px;
  animation: glow 1.4s ease-in-out infinite; }
.tut-coach.min .tc-say, .tut-coach.min .tc-foot { display: none; }

/* things that live at the top of the screen move below the coach */
body.tut-on .build-menu { top: calc(var(--tut-top, 120px) + 6px); transform: translateX(-50%);
  max-height: calc(100vh - var(--tut-top, 120px) - 64px); }
body.tut-on .toast { top: calc(var(--tut-top, 120px) + 6px); }
body.tut-on .game-menu { top: calc(var(--tut-top, 120px) + 6px); }

.tut-focus { position: fixed; inset: 0; pointer-events: none; z-index: 7; }
.tf-ring { position: fixed; display: none; border: 3px solid #ffe14d; border-radius: 12px;
  box-shadow: 0 0 0 3px rgba(0,0,0,.45), 0 0 18px rgba(255,225,77,.75);
  animation: tfPulse 1.1s ease-in-out infinite; }
.tf-ring.round { border-radius: 50%; }
.tf-ring.enemy { border-color: #ff7a5c; box-shadow: 0 0 0 3px rgba(0,0,0,.45), 0 0 16px rgba(255,110,80,.7); }
@keyframes tfPulse { 50% { transform: scale(1.08); } }
.tf-arrow { position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); margin-bottom: 2px;
  color: #ffe14d; font-size: 22px; line-height: 1; text-shadow: 0 2px 3px #000, 0 0 6px #000;
  animation: tfBob .8s ease-in-out infinite; }
.tf-arrow.below { bottom: auto; top: 100%; margin: 2px 0 0; animation-name: tfBobUp; }
.tf-ring.enemy .tf-arrow { display: none; }
.tf-arrow.side { bottom: auto; left: auto; right: 100%; top: 50%; transform: translateY(-50%);
  margin: 0 4px 0 0; animation-name: tfBobSide; }
@keyframes tfBobSide { 50% { transform: translate(-6px, -50%); } }
@keyframes tfBob { 50% { transform: translate(-50%, -6px); } }
@keyframes tfBobUp { 50% { transform: translate(-50%, 6px); } }

.tut-done { position: fixed; inset: 0; z-index: 12; display: flex; align-items: center; justify-content: center;
  background: rgba(8, 11, 20, .55); padding: 16px; }
.td-card { width: min(440px, 100%); background: var(--panel-solid); border: 2px solid var(--brass);
  border-radius: 18px; padding: 20px; text-align: center; box-shadow: 0 24px 70px rgba(0,0,0,.6); }
.td-kicker { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--brass); font-weight: 800; }
.td-title { font-size: 24px; font-weight: 900; margin: 6px 0 8px; }
.td-text { color: #c9d2e6; line-height: 1.5; margin: 0 0 14px; }
.td-btns { display: flex; flex-direction: column; gap: 8px; }
.td-btns button.secondary { margin-bottom: 0; }

.tut-tip { position: fixed; z-index: 8; left: 50%; transform: translateX(-50%);
  bottom: calc(112px + env(safe-area-inset-bottom)); width: min(460px, calc(100vw - 16px));
  display: flex; gap: 10px; align-items: center; background: #23304f; border: 1px solid var(--brass);
  border-radius: 12px; padding: 9px 12px; box-shadow: 0 10px 28px rgba(0,0,0,.5); font-size: 13px; line-height: 1.4; }
.tt-icon { font-size: 18px; }
.tt-text { flex: 1; }
.tut-tip { pointer-events: none; }
.tut-tip.top { bottom: auto; top: calc(110px + env(safe-area-inset-top)); }
.tt-ok { color: var(--muted); font-size: 11px; white-space: nowrap; align-self: flex-end; }

/* join pane / lobby entry points */
.tut-offer { background: linear-gradient(180deg, rgba(232,176,74,.2), rgba(232,176,74,.08));
  border: 2px solid var(--brass); border-radius: 14px; padding: 12px; margin-bottom: 12px; }
.to-title { font-weight: 900; font-size: 17px; color: var(--brass-2); }
.to-text { color: #d5dcec; font-size: 13px; line-height: 1.45; margin: 4px 0 10px; }
.tut-offer .link-btn { margin-top: 4px; color: var(--muted); font-weight: 600; font-size: 13px; }
button.secondary.tut-btn { border-color: rgba(232,176,74,.6); color: var(--brass-2); }

/* the "?" button and the range legend */
.help-btn { font-weight: 900; color: var(--brass-2); }
.range-legend { position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(112px + env(safe-area-inset-bottom)); display: flex; gap: 12px;
  background: rgba(10,14,24,.82); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px;
  font-size: 12px; color: #d6deef; }
#hud > .range-legend { pointer-events: none; }
.range-legend span { display: flex; align-items: center; gap: 5px; }
.range-legend i { width: 13px; height: 13px; border-radius: 3px; display: inline-block; }
.range-legend .lg-move { background: rgba(60,130,255,.75); border: 1px solid rgba(210,235,255,.8); }
.range-legend .lg-atk { background: rgba(240,60,50,.6); border: 1px solid rgba(255,170,160,.6); }
.range-legend.enemy .lg-move { background: rgba(255,170,60,.6); border-color: rgba(255,200,120,.7); }
.ip-role { font-size: 11px; color: #ffd98a; }
.ip-legend { display: inline-flex; align-items: center; gap: 4px; margin-right: 10px; color: #d6deef; }
.ip-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.ip-legend .lg-move { background: rgba(60,130,255,.75); border: 1px solid rgba(210,235,255,.8); }
.ip-legend .lg-atk { background: rgba(240,60,50,.6); border: 1px solid rgba(255,170,160,.6); }
/* wide screens: the legend stacks in the right-hand column above End turn,
   off the board; mid widths tuck it under the funds box */
@media (min-width: 1000px) {
  .range-legend { left: auto; right: 8px; transform: none; width: 124px; flex-direction: column; gap: 4px;
    border-radius: 10px; bottom: calc(108px + env(safe-area-inset-bottom)); padding: 6px 10px; }
}
@media (min-width: 721px) and (max-width: 999px) {
  .range-legend { left: auto; right: 10px; transform: none; top: 56px; bottom: auto; }
}

/* rules reference overlay */
.help-overlay { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center;
  background: rgba(8,11,20,.7); padding: 12px; }
.help-card { width: min(720px, 100%); max-height: calc(100vh - 24px); display: flex; flex-direction: column;
  background: var(--panel-solid); border: 1px solid rgba(232,176,74,.5); border-radius: 16px; overflow: hidden;
  box-shadow: 0 24px 70px rgba(0,0,0,.6); text-align: left; }
.help-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px;
  font-weight: 900; letter-spacing: .06em; color: var(--brass-2); border-bottom: 1px solid var(--line); }
.help-tabs { display: flex; gap: 4px; padding: 8px 10px 0; flex-wrap: wrap; }
.help-tabs button { background: #222c45; color: var(--muted); border: 1px solid #34426a; border-radius: 9px 9px 0 0;
  padding: 7px 12px; cursor: pointer; font-weight: 700; font-size: 13px; }
.help-tabs button.on { background: #2c3858; color: var(--ink); border-color: var(--brass); }
.help-body { overflow-y: auto; padding: 12px; border-top: 1px solid var(--line); }
.help-foot { border-top: 1px solid var(--line); padding: 4px 10px; text-align: center; }
.hu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.hu-card { display: flex; gap: 10px; align-items: flex-start; background: #1d263c; border: 1px solid #2f3b5c;
  border-radius: 12px; padding: 8px 10px; }
.hu-col { min-width: 0; flex: 1; font-size: 12px; line-height: 1.45; }
.hu-name { font-weight: 800; font-size: 14px; display: flex; gap: 10px; justify-content: space-between; }
.hu-cost { color: var(--brass-2); font-variant-numeric: tabular-nums; }
.hu-stats { color: var(--muted); }
.hu-vs .good { color: #8fe0a6; font-weight: 700; }
.hu-vs .bad { color: #ff9c8c; font-weight: 700; }
.hu-note { color: #c3cbe0; }
.ht-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ht-table th { font-size: 11px; color: var(--muted); font-weight: 700; text-align: center; padding: 4px; }
.ht-table th:nth-child(2) { text-align: left; }
.ht-table td { padding: 3px 4px; border-top: 1px solid var(--line); text-align: center; }
.ht-table td:nth-child(2) { text-align: left; }
.ht-table td.stars { color: var(--brass-2); letter-spacing: -1px; white-space: nowrap; }
.ht-table td.no { color: #ff8f80; }
.ht-swatch { display: block; border-radius: 6px; }
.ht-sub { font-size: 10px; color: var(--muted); }
.ht-table tr.ht-cap th { font-size: 10px; font-weight: 600; padding-top: 0; color: #7f8aa3; letter-spacing: .06em; }
.ht-table thead th { vertical-align: bottom; line-height: 1.2; }
.help-note { font-size: 12px; color: var(--muted); line-height: 1.5; }
.help-body h4 { margin: 10px 0 4px; color: var(--brass); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; }
.help-list { margin: 0; padding-left: 20px; font-size: 13px; line-height: 1.55; color: #d6deef; }
.legend-list { list-style: none; padding: 0; margin: 0; font-size: 13px; line-height: 1.5; color: #d6deef; }
.legend-list li { display: flex; gap: 10px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--line); }
.lg { width: 26px; height: 26px; border-radius: 5px; flex: 0 0 auto; display: inline-flex; align-items: center;
  justify-content: center; font-size: 11px; font-weight: 800; background: #4c7a3a; }
.lg-move { background: linear-gradient(rgba(60,130,255,.55), rgba(60,130,255,.55)), #4c7a3a; border: 1px solid rgba(210,235,255,.7); }
.lg-atk { background: linear-gradient(rgba(240,60,50,.5), rgba(240,60,50,.5)), #4c7a3a; }
.lg-ring { background: #4c7a3a; box-shadow: inset 0 0 0 3px rgba(255,80,60,.9); border-radius: 50%; }
.lg-enemy { background: linear-gradient(rgba(255,170,60,.35), rgba(255,170,60,.35)), #4c7a3a; }
.lg-flag { background: rgba(15,18,28,.9); color: #ffe28a; }
.lg-hp { background: #111; color: #fff; border-radius: 50%; }
.lg-done { background: #6d7280; }

@media (max-width: 720px) {
  .tut-coach { padding: 6px 9px; border-radius: 12px; }
  .tc-say { font-size: 13px; line-height: 1.35; margin: 4px 0 3px; }
  .tc-do { font-size: 13px; }
  .tc-hint { font-size: 12px; }
  .tc-tools button { width: 27px; height: 26px; }
  .tc-next { padding: 6px 14px; }
  .range-legend { bottom: calc(132px + env(safe-area-inset-bottom)); font-size: 11px; }
  #rangeLegend { display: none !important; }      /* inline in the info panel instead */
  .ip-role { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: calc(100vw - 90px); }
  .tut-tip { bottom: calc(184px + env(safe-area-inset-bottom)); }
  .tut-tip.top { top: calc(100px + env(safe-area-inset-top)); }
  .hu-grid { grid-template-columns: 1fr; }
  .help-tabs button { padding: 6px 9px; font-size: 12px; }
}
