/* Blue Star Logistics — UI styles */
:root {
  --blue: #42b0d5;
  --deep: #0c2d44;
  --panel: rgba(8, 22, 33, 0.82);
  --panel2: rgba(14, 36, 52, 0.92);
  --text: #eaf4f9;
  --dim: #9fb8c6;
  --warn: #ffb347;
  --bad: #ff5a5a;
  --good: #69d98a;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #06121c; }
body, button, input, select {
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
}
canvas.game { display: block; }

#error-overlay {
  display: none; position: fixed; z-index: 1000; top: 10px; left: 50%;
  transform: translateX(-50%); max-width: 90%;
  background: #5a1212; border: 1px solid #ff7a7a; color: #ffd9d9;
  padding: 10px 16px; border-radius: 8px; font-size: 13px; white-space: pre-wrap;
}

/* ---------- Start screen ---------- */
#start-screen {
  position: fixed; inset: 0; z-index: 500;
  background:
    radial-gradient(1200px 500px at 50% 115%, rgba(66,176,213,0.25), transparent 60%),
    linear-gradient(180deg, #08131d 0%, #0b2233 55%, #0e3550 100%);
  display: flex; align-items: center; justify-content: center; text-align: center;
}
.start-inner { max-width: 720px; padding: 24px; }
.brand {
  font-size: 64px; font-weight: 800; letter-spacing: 4px; color: #fff;
  text-shadow: 0 4px 30px rgba(66,176,213,0.5);
}
.brand .star { color: var(--blue); }
.brand .thin { font-weight: 300; color: var(--blue); }
.subtitle { margin-top: 6px; font-size: 15px; letter-spacing: 6px; color: var(--dim); }
.start-buttons { margin-top: 42px; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.big-btn {
  width: 320px; padding: 14px 0; font-size: 18px; font-weight: 700; letter-spacing: 2px;
  background: var(--blue); color: #06222e; border: none; border-radius: 10px; cursor: pointer;
  transition: transform 0.08s, filter 0.12s;
}
.big-btn:hover { filter: brightness(1.12); transform: translateY(-1px); }
.big-btn.ghost { background: transparent; color: var(--blue); border: 2px solid var(--blue); }
.start-howto {
  margin-top: 26px; text-align: left; background: var(--panel); border: 1px solid rgba(66,176,213,0.35);
  border-radius: 10px; padding: 16px 22px; font-size: 14px; line-height: 1.8; color: var(--text);
  max-height: 38vh; overflow: auto;
}
.start-foot { margin-top: 34px; font-size: 11.5px; color: var(--dim); line-height: 1.7; }
.loading-note {
  position: absolute; bottom: 36px; left: 0; right: 0; text-align: center;
  letter-spacing: 6px; color: var(--blue); font-weight: 700; animation: pulse 1s infinite alternate;
}
@keyframes pulse { from { opacity: 0.45; } to { opacity: 1; } }

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

#topbar {
  position: absolute; top: 12px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 18px; align-items: flex-start;
}
#clock-box {
  background: var(--panel); border: 1px solid rgba(66,176,213,0.3); border-radius: 10px;
  padding: 7px 16px; font-size: 17px; font-weight: 700; display: flex; gap: 12px; align-items: center;
}
#hud-weather { font-size: 18px; }
#money-box {
  position: absolute; right: 16px; top: 0;
  background: var(--panel); border: 1px solid rgba(66,176,213,0.3); border-radius: 10px;
  padding: 8px 16px; min-width: 170px; text-align: right;
}
#hud-money { font-size: 20px; font-weight: 800; color: var(--good); }
#level-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
#hud-level { font-size: 12px; font-weight: 700; color: var(--blue); white-space: nowrap; }
#xp-bar { flex: 1; height: 6px; background: rgba(255,255,255,0.12); border-radius: 3px; overflow: hidden; }
#xp-fill { height: 100%; width: 0%; background: var(--blue); border-radius: 3px; }

#mission-panel {
  position: absolute; right: 16px; top: 86px; width: 280px;
  background: var(--panel); border: 1px solid rgba(66,176,213,0.3); border-left: 4px solid var(--blue);
  border-radius: 10px; padding: 10px 14px;
}
#mission-title { font-size: 11px; letter-spacing: 2px; color: var(--blue); font-weight: 800; }
#mission-obj { font-size: 14px; margin-top: 4px; line-height: 1.45; }
#mission-dist { font-size: 12px; color: var(--dim); margin-top: 4px; }

#prompt {
  position: absolute; bottom: 27%; left: 50%; transform: translateX(-50%);
  background: var(--panel2); border: 1px solid var(--blue); border-radius: 10px;
  padding: 10px 22px; font-size: 16px; font-weight: 600; white-space: nowrap;
}
#prompt b { color: var(--blue); }
#hint {
  position: absolute; top: 70px; left: 50%; transform: translateX(-50%);
  background: rgba(8,22,33,0.6); border-radius: 8px; padding: 6px 14px; font-size: 13px; color: var(--dim);
}

#gauge-cluster { position: absolute; right: 14px; bottom: 12px; text-align: center; }
#gauges { background: transparent; }
#cluster-extra {
  display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: -4px;
  background: var(--panel); border-radius: 8px; padding: 5px 10px; font-size: 13px; font-weight: 700;
}
#hud-gear { color: var(--blue); font-size: 16px; min-width: 22px; }
#hud-damage { color: var(--dim); }
#hud-damage.warn { color: var(--warn); }
#hud-damage.bad { color: var(--bad); }
.ind { color: #3a5666; transition: color 0.05s; }
.ind.on { color: var(--good); text-shadow: 0 0 8px var(--good); }
#ind-lights.on { color: #ffe27a; text-shadow: 0 0 8px #ffe27a; }

#minimap-box {
  position: absolute; left: 14px; bottom: 12px;
  background: var(--panel); border: 1px solid rgba(66,176,213,0.3); border-radius: 12px; padding: 8px;
}
#minimap { display: block; border-radius: 8px; }
#gps-text { font-size: 12px; color: var(--blue); font-weight: 700; text-align: center; margin-top: 5px; min-height: 15px; }

#mirror-frame {
  position: absolute; top: 18px; left: 50%; transform: translateX(-50%);
  width: 30%; max-width: 420px; aspect-ratio: 3.4; border: 3px solid #1d3a4d; border-radius: 8px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.5); pointer-events: none;
}
#mirror-frame::after {
  content: "REAR VIEW"; position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%);
  font-size: 9px; letter-spacing: 2px; color: var(--dim);
}

#toasts {
  position: absolute; bottom: 16%; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast {
  background: var(--panel2); border: 1px solid rgba(66,176,213,0.45); border-radius: 10px;
  padding: 9px 20px; font-size: 14.5px; font-weight: 600; animation: toastIn 0.25s ease-out;
  box-shadow: 0 6px 22px rgba(0,0,0,0.45); white-space: nowrap;
}
.toast.good { border-color: var(--good); }
.toast.bad { border-color: var(--bad); color: #ffc9c9; }
.toast.ach { border-color: #ffd700; color: #ffe89a; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

#damage-flash {
  position: fixed; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(255,40,40,0.45) 100%);
  transition: opacity 0.5s;
}

/* ---------- Menus ---------- */
#menu-overlay {
  position: fixed; inset: 0; z-index: 300; background: rgba(4, 12, 19, 0.78);
  display: flex; align-items: center; justify-content: center; backdrop-filter: blur(3px);
}
#menu-card {
  background: linear-gradient(180deg, #0d2435, #0a1c2a); border: 1px solid rgba(66,176,213,0.4);
  border-radius: 16px; padding: 26px 30px; min-width: 480px; max-width: 860px;
  max-height: 86vh; overflow: auto; box-shadow: 0 18px 60px rgba(0,0,0,0.6);
}
.menu-title { font-size: 22px; font-weight: 800; letter-spacing: 3px; color: var(--blue); margin-bottom: 4px; }
.menu-sub { font-size: 12.5px; color: var(--dim); margin-bottom: 18px; }
.menu-list { display: flex; flex-direction: column; gap: 10px; }
.menu-btn {
  padding: 12px 18px; font-size: 15px; font-weight: 700; letter-spacing: 1px; text-align: left;
  background: rgba(66,176,213,0.1); color: var(--text); border: 1px solid rgba(66,176,213,0.35);
  border-radius: 10px; cursor: pointer; transition: background 0.1s;
}
.menu-btn:hover { background: rgba(66,176,213,0.28); }
.menu-btn.primary { background: var(--blue); color: #06222e; }
.menu-btn.primary:hover { filter: brightness(1.1); }
.menu-btn.danger { border-color: rgba(255,90,90,0.5); color: #ffb3b3; }
.menu-btn:disabled { opacity: 0.4; cursor: default; }
.menu-btn small { display: block; font-weight: 400; color: var(--dim); font-size: 12px; margin-top: 2px; letter-spacing: 0; }
.menu-btn.primary small { color: #06384a; }
.back-row { margin-top: 20px; display: flex; gap: 10px; }

.job-card {
  border: 1px solid rgba(66,176,213,0.3); border-radius: 10px; padding: 12px 16px;
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  background: rgba(255,255,255,0.03);
}
.job-card .jc-main { flex: 1; }
.job-card .jc-route { font-weight: 700; font-size: 15px; }
.job-card .jc-meta { font-size: 12.5px; color: var(--dim); margin-top: 3px; line-height: 1.5; }
.job-card .jc-pay { text-align: right; }
.job-card .jc-pay .p { color: var(--good); font-weight: 800; font-size: 17px; }
.job-card .jc-pay .x { color: var(--blue); font-size: 12px; font-weight: 700; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 10.5px; font-weight: 800; letter-spacing: 1px; margin-right: 5px; }
.tag.t20 { background: #1d5e80; } .tag.t40 { background: #14618f; } .tag.hc { background: #5e3da8; }
.tag.rf { background: #b0bec5; color: #123; } .tag.dg { background: #c2541b; } .tag.rush { background: #c9a227; color: #1d1703; }

.set-row { display: flex; justify-content: space-between; align-items: center; padding: 9px 4px; border-bottom: 1px solid rgba(255,255,255,0.07); gap: 18px; }
.set-row label { font-size: 14px; font-weight: 600; }
.set-row input[type=range] { width: 180px; accent-color: var(--blue); }
.set-row select {
  background: #0a1c2a; border: 1px solid rgba(66,176,213,0.4); color: var(--text);
  padding: 6px 10px; border-radius: 8px; font-size: 13px;
}
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 26px; }
.stat-row { display: flex; justify-content: space-between; padding: 7px 4px; border-bottom: 1px solid rgba(255,255,255,0.07); font-size: 14px; }
.stat-row b { color: var(--blue); }
.ach-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ach-card { border: 1px solid rgba(255,255,255,0.12); border-radius: 10px; padding: 10px 14px; opacity: 0.45; }
.ach-card.got { opacity: 1; border-color: #ffd700; background: rgba(255,215,0,0.06); }
.ach-card .a-name { font-weight: 800; font-size: 14px; }
.ach-card.got .a-name { color: #ffe89a; }
.ach-card .a-desc { font-size: 12px; color: var(--dim); margin-top: 2px; }

.truck-card {
  border: 1px solid rgba(66,176,213,0.3); border-radius: 10px; padding: 14px 18px; margin-bottom: 10px;
  display: flex; justify-content: space-between; align-items: center; gap: 16px; background: rgba(255,255,255,0.03);
}
.truck-card .t-name { font-weight: 800; font-size: 16px; }
.truck-card .t-stats { font-size: 12.5px; color: var(--dim); margin-top: 4px; line-height: 1.6; }
.upg-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 4px; border-bottom: 1px solid rgba(255,255,255,0.07); }
.upg-row .u-name { font-size: 14px; font-weight: 600; }
.upg-row .u-lv { color: var(--blue); font-size: 12px; margin-left: 8px; }
.pill-btn {
  background: var(--blue); color: #06222e; font-weight: 800; border: none; border-radius: 8px;
  padding: 8px 16px; cursor: pointer; font-size: 13px; white-space: nowrap;
}
.pill-btn:hover { filter: brightness(1.1); }
.pill-btn:disabled { background: #2a4a5c; color: #6f8997; cursor: default; }
.pill-btn.owned { background: var(--good); }

#bigmap-canvas { display: block; border-radius: 10px; background: #0a1722; }
.map-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 12px; color: var(--dim); }
.map-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }

.kbd-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.kbd-table td { padding: 6px 8px; border-bottom: 1px solid rgba(255,255,255,0.07); }
.kbd-table td:first-child { width: 130px; }
kbd {
  background: #14313f; border: 1px solid rgba(66,176,213,0.5); border-bottom-width: 3px;
  border-radius: 6px; padding: 2px 9px; font-size: 12.5px; font-weight: 700; color: var(--blue);
  font-family: inherit; margin-right: 3px; display: inline-block;
}
.confirm-box { text-align: center; padding: 10px 0; font-size: 15px; line-height: 1.6; }
