:root {
  color-scheme: dark;
  --ink: #dce4ea;
  --muted: #8b9ba8;
  --dim: #536776;
  --night: #010305;
  --panel: rgba(4, 9, 13, 0.96);
  --panel-soft: rgba(5, 13, 19, 0.86);
  --line: rgba(112, 175, 216, 0.25);
  --cyan: #86cbf8;
  --cyan-bright: #d2efff;
  --amber: #81bde5;
  --red: #ff8b82;
  --green: #8fd9c0;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.64);
  font-family: "Avenir Next", "Segoe UI", ui-sans-serif, -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: var(--night); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 10%, rgba(37, 102, 103, 0.26), transparent 34rem),
    radial-gradient(circle at 84% 42%, rgba(44, 71, 102, 0.18), transparent 28rem),
    linear-gradient(145deg, #050a0d, #09161b 55%, #050a0d);
}
body::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: 0.12;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.02) 1px, transparent 1px);
  background-size: 52px 52px;
}
a { color: var(--cyan); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
input, select, textarea {
  width: 100%;
  color: var(--ink);
  background: rgba(3, 13, 17, .72);
  border: 1px solid rgba(141, 186, 193, .28);
  border-radius: 10px;
  padding: .76rem .82rem;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(122, 215, 210, .12);
}
textarea { min-height: 7rem; resize: vertical; }
label { display: grid; gap: .42rem; color: #c9d5d7; font-size: .9rem; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.eyebrow, .step-number, .kicker {
  margin: 0 0 .5rem;
  color: var(--cyan);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .19em;
  text-transform: uppercase;
}
.muted, .field-hint { color: var(--muted); }
.field-hint { margin: 0; font-size: .8rem; line-height: 1.45; }
.small { font-size: .8rem; }
.button, button.primary, button.secondary, button.danger, .upload-button {
  min-height: 2.65rem;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: .68rem 1.15rem;
  font-weight: 750;
  text-decoration: none;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.button:hover, button:hover { transform: translateY(-1px); }
.button.primary, button.primary {
  color: #041315;
  background: linear-gradient(135deg, var(--cyan-bright), var(--cyan));
  box-shadow: 0 8px 24px rgba(44, 184, 180, .18);
}
.button.secondary, button.secondary, .upload-button {
  color: var(--ink);
  border-color: var(--line);
  background: rgba(255,255,255,.035);
}
button.danger { color: #ffd2cf; border-color: rgba(255,139,130,.35); background: rgba(126,37,34,.18); }
.link-button {
  width: auto;
  min-height: 0;
  padding: 0;
  color: var(--cyan);
  border: 0;
  background: none;
  text-decoration: underline;
}
.button-row { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; }

/* Branded entry and OTP */
.landing-body { display: grid; place-items: center; padding: clamp(1rem, 4vw, 4rem); }
.landing-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(19rem, .72fr);
  gap: clamp(2rem, 7vw, 7rem);
  width: min(1120px, 100%);
  align-items: center;
}
.landing-copy h1 {
  max-width: 13ch;
  margin: .25rem 0 1.2rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.5rem, 9vw, 7rem);
  font-weight: 400;
  line-height: .88;
  letter-spacing: -.055em;
}
.landing-copy .lede { max-width: 42rem; color: #bdc9ca; font-size: clamp(1rem, 2vw, 1.2rem); line-height: 1.7; }
.classification { display: inline-flex; gap: .45rem; align-items: center; margin-top: 1.6rem; color: var(--amber); font-size: .7rem; letter-spacing: .15em; text-transform: uppercase; }
.classification::before { width: .46rem; height: .46rem; border-radius: 50%; background: currentColor; content: ""; box-shadow: 0 0 14px currentColor; }
.auth-shell { position: relative; min-height: 31rem; display: grid; place-items: center; }
.orbit { position: absolute; width: 31rem; height: 31rem; border: 1px solid rgba(122,215,210,.12); border-radius: 50%; pointer-events: none; }
.orbit::before, .orbit::after { position: absolute; inset: 13%; border: 1px solid rgba(122,215,210,.08); border-radius: 50%; content: ""; }
.orbit::after { inset: 31%; }
.auth-card {
  position: relative;
  z-index: 1;
  width: min(27rem, 100%);
  padding: clamp(1.4rem, 4vw, 2.1rem);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(155deg, rgba(18,42,49,.96), rgba(7,21,27,.96));
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}
.auth-card h2 { margin: .2rem 0 .45rem; font-family: Georgia, serif; font-size: 1.8rem; font-weight: 400; }
.auth-form { display: grid; gap: .9rem; margin-top: 1.35rem; }
.auth-form button.primary { width: 100%; margin-top: .2rem; }
.otp-input { text-align: center; font-size: 1.8rem; font-weight: 800; letter-spacing: .35em; font-variant-numeric: tabular-nums; }
.auth-status { min-height: 1.35rem; margin: .8rem 0 0; color: var(--muted); font-size: .85rem; }
.auth-status.error { color: var(--red); }
.auth-status.success { color: var(--green); }
.open-registration-note { margin: 1.25rem 0 0; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--dim); font-size: .75rem; line-height: 1.55; }

/* Portal shell */
.portal-shell { position: relative; z-index: 1; min-height: 100vh; }
.portal-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.4rem;
  padding: .8rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid var(--line);
  background: rgba(5,15,19,.88);
  backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: .8rem; }
.brand-mark { display: grid; place-items: center; width: 2rem; height: 2rem; border: 1px solid var(--cyan); border-radius: 50%; color: var(--cyan); font-size: .68rem; }
.brand strong { font-family: Georgia, serif; font-weight: 400; }
.header-actions { display: flex; gap: .7rem; align-items: center; }
.user-badge { color: var(--muted); font-size: .8rem; }
.portal-grid { display: grid; grid-template-columns: 15.5rem minmax(0, 1fr); min-height: calc(100vh - 4.4rem); }
.portal-nav { position: sticky; top: 4.4rem; align-self: start; display: grid; gap: .35rem; min-height: calc(100vh - 4.4rem); padding: 1.4rem 1rem; border-right: 1px solid var(--line); background: rgba(5,15,19,.5); }
.nav-button { display: flex; justify-content: space-between; align-items: center; width: 100%; min-height: 2.7rem; padding: .65rem .8rem; color: var(--muted); border: 1px solid transparent; border-radius: 9px; background: transparent; text-align: left; }
.nav-button.active, .nav-button:hover { color: var(--ink); border-color: var(--line); background: rgba(122,215,210,.07); }
.portal-main { width: min(1220px, 100%); padding: clamp(1.2rem, 3vw, 3rem); }
.view { display: none; }
.view.active { display: block; }
.view-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.3rem; }
.view-header h1 { margin: 0; font-family: Georgia, serif; font-size: clamp(2rem, 4vw, 3.1rem); font-weight: 400; }
.view-header p { margin: .35rem 0 0; color: var(--muted); }
.panel, .metric-card, .builder-step, .balance-panel, .admin-character-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-soft);
  box-shadow: 0 15px 50px rgba(0,0,0,.17);
}
.panel { padding: 1.15rem; }
.panel h2, .panel h3 { margin-top: 0; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; }
.metric-card { min-height: 9rem; padding: 1.1rem; }
.metric-card h3 { margin: 0 0 .6rem; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.stack { display: grid; gap: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1rem; }
.form-grid .wide { grid-column: 1 / -1; }
.status-pill { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .6rem; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.status-pill.tentative { color: var(--amber); border-color: rgba(240,182,93,.35); }
.status-pill.confirmed { color: var(--green); border-color: rgba(124,217,162,.35); }
.notice { padding: .8rem 1rem; border: 1px solid rgba(240,182,93,.28); border-radius: 10px; color: #efd4aa; background: rgba(103,67,20,.15); }
.empty-state { color: var(--muted); font-style: italic; }

/* Character builder */
.character-layout { display: grid; grid-template-columns: minmax(0, 1fr) 19rem; gap: 1.2rem; align-items: start; }
.character-builder { display: grid; gap: 1rem; }
.builder-step { padding: clamp(1rem, 2.5vw, 1.5rem); }
.builder-step-header { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; }
.builder-step h2 { margin: 0; font-family: Georgia, serif; font-size: 1.45rem; font-weight: 400; }
.builder-step textarea { min-height: 4.8rem; }
.builder-step .private-field { padding: .9rem; border: 1px solid rgba(240,182,93,.24); border-radius: 12px; background: rgba(94,63,22,.12); }
.choice-field { display: grid; gap: .7rem; }
.choice-field legend { margin-bottom: .25rem; color: #c9d5d7; font-size: .9rem; }
.choice-grid { display: flex; flex-wrap: wrap; gap: .48rem; }
.choice-chip {
  width: auto;
  min-height: 2.25rem;
  padding: .48rem .72rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.025);
  font-size: .8rem;
}
.choice-chip.selected { color: #041315; border-color: var(--cyan); background: var(--cyan); }
.counter { color: var(--muted); font-size: .75rem; font-variant-numeric: tabular-nums; }
.counter.complete { color: var(--green); }
.counter.over { color: var(--red); }
.balance-panel { position: sticky; top: 5.6rem; padding: 1rem; }
.balance-panel h2 { margin: 0 0 .4rem; font-family: Georgia, serif; font-size: 1.25rem; font-weight: 400; }
.balance-panel > p { margin-top: 0; color: var(--muted); font-size: .8rem; line-height: 1.5; }
.capability-list { display: grid; gap: .55rem; }
.capability-item { display: grid; gap: .2rem; padding: .65rem .7rem; border: 1px solid var(--line); border-radius: 10px; background: rgba(0,0,0,.13); }
.capability-item strong { font-size: .78rem; }
.capability-item span { color: var(--muted); font-size: .72rem; }
.capability-item.new, .capability-item.missing { border-color: rgba(124,217,162,.35); }
.capability-item.overlap { border-color: rgba(240,182,93,.32); }
.party-preview { display: grid; gap: .6rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.party-person { padding: .6rem; border-radius: 9px; background: rgba(255,255,255,.03); }
.party-person strong, .party-person span { display: block; }
.party-person span { margin-top: .22rem; color: var(--muted); font-size: .72rem; }
.builder-actions { position: sticky; z-index: 8; bottom: .8rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem; padding: .8rem; border: 1px solid var(--line); border-radius: 14px; background: rgba(5,17,21,.94); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.save-state { color: var(--muted); font-size: .78rem; }
.review-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .7rem; }
.review-block { padding: .75rem; border: 1px solid var(--line); border-radius: 10px; background: rgba(0,0,0,.13); }
.review-block.wide { grid-column: 1 / -1; }
.review-block dt { margin-bottom: .25rem; color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; }
.review-block dd { margin: 0; line-height: 1.5; white-space: pre-wrap; }
.privacy-key { display: flex; gap: .5rem; align-items: flex-start; margin-top: 1rem; padding: .75rem; border-radius: 10px; color: #efd4aa; background: rgba(94,63,22,.15); font-size: .8rem; }
.party-card { padding: .9rem; border: 1px solid var(--line); border-radius: 12px; background: rgba(0,0,0,.13); }
.party-card h3 { margin: 0 0 .3rem; }
.party-card p { margin: .25rem 0; color: var(--muted); }

/* Admin character review */
.admin-character-list { display: grid; gap: .8rem; }
.admin-character-card { padding: 1rem; }
.admin-character-head { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.admin-character-head h3 { margin: 0; }
.admin-character-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }
.admin-character-actions input { flex: 1 1 18rem; }

/* Chat and utility views */
.chat-layout { display: grid; grid-template-columns: 15rem minmax(0,1fr); gap: 1rem; min-height: 34rem; }
.room-list { display: grid; align-content: start; gap: .35rem; }
.room-button { width: 100%; padding: .65rem; color: var(--muted); text-align: left; border: 1px solid transparent; border-radius: 8px; background: transparent; }
.room-button.active { color: var(--ink); border-color: var(--line); background: rgba(122,215,210,.07); }
.message-list { display: grid; align-content: end; gap: .6rem; min-height: 24rem; max-height: 56vh; overflow: auto; padding: .5rem; }
.message { padding: .7rem .8rem; border: 1px solid var(--line); border-radius: 10px; background: rgba(0,0,0,.15); }
.message-meta { color: var(--muted); font-size: .72rem; }
.message-body { margin-top: .28rem; white-space: pre-wrap; }
.chat-composer { display: grid; grid-template-columns: 1fr auto; gap: .6rem; margin-top: .7rem; }
.chat-composer textarea { min-height: 3rem; }
.checkbox-row { display: flex; align-items: center; gap: .6rem; }
.checkbox-row input { width: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .65rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }

@media (max-width: 980px) {
  .landing-grid { grid-template-columns: 1fr; gap: 2rem; }
  .landing-copy h1 { max-width: none; }
  .auth-shell { min-height: auto; }
  .orbit { width: 25rem; height: 25rem; }
  .character-layout { grid-template-columns: 1fr; }
  .balance-panel { position: static; }
  .portal-grid { grid-template-columns: 1fr; }
  .portal-nav { position: sticky; z-index: 15; top: 4.4rem; display: flex; min-height: auto; overflow-x: auto; padding: .6rem 1rem; border-right: 0; border-bottom: 1px solid var(--line); backdrop-filter: blur(18px); }
  .nav-button { width: auto; white-space: nowrap; }
}

@media (max-width: 680px) {
  .landing-body { align-items: start; }
  .landing-copy h1 { font-size: 3.7rem; }
  .orbit { display: none; }
  .portal-header { align-items: flex-start; }
  .user-badge { display: none; }
  .portal-main { padding: 1rem; }
  .view-header { display: block; }
  .form-grid, .review-grid { grid-template-columns: 1fr; }
  .form-grid .wide, .review-block.wide { grid-column: auto; }
  .builder-actions { align-items: stretch; }
  .builder-actions .button-row { width: 100%; }
  .builder-actions button { flex: 1; }
  .chat-layout { grid-template-columns: 1fr; }
  .room-list { display: flex; overflow-x: auto; }
  .room-button { width: auto; white-space: nowrap; }
  .chat-composer { grid-template-columns: 1fr; }
}

/* Current markup aliases and specialized states */
.landing { display: grid; min-height: 100vh; padding: clamp(1rem, 4vw, 4rem); }
.starfield, .orbital-rings { position: fixed; inset: 0; pointer-events: none; }
.starfield { opacity: .38; background-image: radial-gradient(circle, rgba(255,255,255,.7) 0 1px, transparent 1.5px); background-size: 83px 79px; }
.orbital-rings { background: radial-gradient(circle at 78% 45%, transparent 0 12rem, rgba(122,215,210,.1) 12.05rem 12.1rem, transparent 12.15rem 17rem, rgba(122,215,210,.055) 17.05rem 17.1rem, transparent 17.15rem); }
.landing-story { position: relative; z-index: 1; }
.landing-story h1 { margin: .4rem 0 1rem; font-family: Georgia, serif; font-size: clamp(3.4rem, 8vw, 7rem); font-weight: 400; line-height: .86; letter-spacing: -.06em; }
.landing-story h1 em { color: var(--cyan); font-weight: 400; }
.landing-story .landing-copy { max-width: 38rem; color: #bdc9ca; font-size: 1.08rem; line-height: 1.7; }
.landing-signal { display: flex; gap: .55rem; align-items: center; margin-top: 1.5rem; color: var(--amber); font-size: .68rem; letter-spacing: .13em; }
.landing-signal span { width: .45rem; height: .45rem; border-radius: 50%; background: var(--amber); box-shadow: 0 0 12px var(--amber); }
.auth-card-mark { float: right; display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border: 1px solid var(--cyan); border-radius: 50%; color: var(--cyan); }
.auth-intro, .auth-code-sent { color: var(--muted); line-height: 1.55; }
.auth-full { display: flex; width: 100%; justify-content: space-between; align-items: center; }
.primary-action { min-height: 2.65rem; padding: .68rem 1.15rem; color: #041315; border: 0; border-radius: 999px; background: linear-gradient(135deg, var(--cyan-bright), var(--cyan)); font-weight: 800; text-decoration: none; }
.ghost { min-height: 2.45rem; padding: .58rem .9rem; color: var(--ink); border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.035); }
.auth-back { width: fit-content; min-height: auto; padding: 0; color: var(--cyan); border: 0; background: none; }
.auth-existing { margin-top: 1.2rem; }
.auth-note { margin: 1.25rem 0 0; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--dim); font-size: .75rem; line-height: 1.55; }
.landing-footer { position: fixed; right: 1.2rem; bottom: 1rem; left: 1.2rem; display: flex; justify-content: space-between; color: var(--dim); font-size: .6rem; letter-spacing: .13em; }

.topbar { position: sticky; z-index: 20; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4.4rem; padding: .8rem clamp(1rem, 4vw, 3rem); border-bottom: 1px solid var(--line); background: rgba(5,15,19,.9); backdrop-filter: blur(18px); }
.topbar .brand { color: var(--ink); text-decoration: none; }
.topbar .brand small { display: block; color: var(--muted); font-family: Inter, sans-serif; font-size: .55rem; letter-spacing: .14em; }
.user-tools { display: flex; align-items: center; gap: .8rem; color: var(--muted); font-size: .8rem; }
.status-dot::before { display: inline-block; width: .42rem; height: .42rem; margin-right: .4rem; border-radius: 50%; background: var(--amber); content: ""; }
.status-dot.online::before { background: var(--green); box-shadow: 0 0 9px var(--green); }
.portal-layout { display: grid; grid-template-columns: 15.5rem minmax(0,1fr); min-height: calc(100vh - 4.4rem); }
.side-nav { position: sticky; top: 4.4rem; align-self: start; display: grid; align-content: start; gap: .35rem; min-height: calc(100vh - 4.4rem); padding: 1.4rem 1rem; border-right: 1px solid var(--line); background: rgba(5,15,19,.5); }
.side-nav button { display: flex; justify-content: space-between; align-items: center; width: 100%; min-height: 2.7rem; padding: .65rem .8rem; color: var(--muted); border: 1px solid transparent; border-radius: 9px; background: transparent; text-align: left; }
.side-nav button.active, .side-nav button:hover { color: var(--ink); border-color: var(--line); background: rgba(122,215,210,.07); }
#main-content { width: min(1220px,100%); padding: clamp(1.2rem,3vw,3rem); outline: none; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.3rem; }
.section-heading h1, .section-heading h2 { margin: 0; font-family: Georgia, serif; font-weight: 400; }
.section-heading h1 { font-size: clamp(2rem,4vw,3.1rem); }
.section-copy { max-width: 48rem; margin: .4rem 0 0; color: var(--muted); line-height: 1.55; }
.card, .form-card, .admin-character-panel { padding: 1.15rem; border: 1px solid var(--line); border-radius: 16px; background: var(--panel-soft); box-shadow: 0 15px 50px rgba(0,0,0,.17); }
.card h2 { margin: .2rem 0 .5rem; font-size: 1.1rem; }
.card.wide { grid-column: 1 / -1; }
.card-label { margin: 0 0 .7rem; color: var(--cyan); font-size: .68rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.party-row { display: flex; flex-wrap: wrap; gap: .7rem; }
.choice-state, .party-draft small { display: inline-block; padding: .22rem .45rem; border: 1px solid var(--line); border-radius: 999px; font-size: .65rem; text-transform: uppercase; }
.choice-state.tentative, .party-draft small.tentative { color: var(--amber); }
.choice-state.confirmed, .party-draft small.confirmed { color: var(--green); }
.character-builder { display: block; }
.builder-main { display: grid; gap: 1rem; }
.character-builder { grid-template-columns: minmax(0,1fr) 19rem; gap: 1.2rem; align-items: start; }
.character-builder:has(.balance-panel) { display: grid; }
.builder-step > header { display: flex; gap: .8rem; align-items: flex-start; margin-bottom: 1.1rem; }
.builder-step > header > span { display: grid; place-items: center; flex: 0 0 2rem; width: 2rem; height: 2rem; border: 1px solid var(--line); border-radius: 50%; color: var(--cyan); font-size: .7rem; }
.builder-step > header p { margin: .25rem 0 0; color: var(--muted); font-size: .85rem; }
.builder-step label + label, .builder-step fieldset + fieldset, .builder-step fieldset + label { margin-top: 1rem; }
.builder-step .form-grid + label, .builder-step label + .form-grid { margin-top: 1rem; }
.hint { color: var(--muted); font-size: .75rem; }
.private-badge { width: fit-content; color: var(--amber); font-size: .7rem; letter-spacing: .05em; text-transform: uppercase; }
.choice-chips { display: flex; flex-wrap: wrap; gap: .48rem; }
.choice-chip { display: inline-flex; align-items: center; }
.choice-chip input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.choice-chip:has(input:checked) { color: #041315; border-color: var(--cyan); background: var(--cyan); }
.choice-chip:focus-within { box-shadow: 0 0 0 3px rgba(122,215,210,.12); }
.builder-step legend { margin-bottom: .65rem; color: #c9d5d7; }
.builder-step legend small { margin-left: .5rem; color: var(--muted); }
.balance-panel { position: sticky; top: 5.5rem; }
.balance-panel .capability-item { display: flex; justify-content: space-between; gap: .8rem; }
.capability-item small { color: var(--muted); text-align: right; }
.capability-item.adds.selected { border-color: rgba(124,217,162,.55); }
.capability-item.considering.selected, .capability-item.represented.selected { border-color: rgba(240,182,93,.48); }
.party-drafts { display: grid; gap: .45rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.party-drafts h3 { margin: 0 0 .2rem; font-size: .85rem; }
.party-draft { display: flex; justify-content: space-between; gap: .6rem; align-items: center; padding: .5rem; border-radius: 8px; background: rgba(255,255,255,.025); font-size: .78rem; }
.character-review, .admin-character-facts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .65rem; }
.review-block small { display: block; margin-bottom: .25rem; color: var(--muted); font-size: .67rem; letter-spacing: .06em; text-transform: uppercase; }
.review-block p { margin: 0; line-height: 1.45; white-space: pre-wrap; }
.private-review { border-color: rgba(240,182,93,.3); background: rgba(94,63,22,.12); }
.builder-actions { justify-content: flex-end; }
.preference-list { display: grid; gap: .75rem; max-width: 44rem; }
.preference-list > label { display: flex; grid-template-columns: auto 1fr; align-items: center; }
.preference-list > label input[type="checkbox"] { width: auto; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(15rem,1fr)); gap: 1rem; }
.form-card.compact { display: grid; align-content: start; gap: .75rem; }
.form-card h2 { margin: 0; }
.admin-character-panel { margin-top: 1rem; }
.compact-heading { align-items: center; }
.admin-character-reviews { display: grid; gap: .8rem; }
.admin-user-list { display: grid; gap: .55rem; }
.admin-user-card { display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding: .75rem; border: 1px solid var(--line); border-radius: 10px; background: rgba(0,0,0,.13); }
.admin-user-card p { margin: .2rem 0; }
.admin-user-card small { color: var(--muted); }
.admin-user-actions { flex: 0 0 auto; }
.admin-character-facts { margin-bottom: .8rem; }
.admin-review-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .7rem; }
.chat-shell { display: grid; grid-template-columns: 15rem minmax(0,1fr); min-height: 36rem; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--panel-soft); }
.room-list { padding: 1rem; border-right: 1px solid var(--line); }
.room-list-heading { margin-bottom: .7rem; color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; }
.chat-panel { display: grid; grid-template-rows: auto 1fr auto auto; min-width: 0; }
.chat-header { display: flex; justify-content: space-between; padding: 1rem; border-bottom: 1px solid var(--line); }
.chat-header h1 { margin: 0; font-size: 1.1rem; }
.messages { min-height: 24rem; max-height: 55vh; padding: 1rem; overflow: auto; }
.message { display: grid; grid-template-columns: 2rem 1fr; gap: .6rem; }
.avatar { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; color: var(--cyan); background: rgba(122,215,210,.1); }
.message-meta { display: flex; flex-wrap: wrap; gap: .55rem; align-items: baseline; }
.message-meta time { color: var(--dim); }
.typing-state { min-height: 1.5rem; padding: 0 1rem; color: var(--muted); font-size: .75rem; }
.message-form { display: grid; grid-template-columns: 1fr auto; gap: .6rem; padding: 1rem; border-top: 1px solid var(--line); }
.message-form textarea { min-height: 2.8rem; }
.message-form button { border: 0; border-radius: 999px; padding: .6rem 1rem; color: #041315; background: var(--cyan); font-weight: 800; }
.badge { min-width: 1.3rem; padding: .14rem .35rem; border-radius: 999px; color: #041315; background: var(--cyan); font-size: .65rem; text-align: center; }
.toast { position: fixed; z-index: 50; right: 1rem; bottom: 1rem; max-width: min(28rem,calc(100vw - 2rem)); padding: .85rem 1rem; border: 1px solid rgba(124,217,162,.4); border-radius: 10px; color: #d9ffe8; background: #0c2820; box-shadow: var(--shadow); }
.toast.error, .error-text { color: #ffd2cf; }
.toast.error { border-color: rgba(255,139,130,.4); background: #321615; }

@media (max-width: 980px) {
  .portal-layout { grid-template-columns: 1fr; }
  .side-nav { z-index: 15; top: 4.4rem; display: flex; min-height: auto; overflow-x: auto; padding: .6rem 1rem; border-right: 0; border-bottom: 1px solid var(--line); backdrop-filter: blur(18px); }
  .side-nav button { width: auto; white-space: nowrap; }
  .character-builder:has(.balance-panel) { grid-template-columns: 1fr; }
  .balance-panel { position: static; }
}

@media (max-width: 680px) {
  .landing { padding: 1.1rem 1rem 4rem; }
  .landing-story h1 { font-size: 3.5rem; }
  .landing-footer { position: static; align-self: end; margin-top: 2rem; }
  .user-tools #user-name { display: none; }
  #main-content { padding: 1rem; }
  .section-heading { display: block; }
  .character-review, .admin-character-facts { grid-template-columns: 1fr; }
  .chat-shell { grid-template-columns: 1fr; }
  .room-list { border-right: 0; border-bottom: 1px solid var(--line); }
  #rooms { display: flex; overflow-x: auto; }
  .message-form { grid-template-columns: 1fr; }
}

/* Project Ascension visual system */
html { background: #010305; }
body {
  color: var(--ink);
  background:
    radial-gradient(ellipse at 50% -8%, rgba(84, 168, 225, .13), transparent 33rem),
    radial-gradient(ellipse at 50% 52%, rgba(35, 99, 143, .08), transparent 43rem),
    linear-gradient(180deg, #010305 0%, #020609 58%, #010305 100%);
}
body::before {
  opacity: .25;
  background-image:
    linear-gradient(rgba(102, 164, 205, .04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(102, 164, 205, .035) 1px, transparent 1px),
    radial-gradient(circle, rgba(175, 218, 245, .35) 0 1px, transparent 1.4px);
  background-size: 72px 72px, 72px 72px, 173px 149px;
}
body::after {
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  content: "";
  background: linear-gradient(180deg, transparent 48%, rgba(118, 195, 244, .06) 49.9%, rgba(184, 226, 251, .14) 50%, rgba(118, 195, 244, .04) 50.1%, transparent 52%);
}
::selection { color: #010305; background: #9ed8ff; }

h1, h2, h3, .brand-context, .card-label, .eyebrow, .room-list-heading, button {
  font-family: "Avenir Next Condensed", "Arial Narrow", "Segoe UI", sans-serif;
}
.eyebrow, .card-label, .room-list-heading, .landing-footer, .landing-signal {
  color: #86c9f4;
  font-weight: 500;
  letter-spacing: .25em;
}
.muted, .field-hint, .hint { color: #7d909f; }

input, select, textarea {
  border-color: rgba(110, 175, 217, .28);
  border-radius: 2px;
  color: #dbe6ed;
  background: linear-gradient(180deg, rgba(1, 5, 8, .96), rgba(3, 10, 15, .92));
  box-shadow: inset 0 1px rgba(255,255,255,.025), inset 0 0 24px rgba(62, 146, 203, .035);
}
input:focus, select:focus, textarea:focus {
  border-color: #79c3f1;
  box-shadow: 0 0 0 1px rgba(121,195,241,.35), inset 0 0 24px rgba(62,146,203,.07), 0 0 18px rgba(62,146,203,.08);
}
label, legend { letter-spacing: .035em; }

.primary-action, .button.primary, button.primary, .message-form button {
  color: #020609;
  border: 1px solid #a6dcfd;
  border-radius: 1px;
  background: linear-gradient(180deg, #d6f0ff, #83c8f3 60%, #5aa5d7);
  box-shadow: inset 0 1px rgba(255,255,255,.75), 0 0 26px rgba(91,178,234,.15);
  clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
  font-size: .74rem;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.ghost, .button.secondary, button.secondary, .upload-button {
  border-color: rgba(111, 177, 219, .3);
  border-radius: 1px;
  color: #aac8da;
  background: rgba(8, 19, 27, .55);
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.link-button { color: #89c9f2; font-size: .68rem; letter-spacing: .09em; text-transform: uppercase; }

/* Landing and authentication */
.landing { padding: clamp(1rem, 3vw, 3rem); }
.starfield { opacity: .22; background-image: radial-gradient(circle, rgba(184,226,251,.7) 0 1px, transparent 1.4px); background-size: 151px 137px; }
.orbital-rings {
  opacity: .65;
  background:
    radial-gradient(ellipse at 49% 46%, transparent 0 27rem, rgba(101,181,231,.12) 27.05rem 27.1rem, transparent 27.2rem),
    linear-gradient(180deg, transparent 49%, rgba(117,197,248,.08) 49.8%, rgba(198,235,255,.2) 50%, rgba(117,197,248,.07) 50.2%, transparent 51%);
}
.landing-grid {
  grid-template-columns: minmax(0, 1.55fr) minmax(21rem, .62fr);
  gap: clamp(1.2rem, 3vw, 3.4rem);
  width: min(1420px, 100%);
}
.landing-story { min-width: 0; overflow: hidden; }
.site-logo {
  display: block;
  width: 100%;
  max-width: none;
  height: auto;
  margin: -14% 0 -10%;
  filter: contrast(1.04) brightness(1.06);
}
.landing-story .landing-copy {
  max-width: 44rem;
  margin: .5rem 4.5% 0;
  color: #92a7b5;
  font-size: .9rem;
  letter-spacing: .12em;
  line-height: 1.8;
  text-transform: uppercase;
}
.landing-signal { margin: 1.35rem 4.5% 0; font-size: .62rem; }
.landing-signal span { border-radius: 0; background: #8dd2fc; box-shadow: 0 0 14px #75c7f8; }
.auth-card {
  padding: clamp(1.4rem, 3vw, 2.2rem);
  border-color: rgba(112, 181, 226, .42);
  border-radius: 0;
  background:
    linear-gradient(135deg, rgba(121,194,240,.07), transparent 26%),
    linear-gradient(180deg, rgba(5,13,19,.98), rgba(1,6,9,.98));
  box-shadow: inset 0 0 55px rgba(52,130,184,.045), 0 30px 100px rgba(0,0,0,.7), 0 0 35px rgba(66,151,210,.04);
  clip-path: polygon(15px 0, calc(100% - 2px) 0, 100% 2px, 100% calc(100% - 15px), calc(100% - 15px) 100%, 2px 100%, 0 calc(100% - 2px), 0 15px);
}
.auth-card::before, .auth-card::after {
  position: absolute;
  width: 34px;
  height: 34px;
  pointer-events: none;
  content: "";
}
.auth-card::before { top: 7px; left: 7px; border-top: 1px solid #8bd1fb; border-left: 1px solid #8bd1fb; }
.auth-card::after { right: 7px; bottom: 7px; border-right: 1px solid #8bd1fb; border-bottom: 1px solid #8bd1fb; }
.auth-card-mark {
  width: 2.7rem;
  height: 2.7rem;
  border-radius: 0;
  border-color: rgba(137,205,247,.55);
  color: #bfe7ff;
  background: rgba(78,153,205,.06);
  clip-path: polygon(50% 0, 100% 100%, 76% 100%, 50% 40%, 25% 100%, 0 100%);
  font-size: 0;
}
.auth-card-mark::after { content: ""; width: 2px; height: 18px; margin-top: 18px; background: #92d3fb; box-shadow: 0 0 10px #80caf7; }
.auth-card h2 { font-family: "Avenir Next Condensed", "Arial Narrow", sans-serif; font-size: 2rem; font-weight: 400; letter-spacing: .08em; text-transform: uppercase; }
.auth-intro, .auth-code-sent { color: #899eac; font-size: .86rem; }
.auth-form label { color: #9bb7c9; font-size: .7rem; letter-spacing: .13em; text-transform: uppercase; }
.auth-form input { min-height: 3.1rem; }
.otp-input { color: #9bd9ff; text-shadow: 0 0 14px rgba(115,199,248,.35); }
.auth-note { border-color: rgba(111,177,219,.19); color: #597181; font-size: .68rem; letter-spacing: .045em; }
.auth-status { color: #87a3b4; }
.landing-footer { color: #4f6c7f; font-size: .54rem; }

/* Portal navigation and command surface */
.topbar {
  min-height: 4.8rem;
  border-color: rgba(111,177,219,.25);
  background: linear-gradient(180deg, rgba(2,7,10,.98), rgba(1,4,7,.94));
  box-shadow: 0 8px 35px rgba(0,0,0,.55);
}
.brand { min-width: 0; gap: .9rem; }
.brand-logo-strip {
  display: block;
  width: clamp(9rem, 16vw, 13rem);
  height: 2.9rem;
  flex: 0 0 auto;
  background-image: url("/ascension-logo.jpg");
  background-repeat: no-repeat;
  background-size: 115% auto;
  background-position: center 43%;
  filter: contrast(1.08) brightness(1.12);
}
.brand-context { display: grid; gap: .15rem; color: #b9cedb; font-size: .66rem; letter-spacing: .22em; white-space: nowrap; }
.brand-context small { color: #597688; font-size: .5rem; letter-spacing: .18em; }
.user-tools { color: #748a98; letter-spacing: .04em; }
.status-dot::before { border-radius: 0; background: #6f94ad; }
.status-dot.online::before { background: #81c7f1; box-shadow: 0 0 10px #81c7f1; }
.portal-layout { grid-template-columns: 16.5rem minmax(0,1fr); }
.side-nav {
  top: 4.8rem;
  min-height: calc(100vh - 4.8rem);
  padding-top: 1.7rem;
  border-color: rgba(111,177,219,.18);
  background: linear-gradient(90deg, rgba(3,10,15,.9), rgba(2,7,11,.63));
}
.side-nav::before { margin: 0 .75rem 1rem; color: #4f7085; content: "PERSONNEL CONSOLE"; font-size: .54rem; letter-spacing: .24em; }
.side-nav button {
  min-height: 2.85rem;
  border-radius: 0;
  font-size: .68rem;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.side-nav button.active, .side-nav button:hover {
  color: #c3e6fa;
  border-color: rgba(117,195,244,.34);
  background: linear-gradient(90deg, rgba(72,153,207,.12), transparent);
  box-shadow: inset 2px 0 #82cbf7;
}
#main-content { max-width: 1400px; }
.section-heading h1, .section-heading h2, .view-header h1 {
  color: #d9e2e8;
  font-family: "Avenir Next Condensed", "Arial Narrow", sans-serif;
  font-weight: 300;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.section-copy { color: #7e919e; }
.card, .form-card, .panel, .metric-card, .builder-step, .balance-panel, .admin-character-card, .admin-character-panel, .chat-shell {
  position: relative;
  border-color: rgba(105,170,212,.24);
  border-radius: 1px;
  background:
    linear-gradient(135deg, rgba(94,174,225,.045), transparent 24%),
    linear-gradient(180deg, rgba(5,13,19,.9), rgba(2,8,12,.9));
  box-shadow: inset 0 1px rgba(203,234,252,.025), inset 0 0 30px rgba(48,123,174,.025), 0 16px 45px rgba(0,0,0,.25);
}
.card::before, .form-card::before, .builder-step::before, .balance-panel::before, .admin-character-panel::before {
  position: absolute;
  top: -1px;
  left: -1px;
  width: 22px;
  height: 22px;
  border-top: 1px solid #71b9e7;
  border-left: 1px solid #71b9e7;
  pointer-events: none;
  content: "";
}
.card-label { font-size: .6rem; }
.status-pill, .choice-state, .party-draft small, .badge {
  border-radius: 1px;
  letter-spacing: .1em;
}
.status-pill { color: #8db4cc; }
.status-pill.tentative, .choice-state.tentative, .party-draft small.tentative { color: #8ec7eb; border-color: rgba(105,180,226,.4); }
.status-pill.confirmed, .choice-state.confirmed, .party-draft small.confirmed { color: #acdcef; border-color: rgba(144,210,242,.45); }
.notice { border-radius: 1px; border-color: rgba(111,177,219,.3); color: #a5c8dd; background: rgba(42,99,135,.1); }

/* Character design lab */
.builder-step > header > span {
  border-radius: 0;
  border-color: rgba(112,184,229,.36);
  color: #8bcdf6;
  background: rgba(75,151,201,.06);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.builder-step h2, .balance-panel h2 { font-family: "Avenir Next Condensed", "Arial Narrow", sans-serif; letter-spacing: .07em; text-transform: uppercase; }
.choice-chip {
  border-radius: 1px;
  border-color: rgba(101,164,205,.25);
  color: #8198a7;
  background: rgba(4,12,17,.72);
}
.choice-chip:has(input:checked), .choice-chip.selected {
  color: #041018;
  border-color: #a7daf9;
  background: linear-gradient(180deg, #ccecff, #79bee9);
  box-shadow: 0 0 18px rgba(92,174,227,.12);
}
.balance-panel { top: 6rem; }
.capability-item { border-radius: 1px; background: rgba(2,8,12,.7); }
.capability-item.adds.selected, .capability-item.new, .capability-item.missing { border-color: rgba(123,199,244,.5); box-shadow: inset 2px 0 #76bde9; }
.capability-item.considering.selected, .capability-item.represented.selected, .capability-item.overlap { border-color: rgba(94,151,188,.4); }
.private-field, .private-review { border-color: rgba(106,172,214,.28) !important; background: rgba(22,58,80,.11) !important; }
.private-badge, .privacy-key { color: #82bce0; }
.builder-actions { border-radius: 1px; border-color: rgba(108,176,219,.32); background: rgba(1,6,9,.96); }
.review-block, .party-person, .party-card, .admin-user-card, .party-draft { border-radius: 1px; border-color: rgba(97,156,195,.19); background: rgba(1,6,9,.58); }

/* Chat and administration */
.chat-shell { border-color: rgba(105,170,212,.3); }
.room-list, .chat-header, .message-form { border-color: rgba(105,170,212,.18); }
.room-button { border-radius: 0; font-size: .72rem; letter-spacing: .05em; }
.room-button.active { color: #bee5fc; border-color: rgba(112,184,229,.3); background: rgba(66,147,201,.1); box-shadow: inset 2px 0 #7cc6f4; }
.message { border-radius: 1px; border-color: rgba(100,162,201,.18); background: rgba(2,8,12,.68); }
.avatar { border-radius: 0; color: #a7dbfa; background: rgba(74,151,202,.1); clip-path: polygon(50% 0, 100% 30%, 82% 100%, 18% 100%, 0 30%); }
.badge { color: #020609; background: #86cbf8; }
.admin-user-card, .admin-character-card { border-color: rgba(101,164,205,.22); }
.toast { border-radius: 1px; border-color: rgba(123,196,240,.45); color: #d5edfb; background: #06131b; }

@media (max-width: 1100px) {
  .landing-grid { grid-template-columns: minmax(0, 1.25fr) minmax(20rem, .72fr); }
  .site-logo { width: 100%; margin-right: 0; margin-left: 0; }
}

@media (max-width: 980px) {
  .landing-grid { grid-template-columns: 1fr; width: min(760px,100%); }
  .site-logo { width: 100%; margin: -14% 0 -11%; }
  .auth-card { width: min(31rem,100%); justify-self: center; }
  .portal-layout { grid-template-columns: 1fr; }
  .side-nav { top: 4.8rem; min-height: auto; }
  .side-nav::before { display: none; }
}

@media (max-width: 680px) {
  .landing { padding: .7rem .75rem 3rem; }
  .landing-grid { gap: .4rem; }
  .site-logo { width: 100%; margin: -12% 0 -10%; }
  .landing-story .landing-copy { margin: .3rem 5% 0; font-size: .7rem; letter-spacing: .09em; }
  .landing-signal { margin: 1rem 5% .6rem; font-size: .52rem; }
  .auth-card { padding: 1.45rem; }
  .topbar { min-height: 4.2rem; padding: .55rem .8rem; }
  .brand-logo-strip { width: 8.5rem; height: 2.25rem; }
  .brand-context { display: none; }
  .user-tools { gap: .45rem; }
  .user-tools .status-dot { font-size: 0; }
  .user-tools .status-dot::before { margin: 0; }
  .side-nav { top: 4.2rem; }
  .section-heading h1 { font-size: 1.85rem; }
}
