/* ═══════════════════════════════════════════════════════════════
   Andrei's Arcade — Shared Design System
   ═══════════════════════════════════════════════════════════════ */

/* ── Variables ──────────────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg:          #08080e;
  --bg-2:        #0b0f18;
  --bg-card:     #0d1420;
  --bg-card-h:   #101b2b;
  --bg-input:    #090e18;
  --bg-overlay:  rgba(8, 8, 14, 0.96);

  /* Borders */
  --border:      #192540;
  --border-dim:  #101a2e;
  --border-h:    #00c8f0;

  /* Accent — electric cyan-blue */
  --accent:            #00c8f0;
  --accent-dim:        #0891b2;
  --accent-dark:       #0c4a6e;
  --accent-glow:       rgba(0, 200, 240, 0.12);
  --accent-glow-strong:rgba(0, 200, 240, 0.28);

  /* Text */
  --text:       #dde8f5;
  --text-dim:   #6b7d92;
  --text-muted: #2c3d52;

  /* Status */
  --red:          #f87171;
  --red-bg:       #1f0a0a;
  --red-border:   #7f1d1d;
  --green:        #34d399;
  --green-bg:     #0a1f12;
  --green-border: #065f46;
  --yellow:       #fbbf24;
  --yellow-bg:    #1f1500;
  --yellow-border:#78350f;

  /* Typography */
  --ff-head: 'Orbitron', sans-serif;
  --ff-ui:   'Rajdhani', sans-serif;
  --ff-body: 'Inter', sans-serif;

  /* Spacing / shape */
  --radius:    8px;
  --radius-sm: 4px;
  --radius-lg: 14px;
  --topbar-h:  52px;
}

/* ── Reset ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--ff-body);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ── Scrollbar ──────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); }

/* ── Google Fonts ───────────────────────────────────────────────── */
/* Include in every HTML head:
   <link rel="preconnect" href="https://fonts.googleapis.com">
   <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
   <link href="https://fonts.googleapis.com/css2?family=Orbitron:wght@600;700;900&family=Rajdhani:wght@500;600;700&family=Inter:wght@400;500;600&display=swap" rel="stylesheet">
*/

/* ══════════════════════════════════════════════════════════════════
   COMPONENTS
   ══════════════════════════════════════════════════════════════════ */

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: var(--ff-ui);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: all .15s;
  white-space: nowrap;
}
.btn:disabled { opacity: .4; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}
.btn-primary:hover:not(:disabled) {
  background: #22d4f5;
  box-shadow: 0 0 20px var(--accent-glow-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border-color: var(--border);
}
.btn-ghost:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

.btn-danger {
  background: transparent;
  color: var(--red);
  border-color: var(--red-border);
}
.btn-danger:hover:not(:disabled) {
  background: var(--red-bg);
}

.btn-sm { padding: 5px 12px; font-size: 0.75rem; }
.btn-lg { padding: 12px 28px; font-size: 0.95rem; }
.btn-icon { padding: 7px; aspect-ratio: 1; }

/* ── Form elements ──────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-family: var(--ff-ui);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--text-muted); }
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.input:disabled { opacity: .5; cursor: not-allowed; }

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7d92' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.input-group {
  position: relative;
}
.input-group .input { padding-left: 40px; }
.input-group .input-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 0.9rem;
}
.input-group .input-action {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 4px;
  border-radius: 3px;
  transition: color .15s;
}
.input-group .input-action:hover { color: var(--accent); }

/* ── Cards ──────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card-title {
  font-family: var(--ff-ui);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* ── Badges ─────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 3px;
  border: 1px solid;
  font-family: var(--ff-ui);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1.6;
}

/* Platform badges */
.badge-dos     { background:#0a2010; color:#34d399; border-color:#065f46; }
.badge-nes     { background:#250a0a; color:#f87171; border-color:#7f1d1d; }
.badge-snes    { background:#1a0a30; color:#c084fc; border-color:#581c87; }
.badge-segaMD  { background:#251500; color:#fb923c; border-color:#7c2d12; }
.badge-gba     { background:#150a30; color:#a78bfa; border-color:#4c1d95; }
.badge-psx     { background:#0a1530; color:#60a5fa; border-color:#1e3a8a; }
.badge-n64     { background:#251f00; color:#fbbf24; border-color:#78350f; }
.badge-gb      { background:#0a200a; color:#86efac; border-color:#14532d; }
.badge-gbc     { background:#0a2020; color:#2dd4bf; border-color:#134e4a; }
.badge-atari2600{ background:#200a0a; color:#fca5a5; border-color:#7f1d1d; }
.badge-default { background:#0a1020; color:#7dd3fc; border-color:#1e3a8a; }

/* Role badges */
.badge-admin { background:rgba(0,200,240,.1); color:var(--accent); border-color:var(--accent-dim); }
.badge-user  { background:var(--bg-card); color:var(--text-dim); border-color:var(--border); }

/* Status badges */
.badge-active  { background:var(--green-bg);  color:var(--green);  border-color:var(--green-border); }
.badge-blocked { background:var(--red-bg);    color:var(--red);    border-color:var(--red-border); }
.badge-pending { background:var(--yellow-bg); color:var(--yellow); border-color:var(--yellow-border); }

/* ── Player Topbar (shared: player-dos, player-console) ──────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  height: var(--topbar-h);
  background: rgba(8, 8, 14, 0.97);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.topbar-title {
  flex: 1;
  font-family: var(--ff-ui);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.topbar-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  flex-shrink: 0;
}
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--ff-ui);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  transition: all .15s;
  white-space: nowrap;
}
.back-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Topbar icon buttons (CRT, fullscreen, etc.) ─────────────────── */
.topbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 0.9rem;
  transition: all .15s;
  flex-shrink: 0;
  position: relative;
}
.topbar-btn:hover { border-color: var(--accent); color: var(--accent); }
.topbar-btn.active { background: var(--accent-glow); border-color: var(--accent); color: var(--accent); }
.topbar-btn[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 3px 8px;
  font-size: 0.7rem;
  font-family: var(--ff-body);
  white-space: nowrap;
  color: var(--text-dim);
  pointer-events: none;
  z-index: 200;
}

/* ── Site header logo ────────────────────────────────────────────── */
.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.site-logo-icon {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #000;
  flex-shrink: 0;
  box-shadow: 0 0 16px var(--accent-glow-strong);
}
.site-logo-text {
  font-family: var(--ff-head);
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: 0.2em;
  text-shadow: 0 0 24px rgba(0, 200, 240, 0.4);
  white-space: nowrap;
}

/* ── Modal overlay ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 8, 14, 0.88);
  backdrop-filter: blur(6px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(12px);
  transition: transform .2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}
.modal-title {
  font-family: var(--ff-ui);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  padding: 4px;
  border-radius: 4px;
  transition: color .15s;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px 24px 24px; }

/* ── Toast notifications ─────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  max-width: 320px;
  pointer-events: all;
  animation: toastIn .2s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
}
.toast.success { border-color: var(--green-border); }
.toast.error   { border-color: var(--red-border); }
.toast.info    { border-color: var(--accent-dim); }
.toast-icon { font-size: 1rem; flex-shrink: 0; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Loading spinner ─────────────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty / error states ────────────────────────────────────────── */
.state-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}
.state-box .state-icon { font-size: 2.5rem; opacity: .5; }
.state-box p { font-size: 0.9rem; color: var(--text-dim); }

/* ── Alert boxes ─────────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid;
  font-size: 0.85rem;
  line-height: 1.5;
}
.alert-error   { background: var(--red-bg);    border-color: var(--red-border);    color: var(--red); }
.alert-success { background: var(--green-bg);  border-color: var(--green-border);  color: var(--green); }
.alert-info    { background: var(--accent-glow); border-color: var(--accent-dark); color: var(--accent); }
.alert-warn    { background: var(--yellow-bg); border-color: var(--yellow-border); color: var(--yellow); }

/* ── Tabs ────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab-btn {
  padding: 10px 18px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: var(--ff-ui);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  white-space: nowrap;
  transition: all .15s;
  margin-bottom: -1px;
}
.tab-btn:hover  { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Table ───────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
thead th {
  padding: 10px 14px;
  background: var(--bg-2);
  font-family: var(--ff-ui);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-dim);
  color: var(--text-dim);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg-2); }
tbody td.td-main { color: var(--text); font-weight: 500; }

/* ── Auth page layout ────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
}
.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}
.auth-logo .site-logo { justify-content: center; }
.auth-logo .site-logo-text { font-size: 1.3rem; }
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.75rem;
  margin: 18px 0;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.auth-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.auth-footer a { color: var(--accent); }
.auth-footer a:hover { text-decoration: underline; }

/* ── PIN Pad ─────────────────────────────────────────────────────── */
.pin-dots {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-bottom: 28px;
}
.pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  transition: all .15s;
}
.pin-dot.filled {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow-strong);
}
.pin-dot.error {
  background: var(--red);
  border-color: var(--red);
  animation: pinShake .3s ease;
}
@keyframes pinShake {
  0%,100%  { transform: translateX(0); }
  25%      { transform: translateX(-4px); }
  75%      { transform: translateX(4px); }
}
.pin-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 240px;
  margin: 0 auto;
}
.pin-key {
  aspect-ratio: 1;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--ff-ui);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  transition: all .1s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pin-key:hover  { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }
.pin-key:active { transform: scale(.94); }
.pin-key.pin-backspace { color: var(--text-dim); font-size: 1rem; }
.pin-key.pin-submit  { background: var(--accent); border-color: var(--accent); color: #000; font-size: 1rem; }
.pin-key.pin-submit:hover { background: #22d4f5; }

/* ── Announcement banner ─────────────────────────────────────────── */
.announcement-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 40px;
  background: rgba(0, 200, 240, 0.08);
  border-bottom: 1px solid var(--accent-dark);
  font-size: 0.85rem;
  color: var(--text);
}
.announcement-bar .ann-icon { color: var(--accent); flex-shrink: 0; }
.announcement-bar .ann-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 3px;
  transition: color .15s;
}
.announcement-bar .ann-close:hover { color: var(--text); }

/* ── CRT filter overlay ──────────────────────────────────────────── */
.crt-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9990;
  display: none;
}
.crt-overlay.on { display: block; }
.crt-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.18) 2px,
    rgba(0, 0, 0, 0.18) 4px
  );
}
.crt-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,.45) 100%);
}

/* ── Responsive helpers ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .topbar-hint     { display: none; }
  .topbar-sep      { display: none; }
  .auth-card       { padding: 24px 20px; }
  .announcement-bar{ padding: 10px 16px; }
  .modal           { max-height: 85vh; }
}
@media (max-width: 480px) {
  .auth-card { border: none; background: transparent; padding: 16px; }
}
