/* GM File Hub — "Liquid glass over a night instrument panel".
   iOS-style frosted glass, big continuous radii and pill controls; the sci-fi lives in the backdrop
   (a faint perspective grid + slow aurora), in hairline light edges on glass, and in the upload beam. */

@font-face { font-family: "Plex Thai"; font-weight: 400; font-display: swap; src: url(/fonts/ibm-plex-sans-thai-thai-400-normal.woff2) format("woff2"); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "Plex Thai"; font-weight: 500; font-display: swap; src: url(/fonts/ibm-plex-sans-thai-thai-500-normal.woff2) format("woff2"); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "Plex Thai"; font-weight: 600; font-display: swap; src: url(/fonts/ibm-plex-sans-thai-thai-600-normal.woff2) format("woff2"); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "Plex Thai"; font-weight: 400; font-display: swap; src: url(/fonts/ibm-plex-sans-thai-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2190-21FF; }
@font-face { font-family: "Plex Thai"; font-weight: 500; font-display: swap; src: url(/fonts/ibm-plex-sans-thai-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2190-21FF; }
@font-face { font-family: "Plex Thai"; font-weight: 600; font-display: swap; src: url(/fonts/ibm-plex-sans-thai-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2190-21FF; }
@font-face { font-family: "Grotesk"; font-weight: 500; font-display: swap; src: url(/fonts/space-grotesk-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Grotesk"; font-weight: 600; font-display: swap; src: url(/fonts/space-grotesk-latin-600-normal.woff2) format("woff2"); }

/* ---------- tokens: night (default) ---------- */
:root {
  --space: #060914;            /* page backdrop */
  --deep: #0c1226;             /* aurora base */
  --glass: rgba(22, 30, 58, .56);
  --glass-hi: rgba(40, 52, 96, .58);
  --glass-solid: #121a33;
  --edge: rgba(160, 190, 255, .16);
  --edge-hi: rgba(190, 225, 255, .38);
  --ink: #eef3ff; --ink2: #a8b3d4; --ink3: #6f7aa0;
  --ion: #5ce1ff;              /* primary signal — cyan ice */
  --ion-ink: #052430;
  --plasma: #8f7cff;           /* secondary — violet */
  --ok: #3ee6a0; --warn: #ffbf47; --bad: #ff5c7a; --info: #5ce1ff;
  --grid: rgba(92, 225, 255, .055);
  --blur: saturate(170%) blur(22px);
  --r-xl: 26px; --r-lg: 20px; --r-md: 14px; --r-pill: 999px;
  color-scheme: dark;
}
/* ---------- tokens: day (pearl glass) ---------- */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --space: #e9eef9; --deep: #dfe6f7;
    --glass: rgba(255, 255, 255, .62); --glass-hi: rgba(255, 255, 255, .8); --glass-solid: #f6f8fd;
    --edge: rgba(40, 60, 120, .12); --edge-hi: rgba(255, 255, 255, .95);
    --ink: #0e1430; --ink2: #4b5576; --ink3: #7c86a6;
    --ion: #0a84c9; --ion-ink: #ffffff; --plasma: #6a55f0;
    --ok: #0f9d68; --warn: #b86e00; --bad: #d92b4b; --info: #0a84c9;
    --grid: rgba(10, 132, 201, .07);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { background: var(--space); }
body {
  margin: 0; min-height: 100vh; color: var(--ink);
  font: 15px/1.6 "Plex Thai", system-ui, sans-serif; letter-spacing: .005em;
  -webkit-font-smoothing: antialiased; background: transparent;
}
/* backdrop: aurora + perspective grid floor, fixed behind everything */
body::before, body::after { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; }
body::before {
  background:
    radial-gradient(60vw 40vh at 85% -5%, color-mix(in srgb, var(--plasma) 34%, transparent), transparent 70%),
    radial-gradient(55vw 45vh at 5% 15%, color-mix(in srgb, var(--ion) 22%, transparent), transparent 70%),
    linear-gradient(180deg, var(--deep), var(--space) 70%);
}
body::after {
  top: 45%;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 64px 64px;
  transform: perspective(600px) rotateX(62deg); transform-origin: top;
  mask-image: linear-gradient(180deg, transparent, #000 30%, transparent 95%);
}
a { color: var(--ion); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: color-mix(in srgb, var(--ion) 35%, transparent); }
:focus-visible { outline: 2px solid var(--ion); outline-offset: 2px; border-radius: 10px; }

/* ---------- glass material ---------- */
.card, .side, .modal, .toast, .auth {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--edge);
  box-shadow: inset 0 1px 0 var(--edge-hi), 0 20px 50px -24px rgba(0, 0, 0, .55);
}
.card { border-radius: var(--r-xl); padding: 20px 22px; position: relative; }
.card + .card, section + section { margin-top: 16px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-h h2 { margin: 0; font-size: 16px; font-weight: 600; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; gap: 0; }
.side {
  position: sticky; top: 14px; height: calc(100vh - 28px); margin: 14px 0 14px 14px;
  border-radius: var(--r-xl); padding: 18px 12px; display: flex; flex-direction: column; gap: 6px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; }
.brand::before {                     /* the signal orb */
  content: ""; width: 26px; height: 26px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 30%, #fff 0 8%, var(--ion) 30%, var(--plasma) 75%);
  box-shadow: 0 0 18px color-mix(in srgb, var(--ion) 60%, transparent);
}
.brand b { font: 600 17px/1.1 "Grotesk", "Plex Thai", sans-serif; letter-spacing: -.01em; }
.brand .tiny { display: none; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { color: var(--ink2); padding: 9px 14px; border-radius: var(--r-pill); font-weight: 500; transition: background .2s, color .2s; }
.nav a:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.nav a.on { color: var(--ink); background: var(--glass-hi); box-shadow: inset 0 1px 0 var(--edge-hi), 0 0 0 1px var(--edge); }
.nav a.on::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 9px; vertical-align: middle; background: var(--ion); box-shadow: 0 0 10px var(--ion); }
.me { margin-top: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 14px 10px 4px; border-top: 1px solid var(--edge); }
.me .btn { margin-left: auto; }
.main { padding: 28px 32px 48px; max-width: 1180px; width: 100%; }

.page-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 6px 0 20px; }
.page-h h1 { margin: 0; font: 600 30px/1.15 "Grotesk", "Plex Thai", sans-serif; letter-spacing: -.02em; }
.page-h .sub { color: var(--ink2); margin-top: 4px; }
.tools { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- game slots ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
a.card { color: inherit; display: block; transition: transform .25s, border-color .25s, box-shadow .25s; }
a.card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--ion) 45%, var(--edge)); box-shadow: inset 0 1px 0 var(--edge-hi), 0 0 0 1px color-mix(in srgb, var(--ion) 25%, transparent), 0 24px 50px -24px color-mix(in srgb, var(--ion) 40%, transparent); }
.game-card .card-h { margin-bottom: 8px; }
.game-card .slug { color: var(--ion); font-size: 12.5px; opacity: .9; }
.game-card .latest { margin: 14px 0 6px; padding: 10px 12px; border-radius: var(--r-md); background: color-mix(in srgb, var(--ink) 5%, transparent); }
.game-card .meta { color: var(--ink3); }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
  height: 38px; padding: 0 18px; border-radius: var(--r-pill); cursor: pointer; font-weight: 500;
  border: 1px solid var(--edge); background: var(--glass-hi); color: var(--ink);
  box-shadow: inset 0 1px 0 var(--edge-hi); transition: background .2s, box-shadow .2s, transform .1s;
}
.btn:hover { background: color-mix(in srgb, var(--ink) 12%, var(--glass-hi)); }
.btn:active { transform: scale(.97); }
.btn.primary { border-color: transparent; color: var(--ion-ink); background: linear-gradient(135deg, var(--ion), color-mix(in srgb, var(--ion) 55%, var(--plasma))); box-shadow: inset 0 1px 0 rgba(255,255,255,.45), 0 8px 22px -8px color-mix(in srgb, var(--ion) 70%, transparent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: color-mix(in srgb, var(--bad) 14%, var(--glass-hi)); }
.btn.small { height: 30px; padding: 0 12px; font-size: 13px; }
.btn:disabled { opacity: .45; pointer-events: none; }

.f { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; color: var(--ink2); font-size: 13.5px; }
.in {
  height: 42px; padding: 0 14px; border-radius: var(--r-md); width: 100%;
  border: 1px solid var(--edge); background: color-mix(in srgb, var(--space) 45%, transparent); color: var(--ink);
  transition: border-color .2s, box-shadow .2s;
}
textarea.in { height: auto; min-height: 90px; padding: 10px 14px; }
.in.small { height: 32px; width: auto; font-size: 13px; padding: 0 10px; }
.in:focus { outline: none; border-color: var(--ion); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ion) 20%, transparent); }
.in[readonly] { color: var(--ink2); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.copy { display: flex; gap: 8px; }
.copy .in { flex: 1; min-width: 0; }

/* ---------- tables ---------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-weight: 500; font-size: 12.5px; color: var(--ink3); padding: 0 10px 10px; }
.tbl td { padding: 12px 10px; border-top: 1px solid var(--edge); vertical-align: top; }
.tbl tr.muted td { opacity: .5; }
.tbl td.row { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- status pills: lit like instrument lamps ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: var(--r-pill); font-size: 12.5px; font-weight: 500; color: var(--c, var(--ink2)); background: color-mix(in srgb, var(--c, var(--ink3)) 14%, transparent); border: 1px solid color-mix(in srgb, var(--c, var(--ink3)) 30%, transparent); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c, var(--ink3)); box-shadow: 0 0 8px var(--c, transparent); }
.pill.ok { --c: var(--ok); } .pill.warn { --c: var(--warn); } .pill.bad { --c: var(--bad); } .pill.info { --c: var(--info); } .pill.mute { --c: var(--ink3); }
.pill.mute::before { box-shadow: none; }

.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; }
.muted { color: var(--ink2); } .small { font-size: 13.5px; } .tiny { font-size: 12.5px; }
.err { color: var(--bad); font-size: 13px; min-height: 1em; margin: 6px 0; }
.empty { text-align: center; color: var(--ink2); padding: 36px 16px; }
.warnbox { margin: 8px 0; padding: 10px 14px; border-radius: var(--r-md); background: color-mix(in srgb, var(--warn) 12%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); color: var(--ink); }
.main > .warnbox { margin: 0 0 16px; }
.notice { padding: 12px 0; border-bottom: 1px solid var(--edge); }
.notice:last-child { border-bottom: 0; }

/* ---------- upload: the one place that glows ---------- */
.drop {
  margin-top: 4px; padding: 30px 16px; text-align: center; color: var(--ink2);
  border-radius: var(--r-lg); border: 1.5px dashed color-mix(in srgb, var(--ion) 40%, var(--edge));
  background: repeating-linear-gradient(-45deg, transparent 0 12px, color-mix(in srgb, var(--ion) 4%, transparent) 12px 13px);
  transition: background .25s, border-color .25s, box-shadow .25s;
}
.drop.over { border-color: var(--ion); background-color: color-mix(in srgb, var(--ion) 10%, transparent); box-shadow: inset 0 0 40px color-mix(in srgb, var(--ion) 25%, transparent); }
.upitem { margin-top: 14px; }
.bar { position: relative; height: 10px; margin-top: 8px; border-radius: var(--r-pill); overflow: hidden; background: color-mix(in srgb, var(--ink) 8%, transparent); }
.bar > i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: linear-gradient(90deg, var(--plasma), var(--ion)); box-shadow: 0 0 14px var(--ion); transition: width .4s; overflow: hidden; }
.bar > i::after {                    /* light travelling along the beam */
  content: ""; position: absolute; inset: 0; width: 40%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent);
  animation: beam 1.6s linear infinite;
}
@keyframes beam { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

/* ---------- toasts & modals ---------- */
.toast-wrap { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: min(420px, calc(100vw - 36px)); }
.toast { padding: 12px 16px 12px 18px; border-radius: var(--r-lg); position: relative; animation: rise .35s cubic-bezier(.2, .9, .3, 1.2); }
.toast::before { content: ""; position: absolute; left: 7px; top: 12px; bottom: 12px; width: 3px; border-radius: 3px; background: var(--c, var(--ion)); box-shadow: 0 0 10px var(--c, var(--ion)); }
.toast.ok { --c: var(--ok); } .toast.warn { --c: var(--warn); } .toast.bad { --c: var(--bad); }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.modal-bg { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: color-mix(in srgb, var(--space) 55%, transparent); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.modal { width: min(460px, 100%); border-radius: var(--r-xl); padding: 22px 24px; animation: pop .28s cubic-bezier(.2, .9, .3, 1.15); background: var(--glass-hi); }
.modal h3 { margin: 0 0 8px; font-size: 18px; }
@keyframes pop { from { opacity: 0; transform: scale(.94); } }

/* ---------- sign-in ---------- */
.auth { width: min(400px, calc(100vw - 32px)); margin: 12vh auto; padding: 30px 28px; border-radius: 30px; display: block; }
.auth h1 { margin: 0 0 4px; font: 600 26px/1.2 "Grotesk", "Plex Thai", sans-serif; letter-spacing: -.02em; }
.auth h1::before { content: ""; display: block; width: 44px; height: 44px; margin-bottom: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff 0 8%, var(--ion) 30%, var(--plasma) 75%); box-shadow: 0 0 30px color-mix(in srgb, var(--ion) 55%, transparent); }
.auth form { display: flex; flex-direction: column; gap: 4px; margin-top: 18px; }
.auth .qr { display: flex; justify-content: center; margin: 18px 0 8px; }
.auth .qr img { width: 200px; height: 200px; border-radius: 18px; padding: 10px; background: #fff; }

/* ---------- one orchestrated moment: the shell powers on once ---------- */
.shell { animation: boot .7s ease-out both; }
.shell::after { content: ""; position: fixed; left: 0; right: 0; top: 0; height: 2px; z-index: 70; pointer-events: none; background: linear-gradient(90deg, transparent, var(--ion), transparent); box-shadow: 0 0 18px var(--ion); animation: scan .9s ease-out .1s both; }
@keyframes boot { from { opacity: 0; filter: blur(6px); } }
@keyframes scan { from { transform: translateY(0); opacity: 1; } to { transform: translateY(100vh); opacity: 0; } }

/* ---------- small screens ---------- */
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; margin: 12px 12px 0; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px; }
  .brand { padding: 4px 8px; }
  .nav { flex-direction: row; overflow-x: auto; flex: 1 1 100%; order: 3; }
  .nav a { white-space: nowrap; }
  .me { margin: 0 0 0 auto; border: 0; padding: 0; }
  .main { padding: 18px 16px 40px; }
  .page-h { flex-direction: column; align-items: flex-start; }
  .tbl { display: block; overflow-x: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .card, .side, .modal, .toast, .auth { background: var(--glass-solid); }
}
.grid > .card + .card { margin-top: 0; }
