@import url("https://fonts.googleapis.com/css2?family=Source+Serif+4:opsz,wght@8..60,400;8..60,600;8..60,700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap");

/* Brand tokens (Nick's personal brand guide). Navy leads; gold marks state, never fills buttons. */
:root {
  --navy: #2F4057;
  --navy-2: #3b5070;
  --navy-deep: #243247;
  --gold: #B48A2E;
  --gold-ink: #8A6116;
  --gold-soft: rgba(180, 138, 46, .12);
  --stone: #A79F93;
  --cream: #F3EBDD;
  --cream-2: #F8F3EA;
  --white: #ffffff;
  --charcoal: #222427;
  --muted: #7A746A;
  --line: #E3DDD2;
  --ok-bg: #f0fdf4; --ok: #166534;
  --warn-bg: #fdf3e1; --warn: #8A6116;
  --bad-bg: #fbeceb; --bad: #9b2c22;
  --radius: 4px;
  --shadow-sm: 0 1px 2px rgba(34, 36, 39, .05);
  --shadow: 0 1px 2px rgba(34, 36, 39, .04), 0 6px 20px rgba(47, 64, 87, .07);
  --shadow-lg: 0 2px 4px rgba(34, 36, 39, .05), 0 18px 48px rgba(47, 64, 87, .16);
  --serif: "Source Serif 4", Georgia, serif;
  --sans: Inter, system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--cream); color: var(--charcoal); font-family: var(--sans); font-size: 14px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { font-family: var(--sans); color: var(--navy); font-weight: 600; margin: 0 0 .4em; letter-spacing: -.01em; }
.serif { font-family: var(--serif); letter-spacing: 0; }
.label { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* Navy top bar used on every screen */
.appbar { background: var(--navy); color: var(--white); display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 20px; }
.appbar .eyebrow { color: rgba(255, 255, 255, .6); }
.appbar h1, .appbar h2 { color: var(--white); margin: 0; }
.eyebrow { font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--gold-ink); }

/* Surfaces */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 16px;
  background: var(--cream-2); border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.card-head .label { color: var(--navy); font-weight: 600; }
.card-body { padding: 14px 16px; }

/* Chips: small mono status tags */
.chip { display: inline-flex; align-items: center; gap: 6px; font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .06em;
  padding: 3px 8px; border-radius: 2px; border: 1px solid var(--line); color: var(--muted); background: var(--white); }
.chip.on { border-color: var(--gold); color: var(--gold-ink); background: var(--gold-soft); }
.appbar .chip { background: transparent; border-color: rgba(255, 255, 255, .2); color: rgba(255, 255, 255, .6); }
.appbar .chip.on { border-color: var(--gold); color: var(--white); background: rgba(180, 138, 46, .25); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 500 13px/1 var(--sans); letter-spacing: .02em;
  min-height: 38px; padding: 0 16px; border-radius: var(--radius); border: 1px solid var(--stone); background: var(--white); color: var(--navy);
  text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, box-shadow .15s; }
.btn:hover { background: var(--cream-2); }
.btn.primary { background: var(--navy); color: var(--white); border-color: var(--navy); }
.btn.primary:hover { background: var(--navy-2); }
.btn.ghost { border-color: var(--line); color: var(--muted); background: transparent; }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn:disabled { opacity: .45; cursor: default; }
.btn:focus-visible, .choice:focus-visible, .pc-option:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

input, textarea, select { font: 14px var(--sans); padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--white); color: var(--charcoal); transition: border-color .15s, box-shadow .15s; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }

/* Character avatar: emoji in a circle */
.avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 44px; height: 44px; border-radius: 50%;
  background: var(--cream); border: 1px solid var(--line); font-size: 24px; line-height: 1; }

/* Health pips */
.pips { display: inline-flex; gap: 4px; }
.pips i { width: 10px; height: 10px; border-radius: 50%; background: var(--navy); }
.pips i.off { background: transparent; box-shadow: inset 0 0 0 1.5px var(--stone); }

/* Home and join pages */
.home main { max-width: 960px; margin: 0 auto; padding: 48px 20px; }
.home h1 { font-family: var(--serif); font-size: 32px; letter-spacing: 0; }
.home section { margin: 28px 0; }
.home section h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }
.home .btn { margin: 0 8px 8px 0; min-height: 44px; }
.home small { color: var(--muted); }
.join { max-width: 420px !important; text-align: center; padding-top: 16vh !important; }
.join form { display: flex; gap: 8px; margin-top: 20px; }
.join input { flex: 1; font-size: 16px; }
.join-error { color: var(--bad); background: var(--bad-bg); padding: 8px 12px; border-radius: var(--radius); }

.offline { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 50; background: var(--bad-bg); color: var(--bad);
  padding: 6px 14px; border-radius: var(--radius); box-shadow: var(--shadow); }
