/* =========================================================
   GLITCH // GIR DOPEWARS ENGINE
   Standalone Game Styles
   ========================================================= */

:root {
  --bg: #02070d;
  --bg-panel: #081428;
  --bg-card: #0a162a;
  --bg-console: #01050a;

  --cyan: #40e0ff;
  --green: #39ff9f;
  --pink: #ff3ecb;
  --orange: #ff8c42;
  --red: #ff4d6d;

  --text-main: #e8f2ff;
  --text-soft: #8aa8cc;
  --text-dim: #4a6580;

  --line: rgba(100, 200, 255, 0.14);
  --line-strong: rgba(64, 224, 255, 0.35);

  --font-mono: "Courier New", Courier, monospace;
  --font-display: "Courier New", Courier, monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;

  background:
    radial-gradient(
      ellipse at 15% 0%,
      rgba(255, 62, 203, 0.10),
      transparent 50%
    ),
    radial-gradient(
      ellipse at 85% 0%,
      rgba(64, 224, 255, 0.10),
      transparent 50%
    ),
    var(--bg);

  color: var(--text-main);
  font-family: var(--font-mono);
  line-height: 1.5;
}

/* =========================================================
   GAME ROOT
   ========================================================= */

.gir-game {
  position: fixed;
  inset: 0;
  z-index: 9999;

  display: block;
  overflow-y: auto;

  min-height: 100vh;
  padding: 1rem;

  background:
    radial-gradient(
      ellipse at 15% 0%,
      rgba(255, 62, 203, 0.10),
      transparent 50%
    ),
    radial-gradient(
      ellipse at 85% 0%,
      rgba(64, 224, 255, 0.10),
      transparent 50%
    ),
    #02070d;

  color: var(--text-main);
}

.gir-game-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
}

/* =========================================================
   HEADER
   ========================================================= */

.gir-game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;

  padding: 1rem 0 1.2rem;
  border-bottom: 1px solid var(--line);
}

.gir-game-kicker {
  color: var(--green);

  font-size: 0.75rem;
  font-weight: 700;

  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.gir-game-header h2 {
  margin: 0.2rem 0;

  color: var(--cyan);

  font-family: var(--font-display);
  font-size: clamp(1.4rem, 4vw, 2rem);

  letter-spacing: 0.08em;
}

.gir-game-subtitle {
  color: var(--text-dim);

  font-size: 0.72rem;

  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.gir-game-close {
  flex-shrink: 0;

  border: 1px solid rgba(255, 62, 203, 0.4);
  background: rgba(255, 62, 203, 0.08);

  color: var(--pink);

  border-radius: 999px;
  padding: 0.6rem 1rem;

  font-family: inherit;
  cursor: pointer;

  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    color 0.15s ease;
}

.gir-game-close:hover,
.gir-game-close:focus-visible {
  border-color: var(--pink);
  background: rgba(255, 62, 203, 0.16);
  color: #fff;
}

/* =========================================================
   STAT BAR
   ========================================================= */

.gir-game-stats {
  display: grid;

  grid-template-columns:
    repeat(6, minmax(0, 1fr));

  gap: 0.7rem;
  margin: 1rem 0;
}

.gir-stat {
  min-width: 0;

  padding: 0.8rem;

  border: 1px solid var(--line);
  border-radius: 14px;

  background: rgba(8, 20, 40, 0.85);

  box-shadow:
    inset 0 0 20px rgba(64, 224, 255, 0.02);
}

.gir-stat-label {
  display: block;

  margin-bottom: 0.15rem;

  color: var(--text-dim);

  font-size: 0.68rem;

  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.gir-stat-value {
  display: block;

  overflow: hidden;

  color: var(--text-main);

  font-size: 1rem;

  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =========================================================
   PANELS
   ========================================================= */

.gir-game .panel {
  padding: 1rem;

  border: 1px solid var(--line);
  border-radius: 18px;

  background: rgba(8, 20, 40, 0.82);

  box-shadow:
    0 8px 30px rgba(0, 0, 0, 0.18);
}

/* =========================================================
   LOCATION
   ========================================================= */

.gir-game-location {
  display: flex;

  justify-content: space-between;
  align-items: center;

  gap: 1rem;
  margin-bottom: 1rem;
}

.gir-location-heading {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.gir-location-heading span {
  color: var(--text-dim);

  font-size: 0.68rem;

  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.gir-location-heading strong {
  color: var(--cyan);
  font-size: 1.2rem;
}

.gir-location-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* =========================================================
   BUTTONS
   ========================================================= */

.gir-game button {
  border: 1px solid var(--line);

  background: rgba(6, 13, 24, 0.8);

  color: var(--text-main);

  border-radius: 9px;

  padding: 0.55rem 0.8rem;

  font-family: inherit;
  font-size: 0.8rem;

  cursor: pointer;

  transition:
    border-color 0.15s ease,
    color 0.15s ease,
    background 0.15s ease,
    transform 0.1s ease;
}

.gir-game button:hover,
.gir-game button:focus-visible {
  border-color: var(--cyan);

  background: rgba(64, 224, 255, 0.07);

  color: var(--cyan);
}

.gir-game button:active {
  transform: translateY(1px);
}

/* =========================================================
   SECTION HEADERS
   ========================================================= */

.gir-section-heading {
  display: flex;

  justify-content: space-between;
  align-items: center;

  margin: 1rem 0 0.6rem;

  color: var(--cyan);

  font-size: 0.78rem;
  font-weight: 700;

  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.gir-market > .gir-section-heading {
  margin-top: 0;
}

.gir-live-dot {
  color: var(--green);

  text-shadow:
    0 0 8px rgba(57, 255, 159, 0.45);
}

/* =========================================================
   MARKET
   ========================================================= */

.gir-market {
  margin-top: 1rem;
}

.gir-market-grid {
  display: grid;

  grid-template-columns:
    repeat(3, minmax(0, 1fr));

  gap: 0.7rem;
}

.gir-market-card {
  min-width: 0;

  padding: 1rem;

  border: 1px solid var(--line);
  border-radius: 16px;

  background: rgba(10, 22, 42, 0.92);

  transition:
    border-color 0.15s ease,
    transform 0.15s ease;
}

.gir-market-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.gir-market-card h3 {
  margin: 0 0 0.25rem;

  color: var(--text-main);
  font-size: 1rem;
}

.gir-price {
  color: var(--cyan);

  font-size: 1.2rem;
  font-weight: 700;
}

.gir-held {
  margin-top: 0.15rem;

  color: var(--text-soft);

  font-size: 0.8rem;
}

.gir-market-buttons {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.7rem;
}

.gir-market-buttons button {
  flex: 1;
}

/* =========================================================
   PLAYER INVENTORY
   ========================================================= */

.gir-inventory {
  margin-top: 1rem;
}

.gir-inventory-panel {
  padding: 1rem;

  border: 1px solid var(--line);
  border-radius: 16px;

  background: rgba(10, 22, 42, 0.92);
}

.gir-inventory-list {
  display: grid;

  grid-template-columns:
    repeat(2, minmax(0, 1fr));

  gap: 0.55rem;
}

.gir-inventory-row {
  display: flex;

  justify-content: space-between;
  align-items: center;

  gap: 1rem;

  padding: 0.65rem 0.75rem;

  border: 1px solid rgba(100, 200, 255, 0.10);

  border-radius: 10px;

  background: #f2f2f2;

  color: #000000 !important;
}

.gir-inventory-row * {
  color: #000000 !important;
}

.gir-inventory-name {
  font-weight: 700;
}

.gir-inventory-qty {
  font-weight: 700;
}

.gir-inventory-empty {
  padding: 0.8rem;

  color: #000000 !important;

  font-weight: 700;

  text-align: center;
}

/* =========================================================
   LOCATION INVENTORY / MARKET TEXT
   FORCE BLACK
   ========================================================= */

.location-inventory,
.location-inventory *,
#market-table,
#market-table *,
.drug-price-row,
.drug-price-row *,
.gir-location-inventory,
.gir-location-inventory *,
.gir-market-inventory,
.gir-market-inventory * {
  color: #000000 !important;
  font-weight: 600;
}

/* =========================================================
   GAME ACTIONS
   ========================================================= */

.gir-actions {
  margin-top: 1rem;
}

.gir-actions button {
  min-width: 80px;
}

/* =========================================================
   CONSOLE / EVENT LOG
   ========================================================= */

.gir-console {
  margin-top: 1rem;
}

.gir-game-log {
  min-height: 180px;
  max-height: 300px;

  overflow-y: auto;

  padding: 0.9rem;

  border: 1px solid var(--line);
  border-radius: 14px;

  background: var(--bg-console);
  color: var(--text-soft);

  font-size: 0.82rem;

  scrollbar-width: thin;

  scrollbar-color:
    rgba(64, 224, 255, 0.25)
    transparent;
}

.gir-game-log::-webkit-scrollbar {
  width: 7px;
}

.gir-game-log::-webkit-scrollbar-track {
  background: transparent;
}

.gir-game-log::-webkit-scrollbar-thumb {
  background: rgba(64, 224, 255, 0.25);
  border-radius: 10px;
}

.gir-log-good {
  color: var(--green);
}

.gir-log-danger {
  color: var(--orange);
}

.gir-log-system {
  color: var(--cyan);
}

/* =========================================================
   LEADERBOARD
   ========================================================= */

.gir-leaderboard {
  margin-top: 1rem;
  margin-bottom: 2rem;
}

.gir-leaderboard-row {
  display: grid;

  grid-template-columns:
    45px minmax(0, 1fr) auto;

  gap: 0.75rem;

  align-items: center;

  padding: 0.55rem 0.7rem;

  border-bottom: 1px solid rgba(100, 200, 255, 0.08);
}

.gir-leaderboard-row:last-child {
  border-bottom: none;
}

.gir-leaderboard-rank {
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.gir-leaderboard-name {
  overflow: hidden;

  text-overflow: ellipsis;
  white-space: nowrap;
}

.gir-leaderboard-score {
  color: var(--green);
  font-family: var(--font-mono);
}

/* =========================================================
   FORM / INPUT SAFETY
   ========================================================= */

.gir-game input,
.gir-game select,
.gir-game textarea {
  font-family: inherit;
}

.gir-game button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 850px) {
  .gir-game-stats {
    grid-template-columns:
      repeat(3, minmax(0, 1fr));
  }

  .gir-market-grid {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .gir-game {
    padding: 0.7rem;
  }

  .gir-game-header {
    align-items: flex-start;
  }

  .gir-game-header h2 {
    font-size: 1.35rem;
  }

  .gir-game-stats {
    grid-template-columns: 1fr 1fr;
  }

  .gir-market-grid {
    grid-template-columns: 1fr;
  }

  .gir-game-location {
    flex-direction: column;
    align-items: stretch;
  }

  .gir-location-actions {
    width: 100%;
  }

  .gir-location-actions button {
    flex: 1;
  }

  .gir-actions {
    display: grid;

    grid-template-columns:
      repeat(2, 1fr);
  }

  .gir-actions button {
    width: 100%;
  }

  .gir-inventory-list {
    grid-template-columns: 1fr;
  }

  .gir-leaderboard-row {
    grid-template-columns:
      35px minmax(0, 1fr) auto;

    gap: 0.5rem;
  }
}

/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  .gir-game button,
  .gir-market-card {
    transition: none;
  }
}