/* ════════════════════════════════════════════════════════════
   play.apeiron.games — Shared Portal Design System
   Apeiron navy/gold. Cinzel (display + UI) / Lora (body).
   Tokens match ../../../../operations/6 Brand Kit/web-tokens.css —
   the single source of truth shared with apeiron.games. Do not
   rename or re-value the core tokens here without updating that
   file too.
   ════════════════════════════════════════════════════════════ */

:root {
  /* Core brand palette (see web-tokens.css) */
  --navy:       #1E2D4E;
  --navy-deep:  #111928;
  --navy-mid:   #263659;
  --gold:       #C9A84C;
  --gold-light: #E8C97A;
  --gold-dim:   #9E7E34;
  --parchment:  #F5EFE0;
  --ash:        #FAFAF8;
  --obsidian:   #161E2C;
  --stone:      #6B7280;
  --aegean:     #2A5F8F;
  --white:      #FFFFFF;

  /* Fonts (see web-tokens.css) */
  --font-display: 'Cinzel Decorative', serif;
  --font-head:    'Cinzel', serif;
  --font-body:    'Lora', serif;

  /* Portal-specific extensions — scoped to this product, not part
     of the shared core set (same pattern as Ahau's jade/terracotta
     accents on apeiron.games). */
  --paper-dim:   #C7CEDB;
  --line:        rgba(201, 168, 76, 0.28);
  --danger:      #E06C5A;

  /* Rhythm */
  --r: 3px;
  --section: clamp(3.5rem, 9vw, 7rem);
  --wrap: 1120px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--obsidian);
  color: var(--ash);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Typography ─────────────────────────────────────────────── */
h1, h2, h3 { font-family: var(--font-head); font-weight: 500; line-height: 1.15; }
h1 { font-size: clamp(2.2rem, 5.4vw, 4rem); letter-spacing: 0.01em; }
h2 { font-size: clamp(1.7rem, 3.6vw, 2.7rem); }
h3 { font-size: clamp(1.15rem, 1.8vw, 1.45rem); }
.display { font-family: var(--font-display); }

.eyebrow {
  font-family: var(--font-head);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
}

a { color: var(--gold); text-decoration: none; transition: color 0.2s var(--ease); }
a:hover { color: var(--gold-light); }

.muted { color: var(--paper-dim); }

/* ── Layout ─────────────────────────────────────────────────── */
.wrap { width: min(var(--wrap), 92vw); margin-inline: auto; }

.divider {
  width: 64px; height: 1px;
  background: var(--gold);
  opacity: 0.55;
  margin: 1.5rem 0;
}
.divider.center { margin-inline: auto; }

/* ── Top bar (shared shell chrome) ──────────────────────────── */
.portal-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px solid rgba(201,168,76,0.14);
  background: rgba(8,11,16,0.85);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 50;
}
.portal-bar .brand {
  display: flex; align-items: center; gap: 0.6rem;
  font-family: var(--font-head); font-size: 1.05rem; letter-spacing: 0.03em;
  color: var(--ash);
}
.portal-bar .brand b { color: var(--gold); font-weight: 500; }
.portal-bar .brand:hover { color: var(--ash); }
.portal-bar .brand .mark {
  width: 26px; height: 26px; flex: 0 0 26px;
  object-fit: contain;   /* real Apeiron A-mark (transparent PNG) sits cleanly in the box */
}
.portal-bar nav { display: flex; align-items: center; gap: 1.4rem; font-family: var(--font-head); font-size: 0.8rem; letter-spacing: 0.04em; }
.portal-bar nav a { color: var(--paper-dim); }
.portal-bar nav a:hover { color: var(--gold); }

/* Auth state chip (filled by portal.js) — ONE consolidated control:
   avatar with the XP bar directly under it, name + level beside it, and a
   single dropdown for everything else (level detail, tier ladder,
   archetype/avatar CTAs, account, sign out). */
.auth-chip { position: relative; display: flex; align-items: center; font-family: var(--font-head); font-size: 0.8rem; }
.auth-chip [data-when] { display: none; }        /* toggled by JS */

.chip-btn {
  display: flex; align-items: center; gap: 0.7rem;
  background: transparent; border: 1px solid var(--line);
  border-radius: var(--r); padding: 0.4rem 0.9rem 0.4rem 0.4rem;
  cursor: pointer; font-family: var(--font-head); color: var(--ash);
  transition: border-color 0.2s var(--ease);
}
.chip-btn:hover { border-color: var(--gold); }
.chip-caret { font-size: 0.65rem; color: var(--paper-dim); }

/* Avatar + mini XP bar stacked underneath it */
.chip-avatar-col { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 0.28rem; }
.chip-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, var(--gold-light), var(--gold-dim));
  color: var(--navy-deep); font-size: 0.74rem; font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25);
}
.chip-avatar.has-avatar { background-color: var(--navy-deep); background-size: cover; background-position: center; background-repeat: no-repeat; color: transparent; }
.chip-mini-track { width: 34px; height: 4px; border-radius: 999px; background: rgba(255,255,255,0.12); overflow: hidden; }
.chip-mini-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-dim), var(--gold-light)); border-radius: 999px; transition: width 0.6s var(--ease); }

.chip-text { display: flex; flex-direction: column; align-items: flex-start; gap: 0.05rem; }
.chip-text .who { color: var(--ash); font-size: 0.85rem; line-height: 1.2; }
.chip-level { font-size: 0.68rem; color: var(--paper-dim); letter-spacing: 0.04em; }

.chip-menu {
  position: absolute; top: calc(100% + 0.6rem); right: 0; z-index: 60;
  width: 260px; padding: 0.9rem 1rem;
  background: linear-gradient(165deg, var(--navy) 0%, var(--navy-deep) 100%);
  border: 1px solid rgba(201,168,76,0.22); border-radius: var(--r);
  box-shadow: 0 12px 32px rgba(0,0,0,0.45);
  display: flex; flex-direction: column;
  animation: gate-in 0.22s var(--ease);
}
.chip-menu[hidden] { display: none; }
.chip-menu a, .chip-menu button {
  display: block; width: 100%; text-align: left;
  background: transparent; border: none; cursor: pointer;
  padding: 0.55rem 0.7rem; border-radius: calc(var(--r) - 1px);
  font-family: var(--font-head); font-size: 0.82rem; color: var(--ash);
}
.chip-menu a:hover, .chip-menu button:hover { background: rgba(201,168,76,0.1); color: var(--gold); }
.chip-menu-sep { height: 1px; background: rgba(201,168,76,0.14); margin: 0.5rem 0.2rem; }

/* Level detail + tier ladder inside the chip dropdown (also reused by account.js) */
.apx-pop-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem;
  font-family: var(--font-head); font-size: 0.98rem; color: var(--ash);
}
.apx-pop-tier { font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); }
.apx-pop-bar { height: 7px; border-radius: 999px; background: rgba(255,255,255,0.1); overflow: hidden; margin: 0.6rem 0 0.5rem; }
.apx-pop-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-dim), var(--gold-light)); border-radius: 999px; transition: width 0.6s var(--ease); }
.apx-pop-xp { font-family: var(--font-body); font-size: 0.8rem; color: var(--paper-dim); line-height: 1.4; }
.apx-pop-tiers { margin-top: 0.8rem; border-top: 1px solid rgba(201,168,76,0.14); padding-top: 0.7rem; display: flex; flex-direction: column; gap: 0.35rem; }
.apx-tier { display: flex; align-items: center; justify-content: space-between; font-family: var(--font-head); font-size: 0.76rem; }
.apx-tier.unlocked span:first-child { color: var(--ash); }
.apx-tier.unlocked span:last-child { color: var(--gold); }
.apx-tier.locked span { color: var(--stone); }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  padding: 0.85rem 1.5rem;
  border-radius: var(--r);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
  transition: transform 0.15s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); }
.btn-gold { background: var(--gold); color: var(--obsidian); }
.btn-gold:hover { background: var(--gold-light); color: var(--obsidian); }
.btn-ghost { background: transparent; color: var(--ash); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }
.btn-block { width: 100%; }
.btn-google { background: #fff; color: #1f1f1f; border-color: #fff; }
.btn-google:hover { background: #f1f1f1; color: #1f1f1f; }
.btn-google svg { width: 18px; height: 18px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ── Cards / games grid ─────────────────────────────────────── */
.games {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.4rem;
}
.game-card {
  position: relative;
  display: flex; flex-direction: column;
  border: 1px solid rgba(201,168,76,0.16);
  border-radius: var(--r);
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-deep) 100%);
  overflow: hidden;
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease);
}
.game-card:hover { transform: translateY(-3px); border-color: var(--gold); }
.game-card .thumb {
  aspect-ratio: 16 / 10;
  background: var(--navy-deep) center/cover no-repeat;
  border-bottom: 1px solid rgba(201,168,76,0.12);
  display: grid; place-items: center;
}
.game-card .thumb .glyph { font-family: var(--font-head); font-size: 2.6rem; color: var(--gold); opacity: 0.85; }
.game-card .body { padding: 1.2rem 1.3rem 1.4rem; display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.game-card .tag {
  font-family: var(--font-head); font-size: 0.62rem; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold);
}
.game-card h3 { color: var(--ash); }
.game-card p { font-size: 0.95rem; color: var(--paper-dim); flex: 1; }
.game-card .cta-row { margin-top: 0.8rem; display: flex; gap: 0.6rem; align-items: center; }

.badge {
  font-family: var(--font-head); font-size: 0.6rem; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  padding: 0.28rem 0.6rem; border-radius: 999px;
  border: 1px solid var(--line); color: var(--gold);
  align-self: flex-start;
}
.badge.soon { color: var(--paper-dim); border-color: rgba(199,206,219,0.3); }

/* ── Footer ─────────────────────────────────────────────────── */
.portal-foot {
  margin-top: auto;
  padding: 2rem clamp(1rem, 4vw, 2.5rem);
  border-top: 1px solid rgba(201,168,76,0.14);
  font-family: var(--font-head); font-size: 0.78rem; color: var(--paper-dim);
  display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center;
}
.portal-foot a { color: var(--paper-dim); }
.portal-foot a:hover { color: var(--gold); }

/* ── Auth / login layout ────────────────────────────────────── */
.auth-shell { flex: 1; display: grid; place-items: center; padding: var(--section) 1rem; }
.auth-card {
  width: min(440px, 94vw);
  border: 1px solid rgba(201,168,76,0.18);
  border-radius: var(--r);
  background: linear-gradient(165deg, var(--navy) 0%, var(--navy-deep) 100%);
  padding: clamp(1.6rem, 4vw, 2.4rem);
}
.auth-card h1 { font-size: clamp(1.6rem, 3.6vw, 2.2rem); }
.auth-card .lede { color: var(--paper-dim); font-size: 0.98rem; margin-top: 0.4rem; }
.auth-card .gate-reason {
  margin: 1rem 0 0; padding: 0.7rem 0.9rem;
  border-left: 2px solid var(--gold);
  background: rgba(201,168,76,0.07);
  font-size: 0.9rem; color: var(--ash);
}
.field { margin-top: 1rem; }
.field label { display: block; font-family: var(--font-head); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--paper-dim); margin-bottom: 0.4rem; }
.field input[type="email"] {
  width: 100%; padding: 0.85rem 1rem;
  background: var(--obsidian); color: var(--ash);
  border: 1px solid var(--line); border-radius: var(--r);
  font-family: var(--font-body); font-size: 1rem;
}
.field input[type="email"]:focus { outline: none; border-color: var(--gold); }

.consent {
  display: flex; gap: 0.7rem; align-items: flex-start;
  margin-top: 1rem; padding: 0.9rem 1rem;
  border: 1px solid rgba(201,168,76,0.16); border-radius: var(--r);
  background: rgba(15,29,56,0.5);
}
.consent input[type="checkbox"] { margin-top: 0.25rem; width: 18px; height: 18px; accent-color: var(--gold); flex: 0 0 18px; }
.consent label { font-family: var(--font-body); font-size: 0.88rem; color: var(--paper-dim); cursor: pointer; }
.consent label b { color: var(--ash); font-weight: 600; }

.or-rule { display: flex; align-items: center; gap: 0.8rem; margin: 1.4rem 0; color: var(--paper-dim); font-family: var(--font-head); font-size: 0.72rem; letter-spacing: 0.14em; }
.or-rule::before, .or-rule::after { content: ""; height: 1px; background: rgba(201,168,76,0.18); flex: 1; }

.form-note { font-size: 0.78rem; color: var(--paper-dim); margin-top: 1rem; text-align: center; }
.form-msg { margin-top: 1rem; padding: 0.8rem 1rem; border-radius: var(--r); font-size: 0.9rem; display: none; }
.form-msg.ok  { display: block; background: rgba(201,168,76,0.1); border: 1px solid var(--line); color: var(--ash); }
.form-msg.err { display: block; background: rgba(224,108,90,0.1); border: 1px solid rgba(224,108,90,0.4); color: var(--danger); }

.turnstile-slot { margin-top: 1rem; min-height: 65px; }

/* ── Gate modal (in-game "wow moment" gate) ─────────────────── */
.gate-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: none; place-items: center;
  background: rgba(8,11,16,0.82); backdrop-filter: blur(6px);
  padding: 1rem;
}
.gate-overlay.open { display: grid; }
.gate-overlay .auth-card { animation: gate-in 0.35s var(--ease); }
@keyframes gate-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ── Per-game feedback / bug-report widget (funnel wrapper pages,
   feedback-widget.js) ───────────────────────────────────────── */
.feedback-fab {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 40;
  display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: flex-end;
}
.feedback-fab .btn {
  padding: 0.6rem 1rem; font-size: 0.78rem;
  background: rgba(15,29,56,0.9); backdrop-filter: blur(4px);
}
.feedback-overlay {
  position: fixed; inset: 0; z-index: 220;
  display: none; place-items: center;
  background: rgba(8,11,16,0.82); backdrop-filter: blur(6px);
  padding: 1rem;
}
.feedback-overlay.open { display: grid; }
.feedback-overlay .auth-card { animation: gate-in 0.35s var(--ease); }
.fb-toggle { display: flex; gap: 0.4rem; }
.fb-tab {
  flex: 1; padding: 0.5rem 0.8rem; border-radius: var(--r);
  border: 1px solid var(--line); background: transparent; color: var(--paper-dim);
  font-family: var(--font-head); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.04em;
  cursor: pointer;
}
.fb-tab.active { border-color: var(--gold); color: var(--gold); }

/* ── Archetype picker (/onboarding) ─────────────────────────── */
.arch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 1.2rem; }
.arch-card {
  text-align: left; padding: 0; overflow: hidden; cursor: pointer;
  display: flex; flex-direction: column; color: inherit;
  border: 1px solid rgba(201,168,76,0.18); border-radius: var(--r);
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-deep) 100%);
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease);
}
.arch-card:hover { transform: translateY(-3px); border-color: var(--gold); }
.arch-card.chosen { border-color: var(--gold); box-shadow: inset 0 0 0 2px var(--gold); }
.arch-art {
  display: block; width: 100%; aspect-ratio: 3 / 3.1;
  background: var(--navy-deep) top center / cover no-repeat;
  border-bottom: 1px solid rgba(201,168,76,0.14);
}
.arch-body { padding: 1rem 1.1rem 1.2rem; display: flex; flex-direction: column; gap: 0.22rem; }
.arch-sub { font-family: var(--font-head); font-size: 0.64rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); }
.arch-name { font-family: var(--font-head); font-size: 1.32rem; color: var(--ash); }
.arch-promise { font-family: var(--font-body); font-size: 0.92rem; color: var(--paper-dim); line-height: 1.45; margin-top: 0.15rem; }

.arch-confirm {
  position: sticky; bottom: 1rem; margin-top: 1.4rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: 1rem 1.2rem; border: 1px solid var(--gold); border-radius: var(--r);
  background: rgba(17,25,40,0.94); backdrop-filter: blur(8px);
}
.arch-confirm[hidden] { display: none; }
.arch-confirm span { color: var(--ash); font-size: 0.95rem; }
.arch-confirm b { color: var(--gold); font-weight: 600; }

/* The take-up-the-mantle flourish + nickname */
.mantle {
  display: grid; grid-template-columns: minmax(0, 300px) 1fr; gap: 1.6rem; overflow: hidden;
  border: 1px solid rgba(201,168,76,0.2); border-radius: var(--r);
  background: linear-gradient(165deg, var(--navy) 0%, var(--navy-deep) 100%);
  animation: gate-in 0.4s var(--ease);
}
.mantle-art { min-height: 340px; background: var(--navy-deep) top center / cover no-repeat; }
.mantle-body { padding: 1.6rem 1.8rem 1.8rem; }
.gold { color: var(--gold); }
.xp-pop { margin-top: 0.9rem; display: inline-block; font-family: var(--font-head); font-size: 0.8rem; letter-spacing: 0.06em; color: var(--gold); border: 1px solid var(--line); border-radius: 999px; padding: 0.3rem 0.8rem; }
.mantle-tag { margin-top: 1rem; font-size: 0.9rem; color: var(--paper-dim); }
.mantle-tag i { color: var(--gold-light); font-style: normal; font-family: var(--font-head); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; margin-right: 0.35rem; }

.nick-field { margin-top: 1.4rem; }
.nick-field label { display: block; font-family: var(--font-head); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--paper-dim); }
.nick-hint { font-size: 0.78rem; color: var(--stone); margin: 0.25rem 0 0.5rem; }
.nick-field input {
  width: 100%; max-width: 360px; padding: 0.8rem 1rem;
  background: var(--obsidian); color: var(--ash);
  border: 1px solid var(--line); border-radius: var(--r);
  font-family: var(--font-body); font-size: 1rem;
}
.nick-field input:focus { outline: none; border-color: var(--gold); }

@media (max-width: 640px) { .mantle { grid-template-columns: 1fr; } .mantle-art { min-height: 220px; } }

/* Personalization on the portal home (injected by portal.js) */
.personal-strip {
  margin: 0 0 1.4rem; padding: 0.9rem 1.1rem;
  border: 1px solid rgba(201,168,76,0.18); border-left: 3px solid var(--gold);
  border-radius: var(--r); background: rgba(201,168,76,0.06);
  color: var(--paper-dim); font-size: 0.92rem;
}
.personal-strip b { color: var(--ash); font-weight: 600; }
.game-card .rec-badge {
  position: absolute; top: 0.7rem; right: 0.7rem; z-index: 2;
  font-family: var(--font-head); font-size: 0.56rem; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--obsidian);
  background: var(--gold); padding: 0.3rem 0.6rem; border-radius: 999px;
}
.apx-arch-cta {
  display: block; margin-top: 0.8rem; text-align: center;
  font-family: var(--font-head); font-size: 0.74rem; letter-spacing: 0.04em;
  padding: 0.5rem; border: 1px solid var(--gold); border-radius: var(--r); color: var(--gold);
}
.apx-arch-cta:hover { background: rgba(201,168,76,0.1); color: var(--gold-light); }

/* ── Avatar gallery (/avatars) ───────────────────────────────── */
.av-shelf { margin-bottom: 2.2rem; }
.av-shelf-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.9rem; flex-wrap: wrap; }
.shelf-count { font-family: var(--font-head); font-size: 0.72rem; letter-spacing: 0.06em; color: var(--gold); }
.shelf-lock { font-family: var(--font-head); font-size: 0.72rem; letter-spacing: 0.06em; color: var(--stone); }
.av-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 0.9rem; }
.av-tile {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
  padding: 0.6rem 0.4rem 0.7rem; cursor: pointer; text-align: center;
  border: 1px solid rgba(201,168,76,0.14); border-radius: var(--r);
  background: rgba(255,255,255,0.02); color: inherit;
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.av-tile:not([disabled]):hover { transform: translateY(-2px); border-color: var(--gold); }
.av-tile.chosen { border-color: var(--gold); box-shadow: inset 0 0 0 2px var(--gold); }
.av-tile[disabled] { cursor: not-allowed; opacity: 0.4; }
.av-img { display: block; width: 84px; height: 84px; border-radius: 50%; background: var(--navy-deep) center/cover no-repeat; border: 1px solid rgba(201,168,76,0.2); }
.av-name { font-family: var(--font-head); font-size: 0.72rem; color: var(--ash); line-height: 1.2; }
.av-badge {
  position: absolute; top: 0.35rem; right: 0.35rem;
  font-family: var(--font-head); font-size: 0.52rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--obsidian); background: var(--gold); padding: 0.15rem 0.4rem; border-radius: 999px;
}
.av-lockmark { position: absolute; top: 0.5rem; right: 0.5rem; font-size: 0.85rem; opacity: 0.8; }

/* ── Level-up modal ──────────────────────────────────────────── */
.levelup-overlay {
  position: fixed; inset: 0; z-index: 300;
  display: none; place-items: center;
  background: rgba(8,11,16,0.86); backdrop-filter: blur(6px); padding: 1rem;
}
.levelup-overlay.open { display: grid; }
.levelup-card {
  width: min(420px, 94vw); text-align: center; padding: clamp(1.8rem, 4vw, 2.6rem);
  border: 1px solid var(--gold); border-radius: var(--r);
  background: linear-gradient(165deg, var(--navy) 0%, var(--navy-deep) 100%);
  animation: gate-in 0.4s var(--ease);
}
.levelup-medal {
  width: 64px; height: 64px; margin: 0 auto 1rem; display: grid; place-items: center;
  border-radius: 50%; background: radial-gradient(circle at 35% 30%, var(--gold-light), var(--gold-dim));
  color: var(--navy-deep); font-family: var(--font-head); font-weight: 700; font-size: 1.3rem;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.3);
}
.levelup-tier { margin-top: 0.9rem; padding: 0.7rem 0.9rem; border: 1px solid var(--line); border-radius: var(--r); background: rgba(201,168,76,0.08); font-size: 0.92rem; color: var(--ash); }
.levelup-tier b { color: var(--gold); }

/* ── Avatar frames — status ring by the EQUIPPED avatar's tier, not the
   player's max level. Applied to any avatar image via .frame-{tier}. ── */
.frame-mortal   { box-shadow: 0 0 0 2px #7A5230; }
.frame-demigod  { box-shadow: 0 0 0 2px #B8C0CC; }
.frame-titan    { box-shadow: 0 0 0 2px var(--gold); }
.frame-olympian { box-shadow: 0 0 0 2px var(--gold-light), 0 0 10px rgba(232,201,122,0.55); }
.frame-throne   { box-shadow: 0 0 0 3px var(--gold-light), 0 0 16px rgba(232,201,122,0.85); }

/* ── Utility ────────────────────────────────────────────────── */
.stack > * + * { margin-top: 1rem; }
.center { text-align: center; }
.hidden { display: none !important; }

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