/* WarTable — mobile-first styles. Big touch targets. */
:root {
  --bg: #14101d;
  --panel: #1e1830;
  --panel-2: #262041;
  --line: #3a3157;
  --text: #f2ecff;
  --muted: #a89cc9;
  --accent: #ffb347;
  --accent-2: #7c5cff;
  --danger: #ff5d5d;
  --good: #5dd39e;
  --radius: 14px;
  --tap: 52px; /* minimum touch target */
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior-y: contain;
}
#app { max-width: 900px; margin: 0 auto; padding: 12px 12px calc(24px + env(safe-area-inset-bottom)); }
h1, h2, h3 { margin: 0.4em 0; line-height: 1.2; }
p { color: var(--muted); line-height: 1.5; }
a { color: var(--accent); }

/* ---------- buttons & inputs ---------- */
button, .btn {
  font-size: 17px; font-weight: 700; color: var(--text);
  background: var(--panel-2); border: 2px solid var(--line);
  border-radius: var(--radius); min-height: var(--tap);
  padding: 12px 18px; cursor: pointer; touch-action: manipulation;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
button:active, .btn:active { transform: scale(0.97); }
button.primary, .btn.primary { background: linear-gradient(135deg, var(--accent-2), #4a2fc9); border-color: transparent; }
button.accent, .btn.accent { background: linear-gradient(135deg, #ff9a3c, #ff5d5d); border-color: transparent; color: #1d1005; }
button.ghost { background: transparent; }
button.danger { border-color: var(--danger); color: var(--danger); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
input[type="text"], input[type="email"], input[type="password"], select {
  font-size: 17px; color: var(--text); background: var(--panel);
  border: 2px solid var(--line); border-radius: var(--radius);
  min-height: var(--tap); padding: 12px 14px; width: 100%;
}
label { display: block; font-weight: 700; margin: 14px 0 6px; }
.card {
  background: var(--panel); border: 2px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin: 12px 0;
}
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.big { font-size: 20px; }

/* ---------- hero / landing ---------- */
.hero { text-align: center; padding: 28px 8px 8px; }
.hero h1 { font-size: 34px; }
.hero .tag { font-size: 18px; color: var(--muted); }
.dice-art { font-size: 54px; letter-spacing: 6px; }

/* ---------- seats grid ---------- */
.seats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .seats { grid-template-columns: repeat(4, 1fr); } }
.seat-card {
  background: var(--panel); border: 2px solid var(--line);
  border-radius: var(--radius); padding: 12px; min-height: 120px;
  cursor: pointer; text-align: center; touch-action: manipulation;
}
.seat-card:active { transform: scale(0.98); }
.seat-card.mine { border-color: var(--accent); }
.seat-card.empty { border-style: dashed; opacity: 0.75; }
.seat-card .life { font-size: 40px; font-weight: 800; }
.seat-card .pname { font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-card .mini { font-size: 13px; color: var(--muted); }

/* ---------- counters ---------- */
.counter { background: var(--panel); border: 2px solid var(--line); border-radius: var(--radius); padding: 12px; margin: 10px 0; }
.counter .chead { display: flex; justify-content: space-between; align-items: center; }
.counter .cname { font-weight: 800; font-size: 18px; }
.counter .cval { font-size: 34px; font-weight: 800; min-width: 2ch; text-align: center; }
.stepper { display: flex; gap: 10px; margin-top: 10px; }
.stepper button { flex: 1; font-size: 24px; }

/* ---------- dice ---------- */
.dice-pick { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.die-chip {
  min-width: var(--tap); min-height: var(--tap);
  border-radius: 12px; font-weight: 800; font-size: 16px;
  border: 2px solid var(--line); background: var(--panel); color: var(--muted);
}
.die-chip.on { border-color: var(--accent); color: var(--text); background: #3a2c12; }
.dice-stage { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin: 14px 0; min-height: 90px; }
.die {
  width: 76px; height: 76px; border-radius: 16px;
  background: linear-gradient(135deg, var(--accent-2), #3a2a86);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 800; box-shadow: 0 4px 14px rgba(0,0,0,.4);
}
.die .dtype { font-size: 12px; opacity: .8; }
.die .dval { font-size: 28px; }
.die.spin-cw { animation: spinCW 0.12s linear infinite; }
.die.spin-ccw { animation: spinCCW 0.12s linear infinite; }
@keyframes spinCW { to { transform: rotate(360deg); } }
@keyframes spinCCW { to { transform: rotate(-360deg); } }
.roll-feed { margin-top: 8px; }
.roll-item { padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 15px; }
.roll-item .who { font-weight: 700; color: var(--accent); }

/* ---------- library ---------- */
.lib-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .lib-grid { grid-template-columns: repeat(5, 1fr); } }
.lib-slot {
  background: var(--panel); border: 2px dashed var(--line);
  border-radius: var(--radius); min-height: 150px; padding: 8px;
  display: flex; flex-direction: column; gap: 6px; align-items: stretch;
}
.lib-slot.filled { border-style: solid; }
.lib-slot img { width: 100%; aspect-ratio: 5/7; object-fit: cover; border-radius: 8px; background: #0c0a14; }
.lib-slot .cname { font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.lib-slot .zone-play { font-size: 12px; color: var(--accent); font-weight: 800; text-align: center; }
.lib-slot button { min-height: 44px; font-size: 14px; padding: 8px; }

/* ---------- modal ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(0,0,0,.65);
  display: flex; align-items: flex-end; justify-content: center; z-index: 50;
}
@media (min-width: 700px) { .modal-back { align-items: center; } }
.modal {
  background: var(--panel); border: 2px solid var(--line); border-radius: 18px 18px 0 0;
  width: 100%; max-width: 560px; max-height: 88vh; max-height: 88dvh;
  overflow-y: auto; padding: 18px; padding-bottom: calc(18px + env(safe-area-inset-bottom));
}
@media (min-width: 700px) { .modal { border-radius: 18px; } }
.modal h3 { margin-top: 0; }

/* ---------- toasts ---------- */
#toasts { position: fixed; bottom: calc(16px + env(safe-area-inset-bottom)); left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 99; pointer-events: none; }
.toast {
  background: #2c2547; border: 2px solid var(--line); color: var(--text);
  border-radius: 12px; padding: 12px 18px; font-weight: 700; max-width: 92vw;
  animation: toastIn .25s ease-out;
}
.toast.error { border-color: var(--danger); }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } }

/* ---------- misc ---------- */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 2px 12px; }
.topbar .title { font-weight: 800; font-size: 20px; }
.code-box {
  font-size: 30px; font-weight: 800; letter-spacing: 6px; text-align: center;
  background: var(--panel); border: 2px dashed var(--accent); border-radius: var(--radius);
  padding: 14px; margin: 12px 0; user-select: all;
}
.invite-link { word-break: break-all; font-size: 14px; }
.host-tools { border-top: 2px solid var(--line); margin-top: 18px; padding-top: 12px; }
.theme-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.theme-swatch { width: var(--tap); height: var(--tap); border-radius: 12px; border: 3px solid transparent; cursor: pointer; }
.theme-swatch.on { border-color: var(--accent); }
.seatcount-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.seatcount-pick button.on { border-color: var(--accent); background: #3a2c12; }
table.kv { width: 100%; border-collapse: collapse; font-size: 15px; }
table.kv td { padding: 8px 4px; border-bottom: 1px solid var(--line); }
table.kv td:first-child { color: var(--muted); }
.legal { font-size: 14px; background: var(--panel); border: 2px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 14px 0; }
.hidden-file { display: none; }
.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.badge { display: inline-block; font-size: 13px; font-weight: 700; background: var(--panel); border: 1px solid var(--accent); border-radius: 999px; padding: 3px 10px; margin-left: 6px; white-space: nowrap; }
.picked { outline: 3px solid var(--accent); border-radius: 10px; background: var(--panel); }
