:root {
  --gold: #c9a86a;
  --gold-dim: rgba(201, 168, 106, 0.35);
  --cream: #efe6d2;
  --muted: #a89b84;
  --ink: rgba(14, 9, 9, 0.80);
  --up: #7fd694;
  --down: #f07a7a;
  --panel-w: min(480px, 40vw);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: #0b0709;
  color: var(--cream);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; font-weight: 600; color: var(--gold); margin: 0 0 8px; letter-spacing: 0.01em; }
h1 { font-size: 26px; }
h2 { font-size: 19px; margin-top: 18px; }
h3 { font-size: 16px; color: var(--cream); }
p { margin: 6px 0; }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 13px; }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; touch-action: none; display: block; }
#labels { position: fixed; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.hotspot, .seat { position: absolute; left: 0; top: 0; pointer-events: auto; will-change: transform; transform-origin: 50% 100%; }
.hotspot {
  display: flex; align-items: center; gap: 8px;
  background: rgba(22, 13, 11, 0.72); color: #f3e7c6;
  border: 1px solid var(--gold-dim); border-radius: 999px;
  padding: 8px 16px 8px 12px; font: 600 15px system-ui, sans-serif; cursor: pointer;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: background 0.2s, border-color 0.2s; white-space: nowrap;
}
.hotspot .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px 2px rgba(201, 168, 106, 0.6); animation: pulse 2.2s ease-in-out infinite; }
.hotspot.edge { border-style: dashed; opacity: 0.92; }
.hotspot .arrow:empty { display: none; }
.hotspot .arrow { color: var(--gold); margin-right: -4px; }
.hotspot:hover, .hotspot.hot { background: rgba(201, 168, 106, 0.28); border-color: var(--gold); }
@keyframes pulse { 0%, 100% { transform: scale(0.85); opacity: 0.8; } 50% { transform: scale(1.2); opacity: 1; } }
.seat {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  background: rgba(12, 8, 8, 0.62); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 12px;
  padding: 6px 11px 5px; font-size: 14px; line-height: 1.2; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  min-width: 84px; text-align: center;
}
.seat.me { cursor: pointer; border-color: var(--gold); box-shadow: 0 0 14px rgba(201, 168, 106, 0.35); }
.seat .av { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: #3a2a22; color: var(--gold); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; margin-bottom: 3px; }
.seat .nm { font-weight: 600; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.net.up { color: var(--up); } .net.down { color: var(--down); } .net.flat { color: var(--muted); }

.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 54px; z-index: 3;
  display: flex; align-items: center; gap: 14px; padding: 0 18px;
  background: linear-gradient(rgba(5, 3, 3, 0.75), rgba(5, 3, 3, 0));
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.back { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 10px; background: rgba(22, 13, 11, 0.8); border: 1px solid var(--gold-dim); color: var(--gold); font-size: 22px; line-height: 1; text-decoration: none; }
.back:hover { background: rgba(201, 168, 106, 0.28); text-decoration: none; }
.brand { font-family: Georgia, serif; font-size: 20px; color: var(--gold); font-weight: 700; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.crumbs { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 14px; overflow: hidden; white-space: nowrap; }
.crumbs a { color: var(--cream); }
.spacer { flex: 1; }
.who { display: flex; align-items: center; gap: 8px; color: var(--cream); font-size: 14px; }
.who img, .who .av { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; background: #3a2a22; display: inline-flex; align-items: center; justify-content: center; color: var(--gold); font-weight: 700; }

.panel {
  position: fixed; top: 66px; right: 16px; bottom: 16px; width: var(--panel-w); z-index: 2;
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--ink); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(201, 168, 106, 0.22); border-radius: 16px; padding: 20px 22px 26px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s;
}
.panel.collapsed { transform: translateX(calc(100% + 24px)); opacity: 0.2; }
.peek {
  position: fixed; z-index: 4; top: 66px; right: 16px; width: 34px; height: 34px; border-radius: 10px;
  background: rgba(22, 13, 11, 0.8); border: 1px solid var(--gold-dim); color: var(--gold); cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
  transform: translateX(calc(-1 * var(--panel-w) - 8px));
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.peek.collapsed { transform: none; }
.handle { display: none; }

@media (max-width: 859px) {
  :root { --panel-w: 100vw; }
  .panel {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 56vh;
    border-radius: 18px 18px 0 0; padding: 26px 18px calc(22px + env(safe-area-inset-bottom));
    border-left: 0; border-right: 0; border-bottom: 0;
  }
  .panel.collapsed { transform: translateY(calc(100% - 46px)); opacity: 1; }
  .handle { display: block; position: sticky; top: -26px; margin: -26px -18px 10px; padding: 8px 0 6px; text-align: center; background: linear-gradient(var(--ink), rgba(14, 9, 9, 0)); cursor: pointer; z-index: 1; }
  .handle::before { content: ""; display: block; width: 44px; height: 5px; border-radius: 3px; margin: 0 auto; background: var(--gold-dim); }
  .peek { display: none; }
  .toasts { bottom: auto; top: 56px; left: 12px; }
  .hud { top: auto; bottom: calc(46px + env(safe-area-inset-bottom) + 8px); font-size: 13px; max-width: calc(100vw - 24px); overflow: hidden; text-overflow: ellipsis; }
  .tool { top: auto; bottom: calc(46px + env(safe-area-inset-bottom) + 52px); }
  .hud { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 4; background: rgba(22, 13, 11, 0.85); color: #f3e7c6; border: 1px solid var(--gold-dim); border-radius: 999px; padding: 7px 16px; font: 600 14px system-ui, sans-serif; white-space: nowrap; pointer-events: none; backdrop-filter: blur(8px); }
.reticle { position: fixed; left: 0; top: 0; z-index: 4; width: 26px; height: 26px; border: 2px solid var(--gold); border-radius: 50%; pointer-events: none; box-shadow: 0 0 10px rgba(201, 168, 106, 0.6), inset 0 0 6px rgba(201, 168, 106, 0.4); }
.reticle::before, .reticle::after { content: ""; position: absolute; background: var(--gold); }
.reticle::before { left: 50%; top: -6px; width: 2px; height: 34px; margin-left: -1px; opacity: 0.6; }
.reticle::after { top: 50%; left: -6px; height: 2px; width: 34px; margin-top: -1px; opacity: 0.6; }
.tool { position: fixed; left: 16px; top: 66px; z-index: 4; width: 40px; height: 40px; border-radius: 12px; background: rgba(22, 13, 11, 0.85); border: 1px solid var(--gold-dim); font-size: 22px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.tool.on { background: rgba(201, 168, 106, 0.4); border-color: var(--gold); box-shadow: 0 0 14px rgba(120, 220, 255, 0.6); }
.safe-ui { left: 50%; top: 24%; width: min(300px, 90vw); }
  .topbar { padding: 0 12px; height: 50px; }
  .brand { font-size: 18px; }
  .crumbs { font-size: 13px; }
}

.card { background: rgba(255, 255, 255, 0.045); border: 1px solid rgba(255, 255, 255, 0.06); border-radius: 12px; padding: 12px 14px; margin: 10px 0; }
.card.hi { border-color: var(--gold-dim); background: rgba(201, 168, 106, 0.08); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 10px; border: 1px solid var(--gold-dim); background: rgba(201, 168, 106, 0.1);
  color: var(--cream); font: 600 14px system-ui, sans-serif; cursor: pointer; text-decoration: none; transition: background 0.15s;
}
.btn:hover { background: rgba(201, 168, 106, 0.22); text-decoration: none; }
.btn.primary { background: var(--gold); color: #1a120a; border-color: var(--gold); }
.btn.primary:hover { background: #dcbb7d; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.danger { border-color: rgba(240, 122, 122, 0.5); color: var(--down); background: rgba(240, 122, 122, 0.08); }
.btn.active { background: var(--gold); color: #1a120a; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.block { width: 100%; }
input, textarea, select {
  width: 100%; padding: 9px 11px; border-radius: 9px; border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.35); color: var(--cream); font: 15px system-ui, sans-serif;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--gold); }
input[type="number"] { width: 100px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
label:first-child { margin-top: 0; }
.err { color: var(--down); font-size: 14px; margin: 8px 0; }
.ok { color: var(--up); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; background: rgba(255, 255, 255, 0.1); color: var(--cream); }
.badge.gold { background: rgba(201, 168, 106, 0.25); color: var(--gold); }
.badge.green { background: rgba(127, 214, 148, 0.18); color: var(--up); }
.badge.red { background: rgba(240, 122, 122, 0.18); color: var(--down); }
.badge.gray { background: rgba(255, 255, 255, 0.08); color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; padding: 6px 6px; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
td { padding: 7px 6px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); vertical-align: middle; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td input { padding: 5px 8px; width: 84px; text-align: right; }
.member { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.member .av, .member img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: #3a2a22; color: var(--gold); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.member .name { font-weight: 600; }
.member .grow { flex: 1; min-width: 0; }
.member .handle { color: var(--muted); font-size: 12px; }
.omen { display: flex; gap: 5px; margin: 6px 0; }
.pcard { width: 34px; height: 48px; border-radius: 5px; background: #f7f3ea; color: #1a1a22; display: flex; flex-direction: column; align-items: center; justify-content: center; font: 700 14px Georgia, serif; line-height: 1; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); }
.pcard.red { color: #c0202a; }
.pcard span:last-child { font-size: 16px; }
.titles { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.title { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; background: rgba(201, 168, 106, 0.14); border: 1px solid var(--gold-dim); font-size: 12px; cursor: help; }
.rsvp { display: flex; gap: 6px; }
.rsvp .btn { flex: 1; }
.spark { width: 100%; height: 160px; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 12px; margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.big { font-size: 28px; font-family: Georgia, serif; color: var(--gold); line-height: 1.1; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .muted { font-size: 12px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.hero { text-align: center; padding: 8px 0 12px; }
.hero h1 { font-size: 34px; margin-bottom: 2px; }
.hero .tag { color: var(--muted); font-style: italic; font-family: Georgia, serif; }
.bsky { display: inline-flex; align-items: center; gap: 8px; }
.copy { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; word-break: break-all; background: rgba(0, 0, 0, 0.35); padding: 6px 8px; border-radius: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
hr { border: 0; border-top: 1px solid rgba(255, 255, 255, 0.08); margin: 14px 0; }
.toasts { position: fixed; left: 16px; bottom: 18px; z-index: 5; display: flex; flex-direction: column; gap: 8px; pointer-events: none; max-width: min(440px, calc(100vw - 32px)); }
.toast { background: rgba(22, 13, 11, 0.88); color: #f3e7c6; border: 1px solid var(--gold-dim); border-radius: 12px; padding: 9px 14px; font-size: 14px; line-height: 1.35; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); animation: toast-in 0.35s ease-out; transition: opacity 0.6s, transform 0.6s; }
.toast.gone { opacity: 0; transform: translateY(8px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
.hud { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 4; background: rgba(22, 13, 11, 0.85); color: #f3e7c6; border: 1px solid var(--gold-dim); border-radius: 999px; padding: 7px 16px; font: 600 14px system-ui, sans-serif; white-space: nowrap; pointer-events: none; backdrop-filter: blur(8px); }
.reticle { position: fixed; left: 0; top: 0; z-index: 4; width: 26px; height: 26px; border: 2px solid var(--gold); border-radius: 50%; pointer-events: none; box-shadow: 0 0 10px rgba(201, 168, 106, 0.6), inset 0 0 6px rgba(201, 168, 106, 0.4); }
.reticle::before, .reticle::after { content: ""; position: absolute; background: var(--gold); }
.reticle::before { left: 50%; top: -6px; width: 2px; height: 34px; margin-left: -1px; opacity: 0.6; }
.reticle::after { top: 50%; left: -6px; height: 2px; width: 34px; margin-top: -1px; opacity: 0.6; }
.tool { position: fixed; left: 16px; top: 66px; z-index: 4; width: 40px; height: 40px; border-radius: 12px; background: rgba(22, 13, 11, 0.85); border: 1px solid var(--gold-dim); font-size: 22px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.tool.on { background: rgba(201, 168, 106, 0.4); border-color: var(--gold); box-shadow: 0 0 14px rgba(120, 220, 255, 0.6); }
.safe-ui { position: absolute; left: 30%; top: 45%; transform: translate(-50%, -50%); pointer-events: auto; background: var(--ink); border: 1px solid var(--gold-dim); border-radius: 14px; padding: 16px 18px; width: 300px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }
.safe-ui h3 { margin-top: 0; color: var(--gold); }
.safe-ui input { width: 72px; text-align: center; font-size: 20px; font-variant-numeric: tabular-nums; }
.seat.turn { border-color: var(--up); box-shadow: 0 0 16px rgba(127, 214, 148, 0.45); }
.seat.folded { opacity: 0.45; }
.seat.won { border-color: var(--gold); box-shadow: 0 0 16px rgba(201, 168, 106, 0.5); }
.seat .act { font-size: 11px; color: var(--gold); }
.seat .act:empty { display: none; }
.log { max-height: 240px; overflow-y: auto; font-size: 13px; display: flex; flex-direction: column; gap: 3px; padding-right: 4px; }
.log .chat { color: var(--gold); font-style: italic; }
.log .sys { color: var(--muted); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.actions .btn { flex: 1; }
input[type="range"] { width: 100%; padding: 0; accent-color: var(--gold); background: transparent; border: 0; }
.secrets { margin-top: 14px; }
.secret { display: flex; gap: 8px; font-size: 13px; padding: 3px 0; }
.secret .n { color: var(--muted); }
.secret.found .n { color: var(--cream); }
.nowebgl { position: fixed; inset: 0; background: radial-gradient(ellipse at 50% 30%, #1f5a3a, #0b0709 70%); z-index: 0; }
