/* Account portal — same palette and type as landing/index.html. No build step. */
:root {
  --night: #070b16;
  --navy: #0c1427;
  --navy-2: #121c35;
  --line: rgba(217, 172, 82, 0.22);
  --ivory: #f5efe1;
  --ivory-dim: #cfc8b8;
  --mist: #a3abbe;
  --gold: #d9ac52;
  --gold-hi: #f3d48a;
  --ink-on-gold: #1a1206;
  --ok: #5fd68a;
  --warn: #f0c060;
  --err: #ff8f8f;
  --radius: 14px;
  --display: 'Cormorant Garamond', 'Times New Roman', Georgia, serif;
  --body: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --header-h: 60px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  color: var(--ivory); font-family: var(--body); font-size: 16px; line-height: 1.6;
  background:
    radial-gradient(ellipse 90% 50% at 50% 0%, rgba(217,172,82,.10), transparent 70%),
    var(--night);
  font-variant-numeric: lining-nums;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--gold-hi); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--gold-hi); outline-offset: 3px; border-radius: 6px; }
main:focus { outline: none; }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--gold); color: var(--ink-on-gold); padding: 10px 16px;
  border-radius: 8px; font-weight: 700; text-decoration: none;
}
.skip:focus { top: 12px; }

.container { width: min(1120px, 100% - 32px); margin-inline: auto; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50; height: var(--header-h);
  background: rgba(7, 11, 22, .86);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 1px 0 var(--line);
}
.site-header .container { height: 100%; display: flex; align-items: center; gap: 16px; }
.brand {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px;
  color: var(--ivory); text-decoration: none; font-family: var(--display);
  font-weight: 700; font-size: 21px;
}
.brand img { width: 38px; height: 38px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(243,212,138,.5), 0 0 18px rgba(243,212,138,.35); }
.header-cta { margin-left: auto; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 24px; border: 0; border-radius: 999px; cursor: pointer;
  font: 700 16px/1 var(--body); letter-spacing: .02em; text-decoration: none; white-space: nowrap;
  transition: transform .15s ease, box-shadow .2s ease, background-color .2s ease, opacity .2s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary {
  color: var(--ink-on-gold);
  background: linear-gradient(180deg, #f7dc96 0%, var(--gold) 55%, #b98a35 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55), 0 0 0 1px rgba(255,226,150,.4), 0 10px 30px -10px rgba(217,172,82,.65);
}
.btn-ghost { color: var(--ivory); background: rgba(245,239,225,.06); box-shadow: inset 0 0 0 1.5px rgba(245,239,225,.45); }
.btn-ghost:hover { background: rgba(245,239,225,.13); }
.btn-text { color: var(--ivory-dim); background: transparent; }
.btn-text:hover { color: var(--ivory); }
.btn:active { transform: translateY(1px); }
.btn-sm { min-height: 44px; padding: 0 18px; font-size: 15px; }
.btn-block { width: 100%; }
.header-cta { min-height: 44px; padding: 0 18px; font-size: 15px; }
.btn[disabled], .btn[aria-busy="true"] { opacity: .6; cursor: progress; }
.btn[aria-busy="true"]::before {
  content: ''; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite;
}

/* ---------- shared ---------- */
.eyebrow { font-size: 12.5px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--gold-hi); }
.muted { color: var(--mist); }
.fine { font-size: 13.5px; color: var(--mist); }
.center { text-align: center; }
.card {
  position: relative;
  background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.01)), var(--navy-2);
  border: 1px solid rgba(245,239,225,.08); border-radius: var(--radius);
  padding: 22px 20px; box-shadow: 0 20px 40px -24px rgba(0,0,0,.8);
}
.card::before {
  content: ''; position: absolute; inset: 0 22px auto; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(243,212,138,.55), transparent);
}
.view { padding-block: 28px 48px; flex: 1; }
main { flex: 1; }

.boot { display: grid; place-items: center; gap: 14px; min-height: 50vh; color: var(--mist); }
.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid rgba(243,212,138,.25); border-top-color: var(--gold-hi);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 16px; }
label { font-size: 14.5px; font-weight: 500; color: var(--ivory-dim); }
.req { color: var(--mist); font-weight: 400; }
input {
  width: 100%; min-height: 48px; padding: 0 14px;
  font: 500 16px var(--body); color: var(--ivory);
  background: rgba(7,11,22,.6); border: 1px solid rgba(245,239,225,.18); border-radius: 10px;
}
input:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px rgba(217,172,82,.25); }
input[aria-invalid="true"] { border-color: var(--err); }
input::placeholder { color: rgba(163,171,190,.6); }
.pw { position: relative; }
.pw input { padding-right: 76px; }
.pw-toggle {
  position: absolute; right: 2px; top: 50%; transform: translateY(-50%);
  min-width: 64px; min-height: 44px; border: 0; border-radius: 8px; cursor: pointer;
  background: transparent; color: var(--gold-hi); font: 700 14px var(--body);
}
.pw-toggle .pw-hide, .pw-toggle[aria-pressed="true"] .pw-show { display: none; }
.pw-toggle[aria-pressed="true"] .pw-hide { display: inline; }
.hint { font-size: 13px; color: var(--mist); }
.form-error { min-height: 0; color: var(--err); font-size: 14.5px; font-weight: 500; }
.form-error:not(:empty) { margin-bottom: 14px; padding: 10px 12px; border-radius: 10px; background: rgba(255,143,143,.08); border: 1px solid rgba(255,143,143,.3); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- login ---------- */
.login-card { width: min(440px, 100%); margin: 6vh auto 0; padding: 30px 24px 24px; display: grid; gap: 10px; }
.login-card h1 { font-family: var(--display); font-size: clamp(34px, 8vw, 44px); }
.login-card form { margin-top: 12px; }
.login-card .fine { margin-top: 6px; }

/* ---------- dashboard ---------- */
.dash-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 20px; margin-bottom: 18px; }
.dash-head h1 { font-family: var(--display); font-size: clamp(30px, 6vw, 42px); overflow-wrap: anywhere; }
.dash-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.notice { font-size: 14.5px; color: var(--ivory-dim); }
.notice:not(:empty) { margin-bottom: 16px; padding: 10px 14px; border-radius: 10px; background: rgba(95,214,138,.08); border: 1px solid rgba(95,214,138,.3); }
.notice.err:not(:empty) { background: rgba(255,143,143,.08); border-color: rgba(255,143,143,.3); color: var(--err); }
.notice.warn { margin-bottom: 14px; padding: 10px 14px; border-radius: 10px; background: rgba(240,192,96,.07); border: 1px solid rgba(240,192,96,.3); color: var(--ivory-dim); }

.dash-grid { display: grid; gap: 20px; }
@media (min-width: 960px) {
  .dash-grid { grid-template-columns: 360px 1fr; align-items: start; }
  .account-card { position: sticky; top: calc(var(--header-h) + 16px); }
}
.account-card h2, .chars h2 { font-size: 19px; font-weight: 700; font-family: var(--body); }
.kv { margin: 14px 0 18px; display: grid; gap: 2px; }
.kv > div { display: grid; grid-template-columns: 118px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid rgba(245,239,225,.06); }
.kv dt { color: var(--mist); font-size: 14px; }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.kv dd.empty { color: var(--mist); font-weight: 400; font-style: italic; }
.acct-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.acct-buttons .btn[aria-expanded="true"] { background: rgba(217,172,82,.16); box-shadow: inset 0 0 0 1.5px var(--gold); }
.subform { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.subform h3 { font-size: 16px; margin-bottom: 12px; }
.subform .hint + .form-error, .subform > .hint { margin-bottom: 12px; }

/* ---------- characters ---------- */
.chars-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 14px; margin-bottom: 14px; }
.chars > .fine { margin-top: 14px; }
.chars-list { display: grid; gap: 14px; }
@media (min-width: 640px) { .chars-list { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); } }

.char { padding: 18px; display: grid; gap: 14px; }
.char-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 8px 10px; }
.char-head > div { flex: 1 1 140px; min-width: 0; }
.char-name { font-size: 19px; font-weight: 700; overflow-wrap: anywhere; }
.char-class { font-size: 14px; color: var(--gold-hi); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; }
.stats > div { padding: 10px 12px; border-radius: 10px; background: rgba(7,11,22,.45); border: 1px solid rgba(245,239,225,.06); }
.stats dt { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--mist); }
.stats dd { margin: 2px 0 0; font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.char-loc { display: flex; align-items: center; gap: 8px; font-size: 14.5px; color: var(--ivory-dim); }
.char-loc svg { width: 18px; height: 18px; color: var(--gold); flex: none; }

/* Train Off badge: ON glows green-gold, OFF is quiet, unknown is an amber outline. */
.badge {
  flex: none; display: inline-flex; align-items: center; gap: 7px;
  min-height: 30px; padding: 4px 11px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700; letter-spacing: .03em; white-space: nowrap;
}
.badge .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge.on { color: #b6f5c9; background: linear-gradient(90deg, rgba(95,214,138,.18), rgba(217,172,82,.16)); box-shadow: inset 0 0 0 1px rgba(95,214,138,.55); }
.badge.on .dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(95,214,138,.25), 0 0 10px var(--ok); animation: pulse 1.8s ease-in-out infinite; }
.badge.off { color: var(--mist); background: rgba(245,239,225,.05); box-shadow: inset 0 0 0 1px rgba(245,239,225,.14); }
.badge.off .dot { background: rgba(163,171,190,.6); }
.badge.unknown { color: var(--warn); background: transparent; box-shadow: inset 0 0 0 1px rgba(240,192,96,.5); }
.badge.unknown .dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--warn); }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(95,214,138,0), 0 0 14px var(--ok); } }

/* loading skeleton + empty/error states */
.skeleton { min-height: 186px; overflow: hidden; }
.skeleton::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(245,239,225,.06) 50%, transparent 70%);
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }
.empty-state { text-align: center; padding: 34px 20px; display: grid; gap: 12px; justify-items: center; }
.empty-state p { color: var(--mist); max-width: 40ch; }

footer { padding: 26px 0 calc(26px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); text-align: center; font-size: 14.5px; color: var(--mist); }
footer a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px; color: var(--ivory-dim); }
footer .fine { margin-top: 6px; font-size: 12.5px; }

@media (max-width: 420px) {
  .header-cta { padding: 0 14px; }
  .dash-actions { width: 100%; }
  .dash-actions .btn { flex: 1 1 0; }
  .kv > div { grid-template-columns: 1fr; gap: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* "Come back later" (in game / Train Off / cannot tell) - not a typing error. */
.form-error.info:not(:empty) { color: var(--warn); background: rgba(240,192,96,.07); border-color: rgba(240,192,96,.35); }
.subform .retry { margin: -4px 0 14px; }

/* ---------- Train Off session statistics (mirrors the landing page mockup) ---------- */
.to-card { display: grid; gap: 14px; margin-bottom: 14px; padding: 18px; }
.to-top { display: flex; align-items: center; gap: 12px; }
.to-ava {
  width: 46px; height: 46px; flex: none; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--display); font-weight: 700; font-size: 18px; color: var(--gold-hi);
  background: radial-gradient(circle at 50% 35%, rgba(243,212,138,.2), rgba(7,11,22,.7));
  box-shadow: inset 0 0 0 1.5px rgba(243,212,138,.55);
}
.to-who { min-width: 0; }
.to-name { font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.to-sub { font-size: 13px; color: var(--mist); }
.to-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: #ffd9a0; margin-top: 2px; }
.to-status i { width: 8px; height: 8px; border-radius: 50%; background: #e8a35c; animation: ping 2s infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(232,163,92,.6); } 80%, 100% { box-shadow: 0 0 0 7px rgba(232,163,92,0); } }

.to-box { background: rgba(255,255,255,.04); border: 1px solid rgba(245,239,225,.08); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.to-label { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--mist); }
.to-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.to-stat { padding: 10px 12px; }
.to-stat .v { font-weight: 700; font-size: 20px; color: var(--ivory); font-variant-numeric: tabular-nums; line-height: 1.25; margin-top: 2px; overflow-wrap: anywhere; }
.to-stat .v small { font-size: 12px; color: var(--mist); font-weight: 500; margin-left: 2px; }
.to-stat .v.pending { font-size: 14px; color: var(--mist); font-weight: 500; }
.to-stat.zen .v { color: var(--gold-hi); }
.to-time { font-size: 12px; color: var(--mist); line-height: 1.4; margin-top: 2px; }
.to-bars { display: flex; align-items: flex-end; gap: 3px; height: 20px; margin-top: 6px; }
.to-bars span { flex: 1; min-height: 2px; background: linear-gradient(180deg, var(--gold-hi), #b98a35); border-radius: 2px 2px 0 0; opacity: .85; }
.to-bars span.running { opacity: .35; }
.to-blocked { margin: 0 0 12px; }

.to-feed { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 2px; max-height: 340px; overflow-y: auto; }
.to-feed li { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px dashed rgba(245,239,225,.08); }
.to-feed li:first-child { border-top: 0; }
.to-feed .gm { width: 12px; height: 12px; margin-left: 4px; transform: rotate(45deg); border-radius: 2px; background: var(--c, #8fc4ff); box-shadow: 0 0 10px var(--c, #8fc4ff); }
.to-feed .exc .gm { transform: none; border-radius: 50%; }
.to-feed .nm { color: var(--ivory); font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.to-feed .nm small { display: block; color: var(--mist); font-size: 12px; }
.to-feed .exc .nm { color: #7ee29a; }
.to-feed .tm { font-size: 12.5px; color: var(--mist); font-variant-numeric: tabular-nums; }
.to-feed .j-bless { --c: #8fc4ff; }
.to-feed .j-soul { --c: #c49bff; }
.to-feed .j-chaos { --c: #e8a35c; }
.to-feed .j-life { --c: #ff8f8f; }
.to-feed .j-creation { --c: #f0e08a; }
.to-feed .exc { --c: #6fdc8c; }
.to-feed-empty, .to-empty { color: var(--mist); font-size: 14px; margin-top: 8px; }
.to-empty { margin: 0; padding: 12px 14px; border-radius: 10px; border: 1px dashed rgba(245,239,225,.18); }
.to-foot { font-size: 12.5px; }

@media (max-width: 420px) {
  .to-card { padding: 14px 12px; }
  .to-stats { gap: 8px; }
  .to-stat { padding: 10px 9px; }
  .to-stat .v { font-size: 16px; }
  .to-label { font-size: 10px; letter-spacing: .06em; }
}
