:root {
  --bg: #0f1420;
  --panel: #161d2e;
  --panel-alt: #1c2540;
  --border: #2a3352;
  --text: #e7eaf3;
  --text-dim: #8b93ab;
  --accent: #4f7cff;
  --green: #33c481;
  --red: #ef5a6f;
  --amber: #e0a94b;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--accent); }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 28px; background: var(--panel); border-bottom: 1px solid var(--border);
}
.topbar .brand { font-weight: 800; font-size: 18px; text-decoration: none; color: var(--text); }
.topnav { display: flex; align-items: center; gap: 16px; font-size: 14px; }
.topnav a { color: var(--text-dim); text-decoration: none; }
.topnav a:hover { color: var(--text); }
.lang-switch { display: flex; gap: 8px; }
.lang-switch a { padding: 2px 8px; border-radius: 6px; }
.lang-switch a.lang-active { color: var(--text); background: rgba(255,255,255,0.08); font-weight: 600; }

/* Minimal RTL support — mirrors the layout for Arabic; this demo
   site's own chrome is still English-only text, RTL here mainly
   affects how things read left-to-right vs right-to-left. */
html[dir="rtl"] .topbar { flex-direction: row-reverse; }
html[dir="rtl"] .topnav { flex-direction: row-reverse; }
html[dir="rtl"] .lang-switch { flex-direction: row-reverse; }
html[dir="rtl"] .chip-row { flex-direction: row-reverse; justify-content: flex-end; }
html[dir="rtl"] .game-grid { direction: rtl; }
html[dir="rtl"] .game-frame-bar { flex-direction: row-reverse; }

.balance-pill {
  background: var(--panel-alt); border: 1px solid var(--border); border-radius: 20px;
  padding: 6px 14px; font-weight: 700; font-size: 13px;
}

.content { max-width: 960px; margin: 0 auto; padding: 28px 20px; }

.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; font-size: 14px; }
.flash-success { background: rgba(51,196,129,0.15); color: var(--green); }
.flash-error { background: rgba(239,90,111,0.15); color: var(--red); }
.flash-info { background: rgba(79,124,255,0.15); color: var(--accent); }

.error { color: var(--red); font-size: 14px; }
.muted { color: var(--text-dim); font-size: 13px; }

.auth-card {
  max-width: 380px; margin: 40px auto; background: var(--panel);
  border: 1px solid var(--border); border-radius: 12px; padding: 28px;
}
.auth-card h1 { margin-top: 0; font-size: 20px; }
.auth-card label { display: block; font-size: 12px; color: var(--text-dim); margin: 12px 0 4px; }
.auth-card input {
  width: 100%; padding: 10px 12px; background: var(--panel-alt); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 14px;
}
.btn {
  width: 100%; margin-top: 18px; padding: 11px; background: var(--accent); color: white;
  border: none; border-radius: 8px; font-weight: 700; font-size: 14px; cursor: pointer;
}
.btn-sm {
  display: inline-block; padding: 6px 12px; background: var(--panel-alt); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); text-decoration: none; font-size: 13px;
}

.test-mode-banner {
  background: rgba(224,169,75,0.12); border: 1px solid var(--amber); color: var(--amber);
  border-radius: 8px; padding: 14px 16px; font-size: 13px; line-height: 1.5; margin-bottom: 20px;
}

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 28px; }
.chip {
  padding: 8px 16px; background: var(--panel); border: 1px solid var(--border); border-radius: 20px;
  text-decoration: none; color: var(--text); font-size: 13px;
}
.chip-active { background: var(--accent); border-color: var(--accent); color: white; }

.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.game-card {
  display: block; position: relative; aspect-ratio: 4 / 3; overflow: hidden;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; text-decoration: none; color: var(--text);
}
.game-card:hover { border-color: var(--accent); }
.game-card-thumb { width: 100%; height: 100%; object-fit: cover; display: block; background: var(--panel-alt); }
.game-card-placeholder {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 2rem; background: var(--panel-alt); color: var(--text-dim);
}
.game-card-name {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 10px 7px;
  font-size: 12px; font-weight: 600; line-height: 1.3;
  background: linear-gradient(to top, rgba(0,0,0,0.85), rgba(0,0,0,0));
  color: #fff;
}

.game-frame-wrap { display: flex; flex-direction: column; height: calc(100vh - 130px); }
.game-frame-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.game-frame { flex: 1; width: 100%; border: 1px solid var(--border); border-radius: 10px; background: black; }