/* =========================================================
   OGX Oracle – DARK SPACE UI (v2)
   - clean tokens
   - better contrast + spacing
   - stable tables @100% zoom
   - better focus + a11y
   - no inline-style dependencies (CSP friendly)
   ========================================================= */

/* NOTE:
   - Fonts are loaded via Google Fonts (allowed by your CSP "relaxed" mode).
   - Keep variables; everything derives from tokens below.
*/

@import url("https://fonts.googleapis.com/css2?family=Oxanium:wght@400;500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap");

/* ──────────────────────────────────────────────────────────
   TOKENS
   ────────────────────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg-0: #040e1e;
  --bg-1: #091828;
  --bg-2: #0d2035;

  /* Surfaces */
  --surface-0: rgba(52, 69, 102, 0.60);
  --surface-1: rgba(37, 48, 70,  0.80);
  --surface-2: rgba(37, 48, 70,  0.96);

  /* Lines */
  --line-0: rgba(65, 86, 128, 0.30);
  --line-1: rgba(65, 86, 128, 0.50);
  --line-2: rgba(65, 86, 128, 0.70);
  --line-3: rgba(65, 86, 128, 0.90);

  /* Text */
  --text-0: #E6EBFB;
  --text-1: rgba(230, 235, 251, 0.80);
  --text-2: rgba(230, 235, 251, 0.55);
  --text-3: rgba(230, 235, 251, 0.38);

  /* Brand / Accent */
  --acc-0: #5b9cf5;
  --acc-1: #93c5fd;
  --acc-2: rgba(65, 86, 128, 0.40);
  --acc-3: rgba(65, 86, 128, 0.70);

  /* Status */
  --good: #34d399;
  --good-bg: rgba(52, 211, 153, 0.10);
  --good-line: rgba(52, 211, 153, 0.34);

  --warn: #f59e0b;
  --warn-bg: rgba(245, 158, 11, 0.10);
  --warn-line: rgba(245, 158, 11, 0.34);

  --bad: #fb7185;
  --bad-bg: rgba(244, 63, 94, 0.10);
  --bad-line: rgba(244, 63, 94, 0.40);

  /* Radii */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 22px;

  /* Shadows */
  --shadow-lg: 0 10px 34px rgba(0, 0, 0, 0.42);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.34);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.28);

  /* Typography */
  --font-ui: "Oxanium", "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-head: "Oxanium", "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Motion */
  --ease: 0.14s ease;

  /* Layout */
  --wrap: 1200px;
}

/* ──────────────────────────────────────────────────────────
   RESET / BASE
   ────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  color-scheme: dark;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-0);
  min-height: 100vh;

  background:
    radial-gradient(1200px 560px at 16% -6%, rgba(65,86,128,0.18), transparent 65%),
    radial-gradient(900px 460px at 84% 2%,  rgba(65,86,128,0.12), transparent 62%),
    radial-gradient(1000px 700px at 50% 112%, rgba(37,48,70,0.15), transparent 58%),
    linear-gradient(180deg, #040e1e 0%, #07162a 48%, #091828 100%);
}

/* Subtle grain / stars overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: none;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
}

:focus-visible {
  outline: none;
}

/* Motion reduction */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ──────────────────────────────────────────────────────────
   LAYOUT UTILS
   ────────────────────────────────────────────────────────── */
.wrap {
  position: relative;
  z-index: 1;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 24px;
}

.main-pad {
  padding-top: 22px;
  padding-bottom: 8px;
}

.row {
  display: flex;
  align-items: center;
}

.between {
  justify-content: space-between;
}

.grow {
  flex: 1;
}

.center {
  text-align: center;
}

.wrap-flex {
  flex-wrap: wrap;
}

.align-center {
  align-items: center;
}

.gap {
  gap: 12px;
}
.gap-xs {
  gap: 8px;
}
.gap-12 {
  gap: 12px;
}

.mt-4 {
  margin-top: 4px;
}
.mt-12 {
  margin-top: 12px;
}
.mt-14 {
  margin-top: 14px;
}
.mt-16 {
  margin-top: 16px;
}

.fs-11 {
  font-size: 11px;
}
.fs-12 {
  font-size: 12px;
}
.fs-13 {
  font-size: 13px;
}

.ml-0 {
  margin-left: 0 !important;
}

.mw-200 {
  max-width: 200px;
}

/* ──────────────────────────────────────────────────────────
   TYPOGRAPHY
   ────────────────────────────────────────────────────────── */
h1 {
  font-family: var(--font-head);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.7px;
  line-height: 1.15;
  color: var(--text-0);
}

h2 {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-1);
  margin-bottom: 14px;
}

.muted {
  color: var(--text-2);
}

.dim {
  color: var(--text-3);
}

.mono {
  font-family: var(--font-mono);
  font-size: 13px;
}

.help-text {
  font-size: 13px;
  margin-bottom: 14px;
  color: var(--text-2);
}

.code-inline {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--acc-1);
}

/* ──────────────────────────────────────────────────────────
   SKIP LINK (A11Y)
   ────────────────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  left: -999px;
  top: 12px;
  z-index: 9999;
  background: rgba(7, 14, 28, 0.92);
  border: 1px solid var(--line-2);
  color: var(--text-0);
  padding: 10px 14px;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
}
.skip-link:focus {
  left: 12px;
}

/* ──────────────────────────────────────────────────────────
   TOPBAR
   ────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(4, 12, 24, 0.70);
  border-bottom: 1px solid var(--line-1);
  backdrop-filter: blur(16px) saturate(1.45);
  -webkit-backdrop-filter: blur(16px) saturate(1.45);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
}

.brand {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.brand-mark {
  color: var(--acc-0);
  text-shadow: 0 0 18px rgba(91, 163, 245, 0.18);
}

.brand-rest {
  color: var(--text-0);
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav a {
  color: var(--text-2);
  padding: 7px 12px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
  transition: color var(--ease), background var(--ease), border-color var(--ease);
  border: 1px solid transparent;
}

.nav a:hover {
  color: var(--text-0);
  background: rgba(91, 163, 245, 0.10);
  border-color: rgba(91, 163, 245, 0.18);
}

.nav a.active {
  color: var(--acc-1);
  background: rgba(91, 163, 245, 0.14);
  border-color: rgba(91, 163, 245, 0.22);
}

/* ──────────────────────────────────────────────────────────
   CARDS / SEPARATORS
   ────────────────────────────────────────────────────────── */
.card {
  background: linear-gradient(180deg, var(--surface-1), var(--surface-0));
  border: 1px solid var(--line-1);
  border-radius: var(--r-xl);
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
}

.sep {
  border: 0;
  border-top: 1px solid var(--line-0);
  margin: 18px 0;
}

/* ──────────────────────────────────────────────────────────
   INPUTS
   ────────────────────────────────────────────────────────── */
.input {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-1);
  background: rgba(7, 14, 28, 0.58);
  color: var(--text-0);
  outline: none;
  transition: border-color var(--ease), box-shadow var(--ease), background var(--ease);
}

.input::placeholder {
  color: var(--text-3);
}

.input:hover {
  border-color: var(--line-2);
}

.input:focus {
  border-color: rgba(91, 163, 245, 0.56);
  box-shadow: 0 0 0 3px rgba(91, 163, 245, 0.16);
  background: rgba(7, 14, 28, 0.78);
}

/* Remove number spinners */
.input[type="number"]::-webkit-inner-spin-button,
.input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.input-sm {
  padding: 8px 10px;
  border-radius: var(--r-sm);
  font-size: 13px;
}

/* File input */
.input[type="file"] {
  padding: 9px 14px;
  cursor: pointer;
}
.input[type="file"]::file-selector-button {
  background: rgba(91, 163, 245, 0.12);
  border: 1px solid rgba(91, 163, 245, 0.30);
  border-radius: 10px;
  color: var(--acc-1);
  padding: 5px 10px;
  margin-right: 10px;
  cursor: pointer;
  font-size: 13px;
  transition: background var(--ease), border-color var(--ease);
}
.input[type="file"]::file-selector-button:hover {
  background: rgba(91, 163, 245, 0.18);
  border-color: rgba(91, 163, 245, 0.44);
}

/* ──────────────────────────────────────────────────────────
   BUTTONS
   ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: var(--r-md);
  border: 1px solid rgba(91, 163, 245, 0.36);
  background: rgba(91, 163, 245, 0.10);
  color: rgba(220, 238, 255, 0.95);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--ease), border-color var(--ease), transform var(--ease), box-shadow var(--ease), color var(--ease);
}

.btn:hover {
  background: rgba(91, 163, 245, 0.18);
  border-color: rgba(91, 163, 245, 0.58);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(91, 163, 245, 0.14);
}

.btn:active {
  transform: translateY(0);
}

.btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(91, 163, 245, 0.24);
}

.btn.ghost {
  border-color: var(--line-1);
  background: rgba(91, 163, 245, 0.05);
  color: var(--text-2);
}

.btn.ghost:hover {
  background: rgba(91, 163, 245, 0.10);
  border-color: var(--line-2);
  color: var(--text-0);
}

.btn.danger {
  border-color: var(--bad-line);
  background: var(--bad-bg);
  color: rgba(255, 150, 165, 0.92);
}

.btn.danger:hover {
  background: rgba(244, 63, 94, 0.16);
  border-color: rgba(244, 63, 94, 0.62);
  box-shadow: 0 4px 16px rgba(244, 63, 94, 0.14);
}

.btn-sm {
  padding: 7px 12px;
  border-radius: var(--r-sm);
  font-size: 13px;
}

/* ──────────────────────────────────────────────────────────
   PILLS / TAGS
   ────────────────────────────────────────────────────────── */
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--line-1);
  background: rgba(7, 14, 28, 0.66);
  color: rgba(210, 234, 255, 0.80);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.pill-warn {
  border-color: var(--warn-line);
  color: rgba(255, 205, 90, 0.95);
  background: var(--warn-bg);
}

.pill-bad {
  border-color: var(--bad-line);
  color: rgba(255, 145, 165, 0.95);
  background: var(--bad-bg);
}

.pill-good {
  border-color: var(--good-line);
  color: rgba(110, 245, 195, 0.95);
  background: var(--good-bg);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2px;
  border: 1px solid var(--line-1);
  background: rgba(7, 14, 28, 0.62);
  color: rgba(210, 234, 255, 0.82);
  margin-left: 6px;
  vertical-align: middle;
}

.tag-main {
  border-color: var(--warn-line);
  background: var(--warn-bg);
  color: rgba(255, 205, 90, 0.95);
}

.tag-moon {
  border-color: rgba(147, 197, 253, 0.34);
  background: rgba(147, 197, 253, 0.10);
  color: rgba(165, 210, 255, 0.92);
}

/* ──────────────────────────────────────────────────────────
   GRID / TILES (INDEX)
   ────────────────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.tile {
  display: flex;
  align-items: center;
  padding: 13px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-1);
  background: rgba(7, 14, 28, 0.48);
  color: var(--text-0);
  font-weight: 700;
  transition: border-color var(--ease), transform var(--ease), background var(--ease), box-shadow var(--ease);
}

.tile:hover {
  border-color: rgba(91, 163, 245, 0.40);
  background: rgba(91, 163, 245, 0.08);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.result-count {
  font-size: 13px;
  margin-bottom: 10px;
  color: var(--text-2);
}

/* ──────────────────────────────────────────────────────────
   TABLES
   ────────────────────────────────────────────────────────── */
.table-wrap {
  margin-top: 16px;
  overflow: auto;
  border-radius: var(--r-lg);
  border: 1px solid var(--line-1);
  background: rgba(7, 14, 28, 0.40);
}

/* Keep tables readable at 100% zoom */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 1050px;
  background: rgba(7, 14, 28, 0.40);
}

.table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.table th {
  padding: 11px 13px;
  background: rgba(10, 20, 40, 0.90);
  color: rgba(195, 220, 255, 0.80);
  text-align: left;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line-2);
  white-space: nowrap;
}

.table td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--line-0);
  vertical-align: middle;
  font-size: 13px;
  color: rgba(220, 238, 255, 0.92);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr:hover {
  background: rgba(91, 163, 245, 0.06);
}

tr.main-planet {
  background: rgba(91, 163, 245, 0.05);
}

tr.main-planet:hover {
  background: rgba(91, 163, 245, 0.10);
}

/* Truncate columns */
.planet-cell,
.note-cell {
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.planet-name {
  display: inline-block;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

/* last col nowrap */
.table td:last-child {
  white-space: nowrap;
}

.coord {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--acc-1);
}

/* Links inside tables */
.player-link {
  color: var(--acc-1);
  font-weight: 700;
}
.player-link:hover {
  text-decoration: underline;
}

/* Clickable row */
.tr-click {
  cursor: pointer;
  user-select: none;
}

/* Focus ring for keyboard row toggle */
tr.tr-toggle:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(91, 163, 245, 0.60);
  background: rgba(91, 163, 245, 0.08);
}

/* Actions cell */
.actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}
.delete-form {
  margin: 0;
}

/* ──────────────────────────────────────────────────────────
   DETAILS (PLAYER EXPAND)
   ────────────────────────────────────────────────────────── */
.tr-detail {
  display: none;
}

.tr-detail.open {
  display: table-row;
}

.detail-box {
  padding: 16px 18px;
  background: rgba(5, 10, 22, 0.74);
  border-top: 1px solid var(--line-1);
}

.detail-head {
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line-0);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.detail-grid .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-3);
}

.detail-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line-0);
}

.detail-checks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

/* Checkboxes */
.check {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
}

.check input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--acc-0);
  cursor: pointer;
}

.check:hover {
  color: var(--text-0);
}

/* ──────────────────────────────────────────────────────────
   IMPORT SUMMARY
   ────────────────────────────────────────────────────────── */
.import-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--good-line);
  background: var(--good-bg);
  color: rgba(110, 245, 195, 0.95);
  font-size: 13px;
  margin-bottom: 16px;
}
.import-summary strong {
  font-weight: 800;
}

/* ──────────────────────────────────────────────────────────
   EMPTY STATE
   ────────────────────────────────────────────────────────── */
.empty-state {
  padding: 28px 0;
  text-align: center;
  border: 1px dashed rgba(91, 163, 245, 0.18);
  border-radius: var(--r-lg);
  background: rgba(7, 14, 28, 0.34);
  color: var(--text-2);
  font-size: 14px;
}

/* ──────────────────────────────────────────────────────────
   CODEBLOCK + DETAILS/SUMMARY
   ────────────────────────────────────────────────────────── */
.codeblock {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
  background: rgba(7, 14, 28, 0.64);
  border: 1px solid var(--line-1);
  border-radius: var(--r-md);
  padding: 14px 16px;
  overflow: auto;
  color: var(--text-2);
  margin-top: 12px;
}

details > summary {
  cursor: pointer;
  user-select: none;
  list-style: none;
  font-size: 13px;
  color: var(--text-2);
  padding: 4px 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color var(--ease);
}

details > summary::before {
  content: "▶";
  font-size: 10px;
  transition: transform var(--ease);
  display: inline-block;
}

details[open] > summary::before {
  transform: rotate(90deg);
}

details > summary:hover {
  color: var(--text-0);
}

details > summary::-webkit-details-marker {
  display: none;
}

/* ──────────────────────────────────────────────────────────
   FOOTER
   ────────────────────────────────────────────────────────── */
.footer {
  padding: 24px 0 32px;
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ──────────────────────────────────────────────────────────
   FORMS
   ────────────────────────────────────────────────────────── */
.form-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.form-row:last-child {
  margin-bottom: 0;
}

/* ──────────────────────────────────────────────────────────
   OPTIONAL: SEARCH CARD / TABS (if you use it in future)
   ────────────────────────────────────────────────────────── */
.search-card {
  border: 1px solid var(--line-1);
  border-radius: var(--r-lg);
  background: rgba(7, 14, 28, 0.42);
  padding: 14px;
}

.search-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.tab {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-1);
  background: rgba(91, 163, 245, 0.05);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.2px;
  transition: background var(--ease), border-color var(--ease), color var(--ease);
}

.tab:hover {
  color: var(--text-0);
  background: rgba(91, 163, 245, 0.10);
  border-color: var(--line-2);
}

.tab.active {
  color: rgba(220, 238, 255, 0.95);
  border-color: rgba(91, 163, 245, 0.40);
  background: rgba(91, 163, 245, 0.14);
}

.search-grid {
  display: grid;
  gap: 10px;
}

.search-footer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-0);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

/* ──────────────────────────────────────────────────────────
   RESPONSIVE
   ────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .wrap {
    padding: 0 16px;
  }

  .topbar-inner {
    flex-wrap: wrap;
    padding: 12px 0;
  }

  .nav a {
    padding: 6px 10px;
  }

  h1 {
    font-size: 22px;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   ORACLE BUDDY (glowing helper)
   ============================================================ */
.oracle-buddy{
  position: fixed;
  right: 18px;
  bottom: 24px;
  z-index: 9999;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  width: 460px;
  max-width: calc(100vw - 36px);
  min-height: 220px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(5, 10, 20, .78);
  border: 1px solid rgba(91,163,245,.18);
  box-shadow:
    0 0 0 1px rgba(91,163,245,.08),
    0 18px 60px rgba(0,0,0,.55),
    0 0 40px rgba(91,163,245,.12);
  backdrop-filter: blur(10px);
  transition: min-height .3s ease;
}

.oracle-buddy__img{
  width: 54px;
  height: 54px;
  border-radius: 14px;
  object-fit: contain;
  background: rgba(0,0,0,.22);
  border: 1px solid rgba(91,163,245,.18);
  box-shadow:
    0 0 0 1px rgba(91,163,245,.08),
    0 0 22px rgba(91,163,245,.22);
}

.oracle-buddy__title{
  font-weight: 700;
  letter-spacing: .02em;
}

.oracle-buddy__msg{
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.35;
  color: rgba(255,255,255,.86);
}

.oracle-buddy__actions{
  display: flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

/* ============================================================
   AUTH (left panel like screenshot)
   ============================================================ */
.authbox{
  margin-left:auto;
  display:flex;
  gap:10px;
  align-items:center;
}

.auth-modal{ position: fixed; inset: 0; z-index: 9998; }
.auth-modal__backdrop{
  position: absolute; inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
}

.auth-panel{
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 460px;
  max-width: calc(100vw - 32px);
  min-height: 520px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  border-radius: 22px;
  background: rgba(5,10,20,.95);
  border: 1px solid rgba(91,163,245,.18);
  box-shadow:
    0 32px 90px rgba(0,0,0,.7),
    0 0 60px rgba(91,163,245,.10),
    0 0 0 1px rgba(91,163,245,.06);
  padding: 28px;
  backdrop-filter: blur(20px);
}

.auth-panel__head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
}

.auth-panel__title{
  font-weight: 900;
  font-size: 22px;
  letter-spacing: .01em;
  color: rgba(255,255,255,.95);
}
.auth-panel__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.auth-panel__logo-mark {
  font-size: 28px;
  font-weight: 900;
  color: #5ba3f5;
  letter-spacing: -.01em;
}
.auth-panel__logo-rest {
  font-size: 22px;
  font-weight: 700;
  color: rgba(255,255,255,.85);
}
.auth-panel__divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255,255,255,.25);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin: 4px 0 2px;
}
.auth-panel__divider::before,
.auth-panel__divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,.08);
}

.auth-tabs {
  display: flex;
  gap: 4px;
  margin-top: 22px;
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 12px;
  padding: 4px;
}

.auth-tab {
  flex: 1;
  padding: 9px 16px;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,.45);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .03em;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}

.auth-tab:hover {
  color: rgba(255,255,255,.75);
  background: rgba(255,255,255,.05);
}

.auth-tab.active {
  background: rgba(91,163,245,.12);
  color: rgba(91,163,245,.9);
  border: 1px solid rgba(91,163,245,.18);
}

.auth-pane {
  margin-top: 20px;
  min-height: 280px;
}

.field input{
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.35);
  color: rgba(255,255,255,.92);
  font-size: 14px;
  transition: border-color .15s ease;
}
.field input:focus {
  outline: none;
  border-color: rgba(91,163,245,.4);
  box-shadow: 0 0 0 3px rgba(91,163,245,.08);
}

.auth-error{
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,0,80,.12);
  border: 1px solid rgba(255,0,80,.22);
  color: rgba(255,255,255,.92);
}

.auth-token{
  margin-top: 12px;
  border-radius: 14px;
  padding: 12px;
  border: 1px solid rgba(91,163,245,.16);
  background: rgba(0,0,0,.18);
}

.auth-token__ta{
  width: 100%;
  min-height: 110px;
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.25);
  color: rgba(255,255,255,.9);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  resize: vertical;
}

/* ============================================================
   ORACLE BUDDY (glowing hint)
   ============================================================ */
.oracle-buddy{
  position: fixed;
  right: 18px;
  bottom: 24px;
  z-index: 9999;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  width: 460px;
  max-width: calc(100vw - 36px);
  min-height: 220px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(5, 10, 20, .78);
  border: 1px solid rgba(91,163,245,.18);
  box-shadow:
    0 0 0 1px rgba(91,163,245,.08),
    0 18px 60px rgba(0,0,0,.55),
    0 0 40px rgba(91,163,245,.12);
  backdrop-filter: blur(10px);
  transition: min-height .3s ease;
}

.oracle-buddy__img{
  width: 54px;
  height: 54px;
  border-radius: 14px;
  object-fit: contain;
  background: rgba(0,0,0,.22);
  border: 1px solid rgba(91,163,245,.18);
  box-shadow:
    0 0 0 1px rgba(91,163,245,.08),
    0 0 22px rgba(91,163,245,.22);
}

.oracle-buddy__title{ font-weight: 800; }
.oracle-buddy__msg{
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.35;
  color: rgba(255,255,255,.86);
}
.oracle-buddy__actions{
  display: flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}
/* Base.html utility classes (replaces inline styles) */
.nav-expedition {
  border-color: rgba(192,132,252,.25);
  color: #c084fc;
}
.nav-expedition:hover {
  color: #d8b4fe;
  border-color: rgba(192,132,252,.45);
}
.nav-prestige-link {
  color: #22d3ee;
}
.nav-prestige-link:hover {
  color: #67e8f9;
}
.auth-username {
  font-size: 13px;
  color: #22d3ee;
  text-decoration: none;
  opacity: .85;
  font-family: var(--font-mono);
}

/* ── Token Popup (username click) ──────────────────────────── */
.token-popup-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 998;
}
.token-popup {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 999;
  min-width: 340px;
  background: linear-gradient(145deg, rgba(4,16,32,.98), rgba(2,10,20,.99));
  border: 1px solid rgba(0,212,255,.22);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 12px 48px rgba(0,0,0,.65), 0 0 0 1px rgba(0,212,255,.06);
}
.token-popup::before {
  content: '';
  position: absolute;
  top: -1px; left: 16px; right: 16px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,212,255,.5), transparent);
  border-radius: 16px 16px 0 0;
}
.token-popup.open { display: block; }
.token-popup-backdrop.open { display: block; }
.token-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.token-popup-title {
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(0,212,255,.55);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.token-popup-close {
  background: none;
  border: none;
  color: rgba(255,255,255,.3);
  font-size: 16px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}
.token-popup-close:hover { color: rgba(255,255,255,.7); }
.token-popup-ta {
  width: 100%;
  box-sizing: border-box;
  background: rgba(0,0,0,.4);
  border: 1px solid rgba(0,212,255,.12);
  border-radius: 10px;
  padding: 10px 12px;
  color: rgba(180,230,255,.8);
  font-family: var(--font-mono);
  font-size: 11px;
  resize: none;
  height: 68px;
  outline: none;
  word-break: break-all;
  line-height: 1.5;
  margin-bottom: 10px;
}
.token-popup-ta:focus {
  border-color: rgba(0,212,255,.28);
}
.token-popup-actions {
  display: flex;
  gap: 8px;
}
.token-popup-btn {
  flex: 1;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid rgba(0,212,255,.25);
  background: rgba(0,212,255,.08);
  color: rgba(0,212,255,.9);
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-head);
  cursor: pointer;
  transition: background .15s, border-color .15s;
  letter-spacing: .04em;
}
.token-popup-btn:hover {
  background: rgba(0,212,255,.16);
  border-color: rgba(0,212,255,.45);
}
.token-popup-hint {
  font-size: 10px;
  color: rgba(0,212,255,.25);
  font-family: var(--font-mono);
  margin-top: 8px;
  text-align: center;
}
.token-popup-copied {
  text-align: center;
  font-size: 11px;
  color: rgba(0,212,255,.6);
  font-family: var(--font-mono);
  margin-top: 6px;
  height: 14px;
}
/* Username button clickable style */
#auth-username {
  cursor: pointer;
  position: relative;
}
#auth-username:hover {
  opacity: .8;
}

.psg-empty-msg { font-size: .85rem; padding: 8px 0; }
/* ─── Mobile / Responsive additions ─────────────────────────────────────── */

/* Hamburger button */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  margin-left: auto;
}
.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: rgba(180,210,255,.8);
  border-radius: 2px;
  transition: transform .2s, opacity .2s;
}

/* Token popup — mobile safe */
.token-popup {
  max-width: min(420px, calc(100vw - 32px));
  left: 50%;
  transform: translateX(-50%);
  right: auto;
}

/* Topbar */
.topbar-inner {
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 768px) {
  /* Show hamburger, hide nav by default */
  .nav-hamburger { display: flex; }

  .nav {
    display: none;
    flex-direction: column;
    width: 100%;
    order: 3;
    background: var(--bg-card, rgba(15,25,50,.98));
    border-top: 1px solid rgba(100,160,255,.1);
    padding: 8px 0;
    gap: 0;
  }
  .nav.nav-open { display: flex; }
  .nav a {
    padding: 12px 16px;
    border-radius: 0;
    font-size: 15px;
    border-bottom: 1px solid rgba(100,160,255,.06);
  }

  /* Authbox — compact on mobile */
  .authbox {
    order: 2;
    margin-left: auto;
  }
  #auth-status { display: none; }
  .brand { order: 1; }

  /* Main content padding */
  .main-pad { padding: 16px 12px; }
  .wrap { padding-left: 12px; padding-right: 12px; }

  /* Tables — horizontal scroll */
  .table-wrap, table { overflow-x: auto; display: block; }

  /* Cards stack */
  .grid-2, .grid-3 { grid-template-columns: 1fr !important; }

  /* Login card — full width on mobile */
  .login-wrap { padding: 16px; }
  .login-card { width: 100%; max-width: 100%; }
}

@media (max-width: 480px) {
  .nav a { font-size: 14px; padding: 10px 14px; }
  .topbar-inner { padding: 8px 12px; }
  .brand-mark, .brand-rest { font-size: 18px; }
}

.lang-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-2, rgba(180,210,255,.55));
  cursor: pointer;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .03em;
  line-height: 1;
  padding: 3px 7px;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}
.lang-btn:hover {
  background: rgba(0,212,255,.08);
  border-color: rgba(0,212,255,.2);
  color: var(--text-0, #e8f4ff);
}
.lang-btn--active {
  background: rgba(0,212,255,.12);
  border-color: rgba(0,212,255,.35);
  color: var(--acc-0, #00d4ff);
}

/* ── PHP App Additions ─────────────────────────────────────── */
.login-wrap { display:flex;align-items:center;justify-content:center;min-height:calc(100vh - 64px);padding:24px; }
.login-card { width:100%;max-width:400px;padding:36px 32px; }
.login-title { text-align:center;font-family:var(--font-head);font-size:28px;letter-spacing:.12em;margin-bottom:4px; }
.tab-row { display:flex;border-bottom:1px solid var(--line-2); }
.tab-btn { flex:1;text-align:center;padding:8px;font-size:13px;color:var(--text-2);border-bottom:2px solid transparent;transition:color var(--ease),border-color var(--ease);text-decoration:none; }
.tab-btn.active { color:var(--acc-0);border-bottom-color:var(--acc-0); }
.form-group { margin-bottom:14px; }
.form-label { display:block;font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:var(--text-2);margin-bottom:6px; }
.form-input { width:100%;padding:9px 12px;border-radius:var(--r-sm);border:1px solid var(--line-2);background:rgba(0,0,0,.3);color:var(--text-0);font-size:14px;transition:border-color var(--ease);box-sizing:border-box; }
.form-input:focus { outline:none;border-color:var(--acc-0); }
.btn-full { width:100%;margin-top:6px; }
.alert { padding:10px 14px;border-radius:var(--r-sm);font-size:13px;margin-bottom:16px; }
.alert-error { background:var(--bad-bg);border:1px solid var(--bad-line);color:var(--bad); }
.alert-ok    { background:var(--good-bg);border:1px solid var(--good-line);color:var(--good); }

/* ==========================================================
   TOPBAR / NAV — OGX Oracle v3
   ========================================================== */

.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(4,14,30,0.88);
  border-bottom: 1px solid rgba(65,86,128,0.45);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  gap: 16px;
}

.topbar-left  { display: flex; align-items: center; gap: 20px; flex-shrink: 0; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* Brand */
.brand {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
}
.brand-ogx    { color: #5b9cf5; }
.brand-oracle { color: rgba(230,235,251,0.75); margin-left: 5px; }

/* Main nav */
.main-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}
.nav-link {
  color: rgba(230,235,251,0.5);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 4px;
  text-decoration: none;
  transition: color .12s, background .12s;
  position: relative;
  white-space: nowrap;
}
.nav-link:hover { color: rgba(230,235,251,0.9); background: rgba(91,156,245,0.08); text-decoration: none; }
.nav-link.active { color: #93c5fd; background: rgba(91,156,245,0.14); }

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #5b9cf5;
  color: #040e1e;
  font-size: 9px;
  font-weight: 700;
  min-width: 15px;
  height: 15px;
  border-radius: 8px;
  padding: 0 3px;
  margin-left: 4px;
  vertical-align: middle;
}

/* Server tabs */
.srv-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(9,24,40,0.7);
  border: 1px solid rgba(65,86,128,0.4);
  border-radius: 5px;
  padding: 2px;
}
.srv-tab {
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 3px;
  color: rgba(230,235,251,0.4);
  text-decoration: none;
  transition: all .12s;
}
.srv-tab:hover { color: rgba(230,235,251,0.8); background: rgba(65,86,128,0.3); text-decoration: none; }
.srv-tab.srv-active { background: rgba(91,156,245,0.18); color: #93c5fd; }
.srv-tab.srv-beta.srv-active { background: rgba(52,211,153,0.15); color: #6ee7b7; }
.srv-tab.srv-uni1.srv-active { background: rgba(251,191,36,0.13); color: #fcd34d; }

/* Lang row */
.lang-row {
  display: flex;
  align-items: center;
  gap: 4px;
}


.ship-mini {
  border: 1px solid rgba(65,86,128,0.45);
  border-radius: 4px;
  background: rgba(8,20,34,.7);
  object-fit: cover;
}

/* Main content area */
.page-main {
  padding: 28px 24px 60px;
  min-height: calc(100vh - 52px);
}

/* ==========================================================
   EXPO GRID + CARDS — v3
   ========================================================== */

.expo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
}

.expo-card {
  background: rgba(13,32,53,0.7);
  border: 1px solid rgba(65,86,128,0.4);
  border-radius: 5px;
  padding: 12px 14px;
  transition: border-color .13s, background .13s;
}
.expo-card:hover {
  border-color: rgba(91,156,245,0.5);
  background: rgba(13,32,53,0.9);
}

.expo-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.expo-resources {
  display: flex;
  gap: 10px;
  font-size: 12px;
  font-family: var(--font-mono);
  flex-wrap: wrap;
}
.res.metal   { color: #b0c4de; }
.res.crystal { color: #7ec8e3; }
.res.deut    { color: #88d8b0; }
.expo-dm {
  font-size: 12px;
  color: #c4b5fd;
  font-family: var(--font-mono);
  margin-top: 4px;
}

/* Outcome badges */
.outcome-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border: 1px solid;
  white-space: nowrap;
}
.outcome-resources, .outcome-success_res {
  background: rgba(88,166,255,.10); border-color: rgba(88,166,255,.30); color: #93c5fd;
}
.outcome-dark_matter, .outcome-success_dm {
  background: rgba(167,139,250,.10); border-color: rgba(167,139,250,.30); color: #c4b5fd;
}
.outcome-ships, .outcome-success_ships {
  background: rgba(52,211,153,.10); border-color: rgba(52,211,153,.30); color: #6ee7b7;
}
.outcome-success_mix {
  background: rgba(52,211,153,.08); border-color: rgba(52,211,153,.25); color: #6ee7b7;
}
.outcome-pirates, .outcome-pirates_win {
  background: rgba(251,191,36,.09); border-color: rgba(251,191,36,.28); color: #fcd34d;
}
.outcome-vanished, .outcome-lost {
  background: rgba(251,113,133,.09); border-color: rgba(251,113,133,.28); color: #fca5a5;
}
.outcome-failed, .outcome-nothing {
  background: rgba(148,163,184,.07); border-color: rgba(148,163,184,.22); color: #94a3b8;
}
.outcome-storm {
  background: rgba(251,146,60,.09); border-color: rgba(251,146,60,.28); color: #fdba74;
}
.outcome-aliens {
  background: rgba(167,139,250,.12); border-color: rgba(167,139,250,.35); color: #e879f9;
}

/* Server badges on cards */
.server-badge {
  font-size: 9px;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: 0.6px;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid rgba(65,86,128,0.5);
  background: rgba(9,24,40,0.6);
  color: rgba(230,235,251,0.5);
  text-transform: uppercase;
}
.server-badge.beta { color: #6ee7b7; border-color: rgba(52,211,153,0.35); background: rgba(52,211,153,0.07); }
.server-badge.uni1 { color: #fcd34d; border-color: rgba(251,191,36,0.35); background: rgba(251,191,36,0.07); }

/* Ship chips */
.ship-chip {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
  border: 1px solid;
  white-space: nowrap;
}
.ship-chip.gain { background: rgba(52,211,153,.08); border-color: rgba(52,211,153,.25); color: #6ee7b7; }
.ship-chip.loss { background: rgba(251,113,133,.08); border-color: rgba(251,113,133,.25); color: #fca5a5; }

/* ==========================================================
   PAGE LAYOUT HELPERS
   ========================================================== */

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}
.page-header h1 { margin: 0 0 3px; }

/* KPI grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
.kpi-card {
  background: rgba(13,32,53,0.7);
  border: 1px solid rgba(65,86,128,0.4);
  border-radius: 5px;
  padding: 12px 14px;
}
.kpi-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: rgba(230,235,251,0.4);
  margin-bottom: 5px;
  font-weight: 700;
}
.kpi-value {
  font-size: 22px;
  font-weight: 700;
  font-family: var(--font-mono);
  line-height: 1.1;
}

/* Stats table */
.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.stats-table th {
  text-align: left;
  padding: 7px 10px;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: rgba(230,235,251,0.4);
  border-bottom: 1px solid rgba(65,86,128,0.4);
  background: rgba(9,24,40,0.5);
  font-weight: 700;
}
.stats-table td {
  padding: 7px 10px;
  border-bottom: 1px solid rgba(65,86,128,0.2);
  vertical-align: middle;
}
.stats-table tr:hover td { background: rgba(37,48,70,0.4); }

/* Section box */
.section-box {
  background: rgba(13,32,53,0.7);
  border: 1px solid rgba(65,86,128,0.4);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 12px;
}
.section-head {
  padding: 9px 14px;
  border-bottom: 1px solid rgba(65,86,128,0.35);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: rgba(230,235,251,0.5);
  background: rgba(9,24,40,0.4);
}

/* Codes */
.codes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  padding: 10px;
}
.code-item {
  border: 1px solid rgba(65,86,128,.42);
  background: rgba(9,24,40,.58);
  border-radius: 6px;
  padding: 12px;
}
.code-item--redeemed {
  opacity: .76;
}
.code-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.code-tier {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(91,163,245,.15);
  color: var(--acc-1);
  border: 1px solid rgba(91,163,245,.32);
}
.code-tier--ok {
  background: rgba(52,211,153,.10);
  color: var(--good);
  border-color: rgba(52,211,153,.3);
}
.code-value {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .06em;
  margin-bottom: 6px;
}
.code-meta {
  color: var(--text-2);
  font-size: 12px;
  margin-bottom: 12px;
}
.code-actions {
  display: flex;
  gap: 8px;
}

/* Galaxy placeholder */
.galaxy-placeholder-body {
  padding: 40px 20px;
  text-align: center;
}
.galaxy-radar {
  font-family: var(--font-mono);
  font-size: 44px;
  line-height: 1;
  color: #93c5fd;
  margin-bottom: 8px;
  text-shadow: 0 0 20px rgba(147,197,253,.35);
}

.galaxy-clippy {
  border-color: rgba(147,197,253,.32);
}
.galaxy-clippy-body {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.galaxy-clippy-icon {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid rgba(147,197,253,.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #93c5fd;
  font-family: var(--font-mono);
  box-shadow: 0 0 14px rgba(147,197,253,.22);
  flex: 0 0 auto;
}
.age-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  border: 1px solid var(--line-1);
  background: rgba(7,14,28,.66);
  color: rgba(210,234,255,.8);
}
.age-fresh {
  border-color: var(--good-line);
  background: var(--good-bg);
  color: var(--good);
}
.age-hours {
  border-color: rgba(147,197,253,.34);
  background: rgba(147,197,253,.10);
  color: #93c5fd;
}
.age-days {
  border-color: var(--warn-line);
  background: var(--warn-bg);
  color: #fcd34d;
}
.age-weeks {
  border-color: var(--bad-line);
  background: var(--bad-bg);
  color: #fca5a5;
}
.age-unknown {
  border-color: var(--line-1);
  background: rgba(7,14,28,.4);
  color: var(--text-2);
}

/* ==========================================================
   RESPONSIVE
   ========================================================== */
@media (max-width: 900px) {
  .main-nav { display: none; }
  .topbar-left { gap: 12px; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 14px; }
  .page-main { padding: 18px 14px 40px; }
  .topbar-right { gap: 6px; }
  .user-menu-trigger { padding: 4px 6px; font-size: 10px; }
  .lang-row .lang-btn { padding: 3px 5px; font-size: 10px; }
}

/* User menu */
.topbar .topbar-right .user-menu {
  position: relative;
  display: inline-block;
}
.topbar .topbar-right .user-menu-trigger {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: 190px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(65,86,128,0.45);
  background: rgba(9,24,40,0.72);
  color: rgba(230,235,251,0.84);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: border-color .12s, background .12s, color .12s, box-shadow .12s;
}
.topbar .topbar-right .user-menu-trigger::after {
  content: "▾";
  font-size: 10px;
  opacity: .75;
}
.topbar .topbar-right .user-menu-trigger:hover {
  border-color: rgba(91,156,245,0.5);
  background: rgba(91,156,245,0.12);
  color: rgba(230,235,251,0.98);
}
.topbar .topbar-right .user-menu-trigger:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(91,156,245,0.22);
}
.topbar .topbar-right .user-menu-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 220px;
  background: rgba(9,24,40,0.98);
  border: 1px solid rgba(65,86,128,0.55);
  border-radius: 8px;
  box-shadow: 0 12px 34px rgba(0,0,0,.45);
  overflow: hidden;
  z-index: 9999;
}
.topbar .topbar-right .user-menu.open .user-menu-dropdown {
  display: block;
}
.topbar .topbar-right .user-menu-dropdown form {
  margin: 0;
}
.topbar .topbar-right .user-menu-item {
  display: block;
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  font-size: 12px;
  line-height: 1.2;
  color: rgba(230,235,251,0.82);
  text-decoration: none;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(65,86,128,0.22);
  cursor: pointer;
  white-space: nowrap;
}
.topbar .topbar-right .user-menu-item:last-child {
  border-bottom: 0;
}
.topbar .topbar-right .user-menu-item:hover {
  background: rgba(91,156,245,0.12);
  color: rgba(230,235,251,0.98);
}
.topbar .topbar-right .user-menu-item-danger {
  color: #fca5a5;
}
