:root {
  --ink: #0B0708; --ember: #171011; --line: #2A1B1C; --line2: #3A2B2C;
  --signal: #E5352B; --signal-ink: #0B0708; --crimson: #8E0B10; --deep: #3A0507;
  --bone: #F4EEEA; --soft: #E6DCD8; --muted: #BFB2AE; --ash: #A89A96;
  --ok: #7FC8A9;
  --serif: 'Playfair Display', Georgia, serif;
  --sans: 'Inter Tight', system-ui, -apple-system, Segoe UI, Arial, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Consolas, monospace;
  --r: 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ink); color: var(--bone); font-family: var(--sans); font-size: 16px; line-height: 1.5; }
body { min-height: 100vh; -webkit-font-smoothing: antialiased; }
a { color: var(--bone); text-decoration: none; }
a:hover { color: var(--signal); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--serif); font-style: italic; font-weight: 500; line-height: 1.1; margin: 0 0 .4em; }
h1 { font-size: clamp(40px, 7vw, 76px); }
h2 { font-size: clamp(30px, 4.6vw, 46px); }
h3 { font-size: 24px; }
p { margin: 0 0 1em; }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--signal); margin: 0 0 8px; }
.mono { font-family: var(--mono); }
.muted { color: var(--ash); }
.soft { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid2 { display: grid; gap: 24px; grid-template-columns: 1fr 1fr; }
@media (max-width: 800px) { .grid2 { grid-template-columns: 1fr; } }
.hidden { display: none !important; }

/* ---- Shell ---- */
.top { position: sticky; top: 0; z-index: 20; background: rgba(11,7,8,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1180px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 20px; }
.brand { font-family: var(--serif); font-style: italic; font-size: 30px; font-weight: 500; line-height: 1; display: flex; align-items: center; gap: 8px; }
.brand svg { width: 30px; height: 30px; }
.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a { padding: 8px 12px; border-radius: 999px; color: var(--muted); font-size: 15px; }
.nav a.on, .nav a:hover { color: var(--bone); background: var(--ember); }
.pill-count { background: var(--signal); color: var(--signal-ink); font-family: var(--mono); font-size: 11px; font-weight: 600; border-radius: 999px; padding: 1px 7px; margin-left: 4px; }
.me-chip { display: flex; align-items: center; gap: 8px; }
.me-chip .av { width: 36px; height: 36px; }
main { max-width: 1180px; margin: 0 auto; padding: 28px 20px 120px; }
.bottom-nav { display: none; }
@media (max-width: 760px) {
  .nav { display: none; }
  .bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: rgba(11,7,8,.96); border-top: 1px solid var(--line); justify-content: space-around; padding: 8px 4px calc(8px + env(safe-area-inset-bottom)); }
  .bottom-nav a { font-size: 12px; color: var(--muted); text-align: center; flex: 1; padding: 4px; }
  .bottom-nav a.on { color: var(--signal); }
  main { padding: 20px 16px 110px; }
}

/* ---- Cards & controls ---- */
.card { background: var(--ember); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; }
.card.tight { padding: 16px; }
.card.glow { background: radial-gradient(circle at 50% 130%, #C4161C 0%, var(--crimson) 38%, #2A0406 100%); border-color: #5a1216; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line2); background: transparent; color: var(--bone); border-radius: 999px; padding: 10px 20px; cursor: pointer; font-weight: 600; font-size: 15px; transition: .15s; }
.btn:hover { border-color: var(--bone); color: var(--bone); }
.btn.red { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
.btn.red:hover { background: #ff4a3f; }
.btn.small { padding: 6px 14px; font-size: 13px; }
.btn.ghost { border-color: transparent; color: var(--muted); }
.btn[disabled] { opacity: .5; cursor: default; }
label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.field { margin-bottom: 16px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; background: var(--ink); border: 1px solid var(--line2); border-radius: 12px; padding: 12px 14px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--signal); }
textarea { min-height: 110px; resize: vertical; }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 999px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 999px; cursor: pointer; color: var(--muted); font-size: 14px; }
.seg button.on { background: var(--bone); color: var(--ink); font-weight: 600; }
.tag { display: inline-block; font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; border: 1px solid var(--line2); border-radius: 999px; padding: 3px 10px; color: var(--ash); }
.tag.red { border-color: var(--signal); color: var(--signal); }
.tag.fill { background: var(--signal); color: var(--signal-ink); border-color: var(--signal); }
.verdict { display: inline-block; font-weight: 600; font-size: 13px; border-radius: 999px; padding: 4px 12px; border: 1.5px solid var(--line2); color: var(--muted); }
.verdict.fits { border-color: var(--signal); color: var(--signal); }
.verdict.close { border-color: #b98a86; color: #e7c3bf; }
.hr { height: 1px; background: var(--line); margin: 24px 0; border: 0; }
.err { color: #ff8a80; font-size: 14px; min-height: 1em; }
.empty { border: 1px dashed var(--line2); border-radius: var(--r); padding: 28px; text-align: center; color: var(--ash); }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--bone); color: var(--ink); padding: 12px 20px; border-radius: 999px; font-weight: 600; z-index: 99; box-shadow: 0 10px 40px rgba(0,0,0,.5); max-width: 90vw; }
.list-item { display: block; padding: 14px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.big-num { font-family: var(--serif); font-style: italic; font-size: 76px; line-height: 1; }
.kicker { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; color: #F4D6D2; text-transform: uppercase; }
.bar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--signal); border-radius: 99px; }
.bar.warn > i { background: #ffb74d; }

/* ---- Landing ---- */
.hero { position: relative; min-height: 78vh; display: flex; align-items: flex-end; border-radius: 28px; overflow: hidden; margin-bottom: 40px; background: var(--ink); }
.hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(11,7,8,.96) 0%, rgba(11,7,8,.7) 45%, rgba(11,7,8,.1) 100%); }
.hero-in { position: relative; z-index: 1; padding: 48px; max-width: 640px; }
.hero h1 { font-size: clamp(64px, 12vw, 150px); margin: 0; }
@media (max-width: 760px) { .hero-in { padding: 28px; } .hero::after { background: linear-gradient(0deg, rgba(11,7,8,.97) 20%, rgba(11,7,8,.5) 70%, rgba(11,7,8,.2) 100%); } }
.auth-box { max-width: 440px; margin: 40px auto; }

/* ---- Listings ---- */
.lcard { background: var(--ember); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; }
.lcard .ph { aspect-ratio: 4/3; background: radial-gradient(ellipse at 50% 100%, var(--crimson) 0%, #2A0406 55%, #120B0C 100%); display: flex; align-items: flex-end; padding: 12px; }
.lcard .ph img { width: 100%; height: 100%; object-fit: cover; }
.lcard .ph.has { padding: 0; }
.lcard .body { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.lcard .name { font-family: var(--serif); font-style: italic; font-size: 22px; line-height: 1.1; }
.price { font-weight: 700; font-size: 22px; }
.slots { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
@media (max-width: 600px) { .slots { grid-template-columns: repeat(3, 1fr); } }
.slot { aspect-ratio: 1; border: 1px dashed var(--line2); border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; font-size: 12px; color: var(--ash); cursor: pointer; overflow: hidden; position: relative; }
.slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.gallery { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }
.gallery img { width: 100%; height: 100%; object-fit: cover; border-radius: 14px; aspect-ratio: 4/3; cursor: zoom-in; }
.thumbs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---- Forum ---- */
.post { padding: 18px 0; border-bottom: 1px solid var(--line); display: flex; gap: 14px; }
.post .av { width: 44px; height: 44px; flex: none; }
.post-body { flex: 1; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.match { font-family: var(--mono); font-size: 11px; color: var(--signal); border: 1px solid var(--signal); border-radius: 999px; padding: 1px 8px; }
.helpful-btn { background: none; border: 1px solid var(--line2); border-radius: 999px; padding: 3px 10px; font-size: 12px; color: var(--muted); cursor: pointer; }
.helpful-btn.on { border-color: var(--signal); color: var(--signal); }
.linkbtn { background: none; border: 0; color: var(--ash); cursor: pointer; font-size: 12px; padding: 0; }
.linkbtn:hover { color: var(--signal); }

/* ---- Huddle ---- */
.chat { height: 58vh; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 16px; background: var(--ink); border: 1px solid var(--line); border-radius: var(--r); }
.msg { display: flex; gap: 10px; align-items: flex-start; }
.msg .av { width: 34px; height: 34px; flex: none; }
.msg .bubble { background: var(--ember); border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px; max-width: 80%; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.mine { flex-direction: row-reverse; }
.msg.mine .bubble { background: #2a0e10; border-color: #5a1216; }
.live-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--signal); margin-right: 6px; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* ---- Avatar ---- */
.av { display: inline-block; border-radius: 50%; background: radial-gradient(circle at 50% 110%, var(--crimson), #1b0b0c 70%); overflow: hidden; }
.av svg { width: 100%; height: 100%; }
.stage { position: relative; background: radial-gradient(ellipse at 50% 100%, #5a0a0e 0%, #1b0708 60%, var(--ink) 100%); border-radius: var(--r); overflow: hidden; height: 300px; }
.stage .ground { position: absolute; left: 0; right: 0; bottom: 38px; height: 2px; background: repeating-linear-gradient(90deg, #3a2b2c 0 30px, transparent 30px 60px); animation: road 0.6s linear infinite; }
@keyframes road { to { background-position: -60px 0; } }
.stage svg.runner { position: absolute; left: 50%; bottom: 36px; transform: translateX(-50%); height: 240px; width: auto; }
.runner .leg-a { transform-origin: 50px 92px; animation: legA .6s ease-in-out infinite; }
.runner .leg-b { transform-origin: 50px 92px; animation: legB .6s ease-in-out infinite; }
.runner .arm-a { transform-origin: 50px 52px; animation: legB .6s ease-in-out infinite; }
.runner .arm-b { transform-origin: 50px 52px; animation: legA .6s ease-in-out infinite; }
.runner .bob { animation: bob .3s ease-in-out infinite alternate; }
.runner.idle .leg-a, .runner.idle .leg-b, .runner.idle .arm-a, .runner.idle .arm-b, .runner.idle .bob { animation: none; }
@keyframes legA { 0%,100% { transform: rotate(28deg); } 50% { transform: rotate(-28deg); } }
@keyframes legB { 0%,100% { transform: rotate(-28deg); } 50% { transform: rotate(28deg); } }
@keyframes bob { to { transform: translateY(-3px); } }
.funeral .shoe-fly { animation: fly 1.6s ease-in forwards; }
@keyframes fly { 0% { transform: translate(0,0) rotate(0); } 60% { transform: translate(60px,-120px) rotate(300deg); } 100% { transform: translate(90px,-60px) rotate(540deg); opacity: .9; } }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.sw { width: 34px; height: 34px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.sw.on { border-color: var(--bone); }

/* ---- Scan ---- */
.scan-wrap { position: relative; touch-action: none; border-radius: var(--r); overflow: hidden; background: #000; }
.scan-wrap canvas { width: 100%; display: block; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: s; padding: 8px 0 8px 40px; position: relative; color: var(--muted); }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 6px; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line2); display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 12px; }
.steps li.now { color: var(--bone); }
.steps li.now::before { background: var(--signal); border-color: var(--signal); color: var(--ink); }
.steps li.done::before { content: '✓'; color: var(--signal); border-color: var(--signal); }

/* ---- Modal & share card ---- */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.72); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--ember); border: 1px solid var(--line); border-radius: 22px; padding: 26px; width: min(560px, 100%); max-height: 90vh; overflow: auto; }
.sharecard { width: 300px; height: 460px; border-radius: 24px; overflow: hidden; position: relative; margin: 0 auto; }
.feedback-fab { position: fixed; right: 16px; bottom: 16px; z-index: 30; }
@media (max-width: 760px) { .feedback-fab { bottom: 84px; } }
table.admin { width: 100%; border-collapse: collapse; font-size: 14px; }
table.admin th, table.admin td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.admin th { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ash); }
.scroll-x { overflow-x: auto; }
