@font-face { font-family: 'Shoulders'; src: url('fonts/big-shoulders-display-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Shoulders'; src: url('fonts/big-shoulders-display-latin-800-normal.woff2') format('woff2'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'Barlow'; src: url('fonts/barlow-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Barlow'; src: url('fonts/barlow-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Barlow'; src: url('fonts/barlow-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }

:root {
  --night: #17222a;
  --steel: #1f2e38;
  --steel-2: #263845;
  --rivet: #34495a;
  --sodium: #f2a33a;
  --sodium-dim: #a8762f;
  --rust: #c55a2d;
  --patina: #6db3a3;
  --wound: #e3655b;
  --glow: #f5d27a;
  --concrete: #e6e0d6;
  --fog: #9aa9b2;
  --ink: #17120b;

  --display: 'Shoulders', 'Arial Narrow', 'Roboto Condensed', sans-serif;
  --body: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --gutter: 16px;
  --nav-h: 62px;
  --rail-w: 220px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--night);
  color: var(--concrete);
  font: 400 16px/1.45 var(--body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
a { color: var(--sodium); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--glow); outline-offset: 2px; }
.muted { color: var(--fog); }
.num { font-family: var(--display); font-weight: 600; letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.cash { color: var(--sodium); }
.good { color: var(--patina); }
.bad { color: var(--wound); }
.hidden { display: none !important; }

/* ---------------------------------------------------------------- shell */
.shell { min-height: 100dvh; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
.top {
  position: sticky; top: 0; z-index: 20;
  background: var(--night);
  border-bottom: 1px solid var(--rivet);
  padding: 10px var(--gutter) 12px;
}
.top-row { display: flex; align-items: center; gap: 12px; }
.wordmark {
  font: 800 26px/1 var(--display);
  color: var(--sodium);
  letter-spacing: .02em;
  margin-right: auto;
}
.wordmark a { color: inherit; }
.wordmark a:hover { text-decoration: none; }
.top-cash { font: 600 22px/1 var(--display); color: var(--sodium); }
.top-level { font: 600 15px/1 var(--body); color: var(--fog); }
.top-level b { font: 600 20px/1 var(--display); color: var(--concrete); }
.bell {
  position: relative; display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--rivet); color: var(--concrete); background: none; cursor: pointer;
}
.bell svg { width: 18px; height: 18px; }
.badge {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--rust); color: #fff; font: 600 11px/18px var(--body); text-align: center;
}

/* meters — the four bars, drawn as segmented gauges */
.meters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-top: 12px; }
.meter { min-width: 0; }
.meter-head { display: flex; align-items: baseline; gap: 6px; }
.meter-name { font: 500 13px/1 var(--body); color: var(--fog); }
.meter-val { font: 800 22px/1 var(--display); margin-left: auto; font-variant-numeric: tabular-nums; }
.meter-val small { font-weight: 600; font-size: 14px; color: var(--fog); }
.gauge {
  position: relative; height: 10px; margin-top: 5px;
  background: var(--steel-2);
  border-radius: 2px; overflow: hidden;
}
.gauge > i { position: absolute; inset: 0 auto 0 0; background: var(--c); border-radius: 2px; transition: width .35s ease; }
.gauge::after { /* the segment notches */
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 2px), var(--night) calc(10% - 2px) 10%);
}
.gauge.over > i { box-shadow: 0 0 10px var(--c); }
.meter-tick { font: 400 12px/1 var(--body); color: var(--fog); margin-top: 4px; height: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-energy { --c: var(--patina); }
.m-nerve { --c: var(--rust); }
.m-happy { --c: var(--glow); }
.m-life { --c: var(--wound); }

.banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px var(--gutter);
  background: color-mix(in srgb, var(--b) 22%, var(--night));
  border-bottom: 1px solid color-mix(in srgb, var(--b) 60%, var(--night));
  font-weight: 500;
}
.banner.hospital { --b: var(--wound); }
.banner.jail { --b: var(--rust); }
.banner.protect { --b: var(--patina); }
.banner .grow { flex: 1; min-width: 180px; }
.banner .clock { font: 800 20px/1 var(--display); font-variant-numeric: tabular-nums; }

main.view { padding: 18px var(--gutter) 32px; max-width: 760px; }

/* bottom nav (phones) */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--steel); border-top: 1px solid var(--rivet);
}
.nav a {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--fog); font: 500 12px/1 var(--body);
}
.nav a:hover { text-decoration: none; color: var(--concrete); }
.nav a svg { width: 22px; height: 22px; }
.nav a.on { color: var(--sodium); }
.nav a.on::before { content: ''; position: absolute; top: 0; left: 25%; right: 25%; height: 3px; background: var(--sodium); border-radius: 0 0 3px 3px; }
.nav .badge { top: 6px; right: calc(50% - 22px); }
.rail { display: none; }

/* ---------------------------------------------------------------- content */
h1.page { font: 800 34px/1.05 var(--display); margin: 0 0 4px; letter-spacing: .01em; }
.lede { color: var(--fog); margin: 0 0 18px; max-width: 60ch; }
h2 { font: 600 22px/1.15 var(--display); margin: 28px 0 8px; letter-spacing: .01em; }
h2:first-child { margin-top: 0; }
p { margin: 0 0 12px; }

.rows { border-top: 1px solid var(--rivet); }
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--rivet);
}
.row .main { flex: 1; min-width: 0; }
.row .title { font-weight: 600; }
.row .sub { color: var(--fog); font-size: 14px; }
.row .side { text-align: right; flex-shrink: 0; }
.row.locked { opacity: .55; }
.row.link { color: inherit; }
.row.link:hover { text-decoration: none; background: color-mix(in srgb, var(--steel) 60%, transparent); }
.row .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 4px 16px; }
.fact { border-top: 2px solid var(--rivet); padding: 8px 0 6px; }
.fact .k { color: var(--fog); font-size: 13px; }
.fact .v { font: 600 22px/1.15 var(--display); font-variant-numeric: tabular-nums; }

.statline { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 14px 0; border-bottom: 1px solid var(--rivet); }
.statline .sname { font: 600 22px/1 var(--display); }
.statline .sval { font: 800 26px/1 var(--display); text-align: right; font-variant-numeric: tabular-nums; }
.statline .sdesc { color: var(--fog); font-size: 14px; }
.statline .sgain { color: var(--patina); font-size: 14px; text-align: right; }
.statline .acts { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr 1.5fr; gap: 8px; margin-top: 8px; }
.statline .acts .btn { flex-direction: column; gap: 0; min-width: 0; line-height: 1.15; padding: 6px 8px; min-height: 46px; }
.statline .acts .btn small { font-size: 12px; }

.xp { height: 6px; background: var(--steel-2); border-radius: 3px; overflow: hidden; margin: 6px 0 4px; }
.xp i { display: block; height: 100%; background: var(--sodium); }

.chip { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 13px; font-weight: 500; background: var(--steel-2); color: var(--fog); white-space: nowrap; }
.chip.hospital { background: color-mix(in srgb, var(--wound) 25%, var(--night)); color: #f3b2ac; }
.chip.jail { background: color-mix(in srgb, var(--rust) 30%, var(--night)); color: #f1b896; }
.chip.okay { background: color-mix(in srgb, var(--patina) 18%, var(--night)); color: var(--patina); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--rivet); margin-right: 6px; vertical-align: 1px; }
.dot.online { background: var(--patina); }
.dot.idle { background: var(--glow); }

.tabs { display: flex; gap: 4px; overflow-x: auto; margin: 0 calc(-1 * var(--gutter)) 14px; padding: 0 var(--gutter); scrollbar-width: none; }
.tabs a { padding: 8px 12px; border-radius: 18px; color: var(--fog); white-space: nowrap; font-weight: 500; border: 1px solid transparent; }
.tabs a:hover { text-decoration: none; color: var(--concrete); }
.tabs a.on { color: var(--concrete); border-color: var(--rivet); background: var(--steel); }

.tip { padding: 12px 14px; border-left: 3px solid var(--sodium); background: var(--steel); border-radius: 0 4px 4px 0; margin-bottom: 8px; }
.tip.calm { border-left-color: var(--patina); }
.invite-link { margin-top: 6px; font-size: 13px; padding: 6px 8px; color: var(--fog); width: 100%; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 8px 14px;
  border: 1px solid var(--rivet); border-radius: 4px;
  background: var(--steel); color: var(--concrete);
  font-weight: 600; cursor: pointer; white-space: nowrap;
  touch-action: manipulation;
}
.btn:hover:not(:disabled) { border-color: var(--fog); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: var(--sodium); border-color: var(--sodium); color: var(--ink); }
.btn.primary:hover:not(:disabled) { background: var(--glow); border-color: var(--glow); }
.btn.danger { background: var(--rust); border-color: var(--rust); color: #fff; }
.btn.danger:hover:not(:disabled) { background: #d76a3c; }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: 14px; }
.btn small { font-weight: 500; opacity: .8; }
.btn.block { width: 100%; }

/* forms */
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; color: var(--fog); font-size: 14px; margin-bottom: 4px; }
.input, textarea.input {
  width: 100%; min-height: 44px; padding: 10px 12px;
  background: var(--night); border: 1px solid var(--rivet); border-radius: 4px;
}
.input:focus { border-color: var(--sodium); outline: none; }
.inline { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.inline .input { flex: 1; min-width: 120px; }
.check { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; color: var(--fog); }
.check input { width: 18px; height: 18px; accent-color: var(--sodium); }

.section { margin-top: 28px; }
.panel { background: var(--steel); border-radius: 6px; padding: 16px; margin-bottom: 14px; }

/* street log */
.log { margin-top: 18px; }
.log-line { padding: 8px 0; border-bottom: 1px dashed var(--rivet); font-size: 15px; }
.log-line .t { color: var(--fog); font-size: 12px; margin-right: 6px; }

/* toast */
.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 10px); z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; padding: 0 var(--gutter); }
.toast {
  pointer-events: auto; max-width: 520px; width: 100%;
  padding: 11px 14px; border-radius: 4px;
  background: var(--concrete); color: var(--ink); font-weight: 500;
  border-left: 5px solid var(--patina);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .35);
  animation: toast-in .18s ease-out;
}
.toast.err { border-left-color: var(--wound); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* sheet / modal */
.scrim { position: fixed; inset: 0; z-index: 70; background: rgba(8, 12, 15, .7); display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 560px; max-height: 88dvh; overflow-y: auto;
  background: var(--steel); border-radius: 10px 10px 0 0;
  padding: 20px var(--gutter) calc(20px + env(safe-area-inset-bottom));
  animation: sheet-in .2s ease-out;
}
@keyframes sheet-in { from { transform: translateY(24px); opacity: .4; } }
.sheet h2 { margin-top: 0; }
.sheet-close { float: right; background: none; border: 0; color: var(--fog); font-size: 26px; line-height: 1; cursor: pointer; padding: 0 4px; }

/* fight */
.vs { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 14px; }
.fighter .fname { font: 800 22px/1.1 var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fighter .fweap { color: var(--fog); font-size: 13px; margin-bottom: 6px; }
.fighter .hp { font: 600 15px/1 var(--display); color: var(--fog); margin-top: 4px; font-variant-numeric: tabular-nums; }
.fighter.right { text-align: right; }
.fighter.right .gauge > i { left: auto; right: 0; }
.blow { padding: 6px 0; border-bottom: 1px solid var(--rivet); font-size: 15px; }
.blow.me b { color: var(--patina); }
.blow.them b { color: var(--wound); }
.blow .crit { color: var(--glow); font-weight: 600; }
.blow.hide { display: none; }
.verdict { font: 800 30px/1.1 var(--display); margin: 16px 0 6px; }
.verdict.win { color: var(--sodium); }
.verdict.loss { color: var(--wound); }

/* chat */
.chat { display: flex; flex-direction: column; height: calc(100dvh - 260px); min-height: 320px; }
.chat-list { flex: 1; overflow-y: auto; padding-right: 4px; }
.msg { padding: 6px 0; }
.msg .who { font-weight: 600; }
.msg .when { color: var(--fog); font-size: 12px; margin-left: 6px; }
.msg .text { overflow-wrap: anywhere; }
.chat-form { display: flex; gap: 8px; padding-top: 10px; border-top: 1px solid var(--rivet); }
.chat-form .input { flex: 1; }

/* auth */
.auth {
  min-height: 100dvh; display: grid; place-items: center; padding: 32px var(--gutter);
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%, color-mix(in srgb, var(--sodium) 22%, transparent), transparent 70%),
    var(--night);
}
.auth-box { width: 100%; max-width: 380px; }
.auth-mark {
  font: 800 clamp(64px, 20vw, 104px)/.86 var(--display);
  color: var(--sodium); margin: 0 0 14px; letter-spacing: .005em;
  text-shadow: 0 0 28px color-mix(in srgb, var(--sodium) 45%, transparent);
  animation: lamp 1.6s steps(1, end) 1;
}
@keyframes lamp {
  0% { opacity: .15; text-shadow: none; }
  8% { opacity: .7; } 12% { opacity: .2; } 22% { opacity: .85; } 26% { opacity: .35; }
  40% { opacity: 1; text-shadow: none; }
  100% { opacity: 1; }
}
.auth-tag { color: var(--fog); font-size: 17px; margin: 0 0 26px; max-width: 34ch; }
.auth .tabs { margin: 0 0 16px; padding: 0; }
.auth-err { color: var(--wound); min-height: 22px; font-size: 15px; margin-bottom: 8px; }

.empty { color: var(--fog); padding: 18px 0; }
.spacer { height: 12px; }

/* ---------------------------------------------------------------- guide */
.auth-help { margin: 18px 0 0; text-align: center; }
.guide p, .guide li { max-width: 68ch; }
.guide ul { padding-left: 20px; margin: 0 0 14px; }
.guide li { margin-bottom: 6px; }
.guide li b, .guide p b { font-weight: 600; color: var(--concrete); }
.guide h2 { margin-top: 36px; font-size: 26px; }
.loop { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 20px; margin: 4px 0 22px; }
.loop-name { font: 800 22px/1 var(--display); }
.loop-what { color: var(--fog); font-size: 14px; margin-top: 6px; }
.guide-jump { margin-bottom: 4px; }
.steps { list-style: none; counter-reset: step; padding: 0; margin: 0 0 14px; border-top: 1px solid var(--rivet); }
.steps li { counter-increment: step; position: relative; padding: 12px 0 12px 44px; margin: 0; border-bottom: 1px solid var(--rivet); max-width: none; }
.steps li::before { content: counter(step); position: absolute; left: 2px; top: 9px; font: 800 28px/1 var(--display); color: var(--sodium); }
.tscroll { overflow-x: auto; margin: 6px 0 16px; -webkit-overflow-scrolling: touch; }
.gtable { width: 100%; border-collapse: collapse; font-size: 15px; }
.gtable th { text-align: left; font-weight: 500; font-size: 13px; color: var(--fog); padding: 6px 14px 6px 0; border-bottom: 1px solid var(--rivet); white-space: nowrap; }
.gtable td { padding: 9px 14px 9px 0; border-bottom: 1px solid var(--rivet); vertical-align: top; }
.gtable td:first-child { font-weight: 600; }
.gtable .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gtable th:last-child, .gtable td:last-child { padding-right: 0; }
.guide-public { min-height: 100dvh; }
.guide-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px var(--gutter); background: var(--night); border-bottom: 1px solid var(--rivet); }
.guide-top .wordmark:hover { text-decoration: none; }
.guide-public .view { margin: 0 auto; padding-bottom: 48px; }

/* ---------------------------------------------------------------- larger screens */
@media (min-width: 900px) {
  :root { --gutter: 24px; }
  .shell { padding-bottom: 0; display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); }
  .nav { display: none; }
  .rail {
    display: flex; flex-direction: column; gap: 2px;
    position: sticky; top: 0; height: 100dvh; overflow-y: auto;
    padding: 18px 12px; border-right: 1px solid var(--rivet); background: var(--steel);
  }
  .rail .wordmark { font-size: 32px; padding: 0 10px 16px; }
  .rail a.r { position: relative; padding: 8px 10px; border-radius: 4px; color: var(--fog); font-weight: 500; }
  .rail a.r:hover { color: var(--concrete); text-decoration: none; background: var(--steel-2); }
  .rail a.r.on { color: var(--sodium); background: var(--steel-2); }
  .rail .badge { position: static; display: inline-block; margin-left: 6px; vertical-align: 1px; }
  .rail .grp { color: var(--fog); font-size: 13px; padding: 14px 10px 4px; opacity: .8; }
  .top .wordmark { visibility: hidden; }
  .meters { grid-template-columns: repeat(4, 1fr); max-width: 980px; }
  .loop { grid-template-columns: repeat(4, 1fr); }
  .toasts { bottom: 20px; }
  .scrim { align-items: center; }
  .sheet { border-radius: 10px; }
}

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