/* Sabre Nexus — shared styles. Dark, high contrast, big touch targets (field use in daylight + gloves). */
:root {
  --accent: #f28c28; --bg: #0d1012; --panel: #171b1f; --line: #2a3036; --text: #eef1f3; --muted: #9aa4ad;
  --info: #3b82f6; --urgent: #f59e0b; --critical: #ef4444; --ok: #22c55e;
  color-scheme: dark;
}
/* Player themes (branding.theme). Night = the defaults above. */
.th-jungle { --bg: #0a0f0a; --panel: #10160f; --line: #26321f; --text: #e7f0e2; --muted: #9fb39a; }
.th-desert { --bg: #14110c; --panel: #1e1a12; --line: #3a3122; --text: #f3ebdc; --muted: #b5a78c; }
.th-urban { --bg: #0f1114; --panel: #1a1d22; --line: #343a42; --text: #e9edf2; --muted: #a3abb6; }
.th-naval { --bg: #0a1018; --panel: #111a26; --line: #24344a; --text: #e6f0fa; --muted: #93a7bd; }
.th-redcell { --bg: #120a0a; --panel: #1c1111; --line: #3a2222; --text: #f5e9e9; --muted: #b89a9a; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
body { overscroll-behavior: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; cursor: pointer; }
button:disabled { opacity: .45; }
button.primary { background: var(--accent); border-color: var(--accent); color: #111; font-weight: 700; }
button.danger { background: #3a1214; border-color: var(--critical); color: #fecaca; }
button.on { background: color-mix(in srgb, var(--accent) 16%, var(--panel)); border-color: var(--accent); color: var(--accent); }
button.big { min-height: 56px; font-size: 18px; width: 100%; }
input, select, textarea { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; width: 100%; }
textarea { min-height: 90px; resize: vertical; }
label { display: block; color: var(--muted); font-size: 13px; margin: 10px 0 4px; }
h1, h2, h3 { margin: 0 0 8px; }
h2 { font-size: 18px; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.err { color: #fca5a5; }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; }
.row > .fit { flex: 0 0 auto; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.chips button { padding: 8px 12px; border-radius: 999px; }
.pre { white-space: pre-wrap; }
.doc-img { display: block; max-width: 100%; border-radius: 8px; margin-top: 8px; }
.dotc { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #555; vertical-align: middle; }
.dotc.on { background: var(--ok); }
.center { display: grid; place-items: center; height: 100%; text-align: center; padding: 24px; }

/* sign-in + gate */
.login { max-width: 360px; margin: 0 auto; padding: 12vh 24px 24px; text-align: center; }
.login input { font-size: 32px; text-align: center; letter-spacing: 10px; margin: 18px 0 12px; }
.login img { max-width: 120px; max-height: 120px; }
.brand { color: var(--accent); font-weight: 800; letter-spacing: .5px; }

/* player layout */
.app { position: fixed; inset: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 8px; padding: 6px 8px; padding-top: max(6px, env(safe-area-inset-top));
  background: var(--panel); border-bottom: 1px solid var(--line); }
.top .title { flex: 1; min-width: 0; }
.top .title b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .title small { color: var(--muted); }
.top .timer { font: 700 20px ui-monospace, monospace; }
.top button { padding: 8px 10px; min-width: 44px; min-height: 44px; }
.conn { width: 12px; height: 12px; border-radius: 50%; background: var(--critical); flex: 0 0 auto; }
.conn.online { background: var(--ok); }
.conn.connecting { background: var(--urgent); }
.banner { background: #3b2a0a; color: #fde68a; padding: 6px 10px; font-weight: 600; text-align: center; }
.banner.off { background: #3a1214; color: #fecaca; }
.mapwrap { position: relative; flex: 1; min-height: 0; }
.map { position: absolute; inset: 0; background: #111; }
.floors { position: absolute; z-index: 500; top: 8px; left: 8px; display: flex; flex-direction: column; gap: 6px; max-height: calc(100% - 16px); overflow: auto; }
.floors button { background: color-mix(in srgb, var(--panel) 92%, transparent); min-height: 44px; text-align: left; }
.floors button small { color: var(--accent); margin-left: 6px; }
.mapbtns { position: absolute; z-index: 500; right: 8px; bottom: 24px; display: flex; flex-direction: column; gap: 6px; }
.mapbtns button { width: 64px; min-height: 52px; padding: 4px 2px; background: color-mix(in srgb, var(--panel) 92%, transparent); line-height: 1.1; }
.mapbtns button.on { background: color-mix(in srgb, var(--accent) 22%, var(--panel)); }
.mapbtns i { display: block; font-style: normal; font-size: 20px; }
.mapbtns small { font-size: 11px; }
.mapbtns i.or { height: 24px; display: grid; place-items: center; }
.mapbtns i.portrait::before, .mapbtns i.landscape::before { content: ''; width: 11px; height: 18px; border: 2px solid currentColor; border-radius: 3px; }
.mapbtns i.landscape::before { width: 18px; height: 11px; }
.pick { position: absolute; z-index: 600; left: 8px; right: 8px; bottom: 8px; background: color-mix(in srgb, var(--panel) 96%, transparent);
  border: 2px solid var(--accent); border-radius: 12px; padding: 10px; display: flex; gap: 8px; align-items: center; }
.pick span { flex: 1; font-weight: 600; }
.bottom { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; padding: 6px;
  padding-bottom: max(6px, env(safe-area-inset-bottom)); background: var(--panel); border-top: 1px solid var(--line); }
.bottom button { min-height: 64px; font-size: 15px; font-weight: 700; position: relative; padding: 6px 4px; }
.bottom button i { display: block; font-style: normal; font-size: 22px; }
.badge { position: absolute; top: 4px; right: 6px; background: var(--critical); color: #fff; border-radius: 999px;
  font-size: 12px; padding: 1px 7px; }

/* map marks */
.mk { background: none; border: 0; }
.mk > div { transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; pointer-events: auto; }
.dot b { width: 22px; height: 22px; border-radius: 50%; background: var(--c); border: 2px solid #fff; display: grid;
  place-items: center; font-size: 11px; color: #000; box-shadow: 0 0 0 2px rgba(0,0,0,.5); }
.dot span, .mark span, .poi span { margin-top: 2px; font-size: 11px; font-weight: 700; white-space: nowrap; color: #fff;
  text-shadow: 0 0 3px #000, 0 0 3px #000; }
.dot.me b { width: 28px; height: 28px; border-width: 3px; box-shadow: 0 0 0 4px rgba(242,140,40,.6); }
.dot.enemy b { border-radius: 4px; transform: rotate(45deg); border-color: var(--critical); }
.dot.stale { opacity: .5; }
.dot.gm b { width: 16px; height: 16px; font-size: 9px; border-width: 1px; }
.mark i, .poi i { font-style: normal; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 6px;
  background: #111; border: 2px solid #fff; font-size: 16px; }
.mark.k-enemy i { border-color: var(--critical); color: var(--critical); }
.mark.k-objective i { border-color: var(--accent); color: var(--accent); }
.mark.k-hazard i { border-color: var(--urgent); color: var(--urgent); }
.mark.k-friendly i { border-color: var(--ok); color: var(--ok); }
.poi i { border-radius: 50%; border-color: #c084fc; color: #c084fc; }
.poi.hidden { opacity: .45; }
.pin i { font-style: normal; font-size: 34px; animation: pulse 1s infinite alternate; }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.3); } }
.zone-label { background: rgba(0,0,0,.5); border: 0; color: #fff; box-shadow: none; font-weight: 700; }

/* sheets */
.sheet-bg { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.5); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 640px; max-height: 88vh; display: flex; flex-direction: column; background: var(--panel);
  border-radius: 16px 16px 0 0; border: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.sheet.wide { max-width: 900px; }
.sheet header { display: flex; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.sheet header h2 { flex: 1; margin: 0; }
.sheet .x { min-width: 44px; min-height: 44px; }
.sheet-body { overflow: auto; padding: 12px 14px 18px; }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; overflow-x: auto; }
.tabs button { flex: 1 0 auto; }
.list > div { padding: 10px 0; border-bottom: 1px solid var(--line); }
.kinds { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin: 8px 0; }
.kinds button { min-height: 64px; font-weight: 700; }

/* alerts */
.al { border-left: 6px solid var(--info); padding: 8px 10px !important; }
.al.urgent { border-color: var(--urgent); }
.al.critical { border-color: var(--critical); }
.al.unread { background: color-mix(in srgb, var(--accent) 8%, var(--panel)); }
.al small { color: var(--muted); }
.card-bg { position: fixed; inset: 0; z-index: 3000; background: rgba(0,0,0,.85); display: grid; place-items: center; padding: 16px; }
.card { width: 100%; max-width: 520px; background: var(--panel); border: 3px solid var(--info); border-radius: 18px; padding: 18px;
  max-height: 100%; overflow: auto; }
.card.urgent { border-color: var(--urgent); }
.card.critical { border-color: var(--critical); animation: flash 1s infinite alternate; }
.card.from-commander { border-style: dashed; }
@keyframes flash { to { box-shadow: 0 0 40px var(--critical); } }
.card .from { font-weight: 800; letter-spacing: 1px; text-transform: uppercase; }
.card .prio { float: right; font-weight: 800; text-transform: uppercase; }
.card.info .prio { color: var(--info); } .card.urgent .prio { color: var(--urgent); } .card.critical .prio { color: var(--critical); }
.card .text { font-size: 24px; font-weight: 700; margin: 14px 0; white-space: pre-wrap; }
.card video { width: 100%; border-radius: 10px; background: #000; margin-bottom: 10px; }
.card button { margin-top: 8px; }

/* lock */
.lock { position: fixed; inset: 0; z-index: 2500; display: flex; align-items: flex-end; justify-content: center; text-align: center;
  padding-bottom: calc(88px + env(safe-area-inset-bottom)); touch-action: none; user-select: none; -webkit-user-select: none; }
.lock .hold { width: 104px; height: 104px; border-radius: 50%; border: 3px solid var(--accent); display: grid; place-items: center;
  font: 700 13px/1.2 system-ui, sans-serif; box-shadow: 0 2px 12px rgba(0,0,0,.6);
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), rgba(13,16,18,.85) 0); }
.lock .hold span { background: rgba(13,16,18,.92); width: 88px; height: 88px; border-radius: 50%; display: grid; place-content: center; }
.lock .hold i { font-style: normal; font-size: 22px; }
.toast { position: fixed; z-index: 4000; left: 50%; bottom: 96px; transform: translateX(-50%); background: #000; border: 1px solid var(--line);
  padding: 10px 16px; border-radius: 10px; max-width: 90vw; }

/* HUD look (branding.hud, player app only): mono type, hard corners, scanlines, glow */
.login .kicker { display: none; }
.hudline { display: none; }
.hud body { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.hud button { border-radius: 2px; text-transform: uppercase; letter-spacing: .04em; }
.hud .brand, .hud .top .timer { color: var(--accent); text-shadow: 0 0 10px color-mix(in srgb, var(--accent) 55%, transparent); letter-spacing: .12em; }
.hud .top, .hud .bottom, .hud .sheet { background-image: repeating-linear-gradient(to bottom, color-mix(in srgb, var(--accent) 6%, transparent) 0 1px, transparent 1px 3px); }
.hud .top { border-bottom-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.hud .bottom { border-top-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.hud .bottom button, .hud .mapbtns button { clip-path: polygon(9px 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%, 0 9px); }
.hud .conn.online { box-shadow: 0 0 8px var(--ok); }
.hud .sheet { border-radius: 4px 4px 0 0; border-top: 2px solid var(--accent); }
.hud .sheet header h2, .hud .card .text { text-transform: uppercase; letter-spacing: .04em; }
.hud .card { border-radius: 4px; }
.hud .mapwrap::after { content: ''; position: absolute; inset: 6px; z-index: 450; pointer-events: none; --b: color-mix(in srgb, var(--accent) 70%, transparent);
  background: linear-gradient(var(--b) 0 0) top left / 18px 2px, linear-gradient(var(--b) 0 0) top left / 2px 18px,
    linear-gradient(var(--b) 0 0) top right / 18px 2px, linear-gradient(var(--b) 0 0) top right / 2px 18px,
    linear-gradient(var(--b) 0 0) bottom left / 18px 2px, linear-gradient(var(--b) 0 0) bottom left / 2px 18px,
    linear-gradient(var(--b) 0 0) bottom right / 18px 2px, linear-gradient(var(--b) 0 0) bottom right / 2px 18px;
  background-repeat: no-repeat; }
.hud .hudline { display: block; position: absolute; z-index: 460; left: 10px; bottom: 6px; font-size: 11px; color: var(--accent);
  background: rgba(0,0,0,.55); padding: 2px 6px; pointer-events: none; letter-spacing: .05em; }
.hud .login .kicker { display: block; color: var(--accent); font-size: 12px; letter-spacing: .3em; margin-top: -4px; }
.hud .login { background: repeating-linear-gradient(to bottom, color-mix(in srgb, var(--accent) 5%, transparent) 0 1px, transparent 1px 3px); min-height: 100%; }
.hud .login input { border-radius: 2px; border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }

/* boot sequence */
.boot { position: fixed; inset: 0; z-index: 5000; background: #020403; color: var(--accent); overflow: hidden; cursor: pointer;
  font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; display: grid; place-items: center; padding: 16px; }
.boot canvas { position: absolute; inset: 0; opacity: .32; }
.boot::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,.035) 0 1px, transparent 1px 3px); }
.boot-box { position: relative; z-index: 1; background: rgba(2,4,3,.82); border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent);
  padding: 14px 16px; max-width: calc(100vw - 32px); min-width: 0; box-shadow: 0 0 30px color-mix(in srgb, var(--accent) 20%, transparent); }
.boot .bl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.boot .bl.head { color: #fff; margin-bottom: 6px; }
.boot .bk { display: inline-block; vertical-align: bottom; overflow: hidden; white-space: pre; width: 0; color: var(--muted);
  animation: bootType .18s steps(var(--n)) var(--d) forwards; }
.boot .bl.head .bk { color: #fff; animation-duration: .5s; }
.boot .bl b, .boot .grant { opacity: 0; animation: bootIn 0s calc(var(--d) + .2s) forwards; color: var(--text); }
.boot .grant { margin-top: 10px; font-size: 22px; font-weight: 800; letter-spacing: .2em; color: var(--accent);
  text-shadow: 0 0 14px var(--accent); text-align: center; }
.boot .grant small { display: block; font-size: 12px; letter-spacing: .15em; color: var(--text); text-shadow: none; }
.boot .skip { position: absolute; z-index: 1; bottom: max(14px, env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center;
  color: var(--muted); letter-spacing: .3em; font-size: 11px; animation: blink 1.2s steps(2) infinite; }
@keyframes bootType { to { width: calc(var(--n) * 1ch); } }
@keyframes bootIn { to { opacity: 1; } }
@keyframes blink { 50% { opacity: .2; } }
@media (prefers-reduced-motion: reduce) { .boot .bk, .boot .bl b, .boot .grant { animation-duration: 0s; animation-delay: 0s; } }

/* landscape phones: actions move to a right-hand rail so the map gets the height */
@media (orientation: landscape) and (max-height: 560px) {
  .app { padding-right: calc(92px + env(safe-area-inset-right)); padding-left: env(safe-area-inset-left); }
  .app .bottom { position: absolute; top: 0; right: 0; bottom: 0; width: calc(92px + env(safe-area-inset-right)); display: flex; flex-direction: column;
    padding: max(6px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) 6px;
    border-top: 0; border-left: 1px solid var(--line); }
  .hud .app .bottom { border-left-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
  .app .bottom button { flex: 1; min-height: 0; font-size: 12px; padding: 2px; }
  .app .bottom button i { font-size: 18px; }
  .top { padding-top: max(2px, env(safe-area-inset-top)); padding-bottom: 2px; }
  .top button { min-height: 36px; }
  .top .title { display: flex; gap: 10px; align-items: baseline; }
  .top .title small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mapbtns { bottom: 12px; }
  .mapbtns button { min-height: 44px; }
  .toast { bottom: 16px; }
  .lock { padding-bottom: 16px; }
}

/* GM console */
.tpv { width: 360px; max-width: 100%; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--bg); color: var(--text); }
.tpv.hud { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.tpv .mapwrap { height: 150px; background: radial-gradient(circle at 30% 40%, #3d4f2e, #1f2a1a 60%, #141c12); }
.tpv .bottom button { pointer-events: none; }
.gm { position: fixed; inset: 0; display: flex; flex-direction: column; }
.gm .top select { width: auto; max-width: 260px; }
.gm-body { flex: 1; min-height: 0; display: flex; }
.gm-map { flex: 1; position: relative; min-width: 0; }
.gm-side { width: 440px; max-width: 50vw; border-left: 1px solid var(--line); display: flex; flex-direction: column; background: var(--panel); }
.gm-side .tabs { padding: 8px 8px 0; margin: 0; }
.gm-side .pane { flex: 1; overflow: auto; padding: 10px; }
.filters { position: absolute; z-index: 500; top: 8px; right: 8px; background: rgba(23,27,31,.92); border-radius: 10px; padding: 6px; display: flex; gap: 4px; flex-wrap: wrap; max-width: 60%; }
.filters button { padding: 6px 10px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
td input, td select { padding: 6px 8px; }
.setup { flex: 1; display: flex; min-height: 0; }
.setup nav { width: 190px; border-right: 1px solid var(--line); padding: 8px; display: flex; flex-direction: column; gap: 4px; overflow: auto; }
.setup nav button { text-align: left; }
.setup main { flex: 1; overflow: auto; padding: 16px 20px 60px; }
.setup main section { max-width: 980px; }
.item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 10px 0; background: #12161a; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 12px; }
.setup-map { height: 420px; position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: 8px 0; }
.team-sw { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: middle; margin-right: 6px; }
@media (max-width: 800px) {
  .gm-body { flex-direction: column; }
  .gm-side { width: auto; max-width: none; height: 50%; border-left: 0; border-top: 1px solid var(--line); }
  .setup { flex-direction: column; }
  .setup nav { width: auto; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
}

/* QR cards (print) */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 8px; background: #fff; color: #000; }
.qcard { border: 1px dashed #999; padding: 10px; text-align: center; break-inside: avoid; }
.qcard .code { font: 800 28px ui-monospace, monospace; letter-spacing: 4px; }
.qcard svg { width: 140px; height: 140px; }
.pill { font-size: 12px; font-weight: 700; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; background: #24303a; color: var(--muted); }
.pill.live { background: #14361f; color: var(--ok); }
.pill.ended, .pill.archived { background: #3a1214; color: #fecaca; }
.savebar { position: sticky; top: -16px; z-index: 700; display: flex; gap: 12px; align-items: center; padding: 8px 0; background: var(--bg); }
.item > .savebar { background: inherit; }
input[type=color] { padding: 2px; height: 44px; }
.filebtn { display: inline-block; margin: 0; color: var(--text); font-size: 16px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 14px; cursor: pointer; flex: 0 0 auto; }
.imgs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.imgs span { position: relative; }
.imgs img { height: 80px; border-radius: 6px; display: block; }
.imgs span button { position: absolute; top: 2px; right: 2px; padding: 0 6px; }
img.logo { height: 44px; }
video.clip { height: 70px; max-width: 200px; }
.vtx { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); }
.chk { display: flex; gap: 6px; align-items: center; color: var(--text); font-size: 15px; margin: 4px 0; }
.chk input { width: auto; }
.picklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; max-height: 240px; overflow: auto;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin: 6px 0; }
.tools { display: flex; gap: 4px; flex: 0 0 auto; }
.tools button { padding: 6px 10px; }
.row.wrap { flex-wrap: wrap; margin: 6px 0; }
.drawbar { background: #24303a; border-radius: 8px; padding: 6px 8px; }
.timerbig { font: 700 48px ui-monospace, monospace; }
.ok { color: var(--ok); }
.mono { font-family: ui-monospace, monospace; }
.nowrap { white-space: nowrap; }
.gm-side h3 { margin-top: 12px; }
h3 small, h2 small { margin-left: 6px; font-weight: 400; }
.qcard .cs { font-size: 22px; font-weight: 800; }
@media print {
  .noprint { display: none !important; }
  html, body { background: #fff; height: auto; }
  .cards { padding: 0; }
}
.print { background: #fff; min-height: 100vh; }
.print .noprint { padding: 8px; background: var(--bg); }
