/* Highground Tactics: the battle HUD and the game's own dialog contents. Menus, dialogs, splash and loading are the
   Game Shell (css/shell.css), skinned by data/theme.json. Colours here follow the same theme (navy + gold). */
:root {
  --ink: #2a2110;          /* text on gold */
  --panel: rgba(24, 26, 39, .92);
  --panel-line: rgba(245, 198, 79, .28);
  --paper: #e3e2ea;        /* text on dark */
  --muted: #a2a3b6;
  --btn: #2a2d44;          /* HUD buttons */
  --accent: #f5c64f;       /* selected / primary */
  --blue: #4f8ff0;
  --red: #ef5f55;
  --good: #6fdc84;
  --bad: #ff7a66;
  --radius: 12px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #14151f; color: var(--paper);
  font: 15px/1.35 'Alegreya Sans', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
#game { position: fixed; inset: 0; touch-action: none; }
#game canvas { display: block; touch-action: none; }
[hidden] { display: none !important; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
svg .f { fill: currentColor; stroke: none; }

/* ---------- HUD (scales with Settings > Text size) ---------- */
#hud { zoom: var(--gs-text, 1); }
#hud button:not(.gs-icon) { font: inherit; color: var(--paper); background: var(--btn); border: 1px solid var(--panel-line); border-radius: 10px; padding: 6px 12px; cursor: pointer; }
#hud button:disabled { opacity: .45; cursor: default; }

/* top bar */
#top { position: fixed; left: 8px; right: 8px; top: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; pointer-events: none; z-index: 5; }
#top > * { pointer-events: auto; }
#btn-menu { width: 46px; height: 46px; }
#lvl-name, #goal, #round { background: var(--panel); border: 1px solid var(--panel-line); padding: 8px 12px; border-radius: var(--radius); font-weight: 700; white-space: nowrap; }
#lvl-name { font-family: 'Cinzel', Georgia, serif; letter-spacing: .5px; }
#goal { color: var(--accent); display: inline-flex; align-items: center; gap: 6px; }
#goal svg { width: 18px; height: 18px; }
#round { font-variant-numeric: tabular-nums; color: var(--muted); }
.grow { flex: 1; pointer-events: none !important; }
#hud .chip-btn { background: var(--panel); padding: 8px 12px; border-radius: var(--radius); font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.chip-btn svg { width: 14px; height: 14px; }
#hud .chip-btn.on { background: var(--accent); color: var(--ink); border-color: var(--accent); }

/* turn order */
#order { position: fixed; left: 50%; top: 62px; transform: translateX(-50%); display: flex; align-items: center; gap: 5px; z-index: 5; max-width: calc(100vw - 16px); overflow-x: auto; padding: 4px 6px; background: rgba(24, 26, 39, .7); border: 1px solid var(--panel-line); border-radius: 30px; }
#hud .tok { position: relative; width: 36px; height: 36px; flex: 0 0 auto; padding: 0; border-radius: 50%; background: #2c2e45; border: 3px solid var(--blue); display: grid; place-items: center; overflow: hidden; }
#hud .tok.enemy { border-color: var(--red); }
#hud .tok.boss { border-color: #ffcf3a; box-shadow: 0 0 0 2px var(--red); }
#hud .tok.vip { border-color: #ffd34a; }
.tok img { width: 24px; height: 24px; }
.tok i { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--good); }
.tok.enemy i { background: var(--bad); }
#hud .tok.now { width: 46px; height: 46px; box-shadow: 0 0 0 3px var(--accent); }
.tok.now img { width: 30px; height: 30px; }
.tok.later { opacity: .55; }
#order .rd { font: 800 15px 'Cinzel', Georgia, serif; color: var(--accent); padding: 0 4px 0 2px; font-variant-numeric: tabular-nums; }
#order .next { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; padding: 0 2px; }

/* unit card, tile info, hint */
#unit { position: fixed; left: 8px; bottom: calc(8px + var(--safe-b)); width: 250px; background: var(--panel); border: 1px solid var(--panel-line); border-radius: 14px; padding: 9px 11px; z-index: 6; border-left: 5px solid var(--blue); }
#unit.enemy { border-left-color: var(--red); }
.uh { display: flex; gap: 8px; align-items: center; }
.uh img { width: 36px; height: 36px; }
.uh b { font-size: 16px; } .uh svg { width: 15px; height: 15px; color: #ffcf3a; }
.uh small { display: block; color: var(--muted); }
.hp { position: relative; height: 16px; background: rgba(255,255,255,.12); border-radius: 6px; overflow: hidden; margin: 7px 0 5px; }
.hp i { position: absolute; inset: 0 auto 0 0; background: var(--good); }
#unit.enemy .hp i { background: var(--bad); }
.hp span { position: relative; display: block; text-align: center; font-size: 11px; font-weight: 700; line-height: 16px; text-shadow: 0 1px 2px #000; }
.stats { display: flex; flex-wrap: wrap; gap: 3px 9px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chip { display: inline-flex; align-items: center; gap: 2px; background: rgba(255,255,255,.1); border-radius: 8px; padding: 1px 7px 1px 2px; font-size: 12px; font-weight: 700; }
.chip img { width: 20px; height: 20px; }
#tile { position: fixed; right: 8px; bottom: calc(8px + var(--safe-b)); background: var(--panel); border: 1px solid var(--panel-line); padding: 6px 10px; border-radius: 10px; color: var(--muted); font-size: 13px; z-index: 4; pointer-events: none; text-transform: capitalize; }
#hint { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + var(--safe-b)); background: var(--panel); border: 1px solid var(--panel-line); padding: 6px 12px; border-radius: 10px; max-width: min(640px, calc(100vw - 32px)); color: var(--paper); font-size: 14px; text-align: center; z-index: 4; pointer-events: none; }

/* skill bar */
#actions { position: fixed; left: 50%; bottom: calc(8px + var(--safe-b)); transform: translateX(-50%); display: flex; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--panel-line); padding: 6px; border-radius: 16px; z-index: 5; max-width: calc(100vw - 16px); }
#skills { display: flex; gap: 6px; }
#hud .skill, #hud .act { position: relative; width: 66px; height: 70px; padding: 3px 2px 2px; display: grid; grid-template-rows: 1fr auto; place-items: center; background: linear-gradient(#33375a, #23253a); border-color: rgba(245, 198, 79, .45); }
.skill img { width: 38px; height: 38px; pointer-events: none; }
.skill small, .act small { font-weight: 700; font-size: 11.5px; white-space: nowrap; overflow: hidden; max-width: 62px; text-overflow: ellipsis; }
#hud .skill.on { background: var(--accent); color: var(--ink); box-shadow: 0 0 12px rgba(245,198,79,.6); }
.skill.off { opacity: .45; }
.skill .cd, .skill .key { position: absolute; top: 2px; right: 3px; font-size: 10px; min-width: 16px; height: 16px; line-height: 16px; border-radius: 8px; text-align: center; }
.skill .cd { background: #0d0e16; color: var(--accent); }
.skill .key { color: rgba(255,255,255,.4); }
.act svg { width: 28px; height: 28px; }
#hud .act.primary { background: linear-gradient(#ffd96b, #e2a92d); color: var(--ink); border-color: #fff1b8; }
.sep { width: 2px; align-self: stretch; background: rgba(245,198,79,.2); }

/* round banner */
#banner { position: fixed; left: 50%; top: 32%; transform: translate(-50%, -50%); font: 800 46px 'Cinzel', Georgia, serif; letter-spacing: 3px; color: var(--accent); text-shadow: 0 4px 0 #0d0e16, 0 0 20px rgba(0,0,0,.6); z-index: 7; pointer-events: none; animation: ban 1.3s ease forwards; white-space: nowrap; }
#banner.bad { color: var(--bad); }
@keyframes ban { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); } 25% { transform: translate(-50%, -50%) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- shell tweaks for this theme (game CSS may restyle shell parts; the shell itself is not edited) ---------- */
.gs-banner { aspect-ratio: 1029 / 240; width: min(440px, 90%); padding-top: 0; transform: translate(-50%, -54%); }
.gs-stars i, .gs-res-stars i { clip-path: none; background: url(../assets/ui/star_off.png) center / contain no-repeat; }
.gs-stars i.on, .gs-res-stars i.on { background: url(../assets/ui/star.png) center / contain no-repeat; }
.gs-stars i { width: 20px; height: 20px; }
.gs-res-stars i { width: 58px; height: 58px; }
.gs-res-stars i:nth-child(2) { width: 70px; height: 70px; margin-top: -8px; }
.gs-lock, .gs-lock::before { all: unset; }
.gs-lock { position: absolute; left: 50%; top: 8px; width: 28px; height: 34px; margin-left: -14px; background: url(../assets/ui/padlock.png) center / contain no-repeat; }
.gs-level { background: linear-gradient(#262941, #1b1d2c); border-color: #3a3e5a; }
.gs-level.gs-done { border-color: #6b5a2a; }
.gs-level .gs-stars { margin-top: auto; }
.gs-level-sub { color: var(--accent); }

/* ---------- dialog contents ---------- */
.star { display: inline-block; width: 18px; height: 18px; vertical-align: -3px; background: url(../assets/ui/star.png) center / contain no-repeat; }
.star.off { background-image: url(../assets/ui/star_off.png); }
.acc { color: var(--accent); }
.gs-p.small { font-size: 13px; }
.center { text-align: center; }
.camp-big { font: 800 30px 'Cinzel', Georgia, serif; color: #fff; }
.camp-big .star { width: 28px; height: 28px; vertical-align: -4px; }
.camp-big small { font: 400 15px 'Alegreya Sans', sans-serif; color: var(--muted); }
.camp-bar { height: 8px; border-radius: 4px; background: #2a2d40; margin: 8px 0 10px; overflow: hidden; }
.camp-bar i { display: block; height: 100%; background: linear-gradient(90deg, #d9a52d, var(--accent)); }
.lv-total { font-weight: 700; color: var(--paper); }
.goalbox { background: rgba(245,198,79,.12); border: 1px solid rgba(245,198,79,.35); color: var(--accent); border-radius: 10px; padding: 7px 10px; font-weight: 700; margin: 8px 0; }
.squad { display: flex; flex-wrap: wrap; gap: 6px; }
.sq { display: flex; align-items: center; gap: 4px; background: rgba(255,255,255,.06); border-radius: 10px; padding: 3px 9px 3px 3px; border-left: 4px solid var(--blue); font-size: 14px; }
.sq.enemy { border-left-color: var(--red); }
.sq.boss, .sq.vip { border-left-color: #ffcf3a; }
.sq img { width: 26px; height: 26px; }
.tips { margin: 10px 0 0; padding-left: 20px; color: var(--paper); }
.tips li { margin: 4px 0; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; margin: 6px 0 10px; color: var(--muted); font-size: 15px; }
.checks span { display: inline-flex; align-items: center; gap: 6px; }
.checks span.on { color: var(--paper); }
.brief-d .checks { justify-content: flex-start; }
table.keys { border-collapse: collapse; width: 100%; font-size: 15px; }
table.keys td { padding: 4px 6px; border-bottom: 1px solid #2c2f44; }
table.keys td:first-child { color: var(--accent); font-weight: 700; white-space: nowrap; width: 38%; }
.gs-pause-info em.g { color: var(--accent); font-style: normal; }

/* phones */
@media (max-width: 760px) {
  #lvl-name, #round { display: none; }
  #top { gap: 5px; flex-wrap: nowrap; }
  #btn-menu { width: 42px; height: 42px; }
  #goal { min-width: 0; overflow: hidden; } #goal span { overflow: hidden; text-overflow: ellipsis; }
  #goal, #round, #hud .chip-btn { padding: 6px 9px; font-size: 13px; }
  #order { top: 56px; }
  #hud .tok { width: 30px; height: 30px; } .tok img { width: 20px; height: 20px; }
  #hud .tok.now { width: 38px; height: 38px; } .tok.now img { width: 26px; height: 26px; }
  #actions { left: 8px; right: 8px; transform: none; max-width: none; justify-content: center; }
  #skills { gap: 4px; }
  #hud .skill, #hud .act { width: 56px; height: 62px; } .skill img { width: 32px; height: 32px; }
  .skill small, .act small { font-size: 10px; max-width: 54px; }
  #unit { bottom: calc(86px + var(--safe-b)); width: 210px; padding: 7px 9px; }
  #unit .stats { display: none; }
  #tile { display: none; }
  #hint { bottom: auto; top: 112px; font-size: 13px; }
  #banner { font-size: 34px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  #hud .skill, #hud .act { width: 52px; height: 54px; } .skill img { width: 28px; height: 28px; }
  #unit { bottom: calc(8px + var(--safe-b)); }
  #hint { display: none; }
}
