* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; background: #000; overflow: hidden; }

/* ── Picker overlay ── */
#picker {
  position: fixed;
  inset: 0;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: "Courier New", Courier, monospace;
  color: #e0e0e0;
  z-index: 10;
}
#picker h1 {
  font-size: clamp(14px, 3.5vw, 26px);
  letter-spacing: 0.2em;
  color: #555;
  margin-bottom: 2em;
  text-transform: uppercase;
}
.game-list {
  list-style: none;
  width: min(480px, 90vw);
}
.game-item {
  display: flex;
  align-items: baseline;
  gap: 1em;
  padding: 0.7em 1em;
  margin-bottom: 0.4em;
  border: 1px solid #222;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.game-item:hover { background: #111; border-color: #444; }
.game-item:focus { background: #111; border-color: #555; outline: none; }
.game-num  { font-size: 0.82em; color: #444; min-width: 1.5em; }
.game-title {
  font-size: clamp(14px, 2.8vw, 19px);
  font-weight: bold;
  letter-spacing: 0.08em;
}
.game-subtitle { font-size: 0.72em; color: #555; margin-left: auto; }

#scores-btn {
  margin-top: 1.6em;
  font-family: inherit;
  font-size: 11px;
  color: #444;
  background: none;
  border: none;
  cursor: pointer;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
#scores-btn:hover { color: #888; }
#picker-hint { margin-top: 0.8em; font-size: 11px; color: #2a2a2a; letter-spacing: 0.1em; }

/* ── Scores overlay ── */
#scores-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  display: none;
  flex-direction: column;
  align-items: center;
  font-family: "Courier New", Courier, monospace;
  color: #e0e0e0;
  z-index: 20;
  overflow-y: auto;
  padding: 2em 1em 3em;
}
#scores-overlay h1 {
  font-size: clamp(13px, 3vw, 22px);
  letter-spacing: 0.2em;
  color: #555;
  margin-bottom: 1.5em;
  text-transform: uppercase;
}
.scores-section { width: min(600px, 95vw); margin-bottom: 2.5em; }
.scores-section h2 {
  font-size: clamp(12px, 2.5vw, 16px);
  letter-spacing: 0.15em;
  margin-bottom: 0.6em;
  padding-bottom: 0.3em;
  border-bottom: 1px solid #222;
}
.scores-table { width: 100%; border-collapse: collapse; font-size: clamp(11px, 1.8vw, 13px); }
.scores-table th {
  text-align: left;
  color: #555;
  padding: 0.3em 0.5em;
  font-weight: normal;
}
.scores-table td { padding: 0.25em 0.5em; color: #aaa; }
.scores-table tr:nth-child(odd) td { background: #080808; }
.scores-rank { color: #3a3a3a; }
.scores-name { color: #e0e0e0; }
.scores-score { color: #e6c03a; }
.scores-empty { color: #333; font-size: 12px; padding: 0.5em 0; }
#scores-close {
  margin-top: 0.5em;
  font-family: inherit;
  font-size: 11px;
  color: #444;
  background: none;
  border: 1px solid #222;
  cursor: pointer;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.5em 1.2em;
}
#scores-close:hover { color: #888; border-color: #444; }

/* ── Terminal ── */
#terminal { width: 100%; height: 100%; display: none; }
#tap-hint {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  color: #555;
  font-family: monospace;
  font-size: 12px;
  pointer-events: none;
  transition: opacity 0.5s;
}

/* ── Native session ── */
#native-session {
  position: fixed;
  inset: 0;
  display: none;
  background:
    radial-gradient(circle at top, rgba(190, 150, 80, 0.18), transparent 35%),
    linear-gradient(180deg, #16110d 0%, #0f0b09 60%, #090706 100%);
  color: #eadfc9;
  font-family: Georgia, "Times New Roman", serif;
  overflow-y: auto;
  padding: 20px 16px 32px;
}
.native-shell {
  width: min(720px, 100%);
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.native-card {
  background: rgba(26, 20, 16, 0.9);
  border: 1px solid rgba(210, 185, 130, 0.18);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  padding: 20px 18px;
  overflow: hidden;
}
/* .native-kicker removed */

/* ── Quit bar & modal ── */
#quit-bar {
  position: fixed;
  top: 12px;
  right: 14px;
  z-index: 200;
  display: none;
}
#quit-btn {
  font-family: "Courier New", Courier, monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: rgba(60, 12, 12, 0.85);
  border: 1px solid rgba(180, 60, 60, 0.4);
  color: #c86060;
  padding: 6px 12px;
  cursor: pointer;
}
#quit-btn:hover {
  background: rgba(90, 18, 18, 0.95);
  border-color: rgba(200, 80, 80, 0.7);
  color: #f08080;
}
#quit-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
}
#quit-modal-box {
  background: #140f0b;
  border: 1px solid rgba(180, 60, 60, 0.5);
  padding: 28px 28px 22px;
  max-width: 320px;
  width: 90%;
  font-family: Georgia, "Times New Roman", serif;
  color: #eadfc9;
}
#quit-modal-msg {
  font-size: 16px;
  margin-bottom: 20px;
  line-height: 1.5;
}
#quit-modal-actions {
  display: flex;
  gap: 12px;
}
#quit-yes {
  flex: 1;
  background: rgba(90, 18, 18, 0.9);
  border: 1px solid rgba(180, 60, 60, 0.5);
  color: #f08080;
  padding: 10px;
  font: inherit;
  cursor: pointer;
}
#quit-yes:hover { background: rgba(120, 24, 24, 0.95); }
#quit-no {
  flex: 1;
  background: rgba(40, 32, 24, 0.9);
  border: 1px solid rgba(210, 185, 130, 0.22);
  color: #c8b896;
  padding: 10px;
  font: inherit;
  cursor: pointer;
}
#quit-no:hover { background: rgba(60, 48, 36, 0.95); }

.game-logo {
  display: block;
  width: calc(100% + 36px);
  height: auto;
  margin: -20px -18px 0;
}
.game-logo-ascii {
  font-family: 'Courier New', Courier, monospace;
  font-size: clamp(7px, 1.6vw, 11px);
  line-height: 1.2;
  color: #888;
  margin-bottom: 4px;
  white-space: pre;
  overflow-x: auto;
}
.game-logo-subtitle {
  font-family: 'Courier New', Courier, monospace;
  font-size: clamp(11px, 2vw, 13px);
  letter-spacing: 0.12em;
  color: #666;
  margin-bottom: 20px;
  text-transform: uppercase;
}
.native-title-lore {
  margin-top: 20px;
}
.native-title-lore p {
  color: #c4bfb2;
  font-size: clamp(14px, 3.5vw, 16px);
  line-height: 1.5;
  margin: 0;
  font-family: 'Courier New', Courier, monospace;
  letter-spacing: 0.03em;
}
.native-title {
  font-size: clamp(22px, 6vw, 38px);
  line-height: 1.05;
  margin-bottom: 14px;
  color: #f3ead7;
  white-space: pre-wrap;
}
.native-lines {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: clamp(16px, 4vw, 19px);
  line-height: 1.55;
  white-space: pre-wrap;
}
.native-lines p {
  color: #d9ccb6;
}
.native-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}
.native-option, .native-submit {
  width: 100%;
  border: 1px solid rgba(210, 185, 130, 0.24);
  background: rgba(52, 39, 28, 0.9);
  color: #f1e6d0;
  padding: 14px 16px;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.native-option:hover, .native-submit:hover {
  background: rgba(77, 57, 39, 0.95);
}
.native-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 6px;
}
.native-label {
  color: #bfa986;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.native-input {
  width: 100%;
  background: #120e0b;
  border: 1px solid rgba(210, 185, 130, 0.22);
  color: #f3ead7;
  padding: 14px 15px;
  font: inherit;
  font-size: 18px;
}
.native-note {
  font-size: 14px;
  line-height: 1.5;
  color: #baa98f;
}
.native-error {
  color: #ffb4a6;
  white-space: pre-wrap;
  font-size: 14px;
}
.native-events {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}
.native-event {
  border: 1px solid rgba(210, 185, 130, 0.18);
  background: rgba(40, 30, 22, 0.9);
  padding: 12px 14px;
  color: #eadfc9;
  font-size: 15px;
  line-height: 1.45;
}
.native-event[data-priority="high"] {
  border-color: rgba(225, 194, 103, 0.45);
  background: rgba(76, 58, 22, 0.9);
  color: #fff0c6;
}
.native-event-title {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #b69a67;
  margin-bottom: 6px;
}

/* ── Character select ── */
.cs-card {
  background: rgba(20, 16, 12, 0.7);
  border: 1px solid rgba(210, 185, 130, 0.22);
  padding: 18px 18px 14px;
  margin-bottom: 12px;
}
.cs-quote {
  font-style: italic;
  color: #9a8a72;
  font-size: clamp(14px, 3.5vw, 16px);
  margin-bottom: 14px;
  line-height: 1.5;
}
.cs-name {
  font-size: clamp(20px, 5vw, 28px);
  letter-spacing: 0.18em;
  color: #f3ead7;
  margin-bottom: 16px;
  font-weight: bold;
}
.cs-stats { margin-bottom: 16px; }
.cs-stat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.cs-stat-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: #7a6a52;
  text-transform: uppercase;
  width: 2.8em;
  flex-shrink: 0;
}
.cs-stat-bar-track {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.06);
}
.cs-stat-bar-fill {
  height: 100%;
  transition: width 0.2s;
}
.cs-stat-val {
  font-size: 13px;
  width: 2.2em;
  text-align: right;
  flex-shrink: 0;
}
.cs-section-label {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #7a6a52;
  margin-bottom: 6px;
  margin-top: 2px;
}
.cs-gear {
  list-style: none;
  margin-bottom: 14px;
}
.cs-gear-item {
  color: #c8b896;
  font-size: clamp(14px, 3.5vw, 16px);
  padding: 2px 0;
}
.cs-gear-hint {
  color: #6a5a42;
  font-size: 13px;
  margin-left: 6px;
}
.cs-passive {
  color: #9a8a72;
  font-size: clamp(14px, 3.5vw, 16px);
  line-height: 1.5;
}
.cs-ship-row {
  color: #c8b48a;
  font-size: clamp(14px, 3.5vw, 16px);
}

/* ── Toast stack ── */
#toast-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 280px;
}
.toast {
  border: 1px solid rgba(210, 185, 130, 0.18);
  background: rgba(30, 22, 16, 0.95);
  padding: 10px 14px;
  color: #eadfc9;
  font-size: 14px;
  line-height: 1.4;
  animation: toast-in 0.15s ease-out;
  pointer-events: auto;
}
.toast[data-priority="high"] {
  border-color: rgba(225, 194, 103, 0.5);
  background: rgba(66, 48, 16, 0.97);
  color: #fff0c6;
}
.toast-title {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #b69a67;
  margin-bottom: 4px;
}
.toast-fade {
  animation: toast-out 0.3s ease-in forwards;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

.combat-shell {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.combat-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}
.combat-turn {
  color: #bfa986;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.combat-hud {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 10px;
}
.combat-side {
  border: 1px solid rgba(210, 185, 130, 0.14);
  background: rgba(20, 15, 11, 0.78);
  padding: 12px 13px;
}
.combat-ship-img {
  display: block;
  width: 100%;
  max-width: 80px;
  height: 80px;
  object-fit: contain;
  margin-bottom: 8px;
}
.combat-ship-img-flip {
  transform: scaleX(-1);
  margin-left: auto;
  margin-right: 0;
}
.combat-name {
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #b69a67;
  margin-bottom: 8px;
}
.combat-name.enemy {
  color: #d8937a;
}
.combat-bar-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #5a4a3a;
  margin-bottom: 3px;
}
.combat-bar {
  position: relative;
  height: 10px;
  border: 1px solid rgba(234, 223, 201, 0.12);
  background: #120e0b;
  overflow: hidden;
  margin-bottom: 4px;
}
.combat-fill {
  position: absolute;
  inset: 0 auto 0 0;
  height: 100%;
}
.combat-fill.player {
  background: linear-gradient(90deg, #7d9e56 0%, #b6cb6b 100%);
}
.combat-fill.enemy {
  background: linear-gradient(90deg, #7a2d24 0%, #c75943 100%);
}
.combat-fill.shield {
  background: linear-gradient(90deg, #3a5a8a 0%, #6080b0 100%);
}
.combat-hp {
  color: #e9dbc2;
  font-size: 13px;
  margin-bottom: 8px;
}
.combat-hp-small {
  color: #8090b0;
  font-size: 11px;
  margin-bottom: 6px;
}
.combat-log {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 0 10px;
}
.combat-log-entry {
  border-left: 2px solid rgba(210, 185, 130, 0.25);
  padding-left: 10px;
  color: #d9ccb6;
  font-size: 15px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.combat-actions-label {
  color: #b69a67;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 4px 0 8px;
}
.native-option-key {
  display: inline-block;
  min-width: 1.3em;
  color: #7a6a55;
  font-size: 0.82em;
  font-variant-numeric: tabular-nums;
}

/* ── Load Game save cards ── */
.save-card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.save-card {
  width: 100%;
  border: 1px solid rgba(210, 185, 130, 0.24);
  background: rgba(52, 39, 28, 0.9);
  color: #f1e6d0;
  padding: 10px 14px;
  text-align: left;
  font: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.save-card:hover {
  background: rgba(77, 57, 39, 0.95);
  border-color: rgba(210, 185, 130, 0.44);
}
.save-card-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.save-card-name {
  flex: 1;
  font-size: 1.05em;
  font-weight: 600;
  color: #f3ead7;
  letter-spacing: 0.02em;
}
.save-card-badge {
  font-size: 0.66em;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
}
.save-card-badge--latest {
  background: rgba(240, 192, 96, 0.18);
  color: #f0c060;
  border: 1px solid rgba(240, 192, 96, 0.35);
}
.save-card-badge--top-xp {
  background: rgba(126, 200, 227, 0.15);
  color: #7ec8e3;
  border: 1px solid rgba(126, 200, 227, 0.32);
}
.save-card-badge--top-cr {
  background: rgba(232, 148, 58, 0.15);
  color: #e8943a;
  border: 1px solid rgba(232, 148, 58, 0.32);
}
.save-card-meta {
  font-size: 0.86em;
  color: #bfa986;
}
.save-card-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}
.save-card-xp-track {
  flex: 1;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}
.save-card-xp-fill {
  height: 100%;
  background: #6fcf6f;
  border-radius: 2px;
}
.save-card-xp-label {
  font-size: 0.76em;
  color: #7a7060;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.save-card-date {
  font-size: 0.76em;
  color: #7a7060;
  font-variant-numeric: tabular-nums;
  margin-left: auto;
  white-space: nowrap;
}
.save-card-new-game {
  margin-top: 4px;
  border-style: dashed;
  border-color: rgba(210, 185, 130, 0.18);
  color: #bfa986;
}
.save-card-new-game:hover {
  background: rgba(77, 57, 39, 0.95);
  color: #f1e6d0;
}

/* ── Station / Travel / Hub ── */
.station-hero {
  display: flex;
  gap: 14px;
  margin-bottom: 10px;
}
.station-hero-img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  flex-shrink: 0;
  border: 1px solid #2a2010;
}
.station-hero-content {
  flex: 1;
  min-width: 0;
}
.location-header {
  margin-bottom: 14px;
}
.location-name {
  font-size: clamp(20px, 5vw, 30px);
  color: #f3ead7;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.location-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 12px;
}
.location-type { color: #7a6a55; letter-spacing: 0.08em; text-transform: uppercase; }
.danger-badge {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 2px 7px;
  border: 1px solid;
}
.danger-badge.LOW    { color: #7aab5c; border-color: rgba(122,171,92,0.35); }
.danger-badge.MEDIUM { color: #c8a23a; border-color: rgba(200,162,58,0.35); }
.danger-badge.HIGH   { color: #c75943; border-color: rgba(199,89,67,0.35); }
.location-desc {
  font-size: 14px;
  color: #8a7a66;
  line-height: 1.5;
  margin-bottom: 12px;
}
.station-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
  padding: 10px 12px;
  border: 1px solid rgba(210, 185, 130, 0.12);
  background: rgba(20, 15, 11, 0.7);
  margin-bottom: 14px;
  font-size: 13px;
}
.station-stat {
  display: flex;
  align-items: center;
  gap: 6px;
}
.station-stat-label { color: #5a4a3a; min-width: 4em; letter-spacing: 0.06em; text-transform: uppercase; font-size: 11px; }
.station-stat-bar-track {
  flex: 1;
  height: 5px;
  background: #120e0b;
  border: 1px solid rgba(210,185,130,0.08);
  overflow: hidden;
}
.station-stat-bar-fill { height: 100%; }
.station-stat-bar-fill.hull   { background: #5a9ab0; }
.station-stat-bar-fill.shield { background: #7a8ab0; }
.station-stat-bar-fill.fuel   { background: #7aab5c; }
.station-stat-val { color: #c8b898; min-width: 3.5em; text-align: right; font-variant-numeric: tabular-nums; }
.station-credits {
  grid-column: 1 / -1;
  color: #e6c03a;
  font-size: 13px;
}
/* ── Ship status card ── */
.ship-status-card {
  border: 1px solid rgba(210, 185, 130, 0.15);
  background: rgba(20, 15, 11, 0.78);
  padding: 14px 16px;
  margin-bottom: 16px;
  border-radius: 3px;
}
.ship-status-player {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: baseline;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(210, 185, 130, 0.1);
  margin-bottom: 10px;
}
.ship-status-name  { color: #e6c03a; font-size: 17px; font-weight: bold; }
.ship-status-bg    { color: #8a7a66; font-size: 13px; }
.ship-status-rank  { color: #9a8a72; font-size: 13px; }
.ship-status-level { color: #9a8a72; font-size: 13px; }
.ship-status-credits { color: #e6c03a; font-size: 14px; margin-left: auto; }
.ship-status-section-label {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #5a4a3a;
  margin: 10px 0 4px;
}
.ship-status-location { color: #c8b898; font-size: 14px; }
.ship-status-loc-type { color: #6a5a42; margin-left: 6px; font-size: 13px; }
.ship-status-model { color: #6a5a42; }
.ship-stat-extra { color: #6a5a42; font-size: 12px; }
.ship-status-body {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.ship-status-img-col {
  flex-shrink: 0;
}
.ship-status-img {
  display: block;
  width: 110px;
  height: 110px;
  object-fit: contain;
  border: 1px solid rgba(210, 185, 130, 0.12);
}
.ship-status-stats-col {
  flex: 1;
  min-width: 0;
}
/* ── Travel ship header ── */
.travel-ship-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}
.travel-ship-img {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  object-fit: contain;
  border: 1px solid rgba(210, 185, 130, 0.1);
}
.travel-ship-info {
  flex: 1;
  min-width: 0;
}
.travel-fuel-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.travel-section-header {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #5a4a3a;
  margin: 10px 0 6px;
}
.travel-fuel-bar {
  font-size: 12px;
}
.travel-dest {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 14px;
  border: 1px solid rgba(210, 185, 130, 0.15);
  background: rgba(26, 20, 16, 0.7);
  cursor: pointer;
  transition: background 0.1s;
}
.travel-dest:hover { background: rgba(52, 39, 28, 0.9); }
.travel-dest-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
  opacity: 0.85;
}
.travel-dest-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
}
.travel-dest-name { font-size: 15px; color: #f1e6d0; }
.travel-dest-cost { font-size: 13px; color: #7aab5c; text-align: right; white-space: nowrap; }
.travel-dest-sub  { font-size: 12px; color: #5a4a3a; }
.travel-dest-type-inter .travel-dest-name { color: #c8b898; }
.travel-dist-bar-track {
  grid-column: 1 / -1;
  height: 3px;
  background: rgba(255,255,255,0.05);
  border-radius: 1px;
  overflow: hidden;
  margin-top: 4px;
}
.travel-dist-bar-fill {
  height: 100%;
  background: #4a3a2a;
  border-radius: 1px;
}
.travel-ship-brief { color: #5a4a3a; font-size: 12px; margin-left: auto; }
.travel-ship-model { color: #3a2a1a; }
.travel-items { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }

/* ── Ending screen ── */
.ending-shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 10px 0 6px;
  gap: 20px;
}
.ending-game-title {
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #5a4a3a;
}
.ending-outcome {
  font-size: clamp(28px, 8vw, 52px);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #f3ead7;
  line-height: 1.05;
}
.ending-outcome.dead    { color: #c75943; }
.ending-outcome.victory { color: #e6c03a; }
.ending-outcome.win     { color: #e6c03a; }
.ending-player {
  font-size: 15px;
  color: #8a7a66;
  letter-spacing: 0.06em;
}
.ending-player strong { color: #d9ccb6; font-weight: normal; }
.ending-score-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(260px, 80vw);
}
.ending-score-label {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #5a4a3a;
}
.ending-score-bar-track {
  width: 100%;
  height: 8px;
  background: #120e0b;
  border: 1px solid rgba(210, 185, 130, 0.12);
  overflow: hidden;
}
.ending-score-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #7d6030 0%, #e6c03a 100%);
  transition: width 0.6s ease;
}
.ending-score-fraction {
  font-size: 22px;
  color: #e6c03a;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}
.ending-score-max { color: #5a4a3a; font-size: 16px; }

.final-stats-headline {
  font-size: clamp(24px, 7vw, 40px);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #f3ead7;
  text-align: center;
}
.final-stats-copy {
  color: #c8b898;
  white-space: pre-wrap;
  line-height: 1.6;
  margin: 0 0 16px;
}
.summary-hit {
  color: #7aab5c;
}
.summary-miss {
  color: #7a6a55;
}

/* ── Player panel ── */
.player-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 16px;
  padding: 12px 14px;
  border: 1px solid rgba(210, 185, 130, 0.14);
  background: rgba(20, 15, 11, 0.8);
  margin-bottom: 14px;
}
.player-panel-identity {
  font-size: 13px;
  color: #b69a67;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.player-panel-caps {
  font-size: 13px;
  color: #e6c03a;
  text-align: right;
  white-space: nowrap;
}
.player-panel-bars {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.player-panel-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.player-panel-bar-label {
  color: #7a6a55;
  min-width: 2.4em;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.player-panel-bar-track {
  flex: 1;
  height: 7px;
  background: #120e0b;
  border: 1px solid rgba(210, 185, 130, 0.1);
  overflow: hidden;
}
.player-panel-bar-fill {
  height: 100%;
}
.player-panel-bar-fill.hp-high  { background: #7aab5c; }
.player-panel-bar-fill.hp-mid   { background: #c8a23a; }
.player-panel-bar-fill.hp-low   { background: #c75943; }
.player-panel-bar-fill.xp       { background: #5a7ab0; }
.player-panel-bar-val {
  color: #8a7a66;
  min-width: 5em;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.player-panel-gear {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
}
.player-panel-gear-slot {
  color: #7a6a55;
  letter-spacing: 0.04em;
}
.player-panel-gear-item {
  color: #c8b898;
}

/* ── Shop / Market ── */
.shop-status {
  display: flex;
  gap: 16px;
  font-size: 14px;
  color: #b69a67;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(210, 185, 130, 0.14);
}
.shop-status-val {
  color: #e6c03a;
  font-weight: bold;
}
.shop-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.shop-item {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 2px 12px;
  padding: 12px 14px;
  border: 1px solid rgba(210, 185, 130, 0.15);
  background: rgba(26, 20, 16, 0.7);
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}
.shop-item:hover:not(.sold-out) { background: rgba(52, 39, 28, 0.9); border-color: rgba(210, 185, 130, 0.3); }
.shop-item.sold-out { opacity: 0.45; cursor: default; }
.shop-item-name {
  font-size: 16px;
  color: #f1e6d0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.shop-item-price {
  font-size: 15px;
  color: #e6c03a;
  text-align: right;
  white-space: nowrap;
  align-self: center;
}
.shop-item-price.sold-out { color: #666; }
.shop-item-desc {
  font-size: 13px;
  color: #8a7a66;
  grid-column: 1 / -1;
}
.shop-item-qty {
  font-size: 12px;
  color: #7a6a55;
}
.shop-item-key {
  font-size: 11px;
  color: #5a4a3a;
  min-width: 1.2em;
}
.shop-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 14px;
}
@media (min-width: 580px) {
  .shop-body { grid-template-columns: 3fr 2fr; }
}
.shop-panel-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  color: #5a4a3a;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.shop-inv-panel {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.shop-inv-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 10px;
  font-size: 13px;
  color: #b69a67;
  background: rgba(26, 20, 16, 0.5);
  border: 1px solid rgba(210, 185, 130, 0.10);
}
.shop-inv-item-name { flex: 1; }
.shop-inv-qty {
  font-size: 12px;
  color: #7aab5c;
  font-weight: bold;
  margin-left: 8px;
}
.shop-inv-empty {
  font-size: 13px;
  color: #4a3a2a;
  font-style: italic;
  padding: 6px 0;
}
.shop-purchase-log {
  border-top: 1px solid rgba(210, 185, 130, 0.12);
  padding-top: 8px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.shop-log-entry {
  font-size: 12px;
  color: #7aab5c;
  padding: 1px 0;
}
/* ── Market two-panel layout ── */
.market-two-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 10px;
}
.market-panel-left,
.market-panel-right {
  border: 1px solid rgba(210, 185, 130, 0.12);
  background: rgba(20, 15, 11, 0.5);
  padding: 10px 12px;
  border-radius: 2px;
}
.market-panel-header {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #5a4a3a;
  margin-bottom: 8px;
}
.market-cargo-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 3px 0;
  border-bottom: 1px solid rgba(210, 185, 130, 0.07);
}
.market-cargo-name { color: #c8b898; font-size: 14px; }
.market-cargo-qty  { color: #8a7a66; font-size: 13px; }
.market-cargo-empty { color: #4a3a2a; font-size: 13px; font-style: italic; }

@media (max-width: 500px) {
  .market-two-panel { grid-template-columns: 1fr; }
}

@media (min-width: 640px) {
  .combat-hud {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── Equip comparison card ── */
.equip-prompt-question {
  font-size: 16px;
  color: #c8b898;
  margin-bottom: 10px;
}
.equip-purchase-line {
  font-size: 14px;
  color: #c8b89a;
  margin: 2px 0;
}
.equip-card {
  background: rgba(20, 16, 12, 0.7);
  border: 1px solid rgba(210, 185, 130, 0.22);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.equip-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 5px 0;
}
.equip-divider {
  border-top: 1px solid rgba(210, 185, 130, 0.15);
  margin: 4px 0;
}
.equip-row-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  min-width: 60px;
  flex-shrink: 0;
}
.equip-row-new .equip-row-label { color: #7ec87e; }
.equip-row-cur .equip-row-label { color: #7a6a55; }
.equip-row-name {
  flex: 1;
  font-size: 14px;
  color: #d2c0a6;
}
.equip-row-name.muted { color: #6a5a48; }
.equip-stat {
  font-size: 13px;
  font-weight: bold;
}
.equip-row-new .equip-stat { color: #7ec87e; }
.equip-row-cur .equip-stat { color: #7a6a55; }
.equip-stat.muted { color: #7a6a55; }

/* ── Final stats card ── */
.final-stats-narrative {
  font-size: 15px;
  color: #d2c0a6;
  line-height: 1.6;
  margin-bottom: 18px;
  white-space: pre-wrap;
}
.final-stats-card {
  background: rgba(20, 16, 12, 0.7);
  border: 1px solid rgba(210, 185, 130, 0.22);
  padding: 16px 18px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.final-stats-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.final-stats-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #7a6a55;
  min-width: 90px;
  flex-shrink: 0;
}
.final-stats-val {
  font-size: 14px;
  color: #d2c0a6;
  display: flex;
  align-items: center;
  gap: 8px;
}
.final-stats-bar-track {
  display: inline-block;
  width: 80px;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
  vertical-align: middle;
}
.final-stats-bar-fill {
  display: block;
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}
.final-stats-bar-fill.hp-high { background: #5a9e5a; }
.final-stats-bar-fill.hp-mid  { background: #9e8a3a; }
.final-stats-bar-fill.hp-low  { background: #9e4a3a; }

/* ── Game HUD bar ── */
#game-hud {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(6, 4, 2, 0.92);
  border-bottom: 1px solid rgba(210, 185, 130, 0.18);
  padding: 0 16px;
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
  color: #c8b890;
  user-select: none;
  backdrop-filter: blur(4px);
}
.hud-bar {
  display: flex;
  align-items: center;
  gap: 0;
  height: 36px;
  overflow: hidden;
  position: relative;
}
.hud-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 10px;
  border-right: 1px solid rgba(210, 185, 130, 0.12);
  white-space: nowrap;
  flex-shrink: 0;
}
.hud-item:first-child { padding-left: 0; }
.hud-item:last-child  { border-right: none; }
.hud-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6a5a42;
}
.hud-val { color: #d2b982; font-size: 12px; }
.hud-name { color: #eadfc9; font-weight: bold; font-size: 12px; }
.hud-mini-bar {
  display: inline-block;
  width: 40px;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
  vertical-align: middle;
  margin: 0 2px;
}
.hud-mini-fill {
  display: block;
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}
.hud-mini-fill.hp-high { background: #4a9a4a; }
.hud-mini-fill.hp-mid  { background: #9a8030; }
.hud-mini-fill.hp-low  { background: #9a3a2a; }
.hud-mini-fill.xp      { background: #3080c0; }
.hud-mini-fill.shield  { background: #2a7ab8; }
.hud-mini-fill.fuel    { background: #3a8a6a; }
.hud-icon { color: #7a6a50; font-size: 11px; }

/* Wide: show text labels */
@media (min-width: 601px) {
  .hud-label { display: inline; }
  .hud-icon  { display: none; }
}
/* Narrow: icon-only (hide labels and text values, keep bars) */
@media (max-width: 600px) {
  .hud-label { display: none; }
  .hud-icon  { display: inline; }
  .hud-item  { padding: 0 6px; gap: 3px; }
  .hud-val   { font-size: 11px; }
  .hud-mini-bar { width: 28px; }
}

/* Ship HUD colour overrides */
#game-hud[data-hud="ship"] {
  border-bottom-color: rgba(0, 200, 120, 0.20);
}
#game-hud[data-hud="ship"] .hud-label { color: #2a6a4a; }
#game-hud[data-hud="ship"] .hud-name  { color: #80ffb0; }
#game-hud[data-hud="ship"] .hud-val   { color: #60d090; }
#game-hud[data-hud="ship"] .hud-icon  { color: #2a6a4a; }
#game-hud[data-hud="ship"] .hud-item  { border-right-color: rgba(0, 200, 120, 0.10); }

/* Hover tooltip */
.hud-tooltip {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: rgba(10, 8, 5, 0.97);
  border: 1px solid rgba(210, 185, 130, 0.25);
  padding: 12px 16px;
  z-index: 30;
  box-shadow: 0 4px 16px rgba(0,0,0,0.6);
}
#game-hud:hover .hud-tooltip  { display: block; }
#game-hud[data-hud="ship"]:hover .hud-tooltip {
  border-color: rgba(0, 200, 120, 0.25);
}
.hud-tip-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 12px;
}
.hud-tip-row:last-child { margin-bottom: 0; }
.hud-tip-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6a5a42;
  min-width: 80px;
  flex-shrink: 0;
}
#game-hud[data-hud="ship"] .hud-tip-label { color: #2a6a4a; }
.hud-tip-bar-track {
  flex: 1;
  height: 5px;
  background: rgba(255,255,255,0.07);
  border-radius: 2px;
  overflow: hidden;
  max-width: 120px;
}
.hud-tip-bar-fill {
  display: block;
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}
.hud-tip-bar-fill.hp-high { background: #4a9a4a; }
.hud-tip-bar-fill.hp-mid  { background: #9a8030; }
.hud-tip-bar-fill.hp-low  { background: #9a3a2a; }
.hud-tip-bar-fill.xp      { background: #3080c0; }
.hud-tip-bar-fill.shield  { background: #2a7ab8; }
.hud-tip-bar-fill.fuel    { background: #3a8a6a; }
.hud-tip-val { color: #d2b982; min-width: 70px; text-align: right; flex-shrink: 0; }
#game-hud[data-hud="ship"] .hud-tip-val { color: #60d090; }
.hud-tip-gear {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(210,185,130,0.10);
  font-size: 11px;
  color: #9a8a6a;
}
.hud-tip-gear-slot { color: #5a4a32; text-transform: uppercase; font-size: 10px; margin-right: 4px; }
.hud-tip-gear-name { color: #c8b080; }

/* ─── Content markup classes (engine_lib/markup.py) ──────────────────────── */
.native-lines .warn  { color: #f07060; }
.native-lines .ok    { color: #6fcf6f; }
.native-lines .stat  { color: #f0c060; }
.native-lines .muted { color: #7a7060; }
.native-lines .hi    { color: #7ec8e3; }

/* ─── Roast Battle / Verbal Combat UI ───────────────────────────────────── */
.roast-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.roast-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.roast-round-label {
  color: #bfa986;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}
.roast-combatants {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.roast-combatant-name {
  font-size: clamp(14px, 3vw, 17px);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: bold;
}
.roast-combatant.player .roast-combatant-name { color: #7aab5c; }
.roast-combatant.opponent .roast-combatant-name { color: #d8937a; }

/* Tug-of-war confidence bar */
.roast-bar-section { display: flex; flex-direction: column; gap: 5px; }
.roast-bar-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.roast-bar-side-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.roast-bar-side-label.them { color: #c75943; }
.roast-bar-side-label.you  { color: #7aab5c; }
.roast-bar-score {
  font-size: 20px;
  font-weight: bold;
  letter-spacing: 0.05em;
  min-width: 3ch;
  text-align: center;
}
.roast-bar-score.pos { color: #7aab5c; }
.roast-bar-score.neg { color: #c75943; }
.roast-bar-score.neu { color: #bfa986; }
.roast-bar-track {
  position: relative;
  height: 18px;
  border: 1px solid rgba(210, 185, 130, 0.15);
  overflow: visible;
  /* THEM (red) is the background — fills from the right */
  background: linear-gradient(90deg, rgba(120,35,20,0.35) 0%, rgba(180,55,35,0.65) 100%);
}
/* YOU (green) fill grows from the left */
.roast-bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  /* JS sets width and transition */
  background: linear-gradient(90deg, rgba(55,130,40,0.75) 0%, rgba(80,170,50,0.5) 100%);
}
.roast-bar-indicator {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 10px;
  transform: translateX(-50%);
  background: #f1e6d0;
  border: 2px solid rgba(241, 230, 208, 0.9);
  border-radius: 3px;
  box-shadow: 0 0 10px rgba(241, 230, 208, 0.45);
  /* JS sets left and transition dynamically for animation */
}

/* Battle log */
.roast-log {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 220px;
  overflow-y: auto;
  padding: 10px 12px;
  border: 1px solid rgba(210, 185, 130, 0.12);
  background: rgba(10, 7, 5, 0.65);
  scrollbar-width: thin;
  scrollbar-color: rgba(210, 185, 130, 0.2) transparent;
}
.roast-log-entry { display: flex; flex-direction: column; gap: 2px; }
.roast-log-speaker {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.roast-log-speaker.player   { color: #5a9a45; }
.roast-log-speaker.opponent { color: #a06040; }
.roast-log-text {
  font-size: 14px;
  line-height: 1.45;
  color: #c8b898;
}
.roast-log-entry.insult         .roast-log-text { color: #d8937a; font-style: italic; }
.roast-log-entry.retort-correct .roast-log-text { color: #8ab87a; }
.roast-log-entry.retort-wrong   .roast-log-text { color: #9a8a72; }
.roast-log-entry.result-good    .roast-log-text {
  color: #e6c03a; font-size: 12px; text-align: center; font-style: italic;
}
.roast-log-entry.result-bad     .roast-log-text {
  color: #9a5040; font-size: 12px; text-align: center; font-style: italic;
}

/* Current insult waiting for a response */
.roast-current-insult {
  border: 1px solid rgba(210, 185, 130, 0.28);
  background: rgba(24, 14, 8, 0.88);
  padding: 14px 16px;
}
.roast-current-label {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #a06040;
  margin-bottom: 8px;
}
.roast-current-text {
  font-size: clamp(14px, 3.5vw, 17px);
  color: #eadfc9;
  line-height: 1.55;
  font-style: italic;
}
.roast-retorts-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #b69a67;
  margin: 2px 0 6px;
}

/* ── Roast battle result state ── */
.roast-continue-btn {
  margin-top: 8px;
  width: 100%;
  text-align: center;
}

@keyframes roast-win-pulse {
  0%, 100% { opacity: 0.75; }
  50%       { opacity: 1; filter: brightness(1.35); }
}
@keyframes roast-lose-pulse {
  0%, 100% { }
  50%       { filter: brightness(1.5) saturate(1.4); }
}
@keyframes roast-indicator-glow-win {
  0%   { box-shadow: 0 0 10px rgba(241,230,208,0.45); background: #f1e6d0; }
  35%  { box-shadow: 0 0 18px rgba(100,210,80,0.9), 0 0 36px rgba(100,210,80,0.5); background: #b0f090; }
  100% { box-shadow: 0 0 10px rgba(241,230,208,0.45); background: #f1e6d0; }
}
@keyframes roast-indicator-glow-lose {
  0%   { box-shadow: 0 0 10px rgba(241,230,208,0.45); background: #f1e6d0; }
  35%  { box-shadow: 0 0 18px rgba(210,80,60,0.9), 0 0 36px rgba(210,80,60,0.5); background: #f09090; }
  100% { box-shadow: 0 0 10px rgba(241,230,208,0.45); background: #f1e6d0; }
}

/* Glow animations trigger immediately on result state */
.roast-result-win .roast-bar-indicator {
  animation: roast-indicator-glow-win 1.8s ease-out forwards;
}
.roast-result-lose .roast-bar-indicator {
  animation: roast-indicator-glow-lose 1.8s ease-out forwards;
}

/* Pulse animations activate after the bar slides into position */
.roast-result-win.roast-bar-pulsing .roast-bar-fill {
  animation: roast-win-pulse 1.4s ease-in-out infinite;
}
.roast-result-lose.roast-bar-pulsing .roast-bar-track {
  animation: roast-lose-pulse 1.4s ease-in-out infinite;
}
