/* ───────────── Emberfall — design tokens ───────────── */
:root {
  --bg: #0d0b0a;
  --bg-2: #120e0c;
  --panel: #18120f;
  --panel-2: #211913;
  --panel-3: #2b2019;
  --line: #3a2c22;
  --line-2: #4d3a2c;
  --text: #f1e8dc;
  --muted: #a99a8b;
  --dim: #75685c;
  --ember: #ff7a2f;
  --ember-2: #ffb347;
  --ember-glow: rgba(255, 122, 47, .35);
  --teal: #3fc1b0;
  --teal-dim: #1d5c55;
  --blood: #e5493b;
  --good: #7bd88f;
  --gold: #f2c14e;
  --gem: #7fd6ff;
  --xp: #b58cff;
  --hp: #e5493b;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --font-display: 'Cinzel', 'Trajan Pro', Georgia, serif;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --side-w: 290px;
  --social-w: 330px;
  --top-h: 58px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 70% -10%, rgba(255, 122, 47, .08), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(63, 193, 176, .06), transparent 60%);
  color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--ember-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: .02em; margin: 0 0 .4em; line-height: 1.2; }
:focus-visible { outline: 2px solid var(--ember-2); outline-offset: 2px; }
::selection { background: var(--ember); color: #000; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

.icon { width: 1.25em; height: 1.25em; image-rendering: pixelated; display: inline-block; vertical-align: -0.28em; flex: none; }
.icon.lg { width: 34px; height: 34px; }
.icon.xl { width: 44px; height: 44px; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.gold { color: var(--gold); }
.gem { color: var(--gem); }
.xp { color: var(--xp); }
.good { color: var(--good); }
.bad { color: var(--blood); }
.ember { color: var(--ember); }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ───────────── Boot ───────────── */
.boot { min-height: 100vh; display: grid; place-content: center; text-align: center; gap: 10px; }
.boot-logo { font: 900 46px/1 var(--font-display); letter-spacing: .14em; color: var(--ember); text-shadow: 0 0 30px var(--ember-glow); animation: flicker 2.2s infinite; }
.boot-sub { color: var(--muted); }
@keyframes flicker { 0%, 100% { opacity: 1; } 45% { opacity: .82; } 50% { opacity: .95; } 70% { opacity: .78; } }

/* ───────────── Buttons & inputs ───────────── */
.btn {
  --b: var(--panel-3);
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  border: 1px solid var(--line-2); background: var(--b); color: var(--text);
  padding: .62em 1.1em; border-radius: var(--radius-sm); cursor: pointer; font-weight: 600;
  transition: transform .08s ease, background .15s, border-color .15s, box-shadow .15s;
  text-decoration: none; white-space: nowrap; user-select: none;
}
.btn:hover:not(:disabled) { border-color: var(--ember); background: #33261d; text-decoration: none; }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, #ff8a3d, #e4601d); border-color: #ff9d57; color: #1b0d05; box-shadow: 0 4px 18px var(--ember-glow); }
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #ff9a52, #f06c25); border-color: #ffc28a; }
.btn.danger { background: linear-gradient(180deg, #d9473a, #a92f25); border-color: #ef6b5e; color: #fff; }
.btn.teal { background: linear-gradient(180deg, #3fc1b0, #2a9486); border-color: #6fe0d1; color: #04211d; }
.btn.ghost { background: transparent; }
.btn.sm { padding: .4em .75em; font-size: .88em; }
.btn.lg { padding: .85em 1.4em; font-size: 1.05em; }
.btn.block { width: 100%; }
.btn .kbd { font-size: .72em; opacity: .65; border: 1px solid currentColor; border-radius: 4px; padding: 0 .3em; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: .85em; color: var(--muted); font-weight: 600; }
.input, select.input, textarea.input {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  padding: .65em .8em; outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--ember); box-shadow: 0 0 0 3px rgba(255, 122, 47, .15); }
textarea.input { resize: vertical; min-height: 110px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.tight { gap: 6px; }
.grow { flex: 1; min-width: 0; }
.stack { display: grid; gap: 12px; }

/* ───────────── Auth screen ───────────── */
.auth {
  min-height: 100vh; display: grid; grid-template-columns: 1.2fr 1fr;
}
.auth-art {
  position: relative; background: #000 center/cover no-repeat; overflow: hidden;
}
.auth-art::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 50%, var(--bg) 100%), linear-gradient(0deg, rgba(13, 11, 10, .85), transparent 45%);
}
.auth-art .tagline { position: absolute; left: 40px; bottom: 40px; z-index: 1; max-width: 520px; }
.auth-art .tagline h1 { font-size: 64px; font-weight: 900; letter-spacing: .12em; color: var(--ember); text-shadow: 0 0 40px rgba(255, 122, 47, .5), 0 4px 0 #000; margin: 0; }
.auth-art .tagline p { font-size: 18px; color: #e8dccb; text-shadow: 0 2px 8px #000; margin: 8px 0 0; }
.auth-panel { display: grid; align-content: center; padding: 40px clamp(20px, 5vw, 64px); }
.auth-card { width: 100%; max-width: 460px; margin: 0 auto; }
.auth-card .logo-sm { display: none; }
.tabs { display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--line); padding: 4px; border-radius: 12px; margin-bottom: 20px; }
.tabs button { flex: 1; background: none; border: 0; padding: .6em; border-radius: 9px; cursor: pointer; color: var(--muted); font-weight: 600; }
.tabs button.active { background: var(--panel-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.class-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.class-card {
  position: relative; border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; cursor: pointer;
  background: var(--panel) center/cover no-repeat; aspect-ratio: 3 / 4; display: flex; align-items: flex-end;
  transition: transform .12s, border-color .15s, box-shadow .15s; padding: 0;
}
.class-card::before { content: ''; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(0, 0, 0, .9), transparent 60%); }
.class-card span { position: relative; padding: 10px; font: 700 15px var(--font-display); width: 100%; text-align: center; }
.class-card:hover { transform: translateY(-2px); }
.class-card.active { border-color: var(--ember); box-shadow: 0 0 0 2px var(--ember), 0 8px 24px var(--ember-glow); }
.class-blurb { min-height: 3.2em; color: var(--muted); font-size: .92em; margin: -4px 0 14px; }
.form-error { color: var(--blood); min-height: 1.4em; font-size: .92em; margin: 4px 0 10px; }
.cf-turnstile { margin: 6px 0 12px; min-height: 65px; }

/* ───────────── App shell ───────────── */
.shell {
  display: grid; height: 100vh; height: 100dvh;
  grid-template-columns: var(--side-w) minmax(0, 1fr) var(--social-w);
  grid-template-rows: var(--top-h) minmax(0, 1fr);
  grid-template-areas: 'top top top' 'side main social';
}
.topbar {
  grid-area: top; display: flex; align-items: center; gap: 16px; padding: 0 18px;
  border-bottom: 1px solid var(--line); background: rgba(13, 11, 10, .85); backdrop-filter: blur(8px); z-index: 5;
}
.brand { font: 900 22px var(--font-display); letter-spacing: .16em; color: var(--ember); text-shadow: 0 0 18px var(--ember-glow); display: flex; align-items: center; gap: 10px; cursor: pointer; }
.brand img { width: 26px; height: 26px; }
.topbar .spacer { flex: 1; }
.dawn { color: var(--muted); font-size: .88em; display: flex; align-items: center; gap: 6px; }
.top-btn { position: relative; background: none; border: 1px solid transparent; border-radius: 10px; padding: 6px 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.top-btn:hover { border-color: var(--line-2); color: var(--text); }
.badge { position: absolute; top: -2px; right: -4px; background: var(--ember); color: #1b0d05; font-size: 11px; font-weight: 800; border-radius: 99px; padding: 0 5px; min-width: 18px; text-align: center; }

.side { grid-area: side; border-right: 1px solid var(--line); overflow-y: auto; padding: 16px; display: grid; align-content: start; gap: 16px; background: linear-gradient(180deg, rgba(24, 18, 15, .6), transparent); }
.main { grid-area: main; overflow-y: auto; scroll-behavior: smooth; }
.social { grid-area: social; border-left: 1px solid var(--line); display: grid; grid-template-rows: auto minmax(0, 1fr); min-height: 0; background: rgba(18, 14, 12, .6); }

/* ───────────── Character card ───────────── */
.char { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.char-head { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.portrait { width: 58px; height: 58px; border-radius: 12px; background: var(--panel-3) center/cover; border: 1px solid var(--line-2); flex: none; box-shadow: 0 0 0 3px rgba(255, 122, 47, .12); }
.char-name { font: 700 17px var(--font-display); line-height: 1.15; word-break: break-word; }
.char-sub { color: var(--muted); font-size: .85em; }
.kindle { color: var(--ember); font-weight: 700; }
.bar { position: relative; height: 18px; border-radius: 99px; background: #0a0807; border: 1px solid var(--line); overflow: hidden; margin: 6px 0; }
.bar > i { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; transition: width .45s cubic-bezier(.2, .8, .2, 1); }
.bar.hp > i { background: linear-gradient(90deg, #a92f25, #ff5e4d); box-shadow: 0 0 12px rgba(229, 73, 59, .6); }
.bar.xp > i { background: linear-gradient(90deg, #6d4bc8, #b58cff); }
.bar.foe > i { background: linear-gradient(90deg, #8f1d14, #e5493b); }
.bar span { position: relative; z-index: 1; display: block; text-align: center; font-size: 11px; font-weight: 700; line-height: 16px; text-shadow: 0 1px 2px #000; }
.bar.low > i { animation: pulse 1s infinite; }
@keyframes pulse { 50% { filter: brightness(1.6); } }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin-top: 10px; font-size: .9em; }
.stat { display: flex; align-items: center; gap: 6px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; min-width: 0; }
.stat b { margin-left: auto; font-variant-numeric: tabular-nums; }
.stat.wide { grid-column: span 2; }
.ready-pill { margin-top: 10px; display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 10px; background: rgba(181, 140, 255, .1); border: 1px solid rgba(181, 140, 255, .35); font-size: .88em; cursor: pointer; }

.nav { display: grid; gap: 4px; }
.nav h4 { font: 600 11px var(--font); text-transform: uppercase; letter-spacing: .14em; color: var(--dim); margin: 10px 8px 4px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--text);
  border: 1px solid transparent; transition: background .12s, border-color .12s;
}
.nav a:hover { background: var(--panel); border-color: var(--line); text-decoration: none; }
.nav a.active { background: linear-gradient(90deg, rgba(255, 122, 47, .16), transparent); border-color: rgba(255, 122, 47, .35); }
.nav a .count { margin-left: auto; font-size: .78em; color: var(--muted); background: var(--bg-2); border: 1px solid var(--line); padding: 0 7px; border-radius: 99px; }

/* ───────────── Scene ───────────── */
.scene { max-width: 1040px; margin: 0 auto; padding: 0 0 40px; animation: fadein .25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.hero {
  position: relative; height: clamp(190px, 30vh, 300px); background: #000 center/cover no-repeat;
  display: flex; align-items: flex-end; padding: 22px 26px; overflow: hidden;
}
.hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(0deg, var(--bg) 2%, rgba(13, 11, 10, .4) 45%, rgba(13, 11, 10, .1)); }
.hero > * { position: relative; z-index: 1; }
.hero h1 { font-size: clamp(26px, 4vw, 40px); font-weight: 900; text-shadow: 0 3px 14px #000; margin: 0; }
.hero p { margin: 4px 0 0; color: #e3d6c4; text-shadow: 0 2px 6px #000; max-width: 640px; }
.embers { position: absolute; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.embers i { position: absolute; bottom: -10px; width: 3px; height: 3px; border-radius: 50%; background: var(--ember-2); box-shadow: 0 0 6px var(--ember); opacity: 0; animation: rise linear infinite; }
@keyframes rise { 0% { transform: translate(0, 0); opacity: 0; } 10% { opacity: .9; } 100% { transform: translate(var(--dx, 20px), -320px); opacity: 0; } }
.body { padding: 4px 26px 0; }
.lead { color: #d9ccbb; font-size: 1.02em; max-width: 720px; }
.section-title { font: 700 13px var(--font); text-transform: uppercase; letter-spacing: .14em; color: var(--muted); margin: 26px 0 10px; display: flex; align-items: center; gap: 10px; }
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* Location / action cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.card {
  position: relative; display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line); color: var(--text); cursor: pointer; text-align: left;
  transition: transform .12s, border-color .15s, box-shadow .15s, background .15s; overflow: hidden; min-height: 96px;
}
.card:hover { transform: translateY(-2px); border-color: var(--ember); box-shadow: 0 10px 26px rgba(0, 0, 0, .4), 0 0 0 1px rgba(255, 122, 47, .25); text-decoration: none; }
.card .card-top { display: flex; align-items: center; gap: 10px; }
.card h3 { font-size: 16px; margin: 0; }
.card p { margin: 0; color: var(--muted); font-size: .88em; }
.card .tag { position: absolute; top: 10px; right: 10px; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 99px; background: var(--bg-2); border: 1px solid var(--line-2); color: var(--muted); }
.card .tag ~ .card-top { padding-right: 92px; }
.card .tag.hot { color: #1b0d05; background: var(--ember); border-color: var(--ember-2); }
.card.art { min-height: 150px; justify-content: flex-end; background-size: cover; background-position: center; }
.card.art::before { content: ''; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(10, 8, 7, .95) 20%, rgba(10, 8, 7, .35) 70%, rgba(10, 8, 7, .1)); transition: opacity .2s; }
.card.art > *:not(.tag) { position: relative; }
.card.disabled { opacity: .5; cursor: not-allowed; }
.card.disabled:hover { transform: none; border-color: var(--line); box-shadow: none; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.panel + .panel { margin-top: 12px; }
.panel h3 { font-size: 18px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.npc { display: flex; gap: 16px; align-items: flex-start; }
.npc-portrait { width: 112px; height: 112px; border-radius: 14px; background: var(--panel-3) center/cover; border: 1px solid var(--line-2); flex: none; box-shadow: var(--shadow); }
.npc-name { font: 700 18px var(--font-display); }
.npc-role { color: var(--muted); font-size: .85em; margin-bottom: 6px; }
.quote { font-style: italic; color: #e3d6c4; }
.meter { display: flex; gap: 4px; margin: 6px 0; }
.meter i { flex: 1; height: 7px; border-radius: 4px; background: var(--bg-2); border: 1px solid var(--line); }
.meter i.on { background: linear-gradient(90deg, #e2557a, #ff8fb1); border-color: #ff8fb1; }

/* Tables (shops, players) */
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .93em; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: .8em; text-transform: uppercase; letter-spacing: .08em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 9px 10px; border-bottom: 1px solid rgba(58, 44, 34, .55); vertical-align: middle; }
.table tr.owned td { background: rgba(63, 193, 176, .08); }
.table tr.locked td { opacity: .5; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }

/* ───────────── Combat ───────────── */
.combat { display: grid; grid-template-columns: minmax(220px, 340px) 1fr; gap: 20px; padding: 22px 26px; align-items: start; }
.foe { position: relative; }
.foe-art { position: relative; aspect-ratio: 1; border-radius: 18px; background: #000 center/cover; border: 1px solid var(--line-2); box-shadow: 0 18px 40px rgba(0, 0, 0, .6), 0 0 0 4px rgba(229, 73, 59, .08); overflow: hidden; }
.foe-art.hit { animation: hit .35s; }
.foe-art.dead { filter: grayscale(1) brightness(.5); transition: filter .6s; }
@keyframes hit { 0% { transform: translate(0); } 20% { transform: translate(-8px, 2px); filter: brightness(1.8) saturate(.4); } 40% { transform: translate(6px, -2px); } 60% { transform: translate(-4px, 1px); } 100% { transform: none; } }
.foe-name { font: 700 22px var(--font-display); margin: 12px 0 0; }
.foe-desc { color: var(--muted); font-size: .9em; margin-bottom: 4px; }
.float { position: absolute; left: 50%; top: 40%; font: 900 34px var(--font-display); color: #fff; text-shadow: 0 0 10px var(--blood), 0 3px 0 #000; pointer-events: none; animation: floatup 1s ease-out forwards; z-index: 3; }
.float.crit { color: var(--ember-2); font-size: 44px; text-shadow: 0 0 16px var(--ember), 0 3px 0 #000; }
.float.heal { color: var(--good); text-shadow: 0 0 10px #2a7, 0 3px 0 #000; }
@keyframes floatup { 0% { transform: translate(-50%, 0) scale(.7); opacity: 0; } 15% { transform: translate(-50%, -10px) scale(1.15); opacity: 1; } 100% { transform: translate(-50%, -90px) scale(1); opacity: 0; } }
.shake { animation: shake .4s; }
@keyframes shake { 20% { transform: translate(-6px, 3px); } 40% { transform: translate(5px, -3px); } 60% { transform: translate(-3px, 2px); } 80% { transform: translate(2px, -1px); } }
.combat-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 14px; }
.combat-actions .btn { padding: .8em; flex-direction: column; gap: 2px; white-space: normal; line-height: 1.2; }
.combat-actions .btn small { font-weight: 500; opacity: .75; font-size: .76em; }
.vs-hp { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.vs-hp .bar { flex: 1; }

/* Log */
.log { display: grid; gap: 6px; margin-top: 14px; }
.log-line { padding: 9px 12px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--line-2); animation: slidein .25s ease both; font-size: .95em; }
.log-line.hit { border-left-color: var(--ember-2); }
.log-line.crit { border-left-color: var(--ember); background: linear-gradient(90deg, rgba(255, 122, 47, .12), var(--panel) 60%); font-weight: 600; }
.log-line.hurt { border-left-color: var(--blood); }
.log-line.good { border-left-color: var(--good); }
.log-line.bad, .log-line.dead { border-left-color: var(--blood); background: linear-gradient(90deg, rgba(229, 73, 59, .12), var(--panel) 60%); }
.log-line.win { border-left-color: var(--gold); background: linear-gradient(90deg, rgba(242, 193, 78, .14), var(--panel) 60%); font-weight: 600; }
.log-line.level { border-left-color: var(--xp); background: linear-gradient(90deg, rgba(181, 140, 255, .18), var(--panel) 60%); font-weight: 700; }
.log-line.ach { border-left-color: var(--teal); background: linear-gradient(90deg, rgba(63, 193, 176, .16), var(--panel) 60%); font-weight: 600; }
.log-line.info { border-left-color: var(--teal-dim); }
@keyframes slidein { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }

/* ───────────── Social panel ───────────── */
.social-tabs { display: flex; border-bottom: 1px solid var(--line); }
.social-tabs button { flex: 1; background: none; border: 0; border-bottom: 2px solid transparent; padding: 12px 6px; cursor: pointer; color: var(--muted); font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 6px; }
.social-tabs button.active { color: var(--text); border-bottom-color: var(--ember); }
.social-body { min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.chat-list { overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.msg { font-size: .92em; line-height: 1.4; word-wrap: break-word; overflow-wrap: anywhere; }
.msg .who { font-weight: 700; color: var(--ember-2); cursor: pointer; }
.msg .who:hover { text-decoration: underline; }
.msg .lvl { font-size: .75em; color: var(--dim); margin-left: 2px; }
.msg time { font-size: .72em; color: var(--dim); margin-left: 6px; }
.msg.system { background: rgba(63, 193, 176, .08); border: 1px solid rgba(63, 193, 176, .25); border-radius: 10px; padding: 7px 10px; }
.msg.system .who { color: var(--teal); }
.msg.me .who { color: var(--gold); }
.chat-form { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
.chat-form .input { padding: .55em .7em; }
.online-list, .news-list { overflow-y: auto; padding: 10px 12px; display: grid; align-content: start; gap: 6px; }
.person { display: flex; align-items: center; gap: 10px; padding: 7px 9px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); cursor: pointer; }
.person:hover { border-color: var(--line-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 8px var(--good); flex: none; }
.dot.off { background: var(--dim); box-shadow: none; }
.news-item { font-size: .9em; padding: 8px 10px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
.news-item time { display: block; font-size: .75em; color: var(--dim); }
.news-item.kindling { border-color: var(--ember); background: linear-gradient(90deg, rgba(255, 122, 47, .16), var(--panel)); }
.news-item.death, .news-item.pvp { border-left: 3px solid var(--blood); }
.news-item.level { border-left: 3px solid var(--xp); }
.news-item.romance { border-left: 3px solid #ff8fb1; }
.news-item.announce { border-left: 3px solid var(--teal); }
.announce-bar { background: linear-gradient(90deg, rgba(63, 193, 176, .2), rgba(63, 193, 176, .05)); border-bottom: 1px solid rgba(63, 193, 176, .35); padding: 8px 18px; font-size: .9em; display: flex; gap: 8px; align-items: center; }

/* ───────────── Toasts & modal ───────────── */
#toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 50; max-width: min(380px, calc(100vw - 36px)); }
.toast { background: var(--panel-2); border: 1px solid var(--line-2); border-left: 3px solid var(--ember); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); animation: slidein .25s ease; font-size: .93em; }
.toast.error { border-left-color: var(--blood); }
.toast.good { border-left-color: var(--good); }
.toast.ach { border-left-color: var(--teal); }
.modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, .65); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 40; padding: 16px; animation: fadein .15s; }
.modal { width: min(560px, 100%); max-height: 88vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: var(--shadow); padding: 22px; }
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.modal-head h2 { margin: 0; flex: 1; font-size: 22px; }

/* Achievements */
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.ach { display: flex; gap: 10px; padding: 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.ach.locked { opacity: .45; filter: grayscale(1); }
.ach b { display: block; }
.ach small { color: var(--muted); }

/* Death */
.death-wrap { text-align: center; padding: 30px 26px; }
.death-wrap h2 { font-size: 34px; color: #cfd8e3; }
.countdown { font: 700 40px var(--font-display); color: var(--teal); text-shadow: 0 0 20px rgba(63, 193, 176, .5); margin: 10px 0; font-variant-numeric: tabular-nums; }

/* Dice */
.dice-row { display: flex; gap: 22px; justify-content: center; align-items: center; margin: 12px 0; }
.die { width: 56px; height: 56px; border-radius: 12px; background: #f1e8dc; color: #1b0d05; display: grid; place-items: center; font: 900 26px var(--font-display); box-shadow: inset 0 -4px 0 #c9b9a3, 0 6px 14px rgba(0, 0, 0, .5); }
.die.house { background: #3a2c22; color: var(--text); box-shadow: inset 0 -4px 0 #24190f, 0 6px 14px rgba(0, 0, 0, .5); }
.die.roll { animation: roll .5s; }
@keyframes roll { 0% { transform: rotate(0) scale(.8); } 50% { transform: rotate(200deg) scale(1.1); } 100% { transform: rotate(360deg) scale(1); } }

/* ───────────── Mobile ───────────── */
.mobile-nav { display: none; }
.hud { display: none; }
@media (max-width: 1240px) {
  :root { --social-w: 290px; --side-w: 260px; }
}
@media (max-width: 1080px) {
  .shell { grid-template-columns: var(--side-w) minmax(0, 1fr); grid-template-areas: 'top top' 'side main'; }
  .social { position: fixed; right: 0; top: var(--top-h); bottom: 0; width: min(380px, 100vw); z-index: 30; transform: translateX(100%); transition: transform .2s; background: var(--bg-2); box-shadow: var(--shadow); }
  .shell.social-open .social { transform: none; }
  .social-toggle { display: inline-flex !important; }
}
.social-toggle { display: none !important; }
@media (max-width: 760px) {
  :root { --top-h: 52px; }
  body { font-size: 14.5px; }
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: var(--top-h) auto minmax(0, 1fr) auto; grid-template-areas: 'top' 'hud' 'main' 'mnav'; }
  .side { position: fixed; inset: var(--top-h) auto 0 0; width: min(320px, 88vw); z-index: 31; background: var(--bg-2); transform: translateX(-105%); transition: transform .2s; box-shadow: var(--shadow); }
  .shell.side-open .side { transform: none; }
  .social { top: var(--top-h); bottom: 60px; }
  .topbar { padding: 0 10px; gap: 8px; }
  .brand { font-size: 18px; letter-spacing: .12em; }
  .dawn .label { display: none; }
  .hud { grid-area: hud; display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--bg-2); font-size: .85em; overflow-x: auto; }
  .hud .bar { width: 90px; height: 14px; margin: 0; flex: none; }
  .hud .bar span { line-height: 12px; font-size: 10px; }
  .hud .h { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
  .mobile-nav { grid-area: mnav; display: flex; border-top: 1px solid var(--line); background: rgba(13, 11, 10, .95); padding-bottom: env(safe-area-inset-bottom); }
  .mobile-nav button { flex: 1; background: none; border: 0; padding: 8px 2px 7px; display: grid; justify-items: center; gap: 2px; color: var(--muted); font-size: 11px; cursor: pointer; position: relative; }
  .mobile-nav button.active { color: var(--ember-2); }
  .mobile-nav .badge { top: 2px; right: calc(50% - 20px); }
  .hero { height: 170px; padding: 16px; }
  .body { padding: 4px 16px 0; }
  .combat { grid-template-columns: 1fr; padding: 16px; }
  .foe-art { max-width: 180px; margin: 0 auto; }
  .foe-name { font-size: 18px; margin-top: 6px; text-align: center; }
  .foe-desc { text-align: center; }
  .split { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .npc-portrait { width: 84px; height: 84px; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { min-height: 34vh; }
  .auth-art::after { background: linear-gradient(0deg, var(--bg) 3%, transparent 70%); }
  .auth-art .tagline { left: 16px; bottom: 14px; }
  .auth-art .tagline h1 { font-size: 40px; }
  .auth-art .tagline p { font-size: 15px; }
  .auth-panel { padding: 10px 16px 30px; }
  .class-pick { gap: 6px; }
  .table td, .table th { padding: 7px 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .embers { display: none; }
}
