/* ==========================================================================
   ALL CITY — game UI
   Concrete, asphalt, spray paint.
   ========================================================================== */

:root {
  --gc: #c23b2e;
  --line: rgba(232, 226, 208, .14);
  --line-2: rgba(232, 226, 208, .3);
  --panel: #121210;
  --panel-2: #181815;
  --ok: #a7c957;
  --bad: #d1493c;
  --warn: #f0b429;
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  --stain: radial-gradient(60% 50% at 30% 20%, rgba(0,0,0,.35), transparent 70%),
           radial-gradient(40% 30% at 80% 80%, rgba(255,255,255,.03), transparent 70%);
}

html.reduce-motion .grain,
html.reduce-motion .scan { display: none; }
html.reduce-motion * { animation-duration: .001ms !important; }
html.reduce-motion .line-flow { display: none; }
@media (prefers-reduced-motion: reduce) {
  .line-flow, .you, .sel { animation: none; }
}

body.game-body { overflow: hidden; background: #08080a; }

#app { position: fixed; inset: 0; z-index: 5; display: flex; }
#screen { flex: 1; min-width: 0; position: relative; }
#overlays { position: fixed; inset: 0; z-index: 90; pointer-events: none; }
#overlays > * { pointer-events: auto; }

/* ---------- boot ---------- */
#need-server { display: none; }
html.no-server #boot, html.no-server #app { display: none; }
html.no-server #need-server {
  display: grid; place-items: center; position: fixed; inset: 0; z-index: 400;
  padding: 24px; background: #08080a; overflow-y: auto;
}
.ns-card { width: min(620px, 100%); border: 1px solid var(--line-2); background: #121210; padding: 30px; }
.ns-card small { font-family: var(--mono); font-size: 12.5px; letter-spacing: .3em; color: var(--hot); }
.ns-card h1 { font-size: clamp(38px, 7vw, 64px); line-height: .86; letter-spacing: -.02em; text-transform: uppercase; margin: 12px 0 18px; }
.ns-card p { font-family: var(--mono); font-size: 14px; line-height: 1.7; color: #cfc9b8; margin-bottom: 10px; }
.ns-card code { color: var(--cyan); }
.ns-card pre { font-family: var(--mono); font-size: 14px; background: rgba(0,0,0,.5); border: 1px solid var(--line); padding: 10px 12px; margin-bottom: 12px; color: var(--paper); overflow-x: auto; }
.ns-card .ns-big { font-family: var(--display); font-size: 16px; letter-spacing: .06em; color: var(--paper); margin: 16px 0; }
.ns-card .ns-big b { color: var(--yellow); }
.ns-card .btn { margin-top: 10px; }

#boot {
  position: fixed; inset: 0; z-index: 300; background: #08080a;
  display: grid; place-items: center; overflow: hidden;
  transition: transform .7s cubic-bezier(.76, 0, .24, 1);
}
.app-ready #boot { transform: translateY(-101%); }
.app-ready #boot { pointer-events: none; }
.boot-mark { font-size: clamp(42px, 9vw, 112px); line-height: .84; text-align: center; letter-spacing: -.02em; }
.boot-mark em { font-style: normal; color: var(--hot); }
.boot-sub { position: absolute; bottom: 12vh; font-family: var(--mono); font-size: 12.5px; letter-spacing: .42em; color: var(--dim); }
.boot-bar { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--hot); animation: bootbar 1.1s ease-out forwards; box-shadow: 0 0 18px var(--hot); }
@keyframes bootbar { from { width: 0 } to { width: 100% } }

/* ==========================================================================
   Shell
   ========================================================================== */
.g-shell { height: 100%; display: grid; grid-template-rows: auto auto 1fr auto; grid-template-columns: minmax(0, 1fr); min-height: 0; }
.g-hud, .g-body, .g-rail { min-width: 0; }

.g-hud {
  position: relative; z-index: 20;
  display: flex; align-items: center; gap: 18px;
  padding: 10px 18px;
  background:
    linear-gradient(180deg, rgba(18,18,16,.98), rgba(10,10,9,.92)),
    var(--noise);
  border-bottom: 2px solid #000;
  box-shadow: 0 1px 0 rgba(232,226,208,.14) inset, 0 6px 18px rgba(0,0,0,.5);
}
.g-hud::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px;
  background: repeating-linear-gradient(90deg, var(--warn) 0 14px, #12100c 14px 28px);
  opacity: .55;
}

.g-brand { display: flex; align-items: baseline; gap: 1px; font-size: 17px; letter-spacing: .12em; flex: none; }
.g-brand b { font-weight: 400; }
.g-brand i { font-style: normal; color: var(--hot); }
.g-brand span { font-weight: 400; }

.g-gang { display: flex; align-items: center; gap: 8px; flex: none; padding-left: 12px; border-left: 1px solid var(--line); }
.g-gang .patch { width: 30px; height: 30px; display: grid; place-items: center; font-size: 17px; color: var(--gc); border: 1px solid var(--gc); background: rgba(0,0,0,.4); transform: rotate(-3deg); }
.g-gang b { display: block; font-family: var(--display); font-size: 14px; letter-spacing: .06em; line-height: 1; }
.g-gang small { display: block; font-family: var(--marker); font-size: 11px; color: var(--dim); margin-top: 4px; letter-spacing: .04em; }

.g-clock { display: flex; flex-direction: column; line-height: 1; flex: none; }
.g-clock small { font-family: var(--mono); font-size: 11px; letter-spacing: .26em; color: var(--dim); margin-bottom: 3px; }
.g-clock strong { font-family: var(--display); font-size: 26px; letter-spacing: .02em; color: var(--paper); font-variant-numeric: tabular-nums; }
.g-clock strong.low { color: var(--hot); text-shadow: 0 0 18px rgba(194,59,46,.6); }
.g-clock span { font-family: var(--mono); font-size: 11px; letter-spacing: .16em; color: var(--dim); margin-top: 3px; }

.g-stats { display: flex; gap: 14px; align-items: flex-start; flex: 1; }
.g-stats > div { min-width: 44px; }
.g-stats small { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .18em; color: var(--dim); margin-bottom: 2px; }
.g-stats b { font-family: var(--display); font-size: 16px; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.g-stats b i { font-style: normal; color: var(--dim); font-size: 11px; }
.g-stats b.hot { color: var(--hot); }
.g-stats .bar { margin-top: 3px; width: 40px; }


/* ---------- body ---------- */
.g-body { display: grid; grid-template-columns: minmax(0, 1fr) 400px; min-height: 0; }

.g-mapwrap {
  position: relative; min-width: 0; min-height: 0;
  background:
    radial-gradient(60% 50% at 50% 40%, rgba(194,59,46,.05), transparent 70%),
    radial-gradient(70% 60% at 20% 90%, rgba(57,215,208,.03), transparent 70%),
    #0a0c0b;
  overflow: hidden;
  border-right: 2px solid #000;
}
.g-map {
  width: 100%; height: 100%; display: block; cursor: grab; touch-action: none;
  user-select: none; -webkit-user-select: none; -webkit-user-drag: none; -webkit-touch-callout: none;
}
.g-map * { user-select: none; -webkit-user-select: none; }
.g-map:active { cursor: grabbing; }

/* ---------- map ---------- */
.sea { fill: #070908; }
.boro { fill: rgba(30,30,26,.6); stroke: rgba(232,226,208,.1); stroke-width: 1; }
.boro:nth-child(2n) { fill: rgba(25,25,22,.6); }

.zpart {
  fill: var(--zc); fill-opacity: var(--zo); stroke: rgba(8,8,7,.9); stroke-width: .55;
  transition: fill-opacity .15s, stroke .15s;
  cursor: pointer;
}
.zpart.locked { fill-opacity: .05; stroke-dasharray: 1.5 2; cursor: default; }
.zpart.inert { fill: #0d1510; fill-opacity: .9; stroke: rgba(232,226,208,.05); cursor: pointer; }
.zpart.mine { stroke: rgba(232,226,208,.28); }
.zpart.theirs { stroke: rgba(0,0,0,.9); }
.zpart.ally { stroke: var(--ok); stroke-dasharray: 2 2; }
.zpart.hot { fill-opacity: .7; stroke: var(--warn); stroke-width: 1.6; filter: drop-shadow(0 0 6px rgba(240,180,41,.55)); }
.zpart.selected { stroke: var(--paper); stroke-width: 1.8; stroke-dasharray: 3 2; }

.transit-layer .line { fill: none; stroke-width: 2; opacity: .7; stroke-linecap: round; stroke-linejoin: round; }
.transit-layer .line.off { opacity: .14; stroke-dasharray: 4 6; }
.transit-layer .stn circle { fill: #08080a; stroke: rgba(232,226,208,.65); stroke-width: .8; }
.transit-layer .stn .core { fill: rgba(232,226,208,.85); stroke: none; }
.transit-layer .stn.off { opacity: .2; }

.zone-labels .zlabel {
  fill: #e8e2d0; font-family: var(--mono); font-weight: 600;
  letter-spacing: .1em; text-anchor: middle; pointer-events: none;
  paint-order: stroke; stroke: rgba(8,8,7,.92); stroke-width: .9px; opacity: .9;
}
.zone-labels .zlabel.sel { fill: var(--warn); font-weight: 700; opacity: 1; }
.boro-labels .borolabel {
  fill: rgba(232,226,208,.12); font-family: var(--display);
  letter-spacing: .3em; text-anchor: middle; pointer-events: none; text-transform: uppercase;
}
.boro-labels .borolabel.on { fill: rgba(232,226,208,.22); }
.zoomed-out .zone-labels { display: none; }
.zoomed-in .boro-labels { display: none; }

.police-dot circle { fill: #2f5fa8; opacity: .8; }
.police-dot text { fill: #9fc0ff; font-family: var(--mono); font-size: 3.2px; text-anchor: middle; }
.income-label { fill: var(--ok); font-family: var(--mono); font-size: 3px; text-anchor: middle; pointer-events: none; }

.map-tools { position: absolute; left: 14px; top: 14px; display: flex; flex-direction: column; gap: 3px; }.map-tools button {
  width: 34px; height: 28px; background: rgba(14,14,12,.88); color: var(--paper);
  border: 1px solid var(--line-2); font-family: var(--mono); font-size: 12.5px; cursor: pointer; transition: .15s;
  box-shadow: 2px 2px 0 rgba(0,0,0,.5);
}
.map-tools button:hover { background: var(--paper); color: #12100c; }
.map-layers { position: absolute; left: 14px; top: 132px; display: flex; flex-direction: column; gap: 3px; }
.map-layers button {
  width: 62px; height: 22px; background: rgba(14,14,12,.85); color: var(--dim);
  border: 1px solid var(--line); font-family: var(--mono); font-size: 11px; letter-spacing: .1em; cursor: pointer;
}
.map-layers button.on { color: #12100c; background: var(--warn); border-color: var(--warn); }
.map-key { position: absolute; left: 14px; bottom: 12px; display: flex; gap: 12px; font-family: var(--mono); font-size: 11px; letter-spacing: .12em; color: var(--dim); }
.map-key span { display: flex; align-items: center; gap: 4px; max-width: 140px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.map-key i { width: 8px; height: 8px; display: inline-block; flex: none; }

.map-tip {
  position: absolute; z-index: 30; width: 190px; padding: 10px 12px;
  background: #100f0d; border: 1px solid var(--line-2); box-shadow: 0 12px 30px rgba(0,0,0,.7);
  pointer-events: none; opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s;
  background-image: var(--noise); background-blend-mode: multiply;
}
.map-tip.show { opacity: 1; transform: none; }
.map-tip b { display: block; font-family: var(--display); font-size: 14px; letter-spacing: .04em; line-height: 1.05; }
.map-tip > span { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .18em; color: var(--dim); margin: 3px 0 6px; }
.tip-owner { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; margin-bottom: 5px; }
.tip-row { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; letter-spacing: .1em; color: var(--dim); border-top: 1px dashed rgba(232,226,208,.12); padding-top: 3px; margin-top: 3px; }
.tip-row b { color: var(--paper); font-weight: 400; }

/* ---------- night-one coach & map feedback ---------- */
.coach {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  z-index: 25; width: min(520px, calc(100% - 112px));
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px 8px 12px;
  background: rgba(14,14,12,.94);
  border: 1px solid var(--warn);
  box-shadow: 0 10px 30px rgba(0,0,0,.6), inset 3px 0 0 var(--warn);
  font-family: var(--mono);
}
.coach-step {
  flex: 0 0 auto; font-size: 11px; letter-spacing: .16em;
  color: var(--warn); border-right: 1px solid var(--line-2); padding-right: 9px;
}
.coach-text { flex: 1; font-size: 11px; line-height: 1.5; color: #d7d1c0; }
.coach-text b { color: var(--paper); }
.coach-x {
  flex: 0 0 auto; background: none; border: 0; color: var(--dim);
  font-size: 14px; line-height: 1; padding: 0; cursor: pointer;
  width: 44px; height: 44px; display: grid; place-items: center;
  margin: -8px -8px -8px 0;
}
.coach-x:hover { color: var(--paper); }

.coach-target { animation: coachPulse 1.6s ease-in-out infinite; }
@keyframes coachPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240,180,41,.55); border-color: var(--warn); }
  50% { box-shadow: 0 0 0 4px rgba(240,180,41,.06); border-color: var(--warn); }
}
.assign.suggested { border-color: var(--warn); background: rgba(240,180,41,.08); }

.float-gain {
  position: absolute; z-index: 24; pointer-events: none;
  transform: translate(-50%, -50%);
  font-family: var(--mono); font-size: 13.5px; letter-spacing: .12em;
  padding: 4px 7px; background: rgba(8,8,7,.86); border: 1px solid var(--line-2);
  white-space: nowrap; animation: floatGain 1.15s ease-out forwards;
}
.float-gain.good { color: var(--ok); border-color: rgba(167,201,87,.5); }
.float-gain.bad { color: var(--bad); border-color: rgba(209,73,60,.5); }
@keyframes floatGain {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(.9); }
  18% { opacity: 1; transform: translate(-50%, -60%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -170%) scale(1); }
}

@media (max-width: 900px) {
  .coach { top: 8px; left: 106px; right: 8px; width: auto; transform: none; padding: 4px 4px 4px 8px; gap: 6px; }
  .g-body[data-sheet="open"] .coach,
  .g-body[data-sheet="full"] .coach { display: none; }
  .coach-step { display: none; }
  .coach-text { font-size: 9.5px; line-height: 1.35; }
  .coach-x { width: 40px; height: 40px; margin: -5px -5px -5px 0; font-size: 13px; }
}

/* ---------- drawer ---------- */
.g-drawer {
  min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  background:
    linear-gradient(180deg, rgba(20,20,17,.98), rgba(10,10,9,.99)),
    var(--noise);
  background-blend-mode: multiply;
  padding: 16px;
  border-left: 1px solid rgba(232,226,208,.08);
}
.g-drawer::-webkit-scrollbar { width: 6px; }
.g-drawer::-webkit-scrollbar-thumb { background: rgba(232,226,208,.18); }
.sheet-handle { display: none; }
.drawer-cue { display: none; font-family: var(--mono); font-size: 11px; letter-spacing: .18em; color: var(--warn); margin: 10px 0 4px; }

.drawer-head { border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 12px; }
.drawer-head small { font-family: var(--mono); font-size: 11px; letter-spacing: .26em; color: var(--gc); }
.drawer-head h2 { font-family: var(--display); font-size: 26px; line-height: .92; letter-spacing: .01em; margin: 7px 0 6px; text-transform: uppercase; }
.drawer-head .motto { font-family: var(--type); font-size: 11px; line-height: 1.6; color: var(--dim); }
.station-head { border-bottom: 2px solid var(--c); }
.station-head .owner { font-family: var(--mono); font-size: 11px; letter-spacing: .18em; margin-bottom: 6px; }

.drawer-back { background: none; border: 0; color: var(--dim); font-family: var(--mono); font-size: 11px; letter-spacing: .18em; padding: 0 0 10px; cursor: pointer; }
.drawer-back:hover { color: var(--paper); }

.panel-block { border: 1px solid var(--line); background: rgba(232,226,208,.015); padding: 11px; margin-bottom: 10px; }
.block-title { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 9px; }
.block-title span { font-family: var(--mono); font-size: 11px; letter-spacing: .24em; color: var(--dim); }
.block-title b { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; color: var(--gc); font-weight: 400; text-align: right; }
.obj { font-family: var(--type); font-size: 12.5px; line-height: 1.65; color: #d6cfbe; }

.crew-chips { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.crew-chip { text-align: left; background: rgba(232,226,208,.03); border: 1px solid var(--line); color: var(--paper); padding: 7px; cursor: pointer; transition: .15s; display: grid; gap: 1px; }
.crew-chip:hover { border-color: var(--line-2); background: rgba(232,226,208,.06); }
.crew-chip b { font-family: var(--display); font-size: 12.5px; letter-spacing: .04em; }
.crew-chip i { font-style: normal; font-family: var(--mono); font-size: 11px; letter-spacing: .08em; color: var(--dim); }
.crew-chip span { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; color: var(--ok); }
.crew-chip.used { opacity: .4; }
.crew-chip.used span { color: var(--bad); }

.fine { font-family: var(--mono); font-size: 11px; line-height: 1.6; letter-spacing: .04em; color: var(--dim); margin-top: 7px; }

.mini-list { display: grid; gap: 5px; }
.mini-row { display: flex; justify-content: space-between; gap: 8px; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px dashed var(--line); color: #cfc9b8; font-family: var(--mono); font-size: 11px; letter-spacing: .04em; padding: 0 0 4px; cursor: pointer; }
.mini-row:hover { color: var(--paper); }
.mini-row b { color: var(--paper); font-weight: 400; }

.radio-block { border-color: rgba(57,215,208,.22); }
.blink { animation: blink 1.6s steps(2) infinite; color: var(--bad) !important; }
@keyframes blink { 50% { opacity: .25 } }
.radio { font-family: var(--type); font-size: 12.5px; line-height: 1.7; color: #d8d1c0; font-style: italic; }
.logline { color: var(--dim); }

.control-block { border: 1px solid var(--line); padding: 11px; margin-bottom: 10px; background: rgba(0,0,0,.28); }
.ctl-row { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; letter-spacing: .14em; color: var(--dim); margin-bottom: 3px; }
.ctl-row b { color: var(--paper); }
.ctl-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 9px; font-family: var(--mono); font-size: 11px; letter-spacing: .08em; color: var(--dim); }
.ctl-meta b { color: var(--paper); }
.ctl-meta b.hot { color: var(--hot); }

.bar { height: 5px; background: rgba(232,226,208,.1); overflow: hidden; margin: 3px 0 8px; border: 1px solid rgba(0,0,0,.4); }
.bar i { display: block; height: 100%; transition: width .4s ease; }
.bar.thin { height: 2px; margin: 0; }

.intel { border-left: 3px solid var(--gc); padding: 7px 9px; background: rgba(194,59,46,.07); font-family: var(--mono); font-size: 11px; line-height: 1.6; color: #cfc9b8; margin-bottom: 10px; }
.intel b { color: var(--gc); letter-spacing: .16em; }
.intel.dim { border-left-color: var(--line-2); background: none; color: var(--dim); }

.gang-list { display: grid; gap: 5px; }
.gang-row { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: center; font-family: var(--mono); font-size: 11px; letter-spacing: .05em; color: #cfc9b8; }
.gang-row i { width: 9px; height: 9px; display: block; transform: rotate(45deg); }
.gang-row b { color: var(--paper); }
.gang-row.clickable {
  width: 100%; background: none; border: 1px solid transparent; padding: 4px 6px; margin: -4px -6px;
  cursor: pointer; text-align: left;
}
.gang-row.clickable:hover, .gang-row.clickable:focus-visible {
  border-color: var(--line-2); background: rgba(232,226,208,.04); outline: none;
}
.gang-row.clickable span { text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }

.landmarks { display: flex; flex-wrap: wrap; gap: 4px; }
.landmarks span { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; color: #cfc9b8; border: 1px solid var(--line); padding: 3px 6px; background: rgba(232,226,208,.03); }
.landmarks.built { margin-top: 6px; }
.landmarks .built-tag { border-color: rgba(167,201,87,.35); color: var(--ok); }

.act-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.act { text-align: left; background: rgba(232,226,208,.03); border: 1px solid var(--line); color: var(--paper); padding: 7px; cursor: pointer; transition: .15s; display: grid; grid-template-columns: 1fr auto; gap: 1px; }
.act b { font-family: var(--display); font-size: 12.5px; letter-spacing: .06em; }
.act b .k { text-decoration: none; font-size: 11px; opacity: .38; margin-right: 5px; vertical-align: 1px; }
.act i { font-style: normal; font-family: var(--mono); font-size: 11px; color: var(--dim); align-self: center; }
.act span { grid-column: span 2; font-family: var(--mono); font-size: 11px; line-height: 1.45; color: var(--dim); }
.act:hover:not(:disabled) { border-color: var(--gc); background: rgba(194,59,46,.09); }
.act.on { border-color: var(--warn); background: rgba(240,180,41,.1); }
.act.disabled, .act:disabled { opacity: .32; cursor: not-allowed; }

.assign-block { border: 1px solid var(--warn); background: rgba(240,180,41,.05); padding: 10px; margin-bottom: 10px; }
.assign-grid { display: grid; gap: 3px; }
.assign { display: grid; grid-template-columns: 1fr auto auto; gap: 7px; align-items: center; background: rgba(0,0,0,.35); border: 1px solid var(--line); color: var(--paper); padding: 7px 9px; cursor: pointer; text-align: left; transition: .15s; }
.assign:hover { border-color: var(--warn); background: rgba(240,180,41,.1); }
.assign b { font-family: var(--display); font-size: 12.5px; letter-spacing: .04em; }
.assign i { display: none; }
.assign span { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; color: var(--dim); }
.assign em { font-style: normal; font-family: var(--mono); font-size: 12.5px; color: var(--gc); }

.link { background: none; border: 0; color: var(--dim); font-family: var(--mono); font-size: 11px; letter-spacing: .14em; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; padding: 5px 0; min-height: 44px; display: inline-flex; align-items: center; }
.link:hover { color: var(--paper); }

.up-grid { display: grid; gap: 3px; }
.up { text-align: left; background: rgba(232,226,208,.03); border: 1px solid var(--line); color: var(--paper); padding: 7px; cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 1px; }
.up b { font-family: var(--display); font-size: 11px; letter-spacing: .06em; }
.up i { font-style: normal; font-family: var(--mono); font-size: 11px; color: var(--warn); }
.up span { grid-column: span 2; font-family: var(--mono); font-size: 11px; line-height: 1.4; color: var(--dim); }
.up:hover:not(:disabled) { border-color: var(--warn); }
.up.owned { opacity: .55; }
.up:disabled { opacity: .32; cursor: not-allowed; }

/* ---------- rail ---------- */
.g-rail { display: flex; align-items: center; border-top: 2px solid #000; background: rgba(10,10,9,.96); padding: 0 12px; min-height: 32px; gap: 14px; }
.rail-ticker { flex: 1; overflow: hidden; }
.rail-track { display: flex; width: max-content; animation: railtrain 42s linear infinite; }
.rail-track span { font-family: var(--mono); font-size: 11px; letter-spacing: .18em; color: var(--dim); padding-right: 80px; white-space: nowrap; }
@keyframes railtrain { to { transform: translateX(-50%) } }
.rail-right { display: flex; gap: 12px; font-family: var(--mono); font-size: 11px; letter-spacing: .1em; color: var(--dim); flex: none; }
.rail-right b { color: var(--paper); }
.rail-right .ok { color: var(--ok); }
.rail-right .bad { color: var(--bad); }

/* ==========================================================================
   Overlays / panels
   ========================================================================== */
.overlay {
  position: fixed; inset: 0; z-index: 95; display: flex; align-items: flex-start; justify-content: flex-end;
  background: rgba(5,5,4,.76); backdrop-filter: blur(4px);
  animation: fadein .18s ease; padding: 20px; overflow-y: auto;
}
@keyframes fadein { from { opacity: 0 } to { opacity: 1 } }

.panel {
  width: min(920px, 100%); background: #121210;
  background-image: var(--noise); background-blend-mode: multiply;
  border: 1px solid var(--line-2); box-shadow: 0 30px 80px rgba(0,0,0,.8);
  animation: panelin .28s cubic-bezier(.16, 1, .3, 1);
  display: flex; flex-direction: column; max-height: calc(100vh - 40px);
  position: relative;
}
.panel::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--hot); }
@keyframes panelin { from { opacity: 0; transform: translateX(30px) } to { opacity: 1; transform: none } }

.panel-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 18px 22px 14px; border-bottom: 1px solid var(--line); }
.panel-head small { font-family: var(--mono); font-size: 11px; letter-spacing: .28em; color: var(--gc); }
.panel-head h2 { font-family: var(--display); font-size: 32px; letter-spacing: .02em; text-transform: uppercase; margin-top: 4px; }
.close { background: none; border: 1px solid var(--line-2); color: var(--paper); width: 44px; height: 44px; flex: 0 0 auto; cursor: pointer; font-size: 14px; }
.close:hover { background: var(--paper); color: #12100c; }
.panel-body { padding: 18px 22px 24px; overflow-y: auto; }
.panel-foot { border-top: 1px solid var(--line); padding: 12px 22px; }

.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; margin: 20px 0 10px; border-top: 1px solid var(--line); padding-top: 12px; }
.section-head h3 { font-family: var(--display); font-size: 16px; letter-spacing: .08em; text-transform: uppercase; }
.section-head span { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; color: var(--dim); text-align: right; }

/* roster */
.roster-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.crew-card { border: 1px solid var(--line); background: rgba(232,226,208,.02); padding: 12px; position: relative; overflow: hidden; }
.crew-card::after { content: ""; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; background: var(--gc); filter: blur(50px); opacity: .1; }
.crew-card.gone { opacity: .45; }
.crew-top { display: flex; gap: 9px; align-items: center; margin-bottom: 8px; }
.crew-top .glyph { font-family: var(--display); font-size: 32px; line-height: .8; color: transparent; -webkit-text-stroke: 1px var(--gc); width: 32px; flex: none; }
.crew-top h3 { font-family: var(--display); font-size: 14px; letter-spacing: .04em; }
.crew-top small { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; color: var(--dim); }
.crew-top .lv { margin-left: auto; }
.pointbtn { background: var(--warn); border: 0; color: #12100c; font-family: var(--mono); font-size: 12.5px; padding: 4px 7px; cursor: pointer; }
.xprow { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: center; font-family: var(--mono); font-size: 11px; color: var(--dim); margin-bottom: 8px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.statrow { display: grid; grid-template-columns: 32px 20px 1fr; gap: 5px; align-items: center; }
.statrow span { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; color: var(--dim); }
.statrow b { font-family: var(--mono); font-size: 11px; text-align: right; }
.statrow .bar { margin: 0; }
.mood { display: flex; gap: 12px; font-family: var(--mono); font-size: 11px; letter-spacing: .08em; color: var(--dim); margin-top: 8px; }
.mood b { color: var(--paper); }
.traits { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 6px; }
.trait { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; border: 1px solid rgba(57,215,208,.32); color: var(--cyan); padding: 2px 5px; }
.wounds { display: flex; gap: 6px; margin-top: 5px; font-family: var(--mono); font-size: 11px; color: var(--hot); }
.trainrow { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 8px; font-family: var(--mono); font-size: 11px; color: var(--dim); align-items: center; }
.trainrow button { background: rgba(232,226,208,.06); border: 1px solid var(--line); color: var(--paper); font-family: var(--mono); font-size: 11px; padding: 3px 7px; cursor: pointer; }
.trainrow button:hover { border-color: var(--warn); color: var(--warn); }

.soldier-card { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; border: 1px solid var(--line); padding: 12px; background: rgba(232,226,208,.02); }
.soldier-card small { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .16em; color: var(--dim); margin-bottom: 3px; }
.soldier-card b { font-family: var(--display); font-size: 18px; }

.btn-small { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; background: var(--warn); color: #12100c; border: 0; padding: 8px 11px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; margin-top: 6px; width: 100%; transition: .15s; }
.btn-small:hover:not(:disabled) { background: var(--paper); }
.btn-small:disabled { opacity: .35; cursor: not-allowed; }
.btn-small.ghost { background: none; border: 1px solid var(--line-2); color: var(--paper); }
.btn-small.ghost:hover { background: var(--paper); color: #12100c; }
.btn-small.danger { background: var(--hot); color: var(--paper); }

/* gang editor */
.gang-grid { margin-top: 0; }
.core-edit { display: grid; gap: 4px; }
.core-edit-row { display: grid; grid-template-columns: 24px 128px 1fr; gap: 6px; align-items: center; }
.core-num { font-family: var(--mono); font-size: 11px; color: var(--dim); }
.core-edit select, .core-edit input {
  background: rgba(0,0,0,.42); border: 1px solid var(--line); color: var(--paper);
  font-family: var(--mono); font-size: 12.5px; padding: 7px; outline: none; min-width: 0;
}
.core-edit select:focus, .core-edit input:focus { border-color: var(--gc); }

/* rivals */
.rival-grid { display: grid; gap: 8px; }
.rival { border: 1px solid var(--line); border-left: 3px solid var(--rc); padding: 12px; background: rgba(232,226,208,.02); }
.rival.dead { opacity: .4; }
.rival-head { display: flex; justify-content: space-between; align-items: center; }
.rival-head h3 { font-family: var(--display); font-size: 16px; letter-spacing: .05em; }
.rival-bars { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; font-family: var(--mono); font-size: 11px; color: var(--dim); margin: 7px 0; }
.rival-bars b { color: var(--paper); }
.rival p { font-family: var(--type); font-size: 11px; line-height: 1.6; color: #b9b3a2; }
.rival-meta { display: flex; gap: 18px; font-family: var(--mono); font-size: 11px; color: var(--dim); margin-top: 7px; }
.rival-meta b { color: var(--paper); font-weight: 400; }
.rival .intel { margin: 9px 0 0; }
.rival.clickable { cursor: pointer; transition: border-color .15s, background .15s, transform .15s; }
.rival.clickable:hover, .rival.clickable:focus-visible {
  border-color: var(--rc); background: rgba(232,226,208,.055); transform: translateY(-1px); outline: none;
}
.rival-open { display: block; margin-top: 9px; font-family: var(--mono); font-size: 11px; letter-spacing: .18em; color: var(--dim); }
.rival.clickable:hover .rival-open { color: var(--rc); }

/* crew file */
.rival-file { --rc: var(--gc); }
.rf-status { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; font-family: var(--mono); font-size: 11px; letter-spacing: .14em; color: var(--dim); margin-bottom: 12px; }
.rf-status .stamp { color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); padding: 2px 7px; letter-spacing: .18em; }
.rf-status .stamp.dead { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.rf-status .stamp.ally { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.rf-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.rf-grid div { border: 1px solid var(--line); padding: 9px 10px; background: rgba(232,226,208,.02); }
.rf-grid small { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .14em; color: var(--dim); margin-bottom: 2px; }
.rf-grid b { font-family: var(--display); font-size: 16px; letter-spacing: .03em; }
.rf-grid b i { font-style: normal; font-family: var(--mono); font-size: 11px; color: var(--dim); letter-spacing: .08em; }
.rf-blurb { font-family: var(--type); font-size: 12.5px; line-height: 1.65; color: #c4beac; margin-bottom: 12px; }
.rf-grudge { margin-bottom: 12px; }
.rf-grudge .block-title { margin-bottom: 5px; }
.rival-roster { display: grid; gap: 4px; }
.rr-row {
  display: grid; grid-template-columns: 1.35fr 1fr 46px 54px; gap: 8px; align-items: center;
  border-left: 2px solid var(--rc); padding: 4px 8px; background: rgba(232,226,208,.025);
  font-family: var(--mono); font-size: 11px;
}
.rr-row b { color: var(--paper); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rr-row i { font-style: normal; color: var(--dim); letter-spacing: .08em; font-size: 11px; }
.rr-row span { color: var(--dim); font-size: 11px; }
.rr-row em { font-style: normal; color: var(--rc); text-align: right; }
.rival-history { list-style: none; display: grid; gap: 5px; }
.rival-history li { display: grid; grid-template-columns: 34px 1fr; gap: 8px; font-family: var(--mono); font-size: 11px; line-height: 1.5; color: #b9b3a2; border-left: 2px solid var(--line-2); padding-left: 8px; }
.rival-history li span { color: var(--dim); }
.rival-history li.h-alliance { border-left-color: var(--ok); }
.rival-history li.h-betrayal, .rival-history li.h-push, .rival-history li.h-rumble { border-left-color: var(--bad); }
.rival-history li.h-defeat { border-left-color: var(--warn); }
.rival-history li.h-spawn { border-left-color: var(--rc); }
.rel-list { display: grid; gap: 4px; }
.rel-row {
  display: grid; grid-template-columns: 8px 1fr auto; gap: 8px; align-items: center; width: 100%;
  background: none; border: 1px solid var(--line); padding: 6px 8px; cursor: pointer;
  font-family: var(--mono); font-size: 11px; color: var(--paper); text-align: left;
}
.rel-row:hover { border-color: var(--line-2); background: rgba(232,226,208,.04); }
.rel-row i { width: 8px; height: 8px; display: block; }
.rel-row b { font-weight: 400; color: var(--dim); font-size: 11px; letter-spacing: .08em; }
.feud-row b { color: var(--bad); }

/* turf war */
.turf-open { width: 100%; }
.tw-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.tw-summary div { border: 1px solid var(--line); padding: 10px; background: rgba(232,226,208,.02); }
.tw-summary small { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .16em; color: var(--dim); margin-bottom: 3px; }
.tw-summary b { font-family: var(--display); font-size: 16px; letter-spacing: .03em; }
.tw-grid { display: grid; gap: 8px; }
.tw-crew { border: 1px solid var(--line); border-left: 3px solid var(--rc); padding: 11px; background: rgba(232,226,208,.02); }
.tw-head { display: flex; align-items: center; gap: 8px; }
.tw-head i { width: 9px; height: 9px; background: var(--rc); display: block; }
.tw-head h3 { font-family: var(--display); font-size: 16px; letter-spacing: .05em; flex: 1; }
.tw-head .stamp { font-family: var(--mono); font-size: 11px; letter-spacing: .16em; color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); padding: 2px 6px; }
.tw-head .stamp.dead { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.tw-head .stamp.ally { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.tw-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 9px 0; }
.tw-stats small { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .12em; color: var(--dim); margin-bottom: 2px; }
.tw-stats b { font-family: var(--mono); font-size: 11px; font-weight: 400; color: var(--paper); }
.tw-adj { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.tw-adj small { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; color: var(--dim); margin-right: 4px; }
.tw-adj span { font-family: var(--mono); font-size: 11px; color: #b9b3a2; border: 1px solid var(--line); padding: 2px 5px; }
.tw-links { display: flex; gap: 14px; margin-top: 9px; }
.tw-feuds { list-style: none; display: grid; gap: 4px; }
.tw-feud {
  display: grid; grid-template-columns: 8px 1fr 40px 1fr 8px auto; gap: 8px; align-items: center;
  border: 1px solid var(--line); padding: 6px 8px; font-family: var(--mono); font-size: 11px;
}
.tw-feud i { width: 8px; height: 8px; display: block; }
.tw-feud b { font-weight: 400; color: var(--paper); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tw-feud .tw-hate { text-align: center; color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent); padding: 1px 4px; }
.tw-feud em { font-style: normal; font-size: 11px; letter-spacing: .1em; color: var(--dim); text-align: right; }
.zpart.frontline { stroke: var(--warn); stroke-width: 1.1; stroke-dasharray: 2.5 1.5; }
.feud-tag text { fill: var(--warn); font-family: var(--mono); font-size: 3px; text-anchor: middle; paint-order: stroke; stroke: rgba(8,8,7,.9); stroke-width: .8px; pointer-events: none; }

/* coalition + police file */
.coalition-banner {
  border: 1px solid color-mix(in srgb, #8a4f9a 45%, transparent);
  border-left: 3px solid #8a4f9a; background: rgba(138,79,154,.08);
  padding: 10px 12px; margin: 10px 0;
}
.coalition-banner small { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .18em; color: #c9a3d4; }
.coalition-banner b { display: block; font-family: var(--display); font-size: 14px; letter-spacing: .05em; margin: 3px 0; }
.coalition-banner p { font-family: var(--type); font-size: 11px; line-height: 1.6; color: #b9b3a2; }
.police-file { border: 1px solid var(--line); padding: 10px; background: rgba(232,226,208,.02); }
.police-file .police-bar { margin-bottom: 8px; }
.police-file .btn-small { margin-top: 8px; width: 100%; }
.police-file.raid, .police-file.taskforce { border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.rf-status .stamp.pact, .tw-head .stamp.pact, .rival-head .stamp.pact { color: #c9a3d4; border-color: color-mix(in srgb, #8a4f9a 55%, transparent); }
.zpart.pact { stroke: #c9a3d4; stroke-width: 1.15; }
.dossier-strip { display: grid; gap: 4px; }
.dossier {
  display: grid; grid-template-columns: 8px 1fr auto; gap: 8px; align-items: center; width: 100%;
  background: none; border: 1px solid var(--line); padding: 6px 8px; cursor: pointer;
  font-family: var(--mono); font-size: 11px; color: var(--paper); text-align: left;
}
.dossier:hover { border-color: var(--line-2); background: rgba(232,226,208,.04); }
.dossier i { width: 8px; height: 8px; display: block; }
.dossier b { font-weight: 400; color: var(--dim); font-size: 11px; letter-spacing: .08em; }

/* ledger */
.finance { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.finance div { border: 1px solid var(--line); padding: 10px; background: rgba(232,226,208,.02); }
.finance small { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .16em; color: var(--dim); margin-bottom: 3px; }
.finance b { font-family: var(--display); font-size: 20px; }
.finance .ok { color: var(--ok); }
.finance .bad { color: var(--bad); }
.shop-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.shop { border: 1px solid var(--line); padding: 11px; background: rgba(232,226,208,.02); }
.shop.maxed { opacity: .55; }
.shop-top { display: flex; gap: 9px; align-items: center; }
.shop-top .icon { font-size: 18px; color: var(--warn); width: 20px; }
.shop-top h3 { font-family: var(--display); font-size: 14px; letter-spacing: .05em; }
.shop-top small { font-family: var(--mono); font-size: 11px; color: var(--gc); }
.shop-top .lvl { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--dim); }
.shop p { font-family: var(--mono); font-size: 11px; line-height: 1.5; color: var(--dim); margin-top: 6px; }

/* journal */
.chapters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.chapter { display: flex; gap: 9px; border: 1px solid var(--line); padding: 9px; opacity: .4; }
.chapter.on { opacity: 1; border-color: var(--line-2); }
.chapter b { font-family: var(--display); font-size: 24px; color: transparent; -webkit-text-stroke: 1px var(--dim); }
.chapter.on b { -webkit-text-stroke-color: var(--gc); }
.chapter h4 { font-family: var(--display); font-size: 11px; letter-spacing: .08em; }
.chapter span { font-family: var(--mono); font-size: 11px; color: var(--dim); }
.log { list-style: none; display: grid; gap: 5px; max-height: 320px; overflow-y: auto; }
.log li { display: grid; grid-template-columns: 32px 1fr; gap: 8px; font-family: var(--mono); font-size: 11px; line-height: 1.5; color: #b9b3a2; border-bottom: 1px dashed var(--line); padding-bottom: 4px; }
.log li span { color: var(--warn); }
.codex-list { display: grid; gap: 7px; }
.codex { border-left: 2px solid var(--line-2); padding-left: 9px; display: grid; gap: 2px; }
.codex b { font-family: var(--display); font-size: 12.5px; letter-spacing: .06em; }
.codex span { font-family: var(--mono); font-size: 11px; line-height: 1.5; color: var(--dim); }

/* settings + data */
.setting-row { display: flex; justify-content: space-between; gap: 20px; align-items: center; border-bottom: 1px solid var(--line); padding: 12px 0; }
.setting-row b { font-family: var(--display); font-size: 14px; letter-spacing: .06em; }
.setting-row p { font-family: var(--mono); font-size: 11px; line-height: 1.5; color: var(--dim); margin-top: 3px; max-width: 52ch; }
.toggle { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; border: 1px solid var(--line-2); background: none; color: var(--dim); padding: 7px 15px; cursor: pointer; }
.toggle.on { background: var(--ok); color: #12100c; border-color: var(--ok); }
.notice { border: 1px solid rgba(240,180,41,.35); background: rgba(240,180,41,.05); padding: 12px; margin-top: 10px; }
.notice b { font-family: var(--display); font-size: 13.5px; letter-spacing: .08em; color: var(--warn); }
.notice p { font-family: var(--mono); font-size: 11px; line-height: 1.6; color: #cfc9b8; margin-top: 6px; }
.notice.hard { border-color: rgba(194,59,46,.45); background: rgba(194,59,46,.07); }
.notice.hard b { color: var(--hot); }
.data-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 12px; }
.data-card { border: 1px solid var(--line); padding: 11px; display: flex; flex-direction: column; gap: 3px; background: rgba(232,226,208,.02); }
.data-card b { font-family: var(--display); font-size: 13.5px; letter-spacing: .06em; }
.data-card p { font-family: var(--mono); font-size: 11px; line-height: 1.5; color: var(--dim); }
.filebtn { display: block; text-align: center; font-family: var(--mono); font-size: 11px; letter-spacing: .12em; border: 1px solid var(--line-2); padding: 8px; cursor: pointer; margin-top: 6px; }
.filebtn:hover { background: var(--paper); color: #12100c; }
.filebtn input { display: none; }
.paste { width: 100%; min-height: 56px; margin-top: 6px; background: rgba(0,0,0,.45); border: 1px solid var(--line); color: var(--paper); font-family: var(--mono); font-size: 11px; padding: 7px; resize: vertical; }
.badges { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.badge { border: 1px solid var(--line); padding: 9px; opacity: .5; }
.badge.on { opacity: 1; border-color: rgba(167,201,87,.4); background: rgba(167,201,87,.05); }
.badge b { display: block; font-family: var(--display); font-size: 12.5px; letter-spacing: .06em; }
.badge span { display: block; font-family: var(--mono); font-size: 11px; line-height: 1.4; color: var(--dim); margin: 3px 0; }
.badge i { font-style: normal; font-family: var(--mono); font-size: 11px; letter-spacing: .14em; color: var(--ok); }

/* ==========================================================================
   Event card / dawn / endings
   ========================================================================== */
.event-overlay { align-items: center; justify-content: center; }
.event-card {
  width: min(640px, 100%); background: #100f0d; background-image: var(--noise);
  background-blend-mode: multiply; border: 1px solid var(--line-2);
  padding: 24px; box-shadow: 0 30px 80px rgba(0,0,0,.8);
  animation: panelin .3s cubic-bezier(.16, 1, .3, 1); position: relative;
}
.event-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--hot); }
.event-card small { font-family: var(--mono); font-size: 11px; letter-spacing: .28em; color: var(--hot); }
.event-card h2 { font-family: var(--display); font-size: 30px; line-height: .94; text-transform: uppercase; margin: 9px 0 12px; letter-spacing: .01em; }
.event-card .body, .event-card .result { font-family: var(--type); font-size: 13.5px; line-height: 1.8; color: #d6cfbe; }
.choices { display: grid; gap: 5px; margin-top: 16px; }
.choice { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: left; background: rgba(232,226,208,.03); border: 1px solid var(--line); color: var(--paper); padding: 11px 13px; cursor: pointer; transition: .15s; }
.choice b { font-family: var(--display); font-size: 13.5px; letter-spacing: .06em; }
.choice em { font-style: normal; font-family: var(--mono); font-size: 11px; letter-spacing: .14em; color: var(--warn); }
.choice:hover { border-color: var(--warn); background: rgba(240,180,41,.08); transform: translateX(3px); }
.effects { list-style: none; margin-top: 12px; display: grid; gap: 3px; }
.effects li { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; color: var(--ok); }
.effects li::before { content: "▸ "; }

.dawn-overlay { align-items: center; justify-content: center; }
.tabloid {
  width: min(700px, 100%); background: #e8e2d0; color: #12100c; padding: 20px 22px 22px;
  box-shadow: 0 30px 90px rgba(0,0,0,.85); position: relative;
  animation: panelin .35s cubic-bezier(.16, 1, .3, 1);
  background-image: var(--noise); background-blend-mode: multiply;
}
.tabloid-top { display: flex; justify-content: space-between; font-family: var(--type); font-size: 11px; letter-spacing: .16em; color: #4a453a; border-bottom: 3px solid #12100c; padding-bottom: 5px; }
.headline { font-family: var(--display); font-size: clamp(30px, 4.4vw, 48px); line-height: .88; letter-spacing: .01em; text-transform: uppercase; margin: 12px 0 7px; color: #12100c; }
.subhead { font-family: var(--type); font-size: 12.5px; line-height: 1.5; color: #4a453a; }
.tabloid-rule { height: 1px; background: #12100c; margin: 12px 0; opacity: .5; }
.dawn-money { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.dawn-money small { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .16em; color: #6a6456; margin-bottom: 2px; }
.dawn-money b { font-family: var(--display); font-size: 17px; }
.dawn-money .ok { color: #3d6b1f; }
.dawn-money .bad { color: #a8261f; }
.dawn-block { border-top: 1px solid rgba(18,16,12,.25); padding-top: 9px; margin-top: 9px; }
.dawn-block h3 { font-family: var(--display); font-size: 12.5px; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 5px; }
.dawn-block p, .dawn-block li { font-family: var(--type); font-size: 11px; line-height: 1.6; color: #3a352b; }
.dawn-block ul { list-style: none; display: grid; gap: 2px; }
.dawn-block li::before { content: "— "; }
.dawn-block.police h3 { color: #a8261f; }
.dawn-block.coalition h3 { color: #7a2f8a; }
.dawn-block .case-num { font-size: 11px; letter-spacing: .1em; opacity: .7; margin-left: 6px; }
.dawn-block.chapter-up { background: rgba(18,16,12,.06); padding: 9px; }
.cliff { margin-top: 12px; border-top: 3px solid #12100c; padding-top: 9px; }
.cliff span { font-family: var(--mono); font-size: 11px; letter-spacing: .2em; color: #a8261f; }
.cliff p { font-family: var(--type); font-size: 13.5px; line-height: 1.6; margin-top: 3px; font-weight: 700; }
.dawn-actions { margin-top: 14px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.dawn-actions .btn { background: #12100c; color: #e8e2d0; box-shadow: 4px 4px 0 #a8261f; }

.firstrun { align-items: center; justify-content: center; }
.firstrun-card { width: min(580px, 100%); background: #100f0d; background-image: var(--noise); background-blend-mode: multiply; border: 1px solid var(--line-2); padding: 26px; }
.firstrun-card small { font-family: var(--mono); font-size: 11px; letter-spacing: .28em; color: var(--hot); }
.firstrun-card h2 { font-family: var(--display); font-size: 34px; line-height: .92; text-transform: uppercase; margin: 10px 0 14px; }
.firstrun-card p { font-family: var(--type); font-size: 12.5px; line-height: 1.7; color: #d6cfbe; margin-bottom: 9px; }
.firstrun-card ul { margin: 0 0 12px 18px; display: grid; gap: 5px; }
.firstrun-card li { font-family: var(--mono); font-size: 11px; line-height: 1.5; color: #b9b3a2; }
.firstrun-card code { color: var(--yellow); }
.firstrun-card .strong { color: var(--paper); }
.firstrun-card .btn { margin-top: 6px; }

.endrun { align-items: center; justify-content: center; }
.endrun-card { width: min(680px, 100%); background: #100f0d; background-image: var(--noise); background-blend-mode: multiply; border: 1px solid var(--line-2); padding: 28px; text-align: center; }
.endrun-card small { font-family: var(--mono); font-size: 11px; letter-spacing: .28em; color: var(--hot); }
.endrun-card h2 { font-family: var(--display); font-size: clamp(40px, 6vw, 68px); line-height: .84; letter-spacing: .01em; text-transform: uppercase; margin: 12px 0 16px; }
.endrun-card p { font-family: var(--type); font-size: 12.5px; line-height: 1.7; color: #b9b3a2; max-width: 46ch; margin: 0 auto 16px; }
.end-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 16px 0; }
.end-stats small { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .16em; color: var(--dim); }
.end-stats b { font-family: var(--display); font-size: 24px; }
.earned { text-align: left; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.earned > b { font-family: var(--mono); font-size: 11px; letter-spacing: .2em; color: var(--ok); }
.end-actions { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; margin-top: 16px; align-items: center; }

/* ==========================================================================
   Title / create
   ========================================================================== */
.title-screen { position: absolute; inset: 0; overflow-y: auto; display: flex; }
.title-bg { position: fixed; inset: 0; z-index: 0; background: radial-gradient(60% 50% at 50% 20%, #1b1a17, #08080a 70%); }
.title-grain { position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .5; background-image: var(--noise); }
.skyline-lg { position: absolute; left: 0; right: 0; bottom: 0; height: 46vh; opacity: .9; }
.skyline-lg svg { width: 100%; height: 100%; }
.title-inner { position: relative; z-index: 2; width: min(1120px, 100%); margin: auto; padding: 38px 6vw; }
.title-kicker { font-family: var(--mono); font-size: 11px; letter-spacing: .4em; color: var(--hot); margin-bottom: 14px; }
.title-mark { font-family: var(--display); font-size: clamp(64px, 12vw, 170px); line-height: .78; letter-spacing: -.01em; }
.title-mark .t1 { display: block; color: var(--paper); text-shadow: 3px 0 rgba(194,59,46,.5), -3px 0 rgba(57,215,208,.25); }
.title-mark .t2 { display: block; color: var(--hot); -webkit-text-stroke: 2px var(--hot); text-shadow: 6px 6px 0 rgba(0,0,0,.6); }
.title-mark .t2 em { font-style: normal; color: transparent; -webkit-text-stroke: 2px var(--paper); }
.title-sub { font-family: var(--mono); font-size: 11px; letter-spacing: .34em; color: var(--dim); margin: 16px 0 5px; }
.title-line { font-family: var(--type); font-size: 13.5px; letter-spacing: .02em; color: #cfc9b8; }
.title-graffiti { font-family: var(--tag); font-size: clamp(12px, 1.5vw, 20px); color: var(--yellow); transform: rotate(-4deg); margin-top: 12px; opacity: .85; letter-spacing: .05em; }
.title-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0; align-items: stretch; }
.title-actions .btn { flex-direction: column; align-items: flex-start; gap: 3px; padding: 13px 19px; }
.title-actions .btn span { line-height: 1.05; font-size: 14px; }
.title-actions .btn em { display: block; font-style: normal; font-family: var(--mono); font-size: 11px; letter-spacing: .1em; opacity: .75; }
.btn.big { padding: 17px 24px; font-size: 16px; }
.btn.ghost { background: transparent; color: var(--paper); border: 1px solid var(--line-2); box-shadow: none; }
.btn.ghost:hover { background: var(--paper); color: #12100c; }

.slot-list { width: min(600px, 100%); border-top: 1px solid var(--line); }
.slot-head { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; letter-spacing: .18em; color: var(--dim); padding: 9px 0; }
.slot-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); padding: 8px 0; }
.slot-row b { display: block; font-family: var(--display); font-size: 12.5px; letter-spacing: .05em; }
.slot-row span { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; color: var(--dim); }
.slot-row.empty { opacity: .45; }
.slot-row.corrupt { color: var(--hot); }
.slot-btns { display: flex; gap: 3px; }
.btn-tiny { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; background: var(--warn); color: #12100c; border: 0; padding: 6px 9px; cursor: pointer; }
.btn-tiny.ghost { background: none; border: 1px solid var(--line-2); color: var(--dim); }
.btn-tiny:hover { filter: brightness(1.12); }
.title-foot { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin-top: 20px; }
.title-foot .link { text-decoration: none; }
.legacy-pill { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; color: var(--ok); border: 1px solid rgba(167,201,87,.35); padding: 4px 8px; }
.build-tag { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; color: var(--dim); }

.create-screen { position: absolute; inset: 0; overflow-y: auto; }
.create-inner { width: min(1040px, 100%); margin: 0 auto; padding: 30px 5vw 60px; }
.create-head small { font-family: var(--mono); font-size: 11px; letter-spacing: .28em; color: var(--hot); }
.create-head h1 { font-family: var(--display); font-size: clamp(36px, 5vw, 64px); line-height: .88; letter-spacing: .01em; text-transform: uppercase; margin: 8px 0 6px; }
.create-head p { font-family: var(--type); font-size: 12.5px; color: var(--dim); }
.create-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; margin: 20px 0; }
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .2em; color: var(--dim); margin-bottom: 6px; }
.field input { width: 100%; background: rgba(0,0,0,.45); border: 1px solid var(--line-2); color: var(--paper); font-family: var(--display); font-size: 17px; letter-spacing: .04em; padding: 10px; outline: none; }
.field input:focus { border-color: var(--gc); }
.field-note { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .14em; color: var(--gc); margin-top: 5px; font-style: normal; }
.swatches { display: flex; gap: 5px; flex-wrap: wrap; }
.swatch { width: 32px; height: 32px; border: 1px solid rgba(232,226,208,.2); background: var(--sw); cursor: pointer; position: relative; }
.swatch.on { outline: 2px solid var(--paper); outline-offset: 2px; }
.emblems { display: flex; gap: 4px; flex-wrap: wrap; }
.emblem { width: 36px; height: 36px; background: rgba(232,226,208,.03); border: 1px solid var(--line); color: var(--paper); font-size: 17px; cursor: pointer; }
.emblem.on { border-color: var(--warn); background: rgba(240,180,41,.1); color: var(--warn); }
.diffs { display: grid; gap: 5px; }
.diff { text-align: left; background: rgba(232,226,208,.03); border: 1px solid var(--line); color: var(--paper); padding: 9px 11px; cursor: pointer; }
.diff b { display: block; font-family: var(--display); font-size: 13.5px; letter-spacing: .08em; }
.diff span { display: block; font-family: var(--mono); font-size: 11px; line-height: 1.45; color: var(--dim); margin-top: 2px; }
.diff em { display: inline-block; font-style: normal; font-family: var(--mono); font-size: 11px; letter-spacing: .12em; color: var(--hot); margin-top: 4px; }
.diff.on { border-color: var(--warn); background: rgba(240,180,41,.07); }
.create-actions { display: flex; justify-content: space-between; align-items: center; gap: 14px; border-top: 1px solid var(--line); padding-top: 16px; }

/* ==========================================================================
   Combat
   ========================================================================== */
.combat-overlay { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; background: rgba(4,4,3,.97); backdrop-filter: blur(6px); padding: 18px; }
.combat { width: min(640px, 100%); background: #100f0d; background-image: var(--noise); background-blend-mode: multiply; border: 1px solid var(--line-2); padding: 22px; text-align: center; }
.combat-head small { font-family: var(--mono); font-size: 11px; letter-spacing: .28em; color: var(--hot); }
.combat-head h2 { font-family: var(--display); font-size: 34px; letter-spacing: .05em; margin: 5px 0 3px; }
.combat-head span { font-family: var(--mono); font-size: 11px; letter-spacing: .18em; color: var(--dim); }
.arena { display: flex; align-items: flex-end; justify-content: center; gap: 24px; margin: 28px 0 18px; height: 128px; }
.fighter { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.fighter i { display: block; width: 52px; height: 100px; background: var(--gc, var(--cyan)); filter: drop-shadow(0 0 14px rgba(57,215,208,.45)); clip-path: polygon(35% 0, 65% 0, 70% 28%, 90% 45%, 72% 55%, 80% 100%, 54% 100%, 50% 70%, 45% 100%, 20% 100%, 28% 55%, 10% 45%, 30% 28%); transition: transform .12s; }
.fighter.them i { background: var(--ec, var(--hot)); filter: drop-shadow(0 0 14px rgba(194,59,46,.5)); transform: scaleX(-1); }
.fighter b { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; color: var(--dim); }
.vs { font-family: var(--mono); font-size: 11px; color: var(--dim); padding-bottom: 32px; }
.arena.strike .fighter.you i { transform: translate(8px, -4px) rotate(5deg); }
.arena.strike .fighter.them i { transform: scaleX(-1) translate(10px, -5px) rotate(-8deg); }
.exchange { font-family: var(--mono); font-size: 12.5px; letter-spacing: .16em; color: var(--dim); min-height: 16px; margin-bottom: 10px; }
.exchange.crit { color: var(--warn); }
.exchange.hit { color: var(--ok); }
.exchange.miss { color: var(--hot); }
.exchange.countered { text-shadow: 0 0 12px currentColor; }
.tell { font-family: var(--mono); font-size: 11px; letter-spacing: .2em; color: var(--warn); min-height: 12px; margin-bottom: 10px; }
.stances { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 12px; }
.stance {
  background: none; border: 1px solid var(--line); padding: 7px 4px; cursor: pointer;
  font-family: var(--mono); color: var(--paper); display: grid; gap: 2px; text-align: center;
}
.stance b { font-size: 11px; letter-spacing: .14em; }
.stance em { font-style: normal; font-size: 11px; letter-spacing: .1em; color: var(--dim); }
.stance:hover { border-color: var(--line-2); background: rgba(232,226,208,.04); }
.stance.on { border-color: var(--gc); background: color-mix(in srgb, var(--gc) 16%, transparent); }
.stance.on em { color: var(--paper); }
.rounds i.countered { box-shadow: 0 0 10px currentColor; }
.combat.showdown { border-color: var(--warn); box-shadow: 0 0 40px rgba(240,180,41,.18); }
.combat.showdown .combat-head small { color: var(--warn); }
.timing-track { position: relative; height: 30px; background: rgba(232,226,208,.06); border: 1px solid var(--line); overflow: hidden; }
.zone { position: absolute; top: 0; bottom: 0; }
.zone.amber { left: 31%; width: 38%; background: rgba(240,180,41,.16); }
.zone.green { left: 41%; width: 18%; background: rgba(167,201,87,.3); }
.needle { position: absolute; top: -4px; bottom: -4px; width: 3px; background: var(--paper); box-shadow: 0 0 12px var(--paper); left: 50%; transform: translateX(-50%); }
.timing-labels { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; letter-spacing: .1em; color: var(--dim); margin-top: 3px; padding: 0 4px; }
.rounds { display: flex; justify-content: center; gap: 7px; margin: 12px 0; }
.rounds i { width: 26px; height: 4px; background: rgba(232,226,208,.14); display: block; }
.rounds i.hit { background: var(--ok); }
.rounds i.crit { background: var(--warn); box-shadow: 0 0 10px var(--warn); }
.rounds i.miss { background: var(--hot); }
.combat .btn { width: 100%; justify-content: center; }
.combat .btn em { font-style: normal; font-family: var(--mono); font-size: 11px; letter-spacing: .22em; opacity: .65; }
.combat-hint { font-family: var(--mono); font-size: 11px; letter-spacing: .06em; color: var(--dim); margin-top: 8px; }
.combat.result h2 { font-family: var(--display); font-size: 44px; }
.combat.result.win h2 { color: var(--ok); }
.combat.result.loss h2 { color: var(--hot); }
.fight-math { display: flex; justify-content: center; gap: 22px; font-family: var(--mono); font-size: 11px; letter-spacing: .1em; color: var(--dim); margin: 10px 0; }
.fight-math b { color: var(--paper); font-size: 16px; }
.combat-lines { list-style: none; display: grid; gap: 5px; margin: 12px 0 16px; }
.combat-lines li { font-family: var(--mono); font-size: 11px; line-height: 1.5; color: #cfc9b8; }

/* toast */
.toast { z-index: 200; max-width: min(560px, 90vw); text-align: center; background: var(--paper); color: #12100c; font-family: var(--mono); font-size: 12.5px; letter-spacing: .06em; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1500px) {
  .g-hud { gap: 12px; }
  .g-stats { gap: 11px; }
  .g-gang small { display: none; }
}

@media (max-width: 1220px) {
  .g-body { grid-template-columns: minmax(0, 1fr) 356px; }
  .g-gang { display: none; }
}

@media (max-width: 900px) {
  .g-hud { flex-wrap: wrap; gap: 8px 14px; padding: 9px 12px; }
  .g-clock { order: 2; }
  .g-stats { order: 3; width: 100%; gap: 13px; }
  /* Map fills the body; the orders panel is a sheet that slides up over it.
     Peek shows the handle, open shows the orders, full shows everything. */
  .g-body { display: block; position: relative; overflow: hidden; }
  .g-mapwrap { position: absolute; inset: 0; border-right: 0; border-bottom: 0; }
  .sheet-handle {
    display: flex; align-items: center; gap: 10px;
    position: sticky; top: 0; z-index: 8;
    width: calc(100% + 32px); margin: 0 -16px 6px; padding: 10px 16px 9px;
    background: linear-gradient(180deg, #171715, #101010);
    border: 0; border-bottom: 1px solid var(--line);
    font: inherit; color: inherit; text-align: left; appearance: none;
    cursor: pointer; user-select: none; touch-action: manipulation;
  }
  .sheet-handle .grip {
    width: 34px; height: 4px; border-radius: 2px;
    background: var(--line-2); flex: 0 0 auto;
  }
  .sheet-handle b {
    flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-family: var(--mono); font-size: 11px; letter-spacing: .14em; color: var(--paper);
  }
  .sheet-handle i {
    font-style: normal; font-family: var(--mono); font-size: 11px;
    letter-spacing: .16em; color: var(--warn); flex: 0 0 auto;
  }
  .g-drawer .drawer-back { margin-top: 2px; }
  .g-mapwrap .map-layers { bottom: calc(74px + env(safe-area-inset-bottom, 0px)); top: auto; }
  .drawer-cue { display: block; }
  .map-key, .g-rail { display: none; }
  .roster-grid, .shop-grid, .data-grid, .badges, .soldier-card { grid-template-columns: 1fr 1fr; }
  .finance, .dawn-money, .end-stats { grid-template-columns: repeat(2, 1fr); }
  .create-grid { grid-template-columns: 1fr; }
  .chapters { grid-template-columns: 1fr; }
  .overlay { padding: 0; }
  .panel { max-height: 100vh; border: 0; }
  .tabloid, .event-card, .firstrun-card, .endrun-card { max-height: 100vh; overflow-y: auto; }
  .core-edit-row { grid-template-columns: 20px 110px 1fr; }
}

@media (max-width: 620px) {
  .borolabel { display: none; }
  .g-hud { gap: 6px 10px; padding: 8px 10px; }
  .g-clock strong { font-size: 21px; }
  .g-stats { gap: 10px; }
  .g-stats > div { min-width: 38px; }
  .act-grid { grid-template-columns: 1fr; gap: 3px; }
  .act { padding: 9px 8px; }
  .act span { display: none; }
  .act b { font-size: 13.5px; }
  .act i { font-size: 11px; }
  .assign { min-height: 44px; }
  .g-drawer { padding: 12px 12px 18px; }
}

/* ==========================================================================
   Jobs, influence, help
   ========================================================================== */
.g-jobs {
  display: flex; align-items: center; gap: 12px;
  padding: 6px 18px; min-height: 32px;
  background: linear-gradient(180deg, rgba(20,20,17,.97), rgba(13,13,11,.95));
  border-bottom: 1px solid rgba(232,226,208,.1);
  font-family: var(--mono); font-size: 11px; letter-spacing: .06em; color: var(--dim);
}
.g-jobs .job-label { color: var(--hot); letter-spacing: .22em; font-size: 11px; flex: none; }
.g-jobs .job-name {
  font-family: var(--bangers); font-size: 16px; letter-spacing: .06em; color: var(--paper);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px;
}
.g-jobs.done .job-name { color: var(--ok); }
.job-bar { flex: 1; height: 4px; background: rgba(232,226,208,.12); max-width: 300px; border: 1px solid rgba(0,0,0,.4); }
.job-bar i { display: block; height: 100%; background: var(--warn); transition: width .4s; }
.g-jobs .job-prog { color: var(--paper); flex: none; }
.g-jobs button {
  background: none; border: 1px solid var(--line); color: var(--dim);
  font-family: var(--mono); font-size: 11px; letter-spacing: .12em; padding: 3px 7px; cursor: pointer;
  flex: none;
}
.g-jobs button:hover { background: var(--paper); color: #12100c; }

.g-stats .inf b i { display: block; font-size: 11px; letter-spacing: .12em; color: var(--cyan); margin-top: 1px; }

.job-title { display: block; font-family: var(--bangers); font-size: 20px; letter-spacing: .05em; margin-bottom: 4px; }
.hint-line {
  font-family: var(--type); font-size: 11px; line-height: 1.55; color: var(--warn);
  border-left: 2px solid var(--warn); padding: 6px 9px;
  background: rgba(240,180,41,.05); margin-bottom: 10px;
}
.tutorial ul { list-style: none; display: grid; gap: 4px; margin-top: 4px; }
.tutorial li { display: flex; gap: 8px; font-family: var(--mono); font-size: 11px; color: var(--dim); }
.tutorial li i { font-style: normal; width: 12px; color: var(--dim); }
.tutorial li.done { color: var(--ok); }
.tutorial li.done i { color: var(--ok); }

.leaderboard { display: grid; gap: 3px; border: 1px solid var(--line); padding: 8px; background: rgba(0,0,0,.25); }
.lb-row {
  display: grid; grid-template-columns: 22px 10px 1fr 120px 44px; gap: 8px; align-items: center;
  font-family: var(--mono); font-size: 11px; color: #cfc9b8; padding: 4px 0;
  border-bottom: 1px dashed rgba(232,226,208,.1);
}
.lb-row:last-child { border-bottom: 0; }
.lb-row.you { background: rgba(240,180,41,.07); color: var(--paper); }
.lb-row.dead { opacity: .45; }
.lb-rank { color: var(--dim); text-align: right; }
.lb-row i { width: 9px; height: 9px; display: block; transform: rotate(45deg); }
.lb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-bar { height: 5px; background: rgba(232,226,208,.1); overflow: hidden; }
.lb-bar i { display: block; height: 100%; }
.lb-row b { text-align: right; color: var(--paper); }

.tabs { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 14px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.tabs button {
  font-family: var(--mono); font-size: 11px; letter-spacing: .14em;
  background: none; border: 1px solid var(--line); color: var(--dim); padding: 6px 9px; cursor: pointer;
}
.tabs button.on { background: var(--warn); border-color: var(--warn); color: #12100c; }
.help-tabs button { font-size: 11px; letter-spacing: .1em; }

.job-main { margin-bottom: 8px; }
.job-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.job-card { border: 1px solid var(--line); padding: 12px; background: rgba(232,226,208,.02); }
.job-card.optional { border-style: dashed; }
.job-card-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.job-card-head b { font-family: var(--bangers); font-size: 16px; letter-spacing: .05em; }
.job-card-head span { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; color: var(--dim); }
.job-card p { font-family: var(--type); font-size: 11px; line-height: 1.5; color: #b9b3a2; margin: 5px 0 8px; }
.job-progress { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.job-progress .bar { margin: 0; }
.job-progress span { font-family: var(--mono); font-size: 11px; color: var(--paper); }
.job-reward { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; color: var(--ok); margin-top: 6px; }
.done-list { display: flex; flex-wrap: wrap; gap: 5px; }
.done-list span { font-family: var(--bangers); font-size: 12.5px; letter-spacing: .06em; border: 1px solid rgba(167,201,87,.3); color: var(--ok); padding: 2px 7px; }

.help-section { border-left: 2px solid var(--gc); padding-left: 14px; }
.help-section h3 { font-family: var(--display); font-size: 20px; letter-spacing: .04em; margin-bottom: 8px; }
.help-section p { font-family: var(--type); font-size: 12.5px; line-height: 1.7; color: #cfc9b8; margin-bottom: 8px; }

.dawn-influence {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  border-top: 1px solid rgba(18,16,12,.25); padding-top: 9px; margin-top: 9px;
}
.dawn-influence small { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .16em; color: #6a6456; }
.dawn-influence b { font-family: var(--display); font-size: 16px; color: #12100c; }
.dawn-influence .ok { color: #3d6b1f; }
.dawn-influence .bad { color: #a8261f; }

.tier-line {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  border: 1px solid var(--line); padding: 8px 10px; margin-top: 8px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .08em; color: var(--dim);
}
.tier-line b { color: var(--paper); }

.up.locked { opacity: .55; }
.up.locked i { color: var(--hot); }
.shop.locked { opacity: .65; }

@media (max-width: 1220px) {
  .g-jobs .job-name { max-width: 160px; }
}
@media (max-width: 900px) {
  .g-jobs {
    display: grid; gap: 4px 6px; padding: 5px 12px 7px;
    grid-template-columns: auto minmax(0, 1fr) auto auto auto;
    grid-template-areas: "label name prog advise jobs" "bar bar bar bar bar";
    align-items: center;
  }
  .g-jobs .job-label { grid-area: label; }
  .g-jobs .job-name { grid-area: name; max-width: none; font-size: 15px; }
  .g-jobs .job-prog { grid-area: prog; }
  .g-jobs .job-bar { grid-area: bar; min-width: 0; width: 100%; max-width: none; height: 3px; }
  .g-jobs [data-act="advise"] { grid-area: advise; }
  .g-jobs [data-open="journal"] { grid-area: jobs; }
  .g-jobs [data-act="locate-job"] { display: none; }
  .g-jobs button { padding: 0 7px; font-size: 11px; }
  .g-jobs.done { display: flex; flex-wrap: wrap; }
  .job-grid { grid-template-columns: 1fr; }
  .lb-row { grid-template-columns: 20px 10px 1fr 70px 40px; }
}

/* ==========================================================================
   TYPOGRAPHY PASS (phase 6.1)
   Body copy is the comic-book voice now; numbers, labels and tabs stay
   condensed. Those prose rules were sized for a 9–12px typewriter face and
   are not readable in a rounded face at that size, so they get a real size,
   real leading, and sentence case.
   ========================================================================== */
.drawer-head .motto,
.obj,
.radio,
.rival p,
.rf-blurb,
.coalition-banner p,
.event-card .body,
.event-card .result,
.subhead,
.dawn-block p,
.dawn-block li,
.cliff p,
.firstrun-card p,
.endrun-card p,
.title-line,
.create-head p,
.job-card p,
.help-section p,
.hint-line {
  font-family: var(--font-body);
  letter-spacing: 0;
  text-transform: none;
  line-height: var(--leading-body);
}
.drawer-head .motto { font-size: 13.5px; color: #b9b3a2; }
.obj { font-size: 14px; color: #d6cfbe; }
.radio { font-size: 14px; color: #d8d1c0; font-style: italic; }
.rival p { font-size: 13.5px; }
.rf-blurb { font-size: 14.5px; line-height: 1.6; }
.coalition-banner p { font-size: 13.5px; }
.event-card .body,
.event-card .result { font-size: 16px; line-height: 1.66; }
.subhead { font-size: 14px; line-height: 1.55; }
.dawn-block p,
.dawn-block li { font-size: 14px; line-height: 1.6; }
.cliff p { font-size: 16px; }
.firstrun-card p { font-size: 14.5px; }
.endrun-card p { font-size: 14.5px; max-width: 52ch; }
.title-line { font-size: 16px; line-height: 1.6; color: #d5cfbe; max-width: 46ch; margin: 0 auto; }
.create-head p { font-size: 14.5px; line-height: 1.6; }
.job-card p { font-size: 13.5px; line-height: 1.55; }
.help-section p { font-size: 14.5px; line-height: 1.68; }
.hint-line { font-size: 13.5px; line-height: 1.55; }

/* the smallest meta labels get a readable floor without losing their voice */
.tabs button, .help-tabs button { font-size: 11px; }
.g-jobs button { font-size: 11px; }
.g-stats .inf b i { font-size: 11px; }
.job-card-head span { font-size: 11px; }
.job-card .job-reward { font-size: 11px; }

/* ==========================================================================
   THEMED SCROLLBARS (game)
   The page-level bar is set in night.css; inside the shell it gets thinner so
   it reads as part of a panel edge, and horizontal nav strips keep a stub bar.
   ========================================================================== */
@supports not selector(::-webkit-scrollbar) {
  .g-drawer, .panel-body, .log, .tabloid, .event-card,
  .firstrun-card, .endrun-card, .create-screen {
    scrollbar-width: thin;
    scrollbar-color: rgba(194,59,46,.92) rgba(0,0,0,.45);
  }
}
.g-drawer::-webkit-scrollbar,
.panel-body::-webkit-scrollbar,
.log::-webkit-scrollbar,
.tabloid::-webkit-scrollbar,
.event-card::-webkit-scrollbar,
.firstrun-card::-webkit-scrollbar,
.endrun-card::-webkit-scrollbar { width: 8px; height: 8px; }
.g-drawer::-webkit-scrollbar-track,
.panel-body::-webkit-scrollbar-track,
.log::-webkit-scrollbar-track,
.tabloid::-webkit-scrollbar-track,
.event-card::-webkit-scrollbar-track,
.firstrun-card::-webkit-scrollbar-track,
.endrun-card::-webkit-scrollbar-track { background: rgba(0,0,0,.45); border-left: 0; }
.g-drawer::-webkit-scrollbar-thumb,
.panel-body::-webkit-scrollbar-thumb,
.log::-webkit-scrollbar-thumb,
.tabloid::-webkit-scrollbar-thumb,
.event-card::-webkit-scrollbar-thumb,
.firstrun-card::-webkit-scrollbar-thumb,
.endrun-card::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--hot), var(--blood));
  border: 1px solid #0c0c0a;
}
.g-drawer::-webkit-scrollbar-thumb:hover,
.panel-body::-webkit-scrollbar-thumb:hover,
.log::-webkit-scrollbar-thumb:hover,
.tabloid::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, var(--yellow), var(--hot)); }

/* horizontal strips: a thin rail, not a slab */
.g-nav::-webkit-scrollbar, .doc-nav::-webkit-scrollbar { height: 5px; }
.g-nav::-webkit-scrollbar-track, .doc-nav::-webkit-scrollbar-track { background: transparent; border-left: 0; }

/* ==========================================================================
   LEGIBILITY PASS (follow-up to the phase 6 typography pass)
   The feedback was specific: text over the concrete/skyline textures is hard
   to read. Three fixes — bigger prose, brighter muted colour, calmer texture
   behind the words. Labels moved from 8–10px to a flat 11px; body copy gets
   15–16.5px with 1.6+ leading.
   ========================================================================== */
.game-body { --dim: #b8b1a1; }

.drawer-head .motto { font-size: 15px; color: #cfc8b6; }
.obj { font-size: 15.5px; color: #e2dccb; }
.radio { font-size: 15.5px; color: #e2dccb; }
.rival p { font-size: 14.5px; color: #ccc5b4; }
.rf-blurb { font-size: 15.5px; color: #d5cebd; }
.coalition-banner p { font-size: 14.5px; color: #ccc5b4; }
.event-card .body,
.event-card .result { font-size: 16.5px; line-height: 1.7; color: #e2dccb; }
.subhead { font-size: 15px; line-height: 1.55; color: #3a3428; }
.dawn-block p,
.dawn-block li { font-size: 15px; line-height: 1.62; color: #2c281f; }
.cliff p { font-size: 16px; }
.firstrun-card p { font-size: 15.5px; color: #e0dac9; }
.endrun-card p { font-size: 15.5px; color: #c9c2b1; }
.title-line { font-size: 18px; line-height: 1.6; color: #e0dac9; max-width: 44ch; }
.create-head p { font-size: 15.5px; color: #c2bcaa; }
.job-card p { font-size: 14.5px; color: #c9c2b1; }
.help-section p { font-size: 16px; color: #ded8c7; }
.hint-line { font-size: 15px; line-height: 1.55; }
.fine { font-size: 11.5px; line-height: 1.65; }
.dawn-block h3 { font-size: 13px; }
.tabloid-top, .cliff span { color: #403a2e; }

/* surfaces: shut the texture out from behind running text */
.overlay { background: rgba(4,4,3,.88); }
.title-grain { opacity: .2; }
.event-card, .panel { background-color: #16150f; }
.map-tip { background: rgba(9,9,8,.97); }

/* the bigger HUD labels need room before they clip: wrap the shell head
   instead of pushing the nav off the right edge on tablet widths */
@media (max-width: 1180px) {
  .g-hud { flex-wrap: wrap; gap: 8px 12px; padding: 8px 12px; }
  .g-stats { flex: 1 1 260px; gap: 10px; }
}
.g-drawer { overflow-x: hidden; }

/* the pre-play page shares the same body voice and contrast */
.play-shell { font-family: var(--font-body); }

/* ==========================================================================
   ATMOSPHERE (game) — title props, drifting title light, map sweep
   ========================================================================== */
.title-props {
  display: flex; gap: clamp(14px, 2vw, 26px); align-items: center;
  margin: 16px 0 2px; color: rgba(232,226,208,.44);
}
.title-props .prop { width: clamp(30px, 3.2vw, 46px); height: clamp(30px, 3.2vw, 46px); }
.title-props .prop:nth-child(2) { transform: rotate(12deg); }
.title-props .prop:nth-child(3) { transform: rotate(-9deg); }
.title-props .prop:nth-child(4) { transform: rotate(6deg); }

.title-bg { animation: titleDrift 34s ease-in-out infinite alternate; transform-origin: 50% 30%; }
@keyframes titleDrift {
  from { transform: scale(1); }
  to   { transform: scale(1.06) translate3d(0, -1%, 0); }
}

.g-mapwrap::after {
  content: ""; position: absolute; inset: -20%; z-index: 1; pointer-events: none;
  background:
    radial-gradient(28% 22% at 30% 25%, rgba(240,180,41,.07), transparent 70%),
    radial-gradient(24% 20% at 70% 70%, rgba(57,215,208,.05), transparent 70%);
  animation: mapSweep 46s ease-in-out infinite alternate;
  will-change: transform;
}
@keyframes mapSweep {
  from { transform: translate3d(-5%, -2%, 0); }
  to   { transform: translate3d(5%, 3%, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .g-mapwrap::after { animation: none !important; }
}

/* ==========================================================================
   PHASE 7 — ONE MENU, ONE SHEET
   The old HUD carried eight tiny nav buttons that wrapped and shrank on
   tablets. It is replaced by a single MENU button that opens a real dialog,
   and the mobile orders drawer is rebuilt as a snap-point sheet with a
   sticky order bar.
   ========================================================================== */

/* ---------- HUD actions ---------- */
.g-actions { display: flex; align-items: center; gap: 8px; flex: none; margin-left: auto; }

.g-menu-btn {
  display: inline-flex; align-items: center; gap: 9px;
  min-height: 44px; padding: 0 14px;
  background: rgba(0,0,0,.5); border: 1px solid var(--line-2); color: var(--paper);
  font-family: var(--mono); font-size: 12px; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase; cursor: pointer;
  box-shadow: 3px 3px 0 rgba(0,0,0,.55); transition: background .15s, color .15s, border-color .15s;
}
.g-menu-btn .bars { display: grid; gap: 3px; }
.g-menu-btn .bars i { display: block; width: 16px; height: 2px; background: var(--hot); transition: background .15s; }
.g-menu-btn:hover { background: var(--paper); color: #12100c; border-color: var(--paper); }
.g-menu-btn:hover .bars i { background: #12100c; }
.g-menu-btn:active { transform: translateY(1px); box-shadow: 1px 1px 0 rgba(0,0,0,.55); }
.g-menu-btn[aria-expanded="true"] { background: var(--hot); border-color: #000; color: var(--paper); }
.g-menu-btn[aria-expanded="true"] .bars i { background: var(--paper); }

.g-end-btn {
  min-height: 44px; padding: 0 18px;
  background: var(--hot); border: 1px solid #000; color: var(--paper);
  font-family: var(--mono); font-size: 12.5px; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; cursor: pointer; box-shadow: 4px 4px 0 rgba(0,0,0,.6);
  transform: rotate(-.5deg); transition: background .15s, color .15s;
}
.g-end-btn:hover { background: var(--warn); color: #12100c; }

/* ---------- menu panel ---------- */
.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.menu-item {
  display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; align-items: center;
  min-height: 64px; padding: 12px 14px;
  background: #14140f; border: 1px solid var(--line); border-left: 3px solid var(--hot);
  color: var(--paper); font-family: var(--display); font-size: 19px; letter-spacing: .06em;
  text-transform: uppercase; text-align: left; text-decoration: none; cursor: pointer;
  transition: background .15s, border-color .15s, transform .15s;
}
.menu-item > span { min-width: 0; }
.menu-item > i { font-style: normal; font-family: var(--mono); font-size: 14px; color: var(--dim); }
.menu-item small {
  grid-column: 1 / -1; font-family: var(--font-body); font-size: 13.5px;
  letter-spacing: 0; text-transform: none; line-height: 1.45; color: var(--dim);
}
.menu-item:hover, .menu-item:focus-visible {
  background: rgba(240,180,41,.1); border-left-color: var(--warn); transform: translateX(2px);
}
.menu-item.doc { border-left-color: var(--cyan); }
.menu-item.doc:hover, .menu-item.doc:focus-visible { border-left-color: var(--cyan); background: rgba(57,215,208,.1); }

.panel:focus { outline: none; }
.panel-foot { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.panel-foot .btn-small { width: auto; margin-top: 0; }
.panel-foot .link { margin-right: auto; }

.keylist { display: grid; gap: 0; margin: 0 0 14px; }
.keylist > div { display: grid; grid-template-columns: 120px 1fr; gap: 14px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--line); }
.keylist dt { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; color: var(--warn); }
.keylist dd { margin: 0; font-family: var(--font-body); font-size: 15px; line-height: 1.5; color: #ded8c7; }

/* ---------- shared sheet chrome (hidden on desktop) ---------- */
.sheet-scrim { display: none; }
.sheet-actions { display: none; }
.sheet-collapse { display: none; }

@media (max-width: 900px) {
  /* HUD: brand, clock, resources, then a full-width action row. */
  .g-actions { order: 4; width: 100%; margin-left: 0; gap: 6px; }
  .g-actions .g-menu-btn { flex: 1; justify-content: center; }
  .g-actions .g-end-btn { flex: 1; }

  /* The map fills the body and the orders sheet floats over it. */
  .g-body { display: block; position: relative; overflow: hidden; }
  .g-mapwrap { position: absolute; inset: 0; border-right: 0; border-bottom: 0; }

  .g-drawer {
    position: absolute; left: 0; right: 0; top: calc(100% - 64px); bottom: 0; z-index: 30;
    height: auto; max-height: none;
    padding: 0 16px;
    overflow-y: auto; overscroll-behavior: contain;
    background:
      linear-gradient(180deg, rgba(28,28,22,.98), rgba(14,14,10,.99) 40%, #0e0e0a),
      var(--noise);
    background-blend-mode: normal, multiply;
    border: 1px solid rgba(232,226,208,.2); border-bottom: 0;
    border-top: 3px solid var(--hot);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -26px 70px rgba(0,0,0,.9), 0 -2px 0 rgba(240,180,41,.35) inset;
    transition: top .32s cubic-bezier(.2, .9, .2, 1);
    will-change: top;
  }
  .g-drawer[data-sheet="open"] { top: 46%; }
  .g-drawer[data-sheet="full"] { top: 0; }
  /* Peek is just the handle: the order bar and close button only exist once
     the sheet is actually open, so nothing is half-clipped in the strip. */
  .g-drawer[data-sheet="peek"] .sheet-actions,
  .g-drawer[data-sheet="peek"] .sheet-collapse,
  .g-drawer[data-sheet="open"] .sheet-collapse { display: none; }

  .sheet-handle {
    position: sticky; top: 0; z-index: 9;
    display: flex; align-items: center; gap: 10px;
    width: calc(100% + 32px); min-height: 56px; margin: 0 -16px 8px; padding: 12px 16px 10px;
    background: linear-gradient(180deg, #1f1f18, #141410);
    border: 0; border-bottom: 1px solid rgba(232,226,208,.14);
    color: inherit; font: inherit; text-align: left; appearance: none;
    cursor: grab; user-select: none; touch-action: none;
    box-shadow: 0 10px 24px rgba(0,0,0,.45);
  }
  .sheet-handle:active { cursor: grabbing; }
  .sheet-handle .grip {
    width: 44px; height: 5px; border-radius: 3px; flex: 0 0 auto;
    background: var(--warn); box-shadow: 0 0 12px rgba(240,180,41,.45);
  }
  .sheet-handle b {
    flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-family: var(--mono); font-size: 11.5px; letter-spacing: .14em; color: var(--paper);
  }
  .sheet-handle i {
    font-style: normal; font-family: var(--mono); font-size: 11px;
    letter-spacing: .16em; color: var(--warn); flex: 0 0 auto;
  }

  .sheet-collapse {
    display: grid; place-items: center;
    position: absolute; right: 12px; top: 62px; z-index: 10;
    width: 44px; height: 44px;
    background: rgba(10,10,8,.9); border: 1px solid var(--line-2); color: var(--paper);
    font-size: 15px; cursor: pointer;
  }
  .sheet-collapse:hover { background: var(--paper); color: #12100c; }

  .sheet-scrim {
    display: block; position: absolute; inset: 0; z-index: 20;
    background: rgba(4,4,3,.7);
    opacity: 0; pointer-events: none; transition: opacity .25s ease;
  }
  .sheet-scrim.on { opacity: 1; pointer-events: auto; }
  .sheet-scrim.on.scrim-open { background: rgba(4,4,3,.32); }
  /* Half-open sheet: the map stays visible under a light scrim. A tap on it
     drops the sheet back to peek, ready for another block. */
  .sheet-scrim.on.scrim-open { pointer-events: auto; }

  .sheet-tail { display: block; height: calc(74px + env(safe-area-inset-bottom, 0px)); flex: none; }
  .g-drawer[data-sheet="peek"] .sheet-tail { display: none; }
  .sheet-actions {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px;
    position: sticky; bottom: 0; z-index: 8;
    margin: 10px -16px 0; padding: 8px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    backdrop-filter: blur(2px);
    background: #0e0e0a;
    border-top: 1px solid rgba(232,226,208,.16);
    box-shadow: 0 -10px 24px rgba(0,0,0,.5);
  }
  .sheet-actions button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 50px; padding: 2px 3px;
    background: #1c1c16; border: 1px solid var(--line-2); color: var(--paper);
    font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: .04em;
    cursor: pointer;
  }
  .sheet-actions button .ic { width: 17px; height: 17px; opacity: .8; }
  .sheet-actions button span { line-height: 1; }
  .sheet-actions button:hover:not(:disabled) { border-color: var(--warn); color: var(--warn); }
  .sheet-actions button:active:not(:disabled) { background: var(--warn); color: #12100c; }
  .sheet-actions button:disabled { opacity: .3; cursor: not-allowed; }
  .sheet-actions .end { background: var(--hot); border-color: #000; color: var(--paper); font-weight: 700; letter-spacing: .08em; }
  .sheet-actions .end:hover { background: var(--warn); color: #12100c; border-color: #000; }

  .g-drawer .drawer-head { padding-top: 6px; }
  .g-drawer .drawer-back { margin-top: 0; }
  .g-mapwrap .map-layers { bottom: calc(74px + env(safe-area-inset-bottom, 0px)); top: auto; }
  .drawer-cue { display: block; }
}

@media (max-width: 620px) {
  .menu-grid { grid-template-columns: 1fr; }
  .menu-item { min-height: 58px; font-size: 17px; }
  .keylist > div { grid-template-columns: 88px 1fr; gap: 10px; }
  .g-stats > div:nth-child(n+6) { display: none; }
  .g-actions .g-menu-btn, .g-actions .g-end-btn { font-size: 11.5px; letter-spacing: .1em; padding: 0 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .g-drawer { transition: none; }
  .sheet-scrim { transition: none; }
}

/* ==========================================================================
   PHASE 7.3 — SHARED GAME UI SYSTEM
   One set of spacing, radii, borders, elevation, control heights and icon
   weights for the whole game. The HUD is regrouped into identity → time →
   resources → holdings → actions, and the map gets clearer control states.
   ========================================================================== */

:root {
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --r-1: 2px;
  --r-2: 4px;
  --r-3: 8px;
  --el-1: 0 1px 0 rgba(0,0,0,.6);
  --el-2: 0 8px 24px rgba(0,0,0,.5);
  --el-3: 0 24px 60px rgba(0,0,0,.72);
  --ctl-h: 44px;
  --surface-1: #121210;
  --surface-2: #171715;
  --surface-3: #1e1e18;
  --ink: #e8e2d0;
  --ink-2: #cfc9b8;
  --ink-3: #b8b1a1;
  --ink-4: #8d8778;
  --rule: 1px solid var(--line);
  --rule-strong: 1px solid var(--line-2);
}

/* ---------- icons ---------- */
.ui-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -3px;
}

/* ---------- primitives ---------- */
.ui-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: var(--ctl-h); padding: 0 var(--sp-3);
  background: var(--surface-2); border: var(--rule-strong); border-radius: var(--r-1);
  color: var(--ink); font-family: var(--mono); font-size: 12px; letter-spacing: .12em;
  text-transform: uppercase; cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.ui-btn:hover:not(:disabled) { background: var(--surface-3); border-color: var(--ink-3); }
.ui-btn:active:not(:disabled) { transform: translateY(1px); }
.ui-btn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #12100c; }
.ui-btn.primary { background: var(--hot); border-color: #000; color: var(--paper); }
.ui-btn.primary:hover:not(:disabled) { background: var(--warn); border-color: #000; color: #12100c; }
.ui-btn.quiet { background: none; border-color: transparent; color: var(--ink-3); }
.ui-btn.quiet:hover:not(:disabled) { background: rgba(232,226,208,.06); color: var(--ink); }
.ui-btn:disabled { opacity: .35; cursor: not-allowed; }
.ui-btn .ic { width: 17px; height: 17px; }

.empty {
  display: grid; justify-items: center; gap: 3px; text-align: center;
  border: 1px dashed var(--line-2); border-radius: var(--r-2);
  padding: var(--sp-4) var(--sp-3); color: var(--ink-3);
}
.empty .ic { width: 26px; height: 26px; opacity: .45; margin-bottom: 2px; }
.empty b { font-family: var(--mono); font-size: 11.5px; letter-spacing: .14em; color: var(--ink-2); text-transform: uppercase; }
.empty span { font-family: var(--font-body); font-size: 13.5px; line-height: 1.5; }

/* ---------- HUD: identity → time → resources → holdings → actions ---------- */
.g-hud { gap: var(--sp-4); padding: var(--sp-2) var(--sp-4); }
.g-ident { display: flex; align-items: center; gap: var(--sp-3); flex: none; min-width: 0; }
.g-ident .g-brand { font-size: 16px; }
.g-gang { padding-left: var(--sp-3); min-width: 0; }
.g-gang b { max-width: 168px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.g-stats { display: flex; align-items: stretch; gap: var(--sp-5); flex: 0 1 auto; min-width: 0; }
.g-stats .stat { display: grid; align-content: start; gap: 2px; min-width: 58px; }
.stat-k { display: flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .16em; color: var(--ink-4); }
.stat-k .ic { width: 14px; height: 14px; opacity: .75; }
.g-stats .stat > b { font-family: var(--display); font-size: 19px; line-height: 1.05; letter-spacing: .02em; color: var(--ink); font-variant-numeric: tabular-nums; }
.g-stats .stat > b i { font-style: normal; font-family: var(--mono); font-size: 10px; letter-spacing: .1em; color: var(--ink-4); margin-left: 4px; }
.g-stats .stat .bar { width: 54px; margin: 3px 0 0; }
.g-stats .stat.hot > b { color: var(--bad); }

.g-hold { display: flex; align-items: center; gap: var(--sp-3); flex: none; margin-left: auto; font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; color: var(--ink-4); }
.g-hold span { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.g-hold .ic { width: 14px; height: 14px; opacity: .6; }
.g-hold b { color: var(--ink-2); font-weight: 400; }

.g-actions { margin-left: 0; }

/* ---------- map: control states, legend, layer chips ---------- */
.zpart { transition: fill-opacity .15s, stroke .15s, filter .15s; }
.zpart:hover { fill-opacity: calc(var(--zo) + .12); stroke: rgba(232,226,208,.5); }
.zpart.mine { stroke: rgba(232,226,208,.38); stroke-width: .9; }
.zpart.pushing { stroke: var(--warn); stroke-width: 1; stroke-dasharray: 2 1.6; }
.zpart.selected { stroke: #fff; stroke-width: 2.2; filter: drop-shadow(0 0 7px rgba(255,255,255,.45)); }
.zpart.selected:hover { fill-opacity: calc(var(--zo) + .12); }

.map-tools { gap: var(--sp-1); }
.map-tools button {
  width: var(--ctl-h); height: var(--ctl-h); display: grid; place-items: center;
  border-radius: var(--r-1); box-shadow: var(--el-1);
}
.map-tools .ic { width: 19px; height: 19px; }

.map-layers { top: 210px; }
.map-layers button {
  width: 88px; height: var(--ctl-h); padding: 0 var(--sp-2);
  border-radius: var(--r-1); background: rgba(10,10,8,.92);
  font-size: 11.5px; letter-spacing: .12em;
}
.map-layers button:hover { border-color: var(--line-2); color: var(--ink); }
.map-layers button.on { color: #12100c; background: var(--warn); border-color: var(--warn); }
.map-layers button[aria-pressed="true"] { box-shadow: inset 0 0 0 1px rgba(0,0,0,.45); }

.map-key { gap: 14px; flex-wrap: wrap; max-width: calc(100% - 28px); row-gap: 6px; color: var(--ink-4); }
.map-key span { gap: 5px; }
.map-key i { width: 10px; height: 10px; border: 1px solid rgba(0,0,0,.55); }
.map-key .sw-push { background: repeating-linear-gradient(45deg, var(--warn) 0 2px, #2c2a22 2px 4px); }
.map-key .sw-rival { background: #8b8a9a; }
.map-key .sw-free { background: #4a4a58; }
.map-key .sw-sel { background: transparent; border: 1.5px dashed #fff; }

/* ---------- components inherit the tokens ---------- */
.panel-block { padding: var(--sp-3); margin-bottom: var(--sp-2); border-radius: var(--r-2); }
.act { padding: var(--sp-2); border-radius: var(--r-2); min-height: 62px; }
.act b { display: flex; align-items: center; gap: 5px; }
.act b .ic { width: 15px; height: 15px; opacity: .8; }
.act b .k { margin-right: 0; }
.crew-chip, .up, .assign { min-height: var(--ctl-h); border-radius: var(--r-2); }
.mini-row { min-height: var(--ctl-h); align-items: center; padding: 0; }
.gang-row.clickable { min-height: var(--ctl-h); align-items: center; }
.tabs button { min-height: var(--ctl-h); border-radius: var(--r-1); }
.g-jobs button { min-height: var(--ctl-h); }
.drawer-back { min-height: var(--ctl-h); display: inline-flex; align-items: center; }
.menu-item { border-radius: var(--r-1); }
.menu-item > i .ic { width: 20px; height: 20px; opacity: .75; }
.menu-item:hover > i .ic, .menu-item:focus-visible > i .ic { opacity: 1; color: var(--warn); }
.menu-item.doc:hover > i .ic, .menu-item.doc:focus-visible > i .ic { color: var(--cyan); }
.close { border-radius: var(--r-1); display: grid; place-items: center; }
.close .ic { width: 16px; height: 16px; }

@media (max-width: 1180px) {
  .g-ident { flex: 1 1 100%; justify-content: space-between; }
  .g-hold { display: none; }
  .g-actions { margin-left: auto; }
}

@media (max-width: 900px) {
  .g-hud { gap: 7px 10px; padding: var(--sp-2) var(--sp-3); }
  .g-stats { flex: 1; }
  .g-clock { order: 2; }
  .g-stats { order: 3; flex: 1 1 100%; width: 100%; gap: var(--sp-3); }
  .g-stats .stat { flex: 1; min-width: 0; }
  .g-actions { order: 4; width: 100%; }
  .map-tools {
    top: 10px; left: 10px; gap: 4px;
    display: grid; grid-template-columns: repeat(2, var(--ctl-h));
  }
  .map-tools button { width: var(--ctl-h); height: var(--ctl-h); }
  .map-layers {
    top: auto; bottom: calc(74px + env(safe-area-inset-bottom, 0px)); left: 10px; right: 10px;
    flex-direction: row; gap: 5px;
  }
  .map-layers button { flex: 1; width: auto; min-width: 0; height: 44px; font-size: 10.5px; letter-spacing: .06em; }
  .map-key { display: none; }
}

@media (max-width: 620px) {
  /* On a phone the gang patch is the identity; the wordmark would just
     steal a row from the map. Gang and clock share the first line. */
  .g-brand { display: none; }
  .g-ident { flex: 0 1 auto; gap: var(--sp-2); }
  .g-gang { display: flex; padding-left: 0; border-left: 0; gap: 6px; }
  .g-gang .patch { width: 26px; height: 26px; font-size: 15px; }
  .g-gang b { font-size: 12.5px; max-width: 108px; }
  .g-clock { margin-left: auto; }
  .g-clock small { font-size: 9px; letter-spacing: .16em; }
  .g-clock strong { font-size: 22px; }

  .g-stats { gap: var(--sp-2); }
  .g-stats .stat { overflow: hidden; }
  .stat-k { font-size: 9.5px; letter-spacing: .02em; gap: 0; white-space: nowrap; }
  .stat-k .ic { display: none; }
  .g-stats .stat > b { font-size: 17px; }
  .g-stats .stat .bar { width: 100%; }
  .g-gang small { display: none; }
  .g-gang b { max-width: 120px; }
}

/* ==========================================================================
   PHASE 8.1 — GRAFFITI LAYER
   One visual language for the game surfaces: halftone walls, torn stickers,
   tape, overspray, marker strokes and paint drips. Everything decorative is
   a pseudo-element or background layer, sits behind text, and animates only
   transform/opacity. Reduced motion removes the lot.
   ========================================================================== */

:root {
  --halftone: radial-gradient(circle at 1px 1px, rgba(232,226,208,.055) 1px, transparent 1.4px);
  --overspray: radial-gradient(55% 55% at 16% 8%, rgba(240,180,41,.09), transparent 70%),
               radial-gradient(40% 40% at 92% 96%, rgba(57,215,208,.05), transparent 70%);
  --tape: linear-gradient(102deg, rgba(232,226,208,.13), rgba(232,226,208,.05) 55%, rgba(232,226,208,.11));
  --sticker: #f0b429;
  --sticker-ink: #12100c;
}

/* ---------- walls ---------- */
.panel-block,
.crew-card,
.control-block,
.intel,
.g-jobs,
.act,
.up,
.assign {
  background-image: var(--halftone), var(--overspray);
  background-size: 5px 5px, 100% 100%;
}

.panel-block,
.crew-card,
.control-block {
  position: relative;
  border-color: rgba(232,226,208,.17);
}

.job-block { overflow: hidden; }
.job-block::after {
  content: "";
  position: absolute; right: -28px; top: -34px;
  width: 116px; height: 116px; border-radius: 50%;
  border: 10px solid rgba(240,180,41,.09);
  transform: rotate(-12deg);
  pointer-events: none;
}

/* torn tape on the crew cards */
.crew-card::before {
  content: "";
  position: absolute; top: 5px; right: 8px;
  width: 52px; height: 15px;
  background: var(--tape);
  border-left: 1px solid rgba(255,255,255,.14);
  border-right: 1px solid rgba(255,255,255,.14);
  transform: rotate(2.5deg);
  clip-path: polygon(2% 0, 100% 6%, 96% 100%, 0 92%);
  pointer-events: none;
}

/* strips of tape on the job board */
.g-jobs { position: relative; }
.g-jobs::before,
.g-jobs::after {
  content: "";
  position: absolute; top: -1px;
  width: 54px; height: 12px;
  background: var(--tape);
  opacity: .7;
  transform: rotate(-3deg);
  clip-path: polygon(3% 0, 100% 4%, 95% 100%, 0 94%);
  pointer-events: none;
}
.g-jobs::before { left: 18px; }
.g-jobs::after { right: 22px; transform: rotate(2.5deg); }

/* ---------- stencil labels & stickers ---------- */
.block-title span {
  position: relative;
  text-transform: uppercase;
  letter-spacing: .19em;
  color: var(--ink-3);
}
.block-title span::after {
  content: "";
  position: absolute; left: 0; right: 6%; bottom: -5px; height: 5px;
  background: var(--hot);
  opacity: .45;
  clip-path: polygon(0 45%, 26% 8%, 62% 32%, 100% 0, 97% 100%, 58% 74%, 24% 100%, 2% 72%);
  transform: rotate(-.4deg);
  pointer-events: none;
}

.block-title b.sticker {
  display: inline-block;
  padding: 3px 8px 4px;
  background: var(--sticker);
  color: var(--sticker-ink);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  line-height: 1.1;
  transform: rotate(-1.2deg);
  clip-path: polygon(2% 8%, 98% 0, 100% 88%, 94% 100%, 4% 94%, 0 20%);
  box-shadow: 2px 2px 0 rgba(0,0,0,.35);
}
.block-title b.sticker.blink { color: var(--sticker-ink) !important; }

/* ---------- headers: spray blob, marker stroke, hand circle ---------- */
.drawer-head { position: relative; }
.drawer-head h2 { position: relative; display: block; width: fit-content; max-width: 100%; isolation: isolate; }
.drawer-head h2::before {
  content: "";
  position: absolute; left: -12px; right: -16px; top: 6%; bottom: -8%;
  background: radial-gradient(60% 80% at 30% 50%, rgba(194,59,46,.24), transparent 72%);
  z-index: -1;
  pointer-events: none;
}
.drawer-head h2::after {
  content: "";
  display: block; height: 7px; margin-top: 2px;
  width: min(260px, 82%);
  background: var(--hot);
  opacity: .65;
  clip-path: polygon(0 40%, 28% 8%, 63% 34%, 100% 0, 98% 100%, 57% 76%, 24% 100%, 2% 68%);
  transform-origin: left center;
  animation: markerDraw .45s ease-out both;
}
.drawer-head small { position: relative; display: inline-block; margin-bottom: 2px; }
.drawer-head small::after {
  content: "";
  position: absolute; inset: -4px -8px;
  border: 2px solid rgba(240,180,41,.4);
  border-radius: 50% 46% 53% 47%;
  transform: rotate(-2.5deg);
  pointer-events: none;
}

.head-mark {
  position: absolute; right: 2px; top: 4px;
  color: rgba(232,226,208,.22);
  pointer-events: none;
}
.head-mark .ic {
  width: 44px; height: 44px;
  stroke-dasharray: 150;
  stroke-dashoffset: 150;
  animation: sprayDraw 1.1s .1s ease-out forwards;
}

.panel-head h2 { position: relative; }
.panel-head h2::after {
  content: "";
  position: absolute; left: 0; bottom: -6px; width: 72%; height: 5px;
  background: var(--hot);
  opacity: .5;
  clip-path: polygon(0 40%, 30% 6%, 66% 32%, 100% 0, 97% 100%, 60% 74%, 26% 100%, 2% 70%);
  transform-origin: left center;
  animation: markerDraw .45s ease-out both;
}
.panel-head small { letter-spacing: .3em; }

/* paint drips under the panel's top edge */
.panel::after {
  content: "";
  position: absolute; left: 0; right: 0; top: 3px; height: 16px;
  background:
    radial-gradient(5px 14px at 14% 0, rgba(194,59,46,.5), transparent 72%),
    radial-gradient(4px 10px at 31% 0, rgba(194,59,46,.38), transparent 72%),
    radial-gradient(6px 16px at 68% 0, rgba(194,59,46,.42), transparent 72%),
    radial-gradient(4px 9px at 86% 0, rgba(194,59,46,.3), transparent 72%);
  pointer-events: none;
}
.sheet-handle::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -1px; height: 10px;
  background:
    radial-gradient(4px 9px at 22% 0, rgba(240,180,41,.5), transparent 72%),
    radial-gradient(3px 6px at 44% 0, rgba(240,180,41,.35), transparent 72%),
    radial-gradient(4px 10px at 73% 0, rgba(240,180,41,.4), transparent 72%);
  pointer-events: none;
}

/* ---------- buttons & action cards ---------- */
.g-menu-btn,
.g-end-btn { position: relative; overflow: hidden; }
.g-menu-btn::after,
.g-end-btn::after {
  content: "";
  position: absolute; left: 10px; right: 10px; bottom: 5px; height: 2px;
  background: currentColor;
  opacity: .45;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .18s ease;
}
.g-menu-btn:hover::after,
.g-end-btn:hover::after,
.g-menu-btn:focus-visible::after,
.g-end-btn:focus-visible::after { transform: scaleX(1); }

.act {
  position: relative;
  overflow: hidden;
}
.act::after {
  content: "";
  position: absolute; right: -26px; bottom: -30px;
  width: 84px; height: 84px; border-radius: 50%;
  background: radial-gradient(circle, rgba(240,180,41,.18), transparent 66%);
  opacity: 0;
  transition: opacity .18s ease;
  pointer-events: none;
}
.act:hover:not(:disabled)::after,
.act:focus-visible::after { opacity: 1; }
.act.on::before {
  content: "";
  position: absolute; inset: 2px;
  border: 2px solid rgba(240,180,41,.35);
  border-radius: 50% 47% 52% 48%;
  transform: rotate(-1.5deg);
  pointer-events: none;
}

/* marker underline on panel footer actions */
.ui-btn { position: relative; overflow: hidden; }
.ui-btn::after {
  content: "";
  position: absolute; left: 12px; right: 12px; bottom: 5px; height: 2px;
  background: currentColor;
  opacity: .4;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .18s ease;
}
.ui-btn:hover::after,
.ui-btn:focus-visible::after { transform: scaleX(1); }

/* neon flicker on the wordmark slash */
.g-brand i { animation: neonFlicker 7s steps(1, end) infinite; }

@keyframes markerDraw {
  from { transform: scaleX(0); opacity: 0; }
  to   { transform: scaleX(1); opacity: .65; }
}
@keyframes sprayDraw {
  to { stroke-dashoffset: 0; }
}
@keyframes neonFlicker {
  0%, 90%, 100% { opacity: 1; }
  91% { opacity: .3; }
  92% { opacity: 1; }
  94% { opacity: .45; }
  95% { opacity: 1; }
}

@media (max-width: 560px) {
  .head-mark { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .drawer-head h2::after,
  .panel-head h2::after,
  .head-mark .ic,
  .g-brand i { animation: none; }
  .head-mark .ic { stroke-dashoffset: 0; }
  .act::after, .ui-btn::after, .g-menu-btn::after, .g-end-btn::after { transition: none; }
}

/* ==========================================================================
   PHASE 8.2 — INTERACTION MOTION
   Buttons press and lift, cards and panel blocks arrive in a short stagger,
   the selected block breathes, control bars fill, TAG throws a spray burst,
   and the dawn paper slams in with counted numbers. Transform and opacity
   only; the reduced-motion overrides at the end remove all of it.
   ========================================================================== */

/* ---------- buttons: lift, press ---------- */
.btn,
.ui-btn,
.g-menu-btn,
.g-end-btn,
.act,
.assign,
.map-tools button,
.map-layers button,
.sheet-actions button,
.menu-item {
  transition: transform .12s ease, background-color .15s ease, border-color .15s ease,
              color .15s ease, box-shadow .15s ease;
}

@media (hover: hover) {
  .btn:hover,
  .ui-btn:hover,
  .g-menu-btn:hover,
  .g-end-btn:hover,
  .act:hover:not(:disabled),
  .assign:hover,
  .map-tools button:hover,
  .map-layers button:hover,
  .sheet-actions button:hover:not(:disabled),
  .menu-item:hover { transform: translateY(-1px); }
}

.btn:active,
.ui-btn:active,
.g-menu-btn:active,
.g-end-btn:active,
.act:active:not(:disabled),
.assign:active,
.map-tools button:active,
.map-layers button:active,
.sheet-actions button:active:not(:disabled),
.menu-item:active { transform: translateY(1px) scale(.995); }

/* ---------- cards: staggered arrival, hover pop, focus glow ---------- */
.panel .panel-block,
.panel .crew-card,
.panel .gang-row,
.tabloid .dawn-block,
.tabloid .cliff {
  animation: cardIn .3s cubic-bezier(.2, .9, .25, 1) backwards;
}
.panel :is(.panel-block, .crew-card, .gang-row):nth-child(2) { animation-delay: .035s; }
.panel :is(.panel-block, .crew-card, .gang-row):nth-child(3) { animation-delay: .07s; }
.panel :is(.panel-block, .crew-card, .gang-row):nth-child(4) { animation-delay: .105s; }
.panel :is(.panel-block, .crew-card, .gang-row):nth-child(5) { animation-delay: .14s; }
.panel :is(.panel-block, .crew-card, .gang-row):nth-child(6) { animation-delay: .175s; }
.panel :is(.panel-block, .crew-card, .gang-row):nth-child(n+7) { animation-delay: .2s; }
.tabloid .dawn-block:nth-child(2n) { animation-delay: .04s; }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(7px); }
  to   { opacity: 1; transform: none; }
}

.crew-card { transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease; }
.crew-card:hover {
  transform: translateY(-2px);
  border-color: rgba(240,180,41,.35);
  box-shadow: 0 10px 24px rgba(0,0,0,.5);
}
.crew-card:focus-visible,
.menu-item:focus-visible,
.act:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--warn), 0 10px 24px rgba(0,0,0,.5);
}

/* ---------- map: selected block breathes ---------- */
.zpart.selected { animation: selPulse 1.8s ease-in-out infinite; }
@keyframes selPulse {
  0%, 100% { stroke-opacity: 1; }
  50%      { stroke-opacity: .45; }
}

/* control bars fill from the left on each render */
.g-drawer .bar i,
.panel .bar i {
  transform-origin: left center;
  animation: barFill .5s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes barFill {
  from { transform: scaleX(0); }
}

/* spray burst on a successful TAG, positioned by A.sprayAt */
.spray-burst {
  position: absolute; z-index: 24; pointer-events: none;
  width: 150px; height: 150px; margin: -75px 0 0 -75px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, rgba(240,180,41,.55), rgba(240,180,41,.2) 38%, transparent 66%),
    radial-gradient(circle at 26% 68%, rgba(240,180,41,.6) 0 6px, transparent 7px),
    radial-gradient(circle at 74% 30%, rgba(240,180,41,.5) 0 4px, transparent 5px),
    radial-gradient(circle at 62% 78%, rgba(240,180,41,.45) 0 3px, transparent 4px);
  animation: sprayBurst .75s ease-out forwards;
}
.spray-burst::after {
  content: "";
  position: absolute; inset: 26%;
  border: 2px solid rgba(240,180,41,.5);
  border-radius: 50% 46% 53% 47%;
  transform: rotate(-6deg);
}
@keyframes sprayBurst {
  0%   { opacity: 0; transform: scale(.3) rotate(-8deg); }
  25%  { opacity: 1; }
  100% { opacity: 0; transform: scale(1.35) rotate(4deg); }
}

/* ---------- dawn: paper slam, stamped headline ---------- */
.dawn-overlay .tabloid {
  transform-origin: 50% 12%;
  animation: paperSlam .45s cubic-bezier(.2, .9, .25, 1) both;
}
@keyframes paperSlam {
  0%   { opacity: 0; transform: translateY(-30px) rotate(-1.4deg) scale(1.02); }
  70%  { opacity: 1; transform: translateY(2px) rotate(.25deg) scale(.997); }
  100% { opacity: 1; transform: none; }
}

.dawn-overlay .headline {
  transform-origin: left center;
  animation: headlineStamp .36s .18s cubic-bezier(.2, 1.3, .3, 1) both;
}
@keyframes headlineStamp {
  from { opacity: 0; transform: scale(1.06); }
  to   { opacity: 1; transform: none; }
}

.dawn-overlay .tabloid::after {
  content: "EXTRA";
  position: absolute; right: 20px; top: 58px;
  padding: 4px 7px;
  border: 2px solid rgba(168,38,31,.7);
  color: rgba(168,38,31,.72);
  font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .2em;
  transform: rotate(-8deg);
  animation: stampIn .3s .4s ease-out both;
  pointer-events: none;
}
@keyframes stampIn {
  from { opacity: 0; transform: rotate(-8deg) scale(1.3); }
  to   { opacity: 1; transform: rotate(-8deg) scale(1); }
}

@media (max-width: 620px) {
  .dawn-overlay .tabloid::after { display: none; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .panel .panel-block,
  .panel .crew-card,
  .panel .gang-row,
  .tabloid .dawn-block,
  .tabloid .cliff,
  .zpart.selected,
  .g-drawer .bar i,
  .panel .bar i,
  .dawn-overlay .tabloid,
  .dawn-overlay .headline,
  .dawn-overlay .tabloid::after { animation: none !important; }
  .spray-burst { display: none !important; }
  .btn, .ui-btn, .g-menu-btn, .g-end-btn, .act, .assign,
  .map-tools button, .map-layers button, .sheet-actions button, .menu-item,
  .crew-card { transition: none !important; }
  .btn:hover, .btn:active, .ui-btn:hover, .ui-btn:active,
  .g-menu-btn:hover, .g-menu-btn:active, .g-end-btn:hover, .g-end-btn:active,
  .act:hover, .act:active, .assign:hover, .assign:active,
  .map-tools button:hover, .map-tools button:active,
  .map-layers button:hover, .map-layers button:active,
  .sheet-actions button:hover, .sheet-actions button:active,
  .menu-item:hover, .menu-item:active, .crew-card:hover { transform: none !important; }
}

html.reduce-motion .panel .panel-block,
html.reduce-motion .panel .crew-card,
html.reduce-motion .panel .gang-row,
html.reduce-motion .zpart.selected,
html.reduce-motion .g-drawer .bar i,
html.reduce-motion .panel .bar i,
html.reduce-motion .dawn-overlay .tabloid,
html.reduce-motion .dawn-overlay .headline { animation: none !important; }
html.reduce-motion .spray-burst { display: none !important; }
html.reduce-motion .btn,
html.reduce-motion .ui-btn,
html.reduce-motion .g-menu-btn,
html.reduce-motion .g-end-btn,
html.reduce-motion .act,
html.reduce-motion .assign,
html.reduce-motion .map-tools button,
html.reduce-motion .map-layers button,
html.reduce-motion .sheet-actions button,
html.reduce-motion .menu-item,
html.reduce-motion .crew-card { transition: none !important; }
html.reduce-motion .btn:hover,
html.reduce-motion .btn:active,
html.reduce-motion .ui-btn:hover,
html.reduce-motion .ui-btn:active,
html.reduce-motion .g-menu-btn:hover,
html.reduce-motion .g-menu-btn:active,
html.reduce-motion .g-end-btn:hover,
html.reduce-motion .g-end-btn:active,
html.reduce-motion .act:hover,
html.reduce-motion .act:active,
html.reduce-motion .assign:hover,
html.reduce-motion .assign:active,
html.reduce-motion .map-tools button:hover,
html.reduce-motion .map-tools button:active,
html.reduce-motion .map-layers button:hover,
html.reduce-motion .map-layers button:active,
html.reduce-motion .sheet-actions button:hover,
html.reduce-motion .sheet-actions button:active,
html.reduce-motion .menu-item:hover,
html.reduce-motion .menu-item:active,
html.reduce-motion .crew-card:hover { transform: none !important; }

/* ==========================================================================
   PHASE 8.3 — PERFORMANCE & ACCESSIBILITY
   A second, separate switch for players who want fewer effects without
   losing all feedback. Ambient layers, the long drifts and the big panel
   entrances go; buttons, bars and focus rings stay. Animations pause while
   the tab is hidden, and every control gets a visible keyboard ring.
   ========================================================================== */

/* ---------- pause everything while the tab is in the background ---------- */
html.is-hidden *,
html.is-hidden *::before,
html.is-hidden *::after {
  animation-play-state: paused !important;
}

/* ---------- visible keyboard focus ---------- */
.btn:focus-visible,
.btn-small:focus-visible,
.ui-btn:focus-visible,
.toggle:focus-visible,
.chip:focus-visible,
.link:focus-visible,
.map-tools button:focus-visible,
.map-layers button:focus-visible,
.sheet-actions button:focus-visible,
.gang-row.clickable:focus-visible,
.rival.clickable:focus-visible {
  outline: 2px solid var(--warn) !important;
  outline-offset: 2px;
}

/* ---------- reduced FX: ambient and large motion off ---------- */
html.reduce-fx .grain,
html.reduce-fx .scan,
html.reduce-fx .glow,
html.reduce-fx .grid,
html.reduce-fx .vignette { display: none !important; }

html.reduce-fx .title-bg,
html.reduce-fx .skyline,
html.reduce-fx .skyline-lg,
html.reduce-fx .wall-tag,
html.reduce-fx .rail-track,
html.reduce-fx .g-mapwrap::after,
html.reduce-fx .g-brand i,
html.reduce-fx .boot-bar,
html.reduce-fx .coach-target,
html.reduce-fx .blink,
html.reduce-fx .zpart.selected { animation: none !important; }

html.reduce-fx .panel,
html.reduce-fx .tabloid,
html.reduce-fx .overlay,
html.reduce-fx .dawn-overlay .tabloid,
html.reduce-fx .dawn-overlay .headline,
html.reduce-fx .dawn-overlay .tabloid::after,
html.reduce-fx .panel .panel-block,
html.reduce-fx .panel .crew-card,
html.reduce-fx .panel .gang-row,
html.reduce-fx .tabloid .dawn-block,
html.reduce-fx .tabloid .cliff { animation: none !important; }

html.reduce-fx .spray-burst { display: none !important; }
html.reduce-fx .g-drawer { transition: none !important; }
html.reduce-fx body { animation: none !important; }

/* Reduced FX still keeps short, local feedback: hover lift, press, bar fill,
   floating gains and the marker underline. */

/* Phase 8.3 target-size and focus follow-ups */
.setting-row .toggle { min-height: 44px; min-width: 76px; padding: 0 16px; }
.close:focus-visible,
.tabs button:focus-visible,
.help-tabs button:focus-visible,
.g-jobs button:focus-visible { outline: 2px solid var(--warn) !important; outline-offset: 2px; }

/* ==========================================================================
   READABILITY PASS 2 — sidebar and orders sheet
   The panel is read at arm's length on a phone, so labels and prose get one
   more small step up. The sheet still scrolls; nothing is allowed to clip.
   ========================================================================== */
.g-drawer { padding: 17px; }
.drawer-head small { font-size: 12px; }
.drawer-head .motto { font-size: 16px; }
.block-title span,
.block-title b { font-size: 12px; }
.obj { font-size: 16.5px; }
.radio { font-size: 16px; }
.fine { font-size: 12.5px; }
.mini-row { font-size: 12px; }
.ctl-row,
.ctl-meta { font-size: 12px; }
.intel { font-size: 12px; }
.landmarks span { font-size: 12px; }
.act b { font-size: 14px; }
.act b .k { font-size: 11.5px; }
.act i { font-size: 12px; }
.act span { font-size: 12px; }
.assign b { font-size: 13.5px; }
.assign span { font-size: 12px; }
.crew-chip b { font-size: 13.5px; }
.crew-chip i,
.crew-chip span { font-size: 11.5px; }
.up b { font-size: 12.5px; }
.up i,
.up span { font-size: 12px; }
.link { font-size: 12px; }
.drawer-cue { font-size: 12px; }
.g-jobs { font-size: 12px; }
.g-jobs .job-label { font-size: 12px; }
.g-jobs button { font-size: 12px; }
.stat-k { font-size: 11.5px; }
.g-stats .stat > b { font-size: 20px; }
.g-clock small,
.g-clock span { font-size: 11.5px; }
.rail-track span,
.rail-right { font-size: 12px; }

@media (max-width: 900px) {
  .sheet-handle b { font-size: 12.5px; }
  .sheet-handle i { font-size: 12px; }
  .sheet-actions button { font-size: 10.5px; }
}

@media (max-width: 620px) {
  .stat-k { font-size: 10.5px; letter-spacing: .04em; }
  .g-stats .stat > b { font-size: 18px; }
  .g-clock small { font-size: 10px; }
  .act b { font-size: 14.5px; }
  .act i { font-size: 12.5px; }
  .g-drawer { padding: 0 13px; }
  .sheet-handle { width: calc(100% + 26px); margin: 0 -13px 8px; }
}

/* These sit after the readability pass so its plain 17px drawer padding does
   not undo the sheet gutters on tablets. Content does not scroll under the
   sticky order bar because the tail before it reserves the bar's height. */
@media (max-width: 900px) {
  .g-drawer { padding: 0 16px; }
}
@media (max-width: 620px) {
  .g-drawer { padding: 0 13px; }
  .sheet-actions { margin-left: -13px; margin-right: -13px; }
}

/* Desktop orders panel: the right rail has room to breathe, so prose and
   controls get one final step up without widening the 356px column. */
@media (min-width: 901px) {
  .g-drawer { padding: 19px 18px; }
  .drawer-head h2 { font-size: 28px; }
  .drawer-head .motto { font-size: 17px; }
  .obj,
  .radio { font-size: 17.5px; }
  .fine,
  .mini-row,
  .ctl-row,
  .ctl-meta,
  .intel,
  .landmarks span { font-size: 13px; }
  .act b { font-size: 15px; }
  .act i,
  .act span,
  .assign span,
  .up i,
  .up span,
  .crew-chip i,
  .crew-chip span { font-size: 13px; }
  .assign b,
  .crew-chip b { font-size: 14px; }
  .link { font-size: 13px; }
}

/* ==========================================================================
   PHASE 9.3 — ACCESSIBILITY AND NEW RETENTION SURFACES
   ========================================================================== */
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

#gMap:focus-visible {
  outline: 3px solid var(--warn);
  outline-offset: -3px;
}

.ngplus-note {
  display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap;
  margin: 14px 0 0; padding: 12px 14px; border-left: 3px solid var(--warn);
  background: rgba(240,180,41,.08);
}
.ngplus-note b { font-family: var(--mono); font-size: 11px; letter-spacing: .2em; color: var(--warn); }
.ngplus-note span { font-size: 14px; color: var(--paper); }

.legacy-perks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.legacy-perk {
  min-height: 92px; padding: 10px 11px; text-align: left;
  background: rgba(232,226,208,.03); border: 1px solid var(--line); color: var(--paper);
  font-family: var(--font-body); cursor: pointer;
}
.legacy-perk:hover:not(:disabled), .legacy-perk:focus-visible { border-color: var(--warn); }
.legacy-perk.on { border-color: var(--warn); background: rgba(240,180,41,.1); box-shadow: inset 3px 0 0 var(--warn); }
.legacy-perk:disabled { opacity: .45; cursor: not-allowed; }
.legacy-perk b { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .12em; color: var(--warn); }
.legacy-perk span { display: block; margin: 4px 0 7px; font-size: 13px; line-height: 1.35; color: #d8d2c1; }
.legacy-perk i { font-style: normal; font-family: var(--mono); font-size: 10px; letter-spacing: .14em; color: var(--dim); }

.codex { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-bottom: 18px; }
.codex-card {
  display: flex; gap: 12px; align-items: center; padding: 10px 12px;
  border: 1px solid var(--line); background: rgba(232,226,208,.02);
}
.codex-card.on { border-color: var(--warn); background: rgba(240,180,41,.07); }
.codex-card .set-crest { flex: 0 0 auto; }
.codex-card b { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .14em; color: var(--paper); }
.codex-card span { display: block; margin: 3px 0; font-family: var(--mono); font-size: 10px; letter-spacing: .1em; color: var(--ok); }
.codex-card small { display: block; font-size: 12px; line-height: 1.4; color: var(--dim); }

.board-block { margin: 0 0 20px; }
.board-block h3 { margin: 0 0 8px; font-family: var(--display); font-size: 24px; color: var(--paper); }
.score-table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 12px; }
.score-table th, .score-table td { padding: 8px 6px; text-align: left; border-bottom: 1px solid var(--line); }
.score-table th { color: var(--dim); font-size: 10px; letter-spacing: .12em; font-weight: 500; }
.score-table td { color: var(--paper); }
.win-mark { color: var(--warn); }

.end-actions .share-btn { font-size: 10px; }
.title-foot .link[data-share-open] { cursor: pointer; }

@media (max-width: 900px) {
  button:not(.sheet-handle), [role="button"], a.btn, .link, .btn-small,
  .map-tools button, .map-layers button, .sheet-actions button,
  .chip, .toggle, .swatch, .emblem, .diff, .menu-item, .act {
    min-height: 44px;
  }
  .swatch, .emblem { min-width: 44px; }
  .legacy-perks { grid-template-columns: 1fr; }
  .codex { grid-template-columns: 1fr; }
  .score-table { font-size: 11px; }
  .score-table th, .score-table td { padding: 7px 4px; }
}
