/*
 * The hub in the Empyreal brand, taken from the studio site (empyreal-au:
 * tailwind.config.cjs, src/styles/global.css, Header.astro, ui/Button.astro).
 * Dark ground, purple accent, Schibsted Grotesk text, Unbounded headings,
 * IBM Plex Mono labels, rounded-xl buttons, 2xl cards. The games keep their
 * own brands; only this site and the quiet sign-in line say Empyreal.
 */
@import url('https://fonts.googleapis.com/css2?family=Unbounded:wght@500;700&family=Schibsted+Grotesk:wght@400;500;600&family=IBM+Plex+Mono:wght@400;600&display=swap');

:root {
  --bg: #0B0B0D;
  --panel: #121316;
  --panel-light: #1A1B1F;
  --text: #EDEFF2;
  --text-muted: #B8BBC0;
  --muted: #A6A8AD;
  --muted-dark: #6B6D73;
  --label: #8E979E;
  --rule: #232529;
  --border: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.12);
  --accent: #A855F7;
  --accent-hover: #C084FC;
  --accent-dark: #9333EA;
  --error: #EF4444;
  --success: #10B981;
  --shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.4);
  --font-sans: 'Schibsted Grotesk', system-ui, sans-serif;
  --font-display: 'Unbounded', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', Consolas, Monaco, monospace;
  --chip-ok-bg: rgba(16, 185, 129, 0.14);
  --chip-ok: #34D399;
  --chip-warn-bg: rgba(245, 158, 11, 0.14);
  --chip-warn: #FBBF24;
  --chip-bad-bg: rgba(239, 68, 68, 0.14);
  --chip-bad: #F87171;
  --chip-muted-bg: rgba(255, 255, 255, 0.06);
  --accent-soft: rgba(168, 85, 247, 0.14);
  --skeleton: rgba(255, 255, 255, 0.06);
  --skeleton-hi: rgba(255, 255, 255, 0.12);
  --on-accent: #fff;
  color-scheme: dark;
}

/* Light, for people whose system asks for it. The brand stays: same accent family, same type. */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #F7F6F3;
    --panel: #FFFFFF;
    --panel-light: #F2F1EE;
    --text: #16161A;
    --text-muted: #45474D;
    --muted: #5C5F66;
    --muted-dark: #8A8D94;
    --label: #646870;
    --rule: #E4E2DE;
    --border: rgba(0, 0, 0, 0.08);
    --border-light: rgba(0, 0, 0, 0.16);
    --accent: #9333EA;
    --accent-hover: #7E22CE;
    --accent-dark: #6B21A8;
    --error: #C62828;
    --success: #047857;
    --shadow-soft: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.08);
    --chip-ok-bg: rgba(4, 120, 87, 0.1);
    --chip-ok: #047857;
    --chip-warn-bg: rgba(180, 83, 9, 0.1);
    --chip-warn: #92400E;
    --chip-bad-bg: rgba(198, 40, 40, 0.1);
    --chip-bad: #B71C1C;
    --chip-muted-bg: rgba(0, 0, 0, 0.05);
    --accent-soft: rgba(147, 51, 234, 0.1);
    --skeleton: rgba(0, 0, 0, 0.06);
    --skeleton-hi: rgba(0, 0, 0, 0.11);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--font-sans); -webkit-font-smoothing: antialiased; font-feature-settings: "rlig" 1, "calt" 1; }
::selection { background: var(--accent-soft); color: var(--accent); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
@media (min-width: 640px) { .wrap { padding: 0 24px; } }

/* Header, as the studio site's */
.site-header { border-bottom: 1px solid var(--rule); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; padding-block: 20px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.brand img { width: 24px; height: 24px; display: block; }
.brand span { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.24em; }
.brand small { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--label); margin-left: 4px; }
nav a { margin-left: 28px; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em; color: var(--label); text-decoration: none; }
nav a:hover, nav a[aria-current] { color: var(--text); }
@media (max-width: 420px) { nav a { margin-left: 16px; } .brand small { display: none; } }

main.wrap { padding-block: 56px 24px; max-width: 880px; }
h1, h2 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 5vw, 3rem); line-height: 1.1; margin: 0 0 16px; text-wrap: balance; }
h2 { font-size: 1.25rem; margin: 48px 0 12px; }
h3 { font-size: 1.125rem; font-weight: 600; margin: 0 0 6px; }
.eyebrow { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent); margin: 0 0 12px; }
.lead { font-size: 1.125rem; color: var(--text-muted); margin: 0 0 24px; }
@media (min-width: 768px) { .lead { font-size: 1.25rem; } }
p { margin: 0 0 16px; }
.muted { color: var(--muted); }
a { color: var(--accent); text-underline-offset: 4px; }
a:hover { color: var(--accent-hover); }

/* Cards */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 1.5rem; padding: 24px; transition: all 0.3s; }
.card:hover { background: var(--panel-light); border-color: var(--border-light); transform: translateY(-2px); box-shadow: var(--shadow-medium); }
.card p { color: var(--text-muted); font-size: 0.95rem; }
.note { background: var(--panel); border: 1px solid var(--border); border-radius: 1rem; padding: 20px; }

/* Buttons, as ui/Button.astro */
.btn, button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 500 1rem/1.5 var(--font-sans); padding: 8px 16px; border-radius: 1rem; border: 0; cursor: pointer; text-decoration: none; transition: all 0.2s; }
.btn-primary, button { background: var(--accent); color: #fff; box-shadow: var(--shadow-soft); }
.btn-primary:hover, button:hover { background: var(--accent-hover); color: #fff; box-shadow: var(--shadow-medium); }
.btn-secondary, button.secondary { background: var(--panel); color: var(--text); border: 1px solid var(--border); box-shadow: none; }
.btn-secondary:hover, button.secondary:hover { background: var(--panel-light); border-color: var(--border-light); color: var(--text); }
button.ghost { background: transparent; color: var(--text); box-shadow: none; padding: 6px 10px; }
button.ghost:hover { background: var(--panel); color: var(--accent); }
button.danger { background: var(--error); }
button.danger:hover { background: var(--error); filter: brightness(1.1); }
button:disabled, .btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

/* Forms */
label.field, p.field { display: block; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--label); margin-bottom: 8px; }
input[type=email], input[type=text], input[type=password], select { font: inherit; width: 100%; max-width: 360px; min-height: 44px; padding: 9px 14px; border-radius: 1rem; border: 1px solid var(--border-light); background: var(--panel); color: var(--text); }
input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
form.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--label); font-weight: 400; text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--rule); }
td { padding: 12px 8px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.error { color: var(--error); }
.ok { color: var(--success); }

.site-footer { border-top: 1px solid var(--rule); margin-top: 64px; }
.site-footer .wrap { padding-block: 28px; display: flex; gap: 24px; flex-wrap: wrap; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em; color: var(--label); }
.site-footer a { color: var(--label); text-decoration: none; }
.site-footer a:hover { color: var(--text); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; } .card:hover { transform: none; } }

/* ---------- Account dashboard (account.html) ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
main.wrap.acct { max-width: 1120px; padding-block: 40px 24px; }
.acct h2 { margin-top: 0; }
.acct input[type=email], .acct input[type=text], .acct input[type=password], .acct select { max-width: none; }

/* Status lines, inline and in toasts */
.status { margin: 8px 0 0; font-size: 0.95rem; min-height: 0; }
.status:empty { display: none; }
.status.error { color: var(--error); }
.status.ok { color: var(--success); }
.notice { border: 1px solid var(--border-light); background: var(--accent-soft); border-radius: 1rem; padding: 12px 16px; margin: 0 0 20px; font-size: 0.95rem; }
.notice.error { background: var(--chip-bad-bg); border-color: transparent; color: var(--text); }

/* Loading */
.boot { padding-block: 24px; display: grid; gap: 14px; max-width: 520px; }
.sk { display: block; height: 14px; border-radius: 8px; background: linear-gradient(90deg, var(--skeleton) 0%, var(--skeleton-hi) 50%, var(--skeleton) 100%); background-size: 200% 100%; animation: sk 1.4s ease-in-out infinite; }
.sk-title { height: 28px; width: 55%; }
.sk-big { height: 36px; width: 40%; }
.sk-line { width: 100%; }
.sk-short { width: 60%; }
@keyframes sk { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.loading { display: grid; gap: 12px; padding-block: 4px; }
.fail { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.fail p { margin: 0; color: var(--text-muted); }

/* Signed out: one card */
.auth { display: grid; place-items: start center; padding-block: 8px 24px; }
.auth-card { width: 100%; max-width: 460px; background: var(--panel); border: 1px solid var(--border); border-radius: 1.5rem; padding: 28px 24px; box-shadow: var(--shadow-soft); }
@media (min-width: 640px) { .auth-card { padding: 36px 36px 32px; } }
.auth-card h1 { font-size: clamp(1.6rem, 4vw, 2rem); margin-bottom: 8px; }
.auth-card .lead { font-size: 1rem; margin-bottom: 20px; }
.auth-foot { max-width: 460px; margin: 16px auto 0; font-size: 0.9rem; text-align: center; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--bg); border: 1px solid var(--border); border-radius: 1rem; margin: 0 0 24px; }
.seg button { background: transparent; color: var(--muted); box-shadow: none; border-radius: 0.75rem; font-weight: 500; }
.seg button:hover { background: var(--panel-light); color: var(--text); box-shadow: none; }
.seg button[aria-selected="true"] { background: var(--panel-light); color: var(--text); box-shadow: var(--shadow-soft); }
.fg { margin: 0 0 16px; }
.fg-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.hint { font-size: 0.85rem; color: var(--muted); margin: 6px 0 0; }
.pw { position: relative; }
.pw input { padding-right: 76px; }
.pw button { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); min-height: 36px; padding: 4px 12px; border-radius: 0.75rem; background: transparent; color: var(--text-muted); box-shadow: none; font-size: 0.9rem; }
.pw button:hover { background: var(--panel-light); color: var(--text); box-shadow: none; }
.linkish { background: none; border: 0; box-shadow: none; color: var(--accent); padding: 0 2px; min-height: 44px; font-size: 0.9rem; text-decoration: underline; text-underline-offset: 4px; }
.linkish:hover { background: none; color: var(--accent-hover); box-shadow: none; }
.fg-head .linkish { min-height: 32px; margin-bottom: 4px; }
.full { width: 100%; }
.or { display: flex; align-items: center; gap: 12px; color: var(--label); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; margin: 20px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
.stack { display: grid; gap: 10px; }
.check { display: flex; gap: 10px; align-items: center; min-height: 44px; font-size: 0.95rem; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

/* Signed in: sidebar and panels */
.dash { display: grid; gap: 24px; }
@media (min-width: 900px) { .dash { grid-template-columns: 240px minmax(0, 1fr); gap: 40px; align-items: start; } }
.side { display: grid; gap: 12px; min-width: 0; }
@media (min-width: 900px) { .side { position: sticky; top: 24px; } }
.who { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.who-text { min-width: 0; }
.who-name { font-weight: 600; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-email { margin: 0; font-size: 0.85rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 900px) { .who { flex-direction: column; align-items: stretch; } .who .ghost { justify-content: flex-start; } }
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -20px; padding: 2px 20px 6px; scroll-snap-type: x proximity; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: 0 0 auto; margin: 0; display: flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 0.9rem; border: 1px solid var(--border); background: var(--panel); color: var(--text-muted); font-family: var(--font-sans); font-size: 0.95rem; letter-spacing: 0; text-decoration: none; white-space: nowrap; scroll-snap-align: start; }
.tabs a:hover { color: var(--text); background: var(--panel-light); }
.tabs a[aria-current="page"] { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
@media (min-width: 900px) {
  .tabs { flex-direction: column; overflow: visible; margin: 0; padding: 0; gap: 2px; }
  .tabs a { border-color: transparent; background: transparent; }
  .tabs a[aria-current="page"] { border-color: transparent; box-shadow: inset 3px 0 0 var(--accent); }
}
.panel-head { margin-bottom: 20px; }
.panel-head h2 { font-size: clamp(1.4rem, 3.5vw, 1.9rem); margin: 0 0 6px; }
.panel-head h2:focus { outline: none; }
.panel-head p { margin: 0; color: var(--text-muted); }
.cards { display: grid; gap: 16px; }
.box { background: var(--panel); border: 1px solid var(--border); border-radius: 1.25rem; padding: 20px; min-width: 0; }
@media (min-width: 640px) { .box { padding: 24px; } }
.box > h3, .box-head h3 { font-size: 1.05rem; margin: 0 0 4px; }
.box-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between; margin-bottom: 12px; }
.box-head p { margin: 0; }
.box > p:last-child, .box > .rows:last-child { margin-bottom: 0; }
.sub { color: var(--muted); font-size: 0.95rem; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.actions + .status, form + .status { margin-top: 10px; }
.empty { color: var(--muted); margin: 0; }
.mono { font-family: var(--font-mono); letter-spacing: 0.04em; }

/* Overview */
.hello h3 { font-family: var(--font-display); font-size: clamp(1.2rem, 3vw, 1.5rem); font-weight: 700; margin: 0 0 4px; overflow-wrap: anywhere; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.tile { display: flex; flex-direction: column; gap: 6px; }
.tile .label { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--label); margin: 0; }
.tile .big { font-family: var(--font-display); font-size: 1.75rem; font-weight: 700; line-height: 1.2; margin: 0; }
.tile .sub { margin: 0; }
.tile .go { margin-top: auto; padding-top: 8px; font-size: 0.95rem; display: inline-flex; align-items: center; min-height: 44px; }
.tile.wide { grid-column: 1 / -1; }
.tile.wide .mini { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px 16px; margin-top: 4px; }
.tile.wide .mini li { flex-direction: column; justify-content: flex-start; gap: 0; }
.tile.wide .mini strong { color: var(--text); font-size: 1.05rem; }
.mini { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: 0.9rem; color: var(--text-muted); }
.mini li { display: flex; justify-content: space-between; gap: 8px; }
.shortcuts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px; }
.shortcuts a { display: block; padding: 12px 14px; border-radius: 1rem; border: 1px solid var(--border); color: var(--text); text-decoration: none; min-height: 44px; }
.shortcuts a:hover { background: var(--panel-light); border-color: var(--border-light); color: var(--text); }
.shortcuts span { display: block; font-size: 0.875rem; color: var(--muted); }

/* Balances */
.balances { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.balance { border: 1px solid var(--border); border-radius: 1rem; padding: 16px; background: var(--bg); }
.balance h4 { margin: 0 0 4px; font-size: 0.95rem; font-weight: 600; }
.balance .big { font-family: var(--font-display); font-size: 2rem; font-weight: 700; line-height: 1.1; margin: 0; }
.balance .big small { font-family: var(--font-sans); font-size: 0.9rem; font-weight: 400; color: var(--muted); margin-left: 6px; }
.balance.zero .big { color: var(--muted-dark); }
.balance p { margin: 6px 0 0; font-size: 0.875rem; color: var(--muted); }

/* Rows: purchases, phones, sessions, methods */
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.rows > li:first-child { padding-top: 4px; }
.rows > li:last-child { border-bottom: 0; padding-bottom: 0; }
.row-title { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.row-meta { margin: 2px 0 0; font-size: 0.875rem; color: var(--muted); overflow-wrap: anywhere; }
.row-side { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; text-align: right; }
.row-price { font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-confirm { grid-column: 1 / -1; }
.row-confirm:empty { display: none; }
@media (max-width: 520px) {
  .rows > li { grid-template-columns: minmax(0, 1fr); }
  .row-side { justify-content: flex-start; text-align: left; }
}
.chip { display: inline-flex; align-items: center; min-height: 26px; padding: 2px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 500; white-space: nowrap; background: var(--chip-muted-bg); color: var(--text-muted); }
.chip.ok { background: var(--chip-ok-bg); color: var(--chip-ok); }
.chip.warn { background: var(--chip-warn-bg); color: var(--chip-warn); }
.chip.bad { background: var(--chip-bad-bg); color: var(--chip-bad); }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.more { margin-top: 12px; }

/* Inline confirm */
.confirm { margin-top: 10px; padding: 14px 16px; border-radius: 1rem; background: var(--bg); border: 1px solid var(--border-light); }
.confirm p { margin: 0 0 10px; font-size: 0.95rem; }
.confirm .status { margin-top: 8px; }

/* Forms inside boxes */
.inline-form { display: grid; gap: 10px; }
@media (min-width: 640px) { .inline-form.one { grid-template-columns: minmax(0, 1fr) auto; align-items: end; } }
.inline-form .fg { margin: 0; }
.danger-zone { border-color: var(--chip-bad-bg); }
.danger-zone h3 { color: var(--error); }
.bullets { margin: 0 0 16px; padding-left: 1.2em; color: var(--text-muted); }
.bullets li { margin-bottom: 4px; }
.links { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.links a { display: inline-flex; align-items: center; min-height: 44px; }
.sso { display: flex; flex-wrap: wrap; gap: 10px; }
.done { text-align: center; padding-block: 24px; }

/* Toasts */
.toasts { position: fixed; z-index: 50; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { pointer-events: auto; background: var(--text); color: var(--bg); border-radius: 1rem; padding: 12px 16px; box-shadow: var(--shadow-medium); font-size: 0.95rem; animation: toast-in 0.2s ease-out; }
.toast.error { background: var(--error); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }
.host-list { list-style: none; margin: 0 0 16px; padding: 0; }
.host-list li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.host-list .actions { justify-content: space-between; }
