/* KindredGP portal — dark command-console aesthetic.
   Palette: near-black blue bg, PS1-HUD cyan accent, faction tri-stripe. */

:root {
  --bg: #0a0d13;
  --bg-raise: #10151f;
  --bg-raise-2: #141b28;
  --line: #1d2635;
  --line-bright: #2b3a52;
  --text: #dbe4f0;
  --muted: #8291a6;
  --accent: #46c8ff;
  --accent-dim: #2b7ea3;
  --tr: #e5484d;
  --nc: #4f8ff7;
  --vs: #9a6ff5;
  --gold: #f5b63f;
  --ok: #4cc38a;
  --bad: #e5484d;
  --radius: 6px;
  --pad: clamp(16px, 4vw, 40px);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 "Segoe UI", system-ui, -apple-system, sans-serif;
}

/* Layered backdrop: grid + glow, fixed behind everything */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1200px 600px at 75% -10%, rgba(70, 200, 255, 0.08), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(154, 111, 245, 0.07), transparent 60%),
    repeating-linear-gradient(0deg, transparent 0 47px, rgba(70, 200, 255, 0.028) 47px 48px),
    repeating-linear-gradient(90deg, transparent 0 47px, rgba(70, 200, 255, 0.028) 47px 48px),
    var(--bg);
}

.accent { color: var(--accent); }
.muted { color: var(--muted); font-size: 0.9rem; }

code {
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 0.9em;
  background: var(--bg-raise-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 7px;
  color: var(--accent);
}

/* ---------- Signature tri-stripe ---------- */

.tristripe {
  display: inline-block;
  width: 26px;
  height: 14px;
  background: linear-gradient(180deg,
    var(--tr) 0 33.3%, var(--nc) 33.3% 66.6%, var(--vs) 66.6% 100%);
  border-radius: 2px;
  flex: none;
}

.tristripe.wide {
  display: block;
  width: 100%;
  height: 4px;
  border-radius: 0;
  background: linear-gradient(90deg,
    var(--tr) 0 33.3%, var(--nc) 33.3% 66.6%, var(--vs) 66.6% 100%);
}

/* ---------- Nav ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(10, 13, 19, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.wordmark-text {
  font-size: 1.15rem;
  font-weight: 300;
  letter-spacing: 0.32em;
}

.wordmark-text b { font-weight: 700; color: var(--accent); }

.nav-right { display: flex; align-items: center; gap: 18px; }

.stat-mini { color: var(--muted); font-size: 0.82rem; letter-spacing: 0.04em; }
.stat-mini span { color: var(--text); font-weight: 600; }

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-bright);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.status-pill[data-state="online"] { color: var(--ok); border-color: rgba(76, 195, 138, 0.4); }
.status-pill[data-state="online"] .status-dot {
  background: var(--ok);
  animation: pulse 2s ease-in-out infinite;
}

.status-pill[data-state="offline"] { color: var(--bad); border-color: rgba(229, 72, 77, 0.4); }
.status-pill[data-state="offline"] .status-dot { background: var(--bad); }

.status-pill[data-state="checking"] { color: var(--muted); }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(76, 195, 138, 0.5); }
  50% { box-shadow: 0 0 0 6px rgba(76, 195, 138, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .status-pill[data-state="online"] .status-dot { animation: none; }
}

/* ---------- Hero ---------- */

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--pad);
}

.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(24px, 5vw, 64px);
  align-items: start;
  padding: clamp(40px, 8vh, 90px) 0 48px;
}

.kicker {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.34em;
  margin: 0 0 14px;
}

h1 {
  font-size: clamp(2.4rem, 5.5vw, 3.9rem);
  line-height: 1.04;
  font-weight: 800;
  letter-spacing: 0.02em;
  margin: 0 0 18px;
}

.lede {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 46ch;
  margin: 0 0 30px;
}

.lede b { color: var(--text); }

/* Stat tiles */

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 30px;
  max-width: 520px;
}

.stat-tile {
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.stat-value {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.1;
}

.stat-value.ok { color: var(--ok); }
.stat-value.bad { color: var(--bad); }

.stat-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 4px;
}

/* Faction chips row */

.factions { display: flex; gap: 10px; flex-wrap: wrap; }

.faction {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 14px 5px 6px;
  background: var(--bg-raise);
}

.faction span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-weight: 800;
  font-size: 0.66rem;
  letter-spacing: 0.05em;
  color: #0a0d13;
}

.faction.tr span { background: var(--tr); }
.faction.nc span { background: var(--nc); }
.faction.vs span { background: var(--vs); }

/* ---------- Auth card ---------- */

.auth-card {
  background: var(--bg-raise);
  border: 1px solid var(--line-bright);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.auth-body { padding: 26px 26px 22px; }

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 22px;
}

.tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  padding: 9px 0;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.tab.active {
  background: var(--bg-raise-2);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--line-bright);
}

.auth-form { display: flex; flex-direction: column; gap: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; }

.field-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.26em;
  color: var(--muted);
}

.field input {
  background: var(--bg);
  border: 1px solid var(--line-bright);
  border-radius: 4px;
  color: var(--text);
  font: inherit;
  padding: 11px 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input::placeholder { color: #4a576b; }

.field input:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px rgba(70, 200, 255, 0.12);
}

.form-msg {
  min-height: 1.2em;
  margin: 0;
  font-size: 0.85rem;
  color: var(--bad);
}

.form-msg.ok { color: var(--ok); }

.btn-primary {
  appearance: none;
  border: 1px solid var(--accent-dim);
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(70, 200, 255, 0.16), rgba(70, 200, 255, 0.05));
  color: var(--accent);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.26em;
  padding: 13px 0;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}

.btn-primary:hover { background: linear-gradient(180deg, rgba(70, 200, 255, 0.26), rgba(70, 200, 255, 0.1)); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary[disabled] { opacity: 0.55; cursor: wait; }

.auth-hint {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.auth-hint b { color: var(--accent); letter-spacing: 0.1em; font-size: 0.76rem; }

/* ---------- Account view ---------- */

.account { padding: clamp(36px, 7vh, 70px) 0 48px; }

.account-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}

h2 { font-size: clamp(1.6rem, 3.5vw, 2.3rem); margin: 0 0 6px; letter-spacing: 0.01em; }

.gm-badge {
  display: inline-block;
  vertical-align: middle;
  margin-left: 10px;
  padding: 3px 10px;
  border-radius: 4px;
  background: rgba(245, 182, 63, 0.14);
  border: 1px solid rgba(245, 182, 63, 0.5);
  color: var(--gold);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.24em;
}

.btn-ghost {
  appearance: none;
  background: transparent;
  border: 1px solid var(--line-bright);
  border-radius: 4px;
  color: var(--muted);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  padding: 9px 18px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.btn-ghost:hover { color: var(--text); border-color: var(--muted); }

.panel {
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 18px;
}

.panel-title {
  margin: 0 0 16px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.28em;
  color: var(--muted);
}

/* Character rows */

.char-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.char-row:first-child { border-top: 0; }

.char-faction {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 800;
  color: #0a0d13;
  flex: none;
}

.char-faction.TR { background: var(--tr); }
.char-faction.NC { background: var(--nc); }
.char-faction.VS { background: var(--vs); }
.char-faction.NEUTRAL { background: var(--muted); }

.char-name { font-weight: 700; font-size: 1.02rem; }

.char-br {
  text-align: right;
  font-size: 0.82rem;
  color: var(--muted);
  min-width: 150px;
}

.char-br b { color: var(--text); font-size: 0.95rem; }

.char-br .cr { color: var(--gold); }

.dl { color: var(--accent); font-weight: 600; }

.br-bar {
  width: 120px;
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  margin-top: 5px;
  overflow: hidden;
}

.br-fill { height: 100%; background: var(--accent); border-radius: 2px; }

.char-seen { color: var(--muted); font-size: 0.8rem; min-width: 90px; text-align: right; }

/* Change-passcode form */

.pw-form { display: flex; flex-direction: column; gap: 12px; }

.pw-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.pw-btn { align-self: flex-start; padding: 11px 26px; }

@media (max-width: 700px) {
  .pw-grid { grid-template-columns: 1fr; }
  .pw-btn { align-self: stretch; }
}

/* Steps */

.steps {
  margin: 0;
  padding-left: 1.3em;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--muted);
}

.steps li::marker { color: var(--accent); font-weight: 700; }

.btn-copy {
  appearance: none;
  background: transparent;
  border: 1px solid var(--line-bright);
  border-radius: 4px;
  color: var(--accent);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  padding: 4px 9px;
  margin-left: 8px;
  cursor: pointer;
}

.btn-copy:hover { border-color: var(--accent-dim); }

/* ---------- Footer ---------- */

.footer { border-top: 1px solid var(--line); margin-top: 40px; }

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 22px var(--pad);
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 0.8rem;
}

.footer-inner p { margin: 0; }
.footer-inner b { color: var(--text); }

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .stat-row { max-width: none; }
  .nav-right .stat-mini { display: none; }
  .char-row { grid-template-columns: auto 1fr auto; }
  .char-seen { display: none; }
}
