/* ISLA RESURGENTE - style.css
   The interface is a field station, not a spaceship: warm greys, olive drab,
   amber indicators, and labels set in a condensed monospace like something
   stencilled on a crate. Every panel is a slab with a hairline rule, because
   the canvas underneath is doing all the colour work and the UI should stay
   out of its way. */

:root {
  --ink:      #e8e3d4;
  --ink-dim:  #a49f8e;
  --ink-mute: #6f6b5e;
  --slab:     #1b1f18;
  --slab-2:   #232820;
  --slab-3:   #2c3229;
  --edge:     #3c4438;
  --amber:    #e0a33c;
  --amber-dk: #a8761f;
  --good:     #7fb069;
  --warn:     #e0a33c;
  --bad:      #d95d43;
  --info:     #6fa8c4;
  --sel:      #cfe07a;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: ui-serif, Georgia, "Times New Roman", serif;
  --hud-h: 46px;
  --rail-w: 62px;
  --pal-h: 96px;
  --mm-h: 206px;          /* minimap block, incl. its label and border */
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%; overflow: hidden;
  background: #0d100b; color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  touch-action: none;
}
body.booting #hud { display: none; }
canvas#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
body.panning canvas#game { cursor: grabbing; }
body.driving canvas#game { cursor: none; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
kbd {
  font-family: var(--mono); font-size: 10px; background: var(--slab-3);
  border: 1px solid var(--edge); border-bottom-width: 2px; border-radius: 3px;
  padding: 1px 4px; color: var(--ink);
}

/* ============================== HUD ============================== */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud > * { pointer-events: auto; }

/* ---- top bar ---- */
#topbar {
  position: absolute; top: 0; left: 0; right: 0; height: var(--hud-h);
  display: flex; align-items: stretch; gap: 0;
  background: linear-gradient(180deg, rgba(20,24,18,.97), rgba(20,24,18,.90));
  border-bottom: 1px solid var(--edge);
  backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: 9px; padding: 0 14px; border-right: 1px solid var(--edge); }
.brand .mark {
  width: 26px; height: 26px; border-radius: 4px; display: grid; place-items: center;
  background: var(--amber); color: #17190f; font: 700 12px/1 var(--mono); letter-spacing: .5px;
}
.brand .titles { display: flex; flex-direction: column; line-height: 1.1; }
.brand b { font: 700 12.5px/1 var(--sans); letter-spacing: 1.4px; }
.brand i { font: 400 9.5px/1.3 var(--mono); color: var(--ink-mute); font-style: normal; letter-spacing: .4px; }

.readouts { display: flex; flex: 1; min-width: 0; overflow: hidden; }
.ro {
  display: flex; flex-direction: column; justify-content: center; gap: 1px;
  padding: 0 14px; border-right: 1px solid rgba(60,68,56,.55); min-width: 0;
}
.ro label { font: 500 8.5px/1 var(--mono); letter-spacing: 1.1px; color: var(--ink-mute); }
.ro span { font: 600 13px/1 var(--mono); letter-spacing: .3px; white-space: nowrap; }
#roMoney span { color: var(--amber); }
#roMoney.neg span { color: var(--bad); }
#roPower.short span { color: var(--bad); }
.stars { color: var(--amber); letter-spacing: 1px !important; }
.stars .off { color: var(--ink-mute); }

.speedbox { display: flex; align-items: center; padding: 0 8px; gap: 3px; border-left: 1px solid var(--edge); }
.speedbox button {
  min-width: 30px; height: 26px; padding: 0 6px; border-radius: 4px;
  border: 1px solid var(--edge); background: var(--slab-2);
  font: 600 10px/1 var(--mono); color: var(--ink-dim);
}
.speedbox button:hover { background: var(--slab-3); color: var(--ink); }
.speedbox button.on { background: var(--amber); border-color: var(--amber); color: #17190f; }
.speedbox .menu { margin-left: 4px; font-size: 13px; }

/* ---- category rail ---- */
#rail {
  position: absolute; top: var(--hud-h); left: 0; bottom: calc(var(--pal-h) + var(--safe-b));
  width: var(--rail-w); display: flex; flex-direction: column; gap: 2px; padding: 6px 5px;
  background: linear-gradient(90deg, rgba(20,24,18,.95), rgba(20,24,18,.72));
  border-right: 1px solid var(--edge); overflow-y: auto; scrollbar-width: thin;
}
#rail button {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 2px 6px; border-radius: 5px; border: 1px solid transparent;
  color: var(--ink-dim); text-align: center;
}
#rail button .ic { font: 600 15px/1 var(--mono); }
#rail button .lb { font: 500 7.5px/1.1 var(--mono); letter-spacing: .4px; }
#rail button:hover { background: var(--slab-2); color: var(--ink); }
#rail button.on { background: var(--slab-3); border-color: var(--amber-dk); color: var(--amber); }

/* ---- tool palette ---- */
#palette {
  position: absolute; left: var(--rail-w); right: 0; bottom: 0;
  height: calc(var(--pal-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: linear-gradient(0deg, rgba(20,24,18,.97), rgba(20,24,18,.86));
  border-top: 1px solid var(--edge); display: flex; flex-direction: column;
}
.paletteInner {
  flex: 1; display: flex; gap: 6px; padding: 8px 10px 4px; overflow-x: auto; overflow-y: hidden;
  scrollbar-width: thin; align-items: stretch;
}
.tool {
  flex: 0 0 auto; width: 118px; padding: 7px 9px; border-radius: 5px;
  border: 1px solid var(--edge); background: var(--slab-2);
  display: flex; flex-direction: column; gap: 3px; text-align: left; position: relative;
}
.tool:hover { background: var(--slab-3); border-color: #55604e; }
.tool.on { border-color: var(--amber); background: #33301d; }
.tool.locked { opacity: .38; cursor: not-allowed; }
.tool .tn { font: 600 10.5px/1.2 var(--sans); letter-spacing: .2px; }
.tool .tc { font: 500 9.5px/1 var(--mono); color: var(--amber); }
.tool .td { font: 400 8.5px/1.25 var(--sans); color: var(--ink-mute); }
.tool .lock { position: absolute; top: 5px; right: 6px; font-size: 9px; color: var(--ink-mute); }
.paletteHint {
  padding: 0 12px 7px; font: 400 10px/1.35 var(--sans); color: var(--ink-mute);
  border-top: 1px solid rgba(60,68,56,.4); padding-top: 5px; min-height: 22px;
}
.paletteHint b { color: var(--ink-dim); font-weight: 600; }

/* ---- inspector ---- */
/* The inspector and the minimap are both pinned to the right rail, so the
   inspector has to stop ABOVE the minimap rather than at the palette - a long
   animal panel otherwise ran its last six facts underneath it, values and all,
   and the numbers were simply not there to read. It scrolls instead. */
#inspector {
  position: absolute; top: calc(var(--hud-h) + 8px); right: 8px; width: 268px;
  max-height: calc(100% - var(--hud-h) - var(--pal-h) - var(--mm-h) - 24px);
  background: rgba(27,31,24,.96); border: 1px solid var(--edge); border-radius: 6px;
  overflow: auto; scrollbar-width: thin; box-shadow: 0 8px 28px rgba(0,0,0,.45);
}
#inspector .ihead {
  padding: 9px 11px 8px; border-bottom: 1px solid var(--edge);
  display: flex; justify-content: space-between; align-items: flex-start; gap: 8px;
  position: sticky; top: 0; background: rgba(27,31,24,.98); z-index: 2;
}
#inspector h3 { margin: 0; font: 700 12.5px/1.2 var(--sans); letter-spacing: .3px; }
#inspector .latin { font: 400 9.5px/1.3 var(--serif); font-style: italic; color: var(--ink-mute); }
#inspector .x { font-size: 16px; color: var(--ink-mute); line-height: 1; padding: 0 2px; }
#inspector .ibody { padding: 9px 11px 11px; }
.portrait { width: 100%; height: 92px; display: block; border-radius: 4px; background: #10130e; margin-bottom: 9px; }
.stat { margin: 6px 0; }
.stat .sl { display: flex; justify-content: space-between; font: 500 9px/1 var(--mono); letter-spacing: .5px; color: var(--ink-mute); margin-bottom: 3px; }
.stat .sl b { color: var(--ink-dim); font-weight: 600; }
.bar { height: 5px; border-radius: 3px; background: #12150f; overflow: hidden; border: 1px solid rgba(60,68,56,.6); }
.bar i { display: block; height: 100%; background: var(--good); transition: width .25s; }
.bar.warn i { background: var(--warn); }
.bar.bad i { background: var(--bad); }
.bar.info i { background: var(--info); }
.kv { display: flex; justify-content: space-between; gap: 8px; font: 400 10px/1.6 var(--sans); border-bottom: 1px dotted rgba(60,68,56,.5); }
.kv span:first-child { color: var(--ink-mute); }
.kv span:last-child { font-family: var(--mono); font-size: 9.5px; }
.kv span.warn { color: var(--warn); }
.kv span.bad  { color: var(--bad); }
.blurb { font: 400 10px/1.45 var(--serif); color: var(--ink-dim); margin: 8px 0 0; padding-top: 7px; border-top: 1px solid var(--edge); }
.ibtns { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.ibtns button {
  flex: 1 1 auto; padding: 6px 8px; border-radius: 4px; border: 1px solid var(--edge);
  background: var(--slab-2); font: 600 9.5px/1 var(--mono); letter-spacing: .4px; color: var(--ink-dim);
}
.ibtns button:hover { background: var(--slab-3); color: var(--ink); border-color: #55604e; }
.ibtns button.danger:hover { border-color: var(--bad); color: var(--bad); }
.tag { display: inline-block; padding: 1.5px 5px; border-radius: 3px; font: 600 8px/1.4 var(--mono); letter-spacing: .5px; }
.tag.herb { background: #2c3a20; color: #9bc06e; }
.tag.carn { background: #3d241d; color: #e08a6e; }
.tag.pisc { background: #1d323d; color: #6eb2e0; }
.tag.loose { background: #4a1d16; color: #ff8b6e; }
.tag.sick { background: #33204a; color: #b58be0; }

/* ---- alerts ---- */
#alerts {
  position: absolute; left: calc(var(--rail-w) + 8px); bottom: calc(var(--pal-h) + var(--safe-b) + 8px);
  width: 286px; display: flex; flex-direction: column-reverse; gap: 4px; max-height: 44%; overflow: hidden;
}
.alert {
  padding: 6px 9px; border-radius: 4px; border-left: 3px solid var(--info);
  background: rgba(27,31,24,.94); font: 400 10.5px/1.35 var(--sans);
  display: flex; gap: 7px; align-items: flex-start; animation: slideIn .22s ease-out;
  border-top: 1px solid var(--edge); border-right: 1px solid var(--edge); border-bottom: 1px solid var(--edge);
}
.alert.good { border-left-color: var(--good); }
.alert.warn { border-left-color: var(--warn); }
.alert.bad  { border-left-color: var(--bad); }
.alert .d { font: 500 8.5px/1.5 var(--mono); color: var(--ink-mute); flex: 0 0 auto; }
.alert.clickable { cursor: pointer; }
.alert.clickable:hover { background: var(--slab-3); }
@keyframes slideIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }

#toasts {
  position: absolute; left: 50%; top: calc(var(--hud-h) + 12px); transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 5px; align-items: center; pointer-events: none;
}
.toast {
  padding: 6px 14px; border-radius: 20px; background: rgba(27,31,24,.95);
  border: 1px solid var(--edge); font: 500 11px/1 var(--sans); animation: pop .2s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---- minimap ---- */
#minimapWrap {
  position: absolute; right: 8px; bottom: calc(var(--pal-h) + var(--safe-b) + 8px);
  width: 180px; border: 1px solid var(--edge); border-radius: 5px; overflow: hidden;
  background: rgba(20,24,18,.95); box-shadow: 0 6px 20px rgba(0,0,0,.4);
}
#minimap { display: block; width: 180px; height: 180px; cursor: pointer; }
#mmLabel {
  font: 500 8px/1 var(--mono); letter-spacing: 1.2px; color: var(--ink-mute);
  padding: 4px 6px; border-top: 1px solid var(--edge); text-align: center;
}

/* ---- jeep hud ---- */
#jeepHud {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--pal-h) + var(--safe-b) + 10px); padding: 8px 14px;
  background: rgba(27,31,24,.95); border: 1px solid var(--amber-dk); border-radius: 5px; text-align: center;
}
.jh-row { display: flex; gap: 14px; align-items: center; justify-content: center; }
.jh-row b { font: 700 12px/1 var(--mono); letter-spacing: 1.5px; color: var(--amber); }
#jhDarts { font-size: 12px; letter-spacing: 3px; color: var(--good); }
#jhDarts .spent { color: #3f4638; }
.jh-hint { font: 400 9.5px/1.4 var(--sans); color: var(--ink-mute); margin-top: 4px; }

/* ============================ MODALS ============================ */
#modalLayer { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; }
#modalLayer .scrim { position: absolute; inset: 0; background: rgba(8,10,7,.72); backdrop-filter: blur(3px); }
.sheet {
  position: relative; width: min(860px, calc(100vw - 32px)); max-height: min(78vh, 720px);
  display: flex; flex-direction: column;
  background: var(--slab); border: 1px solid var(--edge); border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0,0,0,.6); animation: sheetIn .2s ease-out;
}
@keyframes sheetIn { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
.sheet > header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--edge);
}
.sheet h2 { margin: 0; font: 700 14px/1 var(--sans); letter-spacing: 1.6px; text-transform: uppercase; }
.sheet .x { font-size: 22px; line-height: 1; color: var(--ink-mute); padding: 0 4px; }
.sheet .x:hover { color: var(--ink); }
.sheet > .body { padding: 14px 16px; overflow: auto; scrollbar-width: thin; }
.sheet > footer { padding: 10px 16px; border-top: 1px solid var(--edge); display: flex; gap: 8px; justify-content: flex-end; }
.sheet > footer:empty { display: none; }
.btn {
  padding: 8px 15px; border-radius: 5px; border: 1px solid var(--edge); background: var(--slab-2);
  font: 600 10.5px/1 var(--mono); letter-spacing: .8px; color: var(--ink-dim);
}
.btn:hover { background: var(--slab-3); color: var(--ink); }
.btn.primary { background: var(--amber); border-color: var(--amber); color: #17190f; }
.btn.primary:hover { background: #eeb44d; }
.btn:disabled { opacity: .38; cursor: not-allowed; }

.tabs { display: flex; gap: 3px; margin: -4px 0 12px; border-bottom: 1px solid var(--edge); }
.tabs button {
  padding: 7px 13px; font: 600 10px/1 var(--mono); letter-spacing: .8px; color: var(--ink-mute);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button.on { color: var(--amber); border-bottom-color: var(--amber); }

.grid { display: grid; gap: 9px; }
.g2 { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.card {
  border: 1px solid var(--edge); border-radius: 6px; background: var(--slab-2); padding: 11px 12px;
  display: flex; flex-direction: column; gap: 5px;
}
.card.sel { border-color: var(--amber); background: #2e2c1c; }
.card.dim { opacity: .45; }
.card h4 { margin: 0; font: 700 11.5px/1.25 var(--sans); }
.card .meta { font: 400 9.5px/1.3 var(--mono); color: var(--ink-mute); }
.card p { margin: 0; font: 400 10px/1.45 var(--sans); color: var(--ink-dim); }
.card .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: auto; padding-top: 6px; }
.card .price { font: 600 11px/1 var(--mono); color: var(--amber); }
.spcard { display: flex; gap: 10px; align-items: flex-start; }
.spcard canvas { flex: 0 0 auto; border-radius: 4px; background: #12150f; }
.spcard .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.prog { height: 6px; border-radius: 3px; background: #12150f; border: 1px solid rgba(60,68,56,.6); overflow: hidden; }
.prog i { display: block; height: 100%; background: linear-gradient(90deg, var(--amber-dk), var(--amber)); }
.prog.ok i { background: linear-gradient(90deg, #4f7a3c, var(--good)); }
table.data { width: 100%; border-collapse: collapse; font: 400 10.5px/1.5 var(--sans); }
table.data th {
  text-align: left; font: 600 8.5px/1 var(--mono); letter-spacing: .9px; color: var(--ink-mute);
  padding: 5px 8px; border-bottom: 1px solid var(--edge);
}
table.data td { padding: 5px 8px; border-bottom: 1px solid rgba(60,68,56,.35); }
table.data td.num { font-family: var(--mono); font-size: 9.5px; text-align: right; }
table.data tr:hover td { background: rgba(44,50,41,.5); }
.pos { color: var(--good); } .neg2 { color: var(--bad); }
.note { font: 400 10px/1.5 var(--serif); color: var(--ink-mute); font-style: italic; }
input[type=range] { width: 100%; accent-color: var(--amber); }
input[type=text], input[type=number] {
  background: var(--slab); border: 1px solid var(--edge); border-radius: 4px; color: var(--ink);
  padding: 7px 9px; font: 500 12px/1 var(--mono); width: 100%;
}
.spark { display: block; width: 100%; height: 52px; background: #12150f; border: 1px solid var(--edge); border-radius: 4px; }

/* ============================ TITLE ============================= */
#title { position: fixed; inset: 0; z-index: 80; background: #0b0e09; }
#titleArt { position: absolute; inset: 0; width: 100%; height: 100%; }
.tWrap { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; }
.tPlate {
  position: relative; width: min(620px, 100%); padding: 28px 30px 22px;
  background: rgba(14,17,12,.80); border: 1px solid var(--edge); border-radius: 8px;
  backdrop-filter: blur(8px); box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
.tPlate .pre { margin: 0 0 8px; font: 500 9.5px/1 var(--mono); letter-spacing: 2px; color: var(--amber-dk); text-transform: uppercase; }
.tPlate h1 {
  margin: 0 0 10px; font: 700 clamp(28px, 6vw, 48px)/1 var(--sans);
  letter-spacing: clamp(3px, 1.2vw, 9px); color: var(--ink);
}
.tPlate .sub { margin: 0 0 20px; font: 400 12px/1.6 var(--serif); color: var(--ink-dim); max-width: 46ch; }
.tBtns { display: grid; gap: 7px; }
.big {
  display: flex; align-items: baseline; gap: 10px; padding: 12px 15px; border-radius: 5px;
  border: 1px solid var(--edge); background: var(--slab-2);
  font: 700 12px/1 var(--mono); letter-spacing: 1.5px; text-align: left;
}
.big i { font: 400 9.5px/1 var(--sans); font-style: normal; color: var(--ink-mute); letter-spacing: .2px; }
.big:hover { background: var(--slab-3); border-color: var(--amber-dk); }
.big:not(.ghost) { border-color: var(--amber-dk); }
.big.ghost { opacity: .82; }
.tPlate .foot { margin: 16px 0 0; font: 400 9.5px/1.4 var(--mono); color: var(--ink-mute); }
#padHint { color: var(--good); }

#loading { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: #0b0e09; }
#loading.done { display: none; }
.lbar { width: 220px; height: 3px; background: var(--slab-3); border-radius: 2px; overflow: hidden; }
.lbar i { display: block; height: 100%; width: 30%; background: var(--amber); animation: sweep 1.1s ease-in-out infinite; }
@keyframes sweep { 0% { transform: translateX(-110%); } 100% { transform: translateX(360%); } }
#loadMsg { margin: 14px 0 0; font: 400 10.5px/1 var(--mono); letter-spacing: 1.4px; color: var(--ink-mute); }

/* ---------------------- placement ghost readout ------------------ */
#ghostInfo {
  position: fixed; z-index: 20; pointer-events: none; padding: 4px 8px;
  background: rgba(20,24,18,.94); border: 1px solid var(--edge); border-radius: 4px;
  font: 500 10px/1.35 var(--mono); white-space: nowrap; transform: translate(12px, 14px);
}
#ghostInfo.bad { border-color: var(--bad); color: #ffb3a3; }
#ghostInfo.ok { border-color: var(--good); }

/* =========================== PHONE ============================== */
/* The phone layer moves the existing nodes rather than rebuilding them: the
   rail becomes a bottom strip, the palette becomes a sheet, and the inspector
   docks to the bottom so a thumb can reach it. */
#touchPad, #touchBar { display: none; }

body.touch {
  --hud-h: 42px; --rail-w: 0px; --pal-h: 0px;
}
body.touch #rail {
  top: auto; bottom: calc(52px + var(--safe-b)); left: 0; right: 0; width: auto; height: 54px;
  flex-direction: row; border-right: 0; border-top: 1px solid var(--edge);
  overflow-x: auto; overflow-y: hidden; padding: 5px 6px;
}
body.touch #rail button { flex: 0 0 auto; min-width: 58px; }
body.touch #palette {
  left: 0; right: 0; bottom: calc(106px + var(--safe-b)); height: 108px; padding-bottom: 0;
  border-top: 1px solid var(--edge); border-bottom: 1px solid var(--edge);
  /* clear its own height AND the two bars below it, or a slice of the closed
     sheet sits on top of the category rail */
  transform: translateY(calc(100% + 112px + var(--safe-b)));
  transition: transform .2s ease-out;
}
body.touch #palette.open { transform: none; }
body.touch .tool { width: 132px; padding: 9px 10px; }
body.touch #alerts {
  left: 6px; right: 120px; width: auto; bottom: calc(112px + var(--safe-b));
  max-height: 92px;
}
body.touch .alert { padding: 4px 7px; font-size: 9.5px; line-height: 1.3; }
body.touch #minimapWrap { width: 108px; bottom: calc(112px + var(--safe-b)); right: 6px; }
body.touch #minimap { width: 108px; height: 108px; }
body.touch #mmLabel { display: none; }
body.touch #inspector {
  top: auto; bottom: calc(106px + var(--safe-b)); left: 6px; right: 6px; width: auto;
  max-height: 46vh; border-radius: 6px;
}
body.touch #touchBar {
  display: flex; position: absolute; left: 0; right: 0; bottom: 0; height: calc(52px + var(--safe-b));
  padding-bottom: var(--safe-b); background: rgba(20,24,18,.97); border-top: 1px solid var(--edge);
}
body.touch #touchBar button {
  flex: 1; font: 700 10.5px/1 var(--mono); letter-spacing: 1.2px; color: var(--ink-dim);
  border-right: 1px solid var(--edge);
}
body.touch #touchBar button:last-child { border-right: 0; }
body.touch #touchBar button.on { color: var(--amber); background: var(--slab-2); }
body.touch .ro { padding: 0 9px; }
body.touch .ro label { font-size: 7.5px; }
body.touch .ro span { font-size: 11px; }
body.touch .brand .titles { display: none; }
body.touch .speedbox button { min-width: 26px; height: 24px; }
body.touch #jeepHud { display: none !important; }
body.touch .sheet { max-height: 84vh; width: calc(100vw - 16px); }
body.touch .jh-hint { display: none; }

/* on-screen driving controls, only while possessing a jeep */
body.touch.driving #touchPad { display: block; }
body.touch.driving #rail, body.touch.driving #palette, body.touch.driving #touchBar { display: none; }
#touchPad { position: absolute; inset: 0; pointer-events: none; }
#touchPad .stick {
  position: absolute; left: 18px; bottom: calc(24px + var(--safe-b)); width: 116px; height: 116px;
  border-radius: 50%; border: 2px solid rgba(224,163,60,.4); background: rgba(20,24,18,.4);
  pointer-events: auto; touch-action: none;
}
#touchPad .stick i {
  position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px;
  border-radius: 50%; background: rgba(224,163,60,.55); border: 1px solid var(--amber);
}
#touchPad .tbtn {
  position: absolute; right: 20px; bottom: calc(40px + var(--safe-b)); width: 88px; height: 88px;
  border-radius: 50%; border: 2px solid var(--amber-dk); background: rgba(40,32,14,.8);
  font: 700 12px/1 var(--mono); letter-spacing: 1px; color: var(--amber); pointer-events: auto;
}
#touchPad .tbtn.small {
  width: 58px; height: 40px; border-radius: 6px; right: 20px; bottom: calc(146px + var(--safe-b));
  font-size: 10px; color: var(--ink-dim); border-color: var(--edge);
}
#touchPad .tbtn:active { background: rgba(224,163,60,.35); }

/* portrait phones get a rotate nudge rather than a squashed war table */
#rotate { display: none; }
@media (max-width: 900px) and (orientation: portrait) {
  body.touch #rotate {
    display: grid; position: fixed; inset: 0; z-index: 95; place-items: center;
    background: #0b0e09; text-align: center; padding: 30px;
  }
  body.touch #rotate p { font: 400 13px/1.6 var(--serif); color: var(--ink-dim); max-width: 30ch; }
  body.touch #rotate .ic { font-size: 42px; margin-bottom: 14px; display: block; animation: tip 1.8s ease-in-out infinite; }
  @keyframes tip { 0%,100% { transform: rotate(0); } 50% { transform: rotate(-88deg); } }
}

/* --------------------- gamepad focus ring ----------------------- */
body.padnav *:focus-visible,
body.padnav .padfocus {
  outline: 2px solid var(--sel) !important; outline-offset: 2px; border-radius: 4px;
}
#padCursor {
  position: fixed; z-index: 55; width: 22px; height: 22px; margin: -11px 0 0 -11px;
  pointer-events: none; display: none;
}
body.padcursor #padCursor { display: block; }
#padCursor::before, #padCursor::after {
  content: ''; position: absolute; background: var(--sel);
}
#padCursor::before { left: 50%; top: 0; width: 2px; height: 100%; margin-left: -1px; }
#padCursor::after { top: 50%; left: 0; height: 2px; width: 100%; margin-top: -1px; }
