/* ==========================================================================
   ENTHUSED — web hall. A fledgling-god game: you shepherd a tribe, channel
   mana, and reshape a living planet. The site dresses that world: cold cosmic
   void, divine gold, engraved Roman capitals (Cinzel) for anything ceremonial,
   warm vellum text, and a grounded technical sans (IBM Plex) for the interface.
   One persistent header + shell across home / play / rankings — the menu never
   disappears.
   ========================================================================== */

/* Sections are toggled via [hidden]; author display rules would otherwise
   override the UA's display:none. */
[hidden] { display: none !important; }

:root {
  /* --- surfaces: a cold, deep void that warms toward the panels --- */
  --void:      #07080E;   /* page floor */
  --abyss:     #0A0C15;
  --panel:     #10121D;   /* panel base */
  --panel-2:   #151827;   /* raised */
  --panel-3:   #1C2033;   /* elevated / hover */
  --line:      #262A3E;
  --line-soft: #1C2032;
  --hair:      rgba(232,178,76,.16);   /* gold hairline */

  /* --- text: warm vellum on the cold void --- */
  --parch:     #ECE6D6;   /* primary */
  --parch-dim: #A29E90;   /* secondary */
  --parch-mut: #6C7183;   /* muted / meta */

  /* --- divine gold + a single ember accent (used sparingly) --- */
  --gilt:      #E8B24C;
  --gilt-2:    #F7DB94;
  --gilt-deep: #A9812F;
  --gilt-glow: rgba(232,178,76,.28);
  --ember:     #C6603A;

  /* Slot = colour = tribe (contract §2.2): Blue/Red/Yellow/Green. */
  --slot-0: #2952F2;
  --slot-1: #E62421;
  --slot-2: #F2CC26;
  --slot-3: #33B847;

  --ok:   #33B847;
  --warn: #E0A24A;

  --display: "Cinzel", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --radius: 12px;
  --radius-sm: 8px;
  --maxw: 1360px;
  --shadow: 0 18px 50px -20px rgba(0,0,0,.75);
}

* { box-sizing: border-box; }
html, body { margin: 0; }

body {
  background: var(--void);
  color: var(--parch);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  /* Cosmic atmosphere: an indigo glow bleeding from top-right (the heavens),
     a faint gold horizon warmth at the base, and a fine star dust field. */
  background-image:
    radial-gradient(1100px 620px at 82% -8%, rgba(58,74,140,.34), transparent 60%),
    radial-gradient(900px 520px at 10% 0%,  rgba(40,52,104,.20), transparent 55%),
    radial-gradient(1200px 800px at 50% 118%, rgba(232,178,76,.10), transparent 60%);
  background-attachment: fixed;
}
/* star dust — a cheap, static twinkle layer behind everything */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    radial-gradient(1.1px 1.1px at 18% 22%, rgba(255,255,255,.55), transparent),
    radial-gradient(1px 1px at 68% 14%, rgba(255,255,255,.45), transparent),
    radial-gradient(1.2px 1.2px at 42% 34%, rgba(247,219,148,.45), transparent),
    radial-gradient(1px 1px at 86% 40%, rgba(255,255,255,.35), transparent),
    radial-gradient(1px 1px at 30% 8%, rgba(255,255,255,.4), transparent),
    radial-gradient(1.1px 1.1px at 55% 48%, rgba(255,255,255,.3), transparent);
  opacity: .6;
}

a { color: var(--gilt-2); text-decoration: none; }
a:hover { color: var(--gilt); }

.display {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: .02em;
}
.shell { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 1.5rem; }

/* eyebrow — a small gold uppercase label used above titles */
.eyebrow {
  font-family: var(--mono);
  font-size: .7rem; letter-spacing: .34em; text-transform: uppercase;
  color: var(--gilt); opacity: .85;
}

:focus-visible { outline: 2px solid var(--gilt); outline-offset: 2px; border-radius: 4px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .62rem 1.15rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit; font-weight: 600; letter-spacing: .04em;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: filter .15s ease, background .15s ease, border-color .15s ease, transform .05s ease;
}
.btn:active { transform: translateY(1px); }
.btn-sm { padding: .4rem .75rem; font-size: .82rem; }
.btn-block { width: 100%; }

.btn-gold {
  background: linear-gradient(180deg, var(--gilt-2), var(--gilt) 55%, #cf9a34);
  color: #241802; border-color: #d7ac4e;
  box-shadow: 0 1px 0 rgba(255,255,255,.35) inset, 0 8px 22px -10px var(--gilt-glow);
  text-shadow: 0 1px 0 rgba(255,255,255,.25);
}
.btn-gold:hover { filter: brightness(1.07); color: #241802; }

.btn-outline {
  background: rgba(232,178,76,.02); color: var(--gilt-2);
  border-color: var(--gilt-deep);
}
.btn-outline:hover { background: rgba(232,178,76,.09); border-color: var(--gilt); }

.btn-ghost { background: transparent; color: var(--parch-dim); border-color: var(--line); }
.btn-ghost:hover { color: var(--parch); border-color: var(--gilt-deep); }

.btn[disabled] { opacity: .45; cursor: default; }
.btn[disabled]:active { transform: none; }

/* big ceremonial join button, à la the reference */
.btn-cta {
  padding: .95rem 1.2rem; font-family: var(--display); font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; font-size: 1rem;
}

/* ==========================================================================
   HEADER — persistent across every route
   ========================================================================== */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: linear-gradient(180deg, rgba(9,11,18,.95), rgba(8,9,15,.82));
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 var(--hair);
}
.header-inner {
  display: flex; align-items: center; gap: 1.8rem;
  height: 66px; max-width: var(--maxw); margin: 0 auto; padding: 0 1.5rem;
}
.brand { display: flex; align-items: center; gap: .6rem; color: var(--parch); }
.brand-mark { display: inline-flex; filter: drop-shadow(0 0 10px var(--gilt-glow)); }
.brand-word {
  font-family: var(--display); font-size: 1.35rem; font-weight: 700;
  letter-spacing: .2em; color: var(--gilt-2);
  text-shadow: 0 0 22px var(--gilt-glow);
}

.site-nav { display: flex; gap: 1.7rem; }
.site-nav a {
  position: relative;
  color: var(--parch-dim); font-weight: 600; letter-spacing: .12em;
  font-size: .8rem; text-transform: uppercase; padding: .5rem 0;
}
.site-nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gilt), transparent);
  transform: scaleX(0); transition: transform .2s ease;
}
.site-nav a:hover { color: var(--parch); }
.site-nav a.is-active { color: var(--gilt-2); }
.site-nav a.is-active::after { transform: scaleX(1); }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: 1.15rem; }
.header-link {
  display: inline-flex; align-items: center; gap: .4rem;
  color: var(--parch-dim); font-weight: 600; letter-spacing: .06em; font-size: .8rem;
  text-transform: uppercase;
}
.header-link svg { opacity: .8; }
.header-link:hover { color: var(--parch); }
.header-divider { width: 1px; height: 26px; background: var(--line); }

/* ---- user widget (left of DOWNLOAD) ---- */
.user-widget { position: relative; }

.user-signin {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .35rem .8rem .35rem .4rem; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(255,255,255,.02);
  color: var(--parch); font: inherit; font-weight: 600; cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.user-signin:hover { border-color: var(--gilt-deep); background: rgba(232,178,76,.06); }
.user-signin .ghost-av {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; color: var(--parch-mut);
  background: var(--panel-3); border: 1px solid var(--line);
}
.user-signin .si-label { font-size: .85rem; letter-spacing: .02em; }

.user-chip {
  display: inline-flex; align-items: center; gap: .6rem;
  padding: .3rem .6rem .3rem .35rem; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(255,255,255,.02);
  cursor: pointer; font: inherit; color: var(--parch);
  transition: border-color .15s ease, background .15s ease;
}
.user-chip:hover { border-color: var(--gilt-deep); background: rgba(232,178,76,.05); }
.user-chip.is-open { border-color: var(--gilt-deep); background: rgba(232,178,76,.07); }
.chip-emblem { width: 30px; height: 34px; display: inline-flex; }
.chip-emblem .emblem-svg { width: 30px; height: auto; }
.chip-id { display: flex; flex-direction: column; line-height: 1.05; text-align: left; }
.chip-name { font-weight: 700; font-size: .86rem; letter-spacing: .01em; }
.chip-rank { font-family: var(--mono); font-size: .64rem; letter-spacing: .12em; text-transform: uppercase; }
.chip-caret { color: var(--parch-mut); margin-left: .1rem; transition: transform .2s ease; }
.user-chip.is-open .chip-caret { transform: rotate(180deg); }

/* dropdown */
.user-menu {
  position: absolute; top: calc(100% + 12px); right: 0; width: 320px; z-index: 80;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--gilt-deep); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.1rem;
  animation: menu-in .16s ease;
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.um-head { display: flex; gap: .85rem; align-items: center; padding-bottom: .9rem; border-bottom: 1px solid var(--line); }
.um-emblem { width: 54px; flex: none; }
.um-emblem .emblem-svg { width: 54px; height: auto; }
.um-id { min-width: 0; }
.um-name { font-family: var(--display); font-size: 1.1rem; font-weight: 700; color: var(--parch); }
.rank-pill {
  display: inline-flex; align-items: center; gap: .4rem; margin-top: .25rem;
  font-family: var(--mono); font-size: .64rem; letter-spacing: .14em; text-transform: uppercase;
}
.rank-pip { width: 8px; height: 8px; border-radius: 2px; transform: rotate(45deg); }
.um-blurb { color: var(--parch-mut); font-size: .78rem; font-style: italic; margin: .8rem 0 0; line-height: 1.5; }

.um-section { margin-top: .95rem; }
.um-label {
  font-family: var(--mono); font-size: .64rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--parch-mut); margin-bottom: .5rem;
}
.um-form { display: flex; gap: .45rem; }
.um-form input[type=text] {
  flex: 1; min-width: 0; background: var(--void); color: var(--parch);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .5rem .6rem; font: inherit;
}
.um-form input:focus { outline: none; border-color: var(--gilt-deep); }
.um-form button { border: 0; }
.um-err { color: #E8918C; font-size: .76rem; margin: .5rem 0 0; }

.um-guide { margin: .3rem 0 0; padding-left: 1.1rem; color: var(--parch-dim); font-size: .8rem; line-height: 1.65; }
.um-links { display: flex; gap: .5rem; margin-top: .7rem; }
.um-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.um-foot form { margin: 0; }
.um-signout { background: none; border: 1px solid var(--line); color: var(--parch-dim);
  padding: .45rem .9rem; border-radius: var(--radius-sm); cursor: pointer; font: inherit; }
.um-signout:hover { border-color: var(--ember); color: #E8A48C; }

/* ==========================================================================
   HERO — celestial banner; a planet arc rises at the base
   ========================================================================== */
.hero {
  position: relative; overflow: hidden; border-bottom: 1px solid var(--line);
  /* a distant divine sun casts light from the upper right */
  background:
    radial-gradient(60% 90% at 88% 6%, rgba(247,219,148,.12), transparent 60%),
    radial-gradient(90% 120% at 78% -20%, rgba(96,120,210,.16), transparent 55%);
}
.hero-inner { max-width: var(--maxw); margin: 0 auto; padding: 2.5rem 1.5rem 2.2rem; position: relative; z-index: 2; }
.hero-eyebrow { margin-bottom: .7rem; }
.hero h1 {
  font-family: var(--display); font-weight: 700; margin: 0;
  font-size: clamp(2.1rem, 4.6vw, 3.4rem); line-height: 1.02; letter-spacing: .015em;
  color: var(--parch);
  text-shadow: 0 2px 30px rgba(0,0,0,.5);
}
.hero h1 .gild { color: var(--gilt-2); text-shadow: 0 0 40px var(--gilt-glow); }
.hero-sub { color: var(--parch-dim); margin: .6rem 0 0; font-size: 1.02rem; max-width: 46ch; }
.hero-cta { display: flex; gap: .7rem; margin-top: 1.3rem; flex-wrap: wrap; }

/* the planet: a huge soft-lit sphere curving up from below the hero */
.hero-planet {
  position: absolute; left: 50%; bottom: -74%; transform: translateX(-50%);
  width: 155%; aspect-ratio: 1; border-radius: 50%; z-index: 1; pointer-events: none;
  background:
    radial-gradient(58% 52% at 62% 14%, rgba(150,200,150,.42), transparent 66%),
    radial-gradient(70% 60% at 40% 18%, rgba(90,150,110,.30), transparent 70%),
    radial-gradient(120% 120% at 50% 20%, #1a3d24 0%, #123018 30%, #0b1a26 55%, transparent 72%);
  box-shadow: 0 -30px 120px -34px rgba(140,200,150,.45), inset 0 24px 70px -30px rgba(210,235,195,.30);
}
.hero-planet::after { /* gold rim-light where the divine sun grazes the horizon */
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  box-shadow: inset 0 18px 50px -20px var(--gilt-glow);
  border-top: 1.5px solid rgba(247,219,148,.34);
}
.hero::after { /* keep copy legible over the planet */
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(90deg, rgba(7,8,14,.7) 0%, rgba(7,8,14,.15) 45%, transparent 70%);
}

/* ==========================================================================
   HALL — three panes: rooms | detail | social(roster+chat)
   ========================================================================== */
.hall { flex: 1; }
.hall-inner { max-width: var(--maxw); margin: 0 auto; padding: 1.6rem 1.5rem 2.4rem; }

.panes {
  display: grid;
  grid-template-columns: 340px minmax(0,1fr) 322px;
  gap: 1.15rem; align-items: start;
}

.pane {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.pane-pad { padding: 1rem 1rem 1.1rem; }
.pane-social { display: flex; flex-direction: column; gap: 1.15rem; background: none; border: 0; box-shadow: none; }
.pane-social > .pane { flex: none; }

.pane-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .85rem; }
.pane-head h2 {
  font-family: var(--display); font-size: .92rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--gilt-2); margin: 0;
}
.pane-head .count { font-family: var(--mono); font-size: .74rem; color: var(--parch-mut); letter-spacing: .06em; }

/* section divider rule with gold center */
.rule { height: 1px; background: linear-gradient(90deg, transparent, var(--hair), transparent); margin: .2rem 0 .9rem; }

/* ---------- tabs ---------- */
.pane-tabs { display: flex; gap: .4rem; margin-bottom: .9rem; }
.tab {
  flex: 1; background: transparent; border: 1px solid var(--line); color: var(--parch-dim);
  border-radius: var(--radius-sm); padding: .45rem .5rem; cursor: pointer; font: inherit;
  font-weight: 600; font-size: .82rem; letter-spacing: .04em;
}
.tab:hover { color: var(--parch); }
.tab.is-active { color: var(--gilt-2); border-color: var(--gilt-deep); background: rgba(232,178,76,.08); }

/* ---------- room cards (left) ---------- */
.rooms-list, .replays-list { display: flex; flex-direction: column; gap: .6rem; }
.room-card {
  display: grid; grid-template-columns: 66px 1fr; gap: .7rem;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: .55rem; cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .05s ease;
}
.room-card:hover { border-color: var(--gilt-deep); background: var(--panel-3); }
.room-card.is-selected { border-color: var(--gilt); background: rgba(232,178,76,.06); }
.room-card.is-started { opacity: .82; }
.room-thumb {
  width: 66px; height: 66px; border-radius: var(--radius-sm); object-fit: cover;
  background: #0a1524; border: 1px solid var(--line);
}
.room-body { min-width: 0; display: flex; flex-direction: column; gap: .2rem; }
.room-title { font-weight: 700; font-size: .95rem; color: var(--parch); }
.room-meta { color: var(--parch-mut); font-size: .78rem; }
.room-foot { display: flex; align-items: center; justify-content: space-between; margin-top: .4rem; }
.seat-chips { display: flex; gap: .3rem; }
.chip {
  width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line);
  display: inline-flex; cursor: default;
}
.chip.open { background: transparent; border-style: dashed; border-color: var(--parch-mut); cursor: pointer; }
.chip.open:hover { border-color: var(--gilt); }
.chip.filled { border-color: rgba(255,255,255,.28); }
.room-badge {
  font-family: var(--mono); font-size: .64rem; letter-spacing: .08em; text-transform: uppercase;
  padding: .12rem .45rem; border-radius: 4px; color: var(--parch-dim); border: 1px solid var(--line);
}
.room-badge.ranked { color: var(--gilt-2); border-color: var(--gilt-deep); }

/* ---------- your-room panel ---------- */
.your-room {
  background: linear-gradient(180deg, rgba(232,178,76,.07), rgba(232,178,76,.01));
  border: 1px solid var(--gilt-deep); border-radius: var(--radius-sm);
  padding: .85rem; margin-bottom: 1rem;
}
.your-room h3 {
  font-family: var(--display); font-size: .82rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--gilt-2); margin: 0 0 .6rem;
}
.yr-seats { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .6rem; }
.yr-seat {
  display: flex; align-items: center; gap: .55rem; padding: .38rem .55rem;
  border-radius: 6px; background: rgba(0,0,0,.28); border: 1px solid var(--line-soft); cursor: default;
}
.yr-seat.open { cursor: pointer; }
.yr-seat.open:hover { border-color: var(--gilt); }
.yr-seat.mine { border-color: var(--gilt-2); }
.yr-seat .seat-dot { width: 13px; height: 13px; }
.yr-seat .yr-open { color: var(--parch-mut); font-style: italic; font-size: .82rem; }
.yr-row { display: flex; align-items: center; gap: .5rem; margin: .45rem 0; }
.yr-row > label { color: var(--parch-dim); font-size: .8rem; min-width: 3rem; }
.yr-row select {
  flex: 1; background: var(--void); color: var(--parch); border: 1px solid var(--line);
  border-radius: 6px; padding: .4rem; font: inherit;
}
.yr-actions { display: flex; gap: .5rem; margin-top: .6rem; align-items: center; }
.yr-launch { flex: 1; }
.yr-launch:disabled { opacity: .5; cursor: not-allowed; filter: grayscale(.3); }
/* Joiner-side status where the host's button sits — reads as "not your action". */
.yr-waiting { flex: 1; text-align: center; font-size: .82rem; color: var(--parch-dim);
  padding: .5rem .75rem; border: 1px dashed var(--line); border-radius: var(--radius-sm); }
.yr-fallback { font-size: .72rem; color: var(--parch-mut); margin: .45rem 0 0; text-align: center; }
.yr-relink { color: var(--gilt-2); text-decoration: underline; }

/* ---------- center: room detail ---------- */
.detail { min-height: 62vh; }
.detail-empty { display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; min-height: 62vh; padding: 2rem; }
.detail-empty .crest { filter: drop-shadow(0 0 24px var(--gilt-glow)); margin-bottom: 1.2rem; opacity: .9; }
.detail-empty h2 { font-family: var(--display); font-size: 1.5rem; color: var(--parch); margin: 0 0 .5rem; }
.detail-empty p { color: var(--parch-dim); max-width: 42ch; margin: 0 auto; }

/* chat lives in the center pane as the default (no-room-selected) view */
.detail-chat { align-items: stretch; justify-content: flex-start; text-align: left; }
.detail-chat .motd { max-width: none; margin: 0 0 .9rem; }
.detail-chat .chat-log { flex: 1; min-height: 300px; max-height: none; }
.motd { margin-top: 1.2rem; padding: .8rem 1rem; border: 1px solid var(--line); border-left: 2px solid var(--gilt);
  border-radius: 6px; background: rgba(232,178,76,.04); color: var(--parch-dim); font-size: .9rem; max-width: 44ch; }

.detail-room { padding: 1.1rem; }
.detail-art { position: relative; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); }
.detail-art img { display: block; width: 100%; height: 220px; object-fit: cover; background: #0a1524; image-rendering: auto; }
.detail-art .art-fade { position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(8,9,15,.85)); }
.detail-titlebar { position: absolute; left: 1rem; right: 1rem; bottom: .8rem; display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.detail-titlebar h2 { font-family: var(--display); font-size: 1.6rem; color: var(--parch); margin: 0; text-shadow: 0 2px 12px #000; }
.detail-meta { display: grid; grid-template-columns: 1fr 1fr; gap: .1rem 1.4rem; margin: 1.1rem 0; }
.meta-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .55rem 0; border-bottom: 1px solid var(--line-soft); }
.meta-row .k { display: inline-flex; align-items: center; gap: .5rem; color: var(--parch-mut);
  font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; font-family: var(--mono); }
.meta-row .k svg { opacity: .7; }
.meta-row .v { color: var(--parch); font-weight: 600; font-size: .92rem; }
.detail-seats { display: flex; flex-direction: column; gap: .4rem; margin: 1rem 0 1.2rem; }
.detail-seat { display: flex; align-items: center; gap: .6rem; padding: .5rem .65rem; border-radius: 6px;
  background: var(--panel-2); border: 1px solid var(--line); }
.detail-seat.open { border-style: dashed; cursor: pointer; }
.detail-seat.open:hover { border-color: var(--gilt); }
.detail-seat .seat-dot { width: 14px; height: 14px; }
.detail-seat .sn { font-weight: 600; }
.detail-seat .so { color: var(--parch-mut); font-style: italic; }

/* ---------- roster (right) ---------- */
.pane-roster { display: flex; flex-direction: column; min-height: 62vh; }
.pane-roster .roster-list { flex: 1; overflow-y: auto; }
.pane-roster .right-tools { margin-top: auto; }
.roster-list { display: flex; flex-direction: column; gap: .1rem; }
.roster-row { display: flex; align-items: center; gap: .6rem; padding: .4rem .35rem; border-radius: 6px; }
.roster-row:hover { background: rgba(255,255,255,.02); }
.roster-emblem { width: 30px; height: 34px; flex: none; display: inline-flex; }
.roster-emblem .emblem-svg { width: 30px; height: auto; }
.roster-id { min-width: 0; flex: 1; display: flex; flex-direction: column; line-height: 1.15; }
.roster-nick { color: var(--parch); font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.roster-rank { font-family: var(--mono); font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; }
.roster-row.self .roster-nick { color: var(--gilt-2); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.status-online { background: var(--ok); box-shadow: 0 0 8px rgba(51,184,71,.6); }
.status-away { background: #6C7183; }
.status-ingame { background: var(--gilt); box-shadow: 0 0 8px var(--gilt-glow); }
.right-tools { margin-top: .9rem; }

/* ---------- chat ---------- */
.pane-chat { display: flex; flex-direction: column; }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: .5rem;
  padding: .2rem .1rem; min-height: 240px; max-height: 40vh; }
.chat-msg { line-height: 1.4; font-size: .9rem; }
.chat-msg .who { color: var(--gilt-2); font-weight: 700; margin-right: .4rem; }
.chat-msg .body { color: var(--parch); }
.chat-msg .when { color: var(--parch-mut); font-size: .68rem; margin-left: .4rem; font-family: var(--mono); }
.chat-msg.sys .body { color: var(--parch-dim); font-style: italic; }
.chat-empty { color: var(--parch-mut); font-size: .84rem; text-align: center; padding: 2rem 1rem; font-style: italic; }
.chat-notice { color: var(--warn); font-size: .8rem; padding: .35rem .2rem; }
.chat-form { display: flex; gap: .5rem; margin-top: .8rem; }
.chat-form input {
  flex: 1; min-width: 0; background: var(--void); color: var(--parch);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .6rem .7rem; font: inherit;
}
.chat-form input:focus { outline: none; border-color: var(--gilt-deep); }
.chat-form .send { padding: .6rem; width: 42px; }

/* ---------- replays ---------- */
.replay-card { display: grid; grid-template-columns: 60px 1fr; gap: .7rem;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .55rem; }
.replay-thumb { width: 60px; height: 60px; border-radius: 6px; object-fit: cover; background: #0a1524; }
.replay-players { display: flex; flex-wrap: wrap; gap: .4rem; margin: .2rem 0; }
.replay-player { font-size: .8rem; font-weight: 600; }
.replay-player .crown { margin-right: .2rem; }
.replay-result { color: var(--parch-mut); font-size: .74rem; font-family: var(--mono); }

/* ---------- gates ---------- */
.gate { display: flex; align-items: center; justify-content: center; min-height: 52vh; padding: 2rem 1.5rem; }
.gate-card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--gilt-deep); border-radius: var(--radius);
  padding: 2.4rem 2.6rem; text-align: center; max-width: 460px; box-shadow: var(--shadow);
}
.gate-card .crest { filter: drop-shadow(0 0 22px var(--gilt-glow)); margin-bottom: 1rem; }
.gate-card h2 { font-family: var(--display); font-size: 1.7rem; color: var(--parch); margin: 0 0 .6rem; }
.gate-card p { color: var(--parch-dim); margin: 0 auto 1.4rem; max-width: 40ch; }
.gate-card .btn { margin: 0 auto; }
.gate-alt { margin: 1rem 0 0 !important; font-size: .85rem; }

.empty-hint { color: var(--parch-mut); font-size: .84rem; padding: .6rem .2rem; font-style: italic; }

/* ==========================================================================
   RANKINGS — the Ascension ladder
   ========================================================================== */
.rankings-wrap { max-width: 920px; margin: 0 auto; }
.rank-note {
  display: flex; align-items: center; gap: .7rem; justify-content: center;
  color: var(--parch-dim); font-size: .9rem; margin-bottom: 1.6rem;
  padding: .7rem 1rem; border: 1px solid var(--line); border-radius: 999px;
  background: rgba(255,255,255,.02); width: fit-content; margin-inline: auto;
}
.rank-note .tag { font-family: var(--mono); font-size: .64rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--gilt); border: 1px solid var(--gilt-deep); border-radius: 4px; padding: .1rem .45rem; }
.rank-ladder { display: flex; flex-direction: column; gap: .7rem; }
.rank-tier {
  display: grid; grid-template-columns: 78px 1fr auto; gap: 1.1rem; align-items: center;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem;
  position: relative; overflow: hidden;
}
.rank-tier::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--tier); }
.rank-tier.is-me { border-color: var(--gilt-deep); box-shadow: 0 0 0 1px var(--gilt-deep) inset; }
.rank-seal { width: 62px; justify-self: center; filter: drop-shadow(0 4px 12px rgba(0,0,0,.5)); }
.rank-seal .emblem-svg { width: 62px; height: auto; }
.rank-info h3 { font-family: var(--display); font-size: 1.3rem; margin: 0; color: var(--parch); display: flex; align-items: center; gap: .6rem; }
.rank-info .me-tag { font-family: var(--mono); font-size: .6rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--void); background: var(--gilt); border-radius: 4px; padding: .12rem .4rem; }
.rank-info p { margin: .25rem 0 0; color: var(--parch-dim); font-size: .88rem; font-style: italic; }
.rank-req { text-align: right; }
.rank-req .num { font-family: var(--mono); font-size: 1.05rem; color: var(--tier); font-weight: 600; }
.rank-req .lbl { font-family: var(--mono); font-size: .6rem; letter-spacing: .14em; text-transform: uppercase; color: var(--parch-mut); }

/* ==========================================================================
   MODALS — create room + avatar picker
   ========================================================================== */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 90; background: rgba(4,5,10,.74); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 1.5rem;
}
.modal {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--gilt-deep); border-radius: var(--radius);
  padding: 1.5rem 1.6rem; width: 520px; max-width: 100%; box-shadow: var(--shadow);
  max-height: 88vh; overflow-y: auto;
}
.modal h2 { font-family: var(--display); font-size: 1.4rem; margin: 0 0 .3rem; color: var(--parch); }
.modal .modal-sub { color: var(--parch-mut); font-size: .85rem; margin: 0 0 1.1rem; }
.field-label { display: block; color: var(--parch-dim); font-size: .72rem; margin: 1rem 0 .5rem;
  text-transform: uppercase; letter-spacing: .14em; font-family: var(--mono); }
.map-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; max-height: 230px; overflow-y: auto; }
.map-opt { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; cursor: pointer;
  background: var(--panel-2); text-align: center; }
.map-opt:hover { border-color: var(--gilt-deep); }
.map-opt.is-active { border-color: var(--gilt); box-shadow: 0 0 0 1px var(--gilt) inset; }
.map-opt img { width: 100%; height: 76px; object-fit: cover; display: block; background: #0a1524; }
.map-opt span { font-size: .72rem; color: var(--parch-dim); display: block; padding: .3rem .2rem; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { background: transparent; color: var(--parch-dim); border: 0; padding: .45rem 1rem; cursor: pointer; font: inherit; font-weight: 600; }
.seg button.is-active { background: rgba(232,178,76,.14); color: var(--gilt-2); }
.check { display: flex; align-items: center; gap: .5rem; margin-top: 1rem; color: var(--parch-dim); }
.modal-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.5rem; }

/* avatar picker */
.av-preview { display: flex; align-items: center; gap: 1rem; padding: 1rem; margin-bottom: .4rem;
  background: rgba(0,0,0,.25); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.av-preview .pv { width: 64px; flex: none; }
.av-preview .pv .emblem-svg { width: 64px; height: auto; }
.av-preview .pv-txt .n { font-family: var(--display); font-size: 1.15rem; color: var(--parch); }
.av-preview .pv-txt .r { font-family: var(--mono); font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; margin-top: .2rem; }
.sigil-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; }
.sigil-opt { aspect-ratio: 1; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2);
  display: grid; place-items: center; cursor: pointer; color: var(--parch-dim); padding: .4rem; }
.sigil-opt:hover { border-color: var(--gilt-deep); }
.sigil-opt.is-active { border-color: var(--gilt); box-shadow: 0 0 0 1px var(--gilt) inset; }
.sigil-opt svg { width: 100%; height: 100%; }
.color-row { display: flex; gap: .55rem; }
.color-opt { width: 34px; height: 34px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; position: relative; }
.color-opt.is-active { border-color: var(--parch); box-shadow: 0 0 0 2px var(--void), 0 0 0 3px var(--color); }

/* ---------- reconnecting banner ---------- */
.reconnecting {
  position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); z-index: 70;
  background: #3a2a12; color: var(--gilt-2); border: 1px solid var(--gilt-deep);
  border-radius: 999px; padding: .5rem 1.3rem; font-size: .85rem; box-shadow: var(--shadow);
}

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: auto; }
.footer-inner { max-width: var(--maxw); margin: 0 auto; padding: 1.6rem 1.5rem;
  display: flex; align-items: center; gap: 1.4rem; color: var(--parch-mut); font-size: .82rem; flex-wrap: wrap; }
.footer-brand { font-family: var(--display); letter-spacing: .2em; color: var(--parch-dim); font-weight: 700; }
.footer-links { display: flex; gap: 1.2rem; }
.footer-copy { margin-left: auto; font-family: var(--mono); font-size: .74rem; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1180px) {
  .panes { grid-template-columns: 300px minmax(0,1fr); }
  .pane-social { grid-column: 1 / -1; flex-direction: row; }
  .pane-social > .pane { flex: 1; }
  .pane-roster { min-height: 0; }
  .pane-roster .roster-list { max-height: 40vh; }
}
@media (max-width: 900px) {
  .header-inner { gap: 1rem; height: 60px; }
  .site-nav { gap: 1.1rem; }
  .header-link.docs, .chip-id, .header-divider { display: none; }
  .panes { grid-template-columns: 1fr; }
  .pane-social { flex-direction: column; }
  .detail-meta { grid-template-columns: 1fr; }
  .user-menu { position: fixed; top: 66px; right: 8px; left: 8px; width: auto; }
}
@media (max-width: 620px) {
  .site-nav a { font-size: .74rem; letter-spacing: .08em; }
  .brand-word { font-size: 1.1rem; }
  .header-link:not(.docs) span { display: none; }
  .hero-inner { padding: 1.8rem 1.5rem 1.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .site-nav a::after { transition: none; }
}
