/* ── Gold Rush simulation layout ── */
body:has(.goldrush-app) { overflow: hidden; height: 100vh; }

.goldrush-app {
  display: grid;
  grid-template-columns: 555px 1fr;
  grid-template-rows: 1fr;
  height: calc(100vh - 58px);
  gap: 0;
}

.btn {
  padding: 6px 16px;
  border: 1px solid #3a3a4a;
  border-radius: 4px;
  background: linear-gradient(180deg, #222230, #1a1a28);
  color: #ccd;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: inherit;
}
.btn:hover { border-color: #555; box-shadow: 0 0 8px rgba(255, 255, 255, 0.08); }

.round-display {
  font-family: 'Orbitron', sans-serif;
  font-size: 16px;
  font-weight: 500;
  color: #aab;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}

/* ── Sidebars ── */
.sidebar {
  overflow-y: auto;
  padding: 12px;
  background: linear-gradient(180deg, #111118 0%, #0d0d14 100%);
  border-right: 1px solid #1e1e2e;
}

.section {
  margin-bottom: 12px;
  background: #13131e;
  border-radius: 8px;
  padding: 12px 14px;
  border: 1px solid #1a1a2a;
}
.section h3 {
  font-family: 'Orbitron', sans-serif;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #556;
  margin-bottom: 10px;
}

.form-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 13px;
}
.form-row label {
  min-width: 75px;
  color: #778;
  font-size: 12px;
  font-weight: 600;
}
.form-row input[type="number"] {
  width: 64px;
  padding: 4px 6px;
  border: 1px solid #2a2a3a;
  border-radius: 4px;
  background: #0e0e18;
  color: #ccd;
  font-size: 12px;
  font-family: inherit;
}
.form-row input[type="range"] {
  width: 100px;
  flex-shrink: 0;
  accent-color: #ffd700;
}
.form-row input[type="checkbox"] { accent-color: #ffd700; }
.form-row select {
  flex: 1;
  padding: 4px 6px;
  border: 1px solid #2a2a3a;
  border-radius: 4px;
  background: #0e0e18;
  color: #ccd;
  font-size: 12px;
  font-family: inherit;
}

/* ── Player cards ── */
.player-card {
  background: #161622;
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 8px;
  border-left: 3px solid #666;
  border: 1px solid #1e1e2e;
  border-left: 3px solid #666;
}
.player-card .player-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.player-card .color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.player-card .player-name {
  font-size: 13px;
  font-weight: 600;
  flex: 1;
}

.alloc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px 12px;
}
.alloc-row {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
}
.alloc-row label {
  width: 38px;
  color: #778;
  font-size: 11px;
  font-weight: 600;
}
.alloc-row input[type="range"] {
  flex: 1;
  height: 14px;
  accent-color: #ffd700;
}
.alloc-row input[type="number"] {
  width: 52px;
  padding: 2px 4px;
  border: 1px solid #2a2a3a;
  border-radius: 4px;
  background: #0e0e18;
  color: #ccd;
  font-size: 11px;
  font-family: inherit;
}
.alloc-row .alloc-val {
  width: 32px;
  text-align: right;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.alloc-total {
  text-align: right;
  font-size: 11px;
  margin-top: 4px;
  color: #556;
  font-weight: 600;
}
.alloc-total.over { color: #e74c3c; }

.player-stats {
  font-size: 10px;
  color: #4a6;
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3px;
}
.player-stats span { margin-right: 4px; }

.btn-sm {
  padding: 3px 10px;
  font-size: 10px;
  font-weight: 700;
  border: 1px solid #3a3a4a;
  border-radius: 3px;
  background: #1a1a28;
  color: #99a;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: inherit;
  transition: border-color 0.15s;
}
.btn-sm:hover { border-color: #ffd700; color: #ffd700; }
.save-all-btn {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 10px 0;
  border: 1px solid #ffd700;
  border-radius: 6px;
  background: transparent;
  color: #ffd700;
  font-family: 'Orbitron', sans-serif;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 2px;
  transition: background 0.15s, box-shadow 0.15s;
}
.save-all-btn:hover {
  background: rgba(255, 215, 0, 0.08);
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.15);
}

.main {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  background: #0a0a12;
  position: relative;
}
#game-canvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ── Scoreboard ── */
.scoreboard { margin-bottom: 6px; }
.score-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  font-size: 16px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  border-radius: 4px;
  transition: background 0.15s;
}
.score-row:hover { background: rgba(255, 255, 255, 0.03); }
.score-row .score-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  box-shadow: 0 0 6px currentColor;
}
.score-row .score-name { flex: 1; color: #bbc; }
.score-type.api {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  background: #2563eb;
  color: #fff;
  padding: 1px 4px;
  border-radius: 3px;
  margin-left: 5px;
  vertical-align: middle;
  letter-spacing: 0.5px;
}
.score-bounty {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  background: #b8860b;
  color: #fff;
  padding: 1px 4px;
  border-radius: 3px;
  margin-left: 5px;
  vertical-align: middle;
  letter-spacing: 0.5px;
}
.score-row .score-gold {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 16px;
  min-width: 60px;
  text-align: right;
  color: #ffd700;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
}
.score-row .score-rate { font-size: 14px; min-width: 55px; text-align: right; font-weight: 600; }
.score-row .score-tax { font-size: 13px; color: #e74c3c; min-width: 60px; text-align: right; opacity: 0.8; }
.score-row .score-status { color: #ff6600; font-size: 14px; min-width: 40px; text-align: right; font-weight: 700; letter-spacing: 1px; }
.score-status:not(:empty) { animation: fight-blink 0.6s infinite; }
@keyframes fight-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

#chart-canvas {
  width: 100%;
  height: 240px;
  border-radius: 6px;
  background: #0e0e18;
  margin-bottom: 8px;
  border: 1px solid #1a1a2a;
}

.chart-range-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}
.chart-tab {
  flex: 1;
  padding: 6px 0;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid #2a2a3a;
  border-radius: 4px;
  background: #0e0e18;
  color: #556;
  cursor: pointer;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: inherit;
  transition: all 0.15s;
}
.chart-tab:hover { border-color: #444; color: #99a; }
.chart-tab.active {
  background: linear-gradient(180deg, #1a1a30, #151528);
  border-color: #ffd700;
  color: #ffd700;
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.1);
}

/* ── Suspended player styles ── */
.score-row-suspended { opacity: 0.45; }
.score-row-suspended .score-name { cursor: pointer; }
.score-row-suspended .score-name:hover { text-decoration: underline; text-decoration-style: dotted; }
.score-suspended {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  background: #8b0000;
  color: #ff9999;
  padding: 1px 4px;
  border-radius: 3px;
  margin-left: 5px;
  vertical-align: middle;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.score-suspended-status {
  color: #e74c3c;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
}

/* ── Error modal ── */
.error-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.7);
  align-items: center;
  justify-content: center;
}
.error-modal.visible { display: flex; }
.error-modal-content {
  background: linear-gradient(180deg, #1a1a28 0%, #141420 100%);
  border: 1px solid #333;
  border-radius: 12px;
  padding: 24px 28px;
  min-width: 380px;
  max-width: 560px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}
.error-modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.error-modal-player {
  font-family: 'Orbitron', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #e74c3c;
  letter-spacing: 1px;
}
.error-modal-since {
  font-size: 13px;
  color: #667;
  flex: 1;
}
.error-modal-x {
  background: none;
  border: none;
  color: #667;
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  transition: color 0.15s;
}
.error-modal-x:hover { color: #e74c3c; }
.error-modal-body {
  background: #0e0e18;
  border: 1px solid #2a2a3a;
  border-radius: 6px;
  padding: 14px 16px;
  font-family: 'Consolas', 'Fira Code', monospace;
  font-size: 14px;
  line-height: 1.6;
  color: #c99;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
  margin: 0;
  user-select: text;
}
.error-modal-copy-btn {
  display: block;
  margin-top: 14px;
  margin-left: auto;
  padding: 7px 20px;
  border: 1px solid #555;
  border-radius: 5px;
  background: #1e1e2e;
  color: #bbc;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.15s;
  font-family: inherit;
}
.error-modal-copy-btn:hover { border-color: #ffd700; color: #ffd700; }

.scale-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 12px;
}
.scale-row label { width: 55px; color: #778; font-weight: 600; }
.scale-row input[type="number"] {
  width: 55px;
  padding: 3px 4px;
  border: 1px solid #2a2a3a;
  border-radius: 4px;
  background: #0e0e18;
  color: #ccd;
  font-size: 11px;
  font-family: inherit;
}
