/* ============================================================
   FieldOp — UI layer (Oct 2026)
   Loaded after style.css. Same green "tactical terminal" look,
   tidied: a title screen, mode and setup menus that read well,
   and a screen laid out for what the player is doing
   (body.fo-phase-setup / -placement / -playing, set by
   src/titlescreen.js). Phone rules live in style.css's
   body.fieldop-mobile layer; the few here are marked.
   ============================================================ */

:root {
  --fo-g: #5cffa3;
  --fo-g-dim: #2a7a55;
  --fo-ink: #d6f5e3;
  --fo-ink-2: #9cc9b0;
  --fo-ink-3: #6d9a82;
  --fo-panel: rgba(4, 16, 11, 0.94);
  --fo-line: rgba(92, 255, 163, 0.22);
  --fo-line-2: rgba(92, 255, 163, 0.45);
  --fo-head: "Share Tech Mono", "JetBrains Mono", "Consolas", monospace;
  --fo-bar: 34px;
}

/* ══════════════════════════════════════════════════════════════
   TITLE SCREEN
   ══════════════════════════════════════════════════════════════ */
#title-screen {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px clamp(24px, 7vw, 120px);
  background:
    radial-gradient(ellipse at 72% 50%, rgba(2, 6, 12, 0) 0%, rgba(2, 6, 12, 0.35) 55%, rgba(2, 6, 12, 0.85) 100%),
    linear-gradient(90deg, rgba(2, 9, 6, 0.95) 0%, rgba(2, 9, 6, 0.78) 38%, rgba(2, 9, 6, 0.2) 75%, rgba(2, 9, 6, 0.05) 100%);
  font-family: var(--fo-head);
  color: var(--fo-ink);
  overflow-y: auto;
}
#title-screen::after {               /* CRT scanlines over the whole title */
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, transparent 0 2px, rgba(0, 0, 0, 0.16) 3px);
}
.ts-col { position: relative; z-index: 1; max-width: 560px; display: flex; flex-direction: column; gap: 14px; }
.ts-mark svg { width: 64px; height: 64px; fill: none; stroke: var(--fo-g); stroke-width: 1.6; opacity: 0.9; filter: drop-shadow(0 0 8px rgba(92, 255, 163, 0.5)); }
.ts-mark .ts-dot { fill: var(--fo-g); }
.ts-mark .ts-sweep { stroke-width: 2.4; transform-origin: 32px 32px; animation: ts-sweep 3.2s linear infinite; }
@keyframes ts-sweep { to { transform: rotate(360deg); } }
.ts-name {
  margin: 4px 0 0;
  font: 400 clamp(60px, 9vw, 124px)/0.9 var(--fo-head);
  letter-spacing: 0.06em;
  color: #effff6;
  text-shadow: 0 0 34px rgba(92, 255, 163, 0.35), 0 4px 30px rgba(0, 0, 0, 0.6);
}
.ts-name b { font-weight: 400; color: var(--fo-g); }
.ts-tag { font-size: 14px; letter-spacing: 0.32em; text-transform: uppercase; color: var(--fo-ink-2); }
.ts-tag::after { content: ""; display: block; width: 300px; max-width: 100%; height: 6px; margin-top: 12px; border-top: 2px solid var(--fo-g); border-bottom: 2px solid var(--fo-g-dim); }
.ts-about { margin: 6px 0 4px; font: 400 14px/1.65 "JetBrains Mono", "Consolas", monospace; letter-spacing: 0.01em; color: var(--fo-ink-2); text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8); }
.ts-menu { display: flex; flex-direction: column; gap: 10px; width: min(400px, 100%); margin-top: 6px; }
.ts-btn {
  display: block;
  text-align: left;
  font: 400 17px/1.2 var(--fo-head);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fo-ink);
  background: rgba(3, 17, 10, 0.78);
  border: 1px solid var(--fo-line);
  border-radius: 4px;
  padding: 13px 18px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.ts-btn small { display: block; margin-top: 4px; font: 400 12px/1.3 "JetBrains Mono", "Consolas", monospace; letter-spacing: 0.02em; text-transform: none; color: var(--fo-ink-3); }
.ts-btn:hover, .ts-btn:focus-visible { outline: none; transform: translateX(6px); border-color: var(--fo-line-2); background: rgba(10, 40, 24, 0.9); }
.ts-btn.ts-go { color: #04130b; background: var(--fo-g); border-color: var(--fo-g); box-shadow: 0 0 28px rgba(92, 255, 163, 0.28); }
.ts-btn.ts-go small { color: rgba(4, 19, 11, 0.72); }
.ts-btn.ts-go:hover, .ts-btn.ts-go:focus-visible { background: #7dffb9; }
.ts-foot { position: absolute; right: 22px; bottom: 16px; z-index: 1; font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--fo-ink-3); }

/* The world fills the window behind the title: no sidebar, no command bar,
   and no mode cards until New game. */
body.fo-title #mode-overlay,
body.fo-title #setup-overlay { display: none !important; }
body.fo-title #app { grid-template-rows: 1fr 0 !important; grid-template-columns: 1fr 0 !important; }
body.fo-title #cmd-bar,
body.fo-title #right-sidebar,
body.fo-title .mob-topbar,
body.fo-title .mob-map-controls,
body.fo-title #fo-prompt { display: none !important; }

@media (max-width: 720px) {
  #title-screen { justify-content: flex-end; padding: 28px 20px calc(28px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(0deg, rgba(2, 9, 6, 0.97) 0%, rgba(2, 9, 6, 0.85) 55%, rgba(2, 9, 6, 0.35) 100%); }
  .ts-mark svg { width: 48px; height: 48px; }
  .ts-tag { font-size: 12px; letter-spacing: 0.24em; }
  .ts-about { font-size: 13px; }
  .ts-btn { font-size: 16px; padding: 13px 16px; }
  .ts-btn:hover { transform: none; }
  .ts-foot { position: static; margin-top: 18px; text-align: center; }
}
@media (prefers-reduced-motion: reduce) { .ts-mark .ts-sweep { animation: none; } .ts-btn:hover { transform: none; } }

/* ══════════════════════════════════════════════════════════════
   NEW GAME: the mode cards
   ══════════════════════════════════════════════════════════════ */
#mode-overlay { background: rgba(2, 8, 12, 0.82); font-family: var(--fo-head); overflow-y: auto; padding: 24px 0; }
.mode-modal { max-width: 980px; gap: 18px; position: relative; padding-top: 6px; }
.mode-back {
  align-self: flex-start;
  font: 400 13px var(--fo-head); letter-spacing: 0.18em; color: var(--fo-ink-2);
  background: transparent; border: 1px solid var(--fo-line); border-radius: 3px; padding: 8px 14px; cursor: pointer;
}
.mode-back:hover, .mode-back:focus-visible { outline: none; color: var(--fo-g); border-color: var(--fo-line-2); }
.mode-modal-title { font-size: 28px; letter-spacing: 0.24em; }
.mode-modal-sub { font-size: 13px; letter-spacing: 0.3em; }
.mode-modal-cards { counter-reset: fomode; gap: 16px; }
.mode-card { padding: 22px 20px 24px; gap: 12px; border-color: var(--fo-line); background: rgba(3, 17, 10, 0.86); counter-increment: fomode; }
.mode-card::before { content: "0" counter(fomode); font-size: 12px; letter-spacing: 0.3em; color: var(--fo-ink-3); }
.mode-card-icon { display: none; }                  /* emoji clashed with the terminal look */
.mode-card-name { font-size: 18px; letter-spacing: 0.16em; line-height: 1.25; }
.mode-card-desc { font: 400 13px/1.65 "JetBrains Mono", "Consolas", monospace; letter-spacing: 0; color: var(--fo-ink-2); }
.mode-card:hover, .mode-card:focus-visible { outline: none; border-color: var(--fo-line-2); background: rgba(10, 40, 24, 0.92); }
/* Load and Cloud saves live on the title screen now; Continue replaces the old banner */
#mode-btn-load, #mode-btn-cloud, #mode-overlay .resume-banner { display: none !important; }

/* ══════════════════════════════════════════════════════════════
   GAME SETUP MODAL
   ══════════════════════════════════════════════════════════════ */
#setup-overlay { background: rgba(2, 8, 12, 0.78); }
.setup-modal { max-width: 600px; padding: 30px 32px; background: var(--fo-panel); border-color: var(--fo-line-2); }
.setup-modal-title { font-size: 24px !important; letter-spacing: 0.2em !important; }
.setup-modal-sub { font-size: 12px !important; letter-spacing: 0.28em !important; }
.setup-section-label { font-size: 12px !important; letter-spacing: 0.22em !important; color: var(--fo-ink-2) !important; }
.setup-section-hint { font: 400 12px/1.6 "JetBrains Mono", "Consolas", monospace !important; letter-spacing: 0 !important; color: var(--fo-ink-3) !important; }
.setup-count-btn { font-size: 13px !important; min-height: 40px; }
.setup-pers-row { padding: 10px 12px !important; }
.setup-pers-name { font-size: 13px !important; }
.setup-pers-select {
  font: 400 13px var(--fo-head) !important; letter-spacing: 0.08em; color: var(--fo-ink) !important;
  background: #03110a !important; border: 1px solid var(--fo-line-2) !important; border-radius: 3px; padding: 7px 10px !important; min-width: 170px;
}
.setup-btn { font-size: 14px !important; padding: 11px 22px !important; min-height: 42px; }

/* ══════════════════════════════════════════════════════════════
   REGIONAL / MULTI-BLOC: country assignment panel, docked right
   (it used to float over the top of the map, on top of the very
   countries you were trying to click)
   ══════════════════════════════════════════════════════════════ */
body.fo-assign:not(.fieldop-mobile) .setup-select-panel {
  top: 0; right: 0; left: auto; bottom: var(--fo-bar);
  transform: none;
  width: 300px;
  border-radius: 0;
  border-width: 0 0 0 1px;
  align-items: stretch;
  justify-content: flex-start;
  gap: 14px;
  padding: 20px 18px;
  overflow-y: auto;
  box-shadow: none;
}
body.fo-assign:not(.fieldop-mobile) .ssp-title { font-size: 17px; }
body.fo-assign:not(.fieldop-mobile) .ssp-instr { text-align: left; }
body.fo-assign:not(.fieldop-mobile) .ssp-palette { flex-direction: column; flex-wrap: nowrap; }
body.fo-assign:not(.fieldop-mobile) .ssp-chip { justify-content: flex-start; padding: 11px 14px; opacity: 0.75; }
body.fo-assign:not(.fieldop-mobile) .ssp-chip-count { margin-left: auto; }
body.fo-assign:not(.fieldop-mobile) .ssp-begin { margin-top: auto; padding: 13px 18px; font-size: 14px; }
.ssp-instr { font: 400 12.5px/1.6 "JetBrains Mono", "Consolas", monospace !important; letter-spacing: 0 !important; }
.ssp-chip { font-size: 13px !important; }
.ssp-chip-count { font-size: 12px !important; }
/* Phones: a compact sheet along the bottom instead of over the map's top */
body.fieldop-mobile.fo-assign .setup-select-panel {
  top: auto; bottom: calc(var(--mob-bar-h, 58px) + env(safe-area-inset-bottom, 0px) + 8px);
  width: calc(100vw - 16px); gap: 8px; padding: 10px 12px;
}
body.fieldop-mobile.fo-assign .ssp-title { display: none; }

/* ══════════════════════════════════════════════════════════════
   THE PROMPT: what to do next, at the top of the map
   (setup and placement; mirrors the status line)
   ══════════════════════════════════════════════════════════════ */
#fo-prompt {
  position: absolute;
  top: 14px; left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  max-width: min(760px, calc(100% - 32px));
  padding: 9px 18px;
  font: 400 13px/1.4 var(--fo-head);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-align: center;
  color: var(--fo-g);
  background: rgba(3, 14, 9, 0.9);
  border: 1px solid var(--fo-line-2);
  border-radius: 4px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  display: none;
}
#fo-prompt.on { display: block; }
body.fieldop-mobile #fo-prompt { top: calc(var(--mob-top-h, 34px) + env(safe-area-inset-top, 0px) + 8px); font-size: 11.5px; letter-spacing: 0.1em; padding: 7px 12px; }

/* ══════════════════════════════════════════════════════════════
   DESKTOP LAYOUT BY PHASE
   ══════════════════════════════════════════════════════════════ */
body:not(.fieldop-mobile) #app { transition: none; }

/* Setup (picking territories): the map gets the screen; the command bar is
   just its top strip; the empty sidebar column goes away. */
body.fo-phase-setup:not(.fieldop-mobile) #app { grid-template-columns: 1fr 0; grid-template-rows: 1fr var(--fo-bar); }
body.fo-phase-setup.fo-assign:not(.fieldop-mobile) #app { grid-template-columns: 1fr 300px; }
body.fo-phase-setup:not(.fieldop-mobile) #right-sidebar { display: none; }
/* Placement: the deploy panel in the sidebar, a slim bottom strip */
body.fo-phase-placement:not(.fieldop-mobile) #app { grid-template-columns: 1fr 300px; grid-template-rows: 1fr var(--fo-bar); }
body.fo-phase-setup:not(.fieldop-mobile) #cmd-bar,
body.fo-phase-placement:not(.fieldop-mobile) #cmd-bar { grid-template-rows: var(--fo-bar) 0; }
body.fo-phase-setup:not(.fieldop-mobile) .cmd-main,
body.fo-phase-placement:not(.fieldop-mobile) .cmd-main { display: none; }
/* Playing */
body.fo-phase-playing:not(.fieldop-mobile) #app { grid-template-columns: 1fr 300px; grid-template-rows: 1fr 230px; }
body.fo-phase-playing:not(.fieldop-mobile) #cmd-bar { grid-template-rows: var(--fo-bar) 1fr; }

/* ── The top strip of the command bar ── */
body:not(.fieldop-mobile) #cmd-bar { font-size: 12px; }
body:not(.fieldop-mobile) .cmd-state { gap: 16px; padding: 0 16px; }
body:not(.fieldop-mobile) .cmd-state .hud-label:first-child { letter-spacing: 0.16em; }
body:not(.fieldop-mobile) .cmd-state button {
  font: 400 12px var(--fo-head) !important; letter-spacing: 0.12em !important; padding: 5px 13px !important; min-height: 26px;
}
body:not(.fieldop-mobile) #confirm-btn.playing { display: none; }   /* "GAME ON": a phone control, nothing to do on desktop */
@media (max-width: 1500px) {
  body:not(.fieldop-mobile) .cmd-state .hud-cluster:has(#cursor-coord) { display: none; }
}
@media (max-width: 1250px) {
  body:not(.fieldop-mobile) .cmd-state .hud-cluster:has(#city-hover),
  body:not(.fieldop-mobile) .cmd-state .hud-cluster:has(#opponent-territory) { display: none; }
}

/* ── The main row while playing: no dead space ── */
body:not(.fieldop-mobile) .cmd-actions:empty { display: none; }
body:not(.fieldop-mobile) #event-feed.event-feed--docked { flex: 1 1 260px; min-width: 220px; }
body:not(.fieldop-mobile) .cmd-detail { width: 300px; padding: 12px 16px; }
body:not(.fieldop-mobile) #status-text { font-size: 13px; line-height: 1.45; }
body:not(.fieldop-mobile) .cmd-hints { display: none; }            /* the controls are on the title / help, not taking a row */
/* Pause and speed are global controls: they live in the top strip now
   (moved there by titlescreen.js), which frees the economy panel. */
body:not(.fieldop-mobile) .cmd-state .cmd-speed { gap: 4px; }
body:not(.fieldop-mobile) .cmd-state .cmd-speed .hud-dim { display: none; }
body:not(.fieldop-mobile) .cmd-state .cmd-speed .hud-sep { display: none; }
body:not(.fieldop-mobile) .cmd-state .speed-btn,
body:not(.fieldop-mobile) .cmd-state .pause-btn { font: 400 12px var(--fo-head) !important; padding: 3px 9px !important; min-height: 24px; min-width: 32px; }
body:not(.fieldop-mobile) .cmd-meta { width: 520px; padding: 10px 16px; overflow: hidden; }
body:not(.fieldop-mobile) .econ-head { flex-wrap: nowrap; gap: 10px; font-size: 12px; overflow: hidden; letter-spacing: 0.02em; }
body:not(.fieldop-mobile) .econ-head .hud-dim { letter-spacing: 0.02em; }
body:not(.fieldop-mobile) .econ-line { font-size: 12px; line-height: 1.45; }

/* Sidebar tabs and roster read better a size up */
.gp-tab-btn { font-size: 11px !important; padding: 7px 4px !important; }
.gp-row { padding: 7px 10px; }

body:not(.fieldop-mobile) .cmd-zoom-row { display: none !important; }

/* ── Phones ── */
/* Load lives on the title screen; before there are forces, "Forces" has nothing to open */
body.fieldop-mobile #load-setup-btn { display: none !important; }
body.fieldop-mobile.fo-phase-setup .mob-sidebar-btn { display: none !important; }
body.fieldop-mobile.fo-phase-setup #confirm-btn { flex: 1 1 auto; max-width: none; }
body.fieldop-mobile .setup-modal { padding: 22px 18px; width: calc(100vw - 24px); }
body.fieldop-mobile .setup-pers-row { gap: 8px; }
body.fieldop-mobile .setup-pers-select { min-width: 0; flex: 1 1 auto; max-width: 52%; }
