:root {
  --bg: #0f1115;
  --card: #151923;
  --muted: #9aa3b2;
  --text: #e6eaf2;
  --accent: #5b8cff;
  --danger: #ff6b6b;
  --warn: #ffd166;
  --success: #24c17a;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial; background: linear-gradient(180deg, #0b0d12, #0f1115); color: var(--text); }
.container { max-width: 1400px; margin: 2rem auto; padding: 0 1rem; }
.topbar { display:flex; align-items:center; justify-content:space-between; }
.topbar-actions .ghost { background: transparent; border:1px solid #2a2f3b; color: var(--text); }
.session-id-display { color: var(--muted); font-size: 0.85em; font-weight: 500; margin-left: 0.5rem; }

/* User header styles */
.user-header { position: fixed; top: 0; right: 0; padding: 0.75rem 1rem; display: flex; align-items: center; gap: 0.75rem; z-index: 100; background: rgba(15, 17, 23, 0.95); backdrop-filter: blur(10px); border-bottom-left-radius: 8px; border-bottom: 1px solid #1f2430; border-left: 1px solid #1f2430; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); }
.user-header.hidden { display: none; }
.user-username { color: var(--text); font-weight: 500; font-size: 0.9rem; white-space: nowrap; }
.user-header button.logout-btn, .user-header button.login-btn { background: transparent; border: 1px solid #2a2f3b; color: var(--text); padding: 0.4rem 0.8rem; border-radius: 6px; font-size: 0.85rem; font-weight: 500; cursor: pointer; margin: 0; transition: all 0.2s; white-space: nowrap; }
.user-header button.logout-btn:hover { background: rgba(255, 107, 107, 0.1); border-color: var(--danger); color: var(--danger); }
.user-header button.login-btn:hover { background: rgba(91, 140, 255, 0.1); border-color: var(--accent); color: var(--accent); }
.user-header button.logout-btn:active, .user-header button.login-btn:active { transform: translateY(1px); }

.card { background: var(--card); border: 1px solid #1f2430; border-radius: 12px; padding: 1rem; box-shadow: 0 10px 20px rgba(0,0,0,0.25); margin-bottom: 1rem; }
.grid { display: grid; grid-template-columns: 1.2fr 1.8fr; gap: 1rem; }
@media (max-width: 1000px) { .grid { grid-template-columns: 1fr; } }

label { display: block; font-weight: 600; margin-bottom: .4rem; }
label.inline-label { display: inline-flex; align-items: center; margin-bottom: 0; margin-right: 0.4rem; font-weight: 500; }
input, textarea, select { width: 100%; padding: .5rem .6rem; border-radius: 8px; border: 1px solid #2a2f3b; background: #0f1320; color: var(--text); }
textarea { resize: vertical; }
.bank-goto-input { width: 25% !important; }

button { background: var(--accent); color: white; border: none; padding: .6rem .9rem; border-radius: 10px; cursor: pointer; font-weight: 600; margin-left: .5rem; }
button:hover { filter: brightness(1.12); }
button:active { transform: translateY(1px); }
button.warn { background: var(--warn); color: #111; }
button.danger { background: var(--danger); }
button:disabled { background: #2a2f3b; color: var(--muted); cursor: not-allowed; }

.row { display: flex; align-items: flex-end; gap: .6rem; margin: .6rem 0; flex-wrap: wrap; }
.roles { display: flex; gap: .8rem; align-items: center; }
.role-option { 
  display: flex; 
  align-items: center; 
  cursor: pointer; 
  margin: 0;
  position: relative;
}
.role-option input[type="radio"] { 
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.role-label {
  display: inline-block;
  padding: .5rem 1rem;
  border-radius: 8px;
  border: 1px solid #2a2f3b;
  background: #0f1320;
  color: var(--text);
  font-weight: 500;
  transition: all 0.2s ease;
  min-width: 80px;
  text-align: center;
}
.role-option input[type="radio"]:checked + .role-label {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(91, 140, 255, 0.2);
}
.role-option:hover .role-label {
  border-color: #3a4150;
  background: #151a25;
}
.role-option input[type="radio"]:checked + .role-label:hover {
  background: #6b9aff;
  border-color: #6b9aff;
}
.error { color: var(--danger); margin-top: .5rem; }
.muted { color: var(--muted); font-size: .9rem; }
.hidden { display: none; }
.divider { height: 1px; background: #232a37; margin: .8rem 0; }
.center { text-align:center; }

.turn-banner { display:flex; align-items:center; gap:.5rem; margin-bottom:.6rem; padding:.5rem .6rem; border:1px dashed #2a2f3b; border-radius:10px; }
.turn-banner.active { border-color: var(--accent); background: rgba(91,140,255,0.08); }
.turn-banner.waiting-host { border-color: var(--warn); background: rgba(255,209,102,0.15); border-width: 2px; border-style: solid; animation: pulse-waiting 2s ease-in-out infinite; }
.turn-banner.waiting-host .dot { background: var(--warn); }
.dot { width: 10px; height:10px; border-radius:50%; display:inline-block; background: var(--muted); }
.pulse { animation: pulse 1.2s infinite; }
.turn-banner.active .dot { background: var(--accent); }
@keyframes pulse-waiting {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,209,102,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(255,209,102,0); }
}

.turn-indicator { margin-top:.6rem; padding:.4rem .6rem; border-radius:8px; background:#121725; border:1px solid #222a3a; }
.turn-indicator.active { box-shadow: 0 0 0 3px rgba(91,140,255,0.15); }
.turn-indicator.me { border-color: var(--success); background: rgba(36, 193, 122, 0.12); }

#players-table, #answers-table { width: 100%; border-collapse: collapse; table-layout: auto; }
#players-table th, #players-table td, #answers-table th, #answers-table td { border-bottom: 1px solid #232a37; padding: .5rem; text-align: left; vertical-align: middle; }
#players-table th, #answers-table th { color: var(--muted); font-weight: 500; text-align: left !important; }
#answers-table td:nth-child(3) { white-space: nowrap; }
#players-table tr.turn-now { background: rgba(91,140,255,0.08); }

.stats { display:grid; grid-template-columns: repeat(7, auto); gap: .8rem 1rem; margin-bottom:.8rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Courier New', monospace; }

/* Stacked KPI-style Q/H/A layout */
.qgrid { display:grid; grid-template-columns: 1fr; gap: .8rem; align-items:center; justify-items:center; margin:.8rem 0; }
.qbox { background:#111623; border:1px solid #232a37; border-radius:12px; padding:.8rem 1rem; width:100%; text-align:center; }
.qbox-label { color: var(--muted); font-weight:700; letter-spacing:.02em; }
.qbox-value { font-size:1.15rem; font-weight:700; margin-top:.2rem; white-space: pre-line; }

.preview { padding: .6rem .8rem; border:1px dashed #2a2f3b; border-radius: 10px; background: rgba(91,140,255,0.06); }

.reveal-box { margin: .6rem 0; padding:.6rem .8rem; border:1px dashed #2a2f3b; border-radius:10px; background: rgba(36, 193, 122, 0.08); }
.reveal-box .mini { width:100%; border-collapse: collapse; }
.reveal-box .mini th, .reveal-box .mini td { border-bottom:1px dashed #293244; padding:.35rem .4rem; }
.reveal-box .mini th { color: var(--muted); font-weight: 500; }

.you-pill { display:inline-flex; align-items:center; gap:.4rem; margin:.4rem 0 .8rem; padding:.35rem .6rem; border-radius:999px; background: rgba(91, 140, 255, 0.12); border: 1px solid rgba(91, 140, 255, 0.35); font-weight: 700; }
.blind-pill { background: rgba(255, 255, 255, 0.1); border:1px solid #2a2f3b; padding:.1rem .45rem; border-radius:999px; font-size:.85rem; }

.kpis { gap: .8rem; width: 100%; }
.kpis .kpi { flex: 1; min-width: 0; }
.kpi { background:#111623; border:1px solid #232a37; border-radius:10px; padding:.6rem .8rem; min-width:140px; text-align:center; }
.kpi-label { color: var(--muted); font-size:.85rem; }
.kpi-value { font-size:1.3rem; font-weight:800; margin-top:.1rem; }
.kpi-wide { width:100%; margin-top:.4rem; }

details summary { cursor: pointer; font-weight: 800; padding: .4rem .6rem; border: 1px solid #2a2f3b; border-radius: 10px; background: #0f1320; list-style: none; }
details[open] summary { background: rgba(91,140,255,0.08); border-color: var(--accent); }
details .top-pad { margin-top: .6rem; }

.overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.55); display:flex; align-items:center; justify-content:center; z-index: 1000; }
.overlay-card { background: var(--card); border: 1px solid #2a2f3b; border-radius: 14px; padding: 1rem 1.2rem; width: min(520px, 92vw); box-shadow: 0 20px 40px rgba(0,0,0,0.5); }
.overlay .winners { list-style: none; padding-left: 0; }
.overlay .winners li { display:flex; align-items:center; justify-content:space-between; padding: .4rem 0; border-bottom: 1px dashed #262d3a; }
.overlay .winners li:last-child { border-bottom: none; }
.overlay .gain { color: var(--success); font-weight: 700; }
.overlay .potline { margin: .4rem 0 .6rem; }
.overlay .end { justify-content: flex-end; }

.overlay.hidden { display: none !important; }

.turn-indicator.good { border-color: var(--success); background: rgba(36,193,122,0.12); color: var(--success); }
.qbox.public { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(91,140,255,0.15) inset; }
.qbox.public .qbox-label::after { content: ' •'; color: var(--accent); font-weight: 800; }
.tag-closest { display:inline-block; margin-left:.4rem; padding:.1rem .35rem; font-size:.75rem; border-radius:6px; background:rgba(36,193,122,0.15); color:var(--success); border:1px solid rgba(36,193,122,0.35); vertical-align:middle; }
.tag-folded { display:inline-block; margin-left:.4rem; padding:.1rem .35rem; font-size:.75rem; border-radius:6px; background:rgba(255,107,107,0.15); color:var(--danger); border:1px solid rgba(255,107,107,0.35); vertical-align:middle; }

