/* ═══════════════════════════════════════════════════════════════
   Sprint Poker — Stylesheet
   Light & dark theme, mobile-first, no frameworks
═══════════════════════════════════════════════════════════════ */

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  /* Brand */
  --primary:        #6366f1;
  --primary-hover:  #4f52e0;
  --primary-light:  #eef2ff;
  --danger:         #ef4444;
  --danger-hover:   #dc2626;
  --success:        #22c55e;
  --warning:        #f59e0b;

  /* Light theme surfaces */
  --bg:             #f8fafc;
  --surface:        #ffffff;
  --surface-2:      #f1f5f9;
  --border:         #e2e8f0;

  /* Light theme text */
  --text:           #0f172a;
  --text-muted:     #64748b;
  --text-inverse:   #ffffff;

  /* Card game */
  --card-bg:        #ffffff;
  --card-border:    #cbd5e1;
  --card-hover-bg:  #eef2ff;
  --card-hover-border: #6366f1;
  --card-selected-bg:  #6366f1;
  --card-selected-text: #ffffff;
  --card-selected-border: #4f52e0;

  /* Shadows */
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:   0 4px 12px rgba(0,0,0,.1), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:   0 10px 25px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.08);

  /* Misc */
  --radius:      0.75rem;
  --radius-sm:   0.5rem;
  --radius-lg:   1rem;
  --transition:  0.2s ease;
}

/* Dark theme */
[data-theme="dark"] {
  --bg:             #0f172a;
  --surface:        #1e293b;
  --surface-2:      #273449;
  --border:         #334155;

  --text:           #f1f5f9;
  --text-muted:     #94a3b8;
  --text-inverse:   #0f172a;

  --primary-light:  #1e2a4a;

  --card-bg:        #1e293b;
  --card-border:    #334155;
  --card-hover-bg:  #1e2a4a;
  --card-hover-border: #6366f1;
  --card-selected-bg:  #6366f1;
  --card-selected-text: #ffffff;
  --card-selected-border: #818cf8;

  --shadow-sm:   0 1px 3px rgba(0,0,0,.3);
  --shadow-md:   0 4px 12px rgba(0,0,0,.4);
  --shadow-lg:   0 10px 25px rgba(0,0,0,.5);
}

/* ── Reset / Base ──────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Improve scrolling performance and behavior globally */
* {
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch; /* iOS momentum scrolling */
}

/* Better scroll containment for scrollable elements */
[style*="overflow-y: auto"],
[style*="overflow: auto"],
.room-sidebar,
.room-main,
.table-bottom,
.session-history-table-wrap {
  overscroll-behavior: contain;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 80px; /* Account for sticky header */
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
               'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100dvh;
  transition: background var(--transition), color var(--transition);
  overscroll-behavior: contain; /* Prevent scroll chaining */
  scroll-padding-top: 80px; /* Account for sticky elements */
}

img, svg { display: block; max-width: 100%; }

ul, ol { list-style: none; }

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

/* ── Utilities ─────────────────────────────────────────────── */
.hidden        { display: none !important; }
.text-center   { text-align: center; }
.muted         { color: var(--text-muted); font-size: .875rem; }

/* ── Theme toggle ──────────────────────────────────────────── */
.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background var(--transition), border-color var(--transition),
              transform var(--transition);
  font-size: 1.1rem;
  line-height: 1;
}
.theme-toggle:hover { transform: scale(1.1); }

/* Inline variant — used inside the room header (not fixed) */
.theme-toggle-inline {
  position: static;
  box-shadow: none;
  flex-shrink: 0;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .65rem 1.25rem;
  border-radius: var(--radius-sm);
  border: none;
  font-size: .9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition),
              box-shadow var(--transition), opacity var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:active  { transform: scale(.97); }
.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); box-shadow: var(--shadow-sm); }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--border); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); }

.btn-sm   { padding: .45rem .85rem; font-size: .85rem; }
.btn-full { width: 100%; }

.btn-icon {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .4rem .6rem;
  font-size: .9rem;
  cursor: pointer;
  transition: background var(--transition);
}
.btn-icon:hover { background: var(--border); }

/* ── Forms ─────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  margin-bottom: 1rem;
}
.form-group label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.form-group input,
.form-group select {
  padding: .7rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
}
.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}
.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
.form-group input::placeholder { color: var(--text-muted); }

/* ── Card (surface panel) ──────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
}
.card-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: var(--text);
}
.card-subtitle {
  font-size: .875rem;
  color: var(--text-muted);
  margin-top: -.75rem;
  margin-bottom: 1rem;
}

/* ═══════════════════════════════════════════════════════════════
   HOME PAGE
═══════════════════════════════════════════════════════════════ */
.home-main {
  max-width: 520px;
  margin: 0 auto;
  padding: 2.5rem 1rem 5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.home-hero {
  text-align: center;
  padding: 1rem 0 .5rem;
}
.hero-logo {
  font-size: 3.5rem;
  line-height: 1;
  margin-bottom: .5rem;
  animation: float 3s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}
.hero-title {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -.03em;
  background: linear-gradient(135deg, var(--primary), #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-subtitle {
  margin-top: .35rem;
  color: var(--text-muted);
  font-size: 1.05rem;
}

/* Create-success */
.create-success {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
}
.success-icon   { font-size: 2.5rem; margin-bottom: .5rem; }
.success-label  { font-size: 1.1rem; font-weight: 700; margin-bottom: .25rem; }
.success-room-name { font-size: 1.25rem; font-weight: 800; color: var(--primary); margin-bottom: .25rem; }
.success-expires { font-size: .85rem; color: var(--text-muted); margin-bottom: 1rem; }
.success-share-label { font-size: .85rem; font-weight: 600; color: var(--text-muted);
                        text-transform: uppercase; letter-spacing: .05em; margin-bottom: .5rem; }

.share-url-box {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .6rem .75rem;
  overflow: hidden;
}
.share-url {
  font-size: .85rem;
  color: var(--primary);
  word-break: break-all;
  flex: 1;
  text-align: left;
}
.share-actions {
  display: flex;
  gap: .75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.share-actions .btn { flex: 1; min-width: 120px; }

/* Quick rooms */
.quick-rooms {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}
.quick-room-btn {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .85rem 1rem;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
  transition: background var(--transition), border-color var(--transition),
              transform var(--transition), box-shadow var(--transition);
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.quick-room-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.quick-room-btn:active { transform: scale(.97); }
.quick-room-icon { font-size: 1.2rem; flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════════
   ROOM PAGE — SCREENS
═══════════════════════════════════════════════════════════════ */
.screen {
  min-height: 100dvh;
}

/* ── Join screen ────────────────────────────────────────────── */
.join-card {
  max-width: 420px;
  margin: 0 auto;
  padding: 3rem 1rem 5rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.join-logo  { font-size: 3rem; text-align: center; margin-bottom: .5rem; }
.join-title { font-size: 1.75rem; font-weight: 800; text-align: center;
               background: linear-gradient(135deg, var(--primary), #818cf8);
               -webkit-background-clip: text; -webkit-text-fill-color: transparent;
               background-clip: text; margin-bottom: .25rem; }
.join-room-label { text-align: center; color: var(--text-muted); margin-bottom: 1.5rem; font-size: .95rem; }
.join-room-label span { font-weight: 700; color: var(--text); }
.join-error {
  margin-top: .75rem;
  padding: .75rem 1rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  color: #b91c1c;
  font-size: .9rem;
}
[data-theme="dark"] .join-error {
  background: #2d1b1b;
  border-color: #7f1d1d;
  color: #fca5a5;
}

/* ── Room header ────────────────────────────────────────────── */
.room-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}
.room-header-left {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-width: 0;
}
.room-header-logo { font-size: 1.75rem; flex-shrink: 0; }
.room-header-title {
  font-size: 1.1rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}
.room-expires {
  font-size: .75rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.room-expires.expiring {
  color: var(--warning);
  font-weight: 600;
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .5; }
}
.room-header-actions {
  display: flex;
  gap: .5rem;
  flex-shrink: 0;
}

#sessionHistoryBtn {
  display: none; /* Hidden by default, shown by JS when there's history */
}

/* ── Room layout ────────────────────────────────────────────── */
.room-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: calc(100dvh - 64px);
}

/* ── Room sidebar ──────────────────────────────────────────── */
.room-sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch; /* iOS momentum scrolling */
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar-heading {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
}

/* Participant list */
.participant-list {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.participant-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .55rem .75rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: .9rem;
  transition: background var(--transition);
}
.participant-item.disconnected { opacity: .45; }
.participant-name-wrap {
  display: flex;
  align-items: center;
  gap: .4rem;
  min-width: 0;
}
.participant-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}
.participant-dot.offline { background: var(--text-muted); }
.participant-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.participant-badge {
  font-size: .7rem;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 999px;
  padding: .1rem .5rem;
  font-weight: 700;
  flex-shrink: 0;
}
[data-theme="dark"] .participant-badge { background: #1e2a4a; color: #818cf8; }
.vote-indicator {
  font-size: .78rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.vote-indicator.voted { color: var(--success); font-weight: 600; }

.participant-remove-btn {
  flex-shrink: 0;
  margin-left: .25rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: .75rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition),
              transform var(--transition);
  /* always visible for facilitator — JS adds .facilitator-visible class */
  opacity: 0;
}
.participant-item:hover .participant-remove-btn { opacity: 1; }
/* Facilitator always sees the remove button */
.participant-remove-btn.facilitator-visible { opacity: 1; }
.participant-remove-btn:hover {
  background: var(--danger);
  color: #fff;
  transform: scale(1.15);
}
.participant-remove-btn:active { transform: scale(.95); }

/* Facilitator controls */
.facilitator-controls,
.waiting-state {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.facilitator-badge {
  font-size: .8rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  padding: .5rem .75rem;
}
[data-theme="dark"] .facilitator-badge { background: #1e2a4a; }
.vote-status {
  font-size: .9rem;
  color: var(--text-muted);
  text-align: center;
}
.vote-status span { font-weight: 700; color: var(--text); }
.waiting-msg { text-align: center; font-size: .85rem; }

/* ── Room main ──────────────────────────────────────────────── */
/* ── Room main ──────────────────────────────────────────────── */
.room-main {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg);
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch; /* iOS momentum scrolling */
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  scroll-padding-top: 20px;
}

/* Results panel */
.results-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.results-heading {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text);
}
.results-grid {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin-bottom: 1.25rem;
}
.result-group { display: flex; flex-direction: column; gap: .25rem; }

.result-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .45rem .75rem;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  font-size: .85rem;
  margin-top: .5rem;
  cursor: pointer;
  user-select: none;
}
.result-group-header:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.result-group-header:first-child { margin-top: 0; }
.result-group-sp { font-weight: 800; }
.result-group-right { display: flex; align-items: center; gap: .5rem; }
.result-group-count { font-weight: 600; opacity: .9; }
.result-group-chevron {
  font-size: .65rem;
  transition: transform .2s ease;
  opacity: .85;
}
.result-group-chevron.rotated { transform: rotate(90deg); }

/* Body: collapsed by default */
.result-group-body {
  display: none;
  flex-direction: column;
  gap: .25rem;
}
.result-group-body.open { display: flex; }

.result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .55rem .75rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: .95rem;
  gap: .5rem;
}
.result-row-grouped {
  padding-left: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
}
[data-theme="dark"] .result-row-grouped { background: #131e35; }
.result-name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.results-stats {
  display: flex;
  justify-content: center;
  gap: .75rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}
.stat-item { text-align: center; }
.stat-label { font-size: .7rem; font-weight: 700; text-transform: uppercase;
               letter-spacing: .06em; color: var(--text-muted); }
.stat-value { font-size: 1.3rem; font-weight: 800; color: var(--text); margin-top: .1rem; }
.stat-value.highlight { color: var(--primary); }

/* Cards section */
.cards-section {
  width: 15%;
  position: fixed;
  left: 1%;
  top: 125px;
}
.cards-heading {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: .65rem;
}

.poker-card {
  aspect-ratio: 2 / 3;
  background: var(--card-bg);
  border: 2px solid var(--card-border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 800;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition),
              transform .15s ease, box-shadow var(--transition);
  box-shadow: var(--shadow-sm);
  position: relative;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  color: var(--text);
}
.poker-card::before,
.poker-card::after {
  content: attr(data-value);
  position: absolute;
  font-size: .6rem;
  font-weight: 700;
  color: inherit;
  opacity: .6;
}
.poker-card::before { top: .35rem; left: .4rem; }
.poker-card::after  { bottom: .35rem; right: .4rem; transform: rotate(180deg); }

.poker-card:hover:not(.selected):not(:disabled) {
  background: var(--card-hover-bg);
  border-color: var(--card-hover-border);
  transform: translateY(-4px) scale(1.03);
  box-shadow: var(--shadow-md);
}
.poker-card:active:not(:disabled) { transform: translateY(-1px) scale(.99); }

.poker-card.selected {
  background: var(--card-selected-bg);
  border-color: var(--card-selected-border);
  color: var(--card-selected-text);
  transform: translateY(-6px);
  box-shadow: 0 8px 20px rgba(99,102,241,.35);
}

.poker-card:disabled,
.poker-card.revealed-disabled {
  cursor: default;
  opacity: .6;
}
.poker-card.coffee { font-size: 1.5rem; }

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  position: relative;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}
.modal.modal-large {
  max-width: 900px;
  padding: 1.5rem;
}
.modal h3 { 
  font-size: 1.15rem; 
  font-weight: 700; 
  margin-bottom: .5rem; 
}
.modal-close {
  position: absolute;
  top: .75rem; 
  right: .75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 2rem; 
  height: 2rem;
  display: flex; 
  align-items: center; 
  justify-content: center;
  cursor: pointer; 
  font-size: .85rem;
  transition: background var(--transition);
  z-index: 1;
}
.modal-close:hover { 
  background: var(--border); 
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.modal-header h3 {
  margin-bottom: 0;
}

.session-history-modal-content {
  min-height: 200px;
}

.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state h4 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.empty-state p {
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
═══════════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 2000;
  display: flex;
  flex-direction: column-reverse;
  gap: .5rem;
  pointer-events: none;
  max-width: 340px;
  width: calc(100% - 2.5rem);
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
  box-shadow: var(--shadow-lg);
  font-size: .875rem;
  color: var(--text);
  pointer-events: all;
  display: flex;
  align-items: center;
  gap: .6rem;
  animation: slideUp .25s ease forwards;
}
.toast.toast-success { border-left: 3px solid var(--success); }
.toast.toast-error   { border-left: 3px solid var(--danger); }
.toast.toast-warning { border-left: 3px solid var(--warning); }
.toast.toast-info    { border-left: 3px solid var(--primary); }
.toast.toast-out     { animation: slideDown .25s ease forwards; }

@keyframes slideUp   { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 1; transform: translateY(0); }    to { opacity: 0; transform: translateY(12px); } }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE
═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Room layout: stack vertically */
  .room-layout {
    grid-template-columns: 1fr;
    min-height: unset;
  }

  /* Sidebar goes to bottom on mobile as a sticky tray */
  .room-sidebar {
    border-right: none;
    border-top: 1px solid var(--border);
    order: 2;
    padding: 1rem;
    max-height: 40vh; /* Limit height on mobile */
    overflow-y: auto;
    overflow-x: hidden;
  }

  .room-main {
    order: 1;
    padding: 1rem;
    /* leave room for sticky voting area */
    padding-bottom: 1rem;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 60vh; /* Prevent full screen scrolling issues */
  }

  /* Cards: bigger touch targets */
  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: .6rem;
  }
  .poker-card {
    font-size: 1.1rem;
  }

  /* Room header */
  .room-header-title { max-width: 140px; font-size: 1rem; }
  .room-header { padding: .7rem 1rem; }

  /* Results stats on mobile */
  .results-stats {
    justify-content: center;
  }

  /* Quick rooms: single column on small phones */
  @media (max-width: 360px) {
    .quick-rooms { grid-template-columns: 1fr; }
  }

  /* Share URL box */
  .share-url { font-size: .78rem; }

  /* Toast at bottom-center on mobile */
  .toast-container {
    right: 50%;
    transform: translateX(50%);
    bottom: 1rem;
    max-width: calc(100% - 2rem);
    width: calc(100% - 2rem);
  }

  /* Modal adjustments for mobile */
  .modal.modal-large {
    max-width: calc(100vw - 1rem);
    padding: 1rem;
    max-height: calc(100vh - 1rem);
  }

  .modal-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .modal-header h3 {
    text-align: center;
  }
}

/* Narrow phones */
@media (max-width: 400px) {
  .home-main { padding: 1.5rem .75rem 4rem; }
  .card       { padding: 1.25rem; }
  .hero-title { font-size: 1.9rem; }
}

/* ═══════════════════════════════════════════════════════════════
   FOCUS VISIBLE (accessibility)
═══════════════════════════════════════════════════════════════ */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════════
   SCROLLBAR STYLING (webkit + Firefox)
═══════════════════════════════════════════════════════════════ */
/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* WebKit scrollbar */
::-webkit-scrollbar { 
  width: 8px; 
  height: 8px; 
}
::-webkit-scrollbar-track { 
  background: transparent; 
  border-radius: 4px;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
  transition: background 0.2s ease;
}
::-webkit-scrollbar-thumb:hover { 
  background: var(--text-muted); 
}
::-webkit-scrollbar-corner {
  background: transparent;
}

/* ═══════════════════════════════════════════════════════════════
   SEO LANDING SECTION
═══════════════════════════════════════════════════════════════ */
.seo-section {
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  padding: 3rem 1rem 4rem;
  margin-top: 1rem;
}

.seo-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.seo-heading {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.02em;
}

.seo-body {
  color: var(--text-muted);
  font-size: .9375rem;
  line-height: 1.75;
}
.seo-body strong { color: var(--text); }

/* Feature grid */
.seo-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.seo-feature {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.seo-feature-icon {
  font-size: 1.4rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: .1rem;
}

.seo-feature strong {
  display: block;
  font-size: .9rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .2rem;
}

.seo-feature p {
  font-size: .825rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

/* FAQ */
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}

.faq-question {
  display: block;
  padding: .9rem 1rem;
  font-size: .9375rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background var(--transition);
}
.faq-question::-webkit-details-marker { display: none; }
.faq-question::before {
  content: '+ ';
  color: var(--primary);
  font-weight: 800;
}
details[open] .faq-question::before { content: '− '; }

.faq-question:hover { background: var(--surface-2); }

.faq-answer {
  padding: 0 1rem 1rem;
  font-size: .875rem;
  color: var(--text-muted);
  line-height: 1.7;
  border-top: 1px solid var(--border);
  padding-top: .75rem;
}
.faq-answer strong { color: var(--text); }

/* Footer */
.site-footer {
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: .8125rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.site-footer a { color: var(--primary); }
.site-footer a:hover { text-decoration: underline; }

/* Responsive SEO section */
@media (max-width: 600px) {
  .seo-features {
    grid-template-columns: 1fr;
  }
  .seo-heading {
    font-size: 1.1rem;
  }
}

/* ═══════════════════════════════════════════════════════════════
   TABLE-MODE OVERRIDES (replaces old room-layout grid)
═══════════════════════════════════════════════════════════════ */

/* hide the old bottom results-panel in table mode — results live on the table now */
.room-layout.table-mode .results-panel { display: none !important; }

/* ═══════════════════════════════════════════════════════════════
   3-2-1 COUNTDOWN OVERLAY
═══════════════════════════════════════════════════════════════ */
.countdown-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(6px);
  pointer-events: all;
}
.countdown-overlay.hidden { display: none; }

.countdown-ring {
  position: relative;
  width: 180px;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.countdown-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.countdown-circle-bg {
  fill: none;
  stroke: rgba(255,255,255,.15);
  stroke-width: 6;
}

.countdown-circle-progress {
  fill: none;
  stroke: #6366f1;
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset .9s linear, stroke .3s ease;
}

.countdown-number {
  font-size: 5rem;
  font-weight: 900;
  color: #fff;
  line-height: 1;
  text-shadow: 0 4px 20px rgba(0,0,0,.5);
  animation: countBounce .9s ease-out;
  position: relative;
  z-index: 1;
}

.countdown-label {
  position: absolute;
  bottom: -2rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: .9rem;
  font-weight: 600;
  color: rgba(255,255,255,.75);
  white-space: nowrap;
  letter-spacing: .08em;
  text-transform: uppercase;
}

@keyframes countBounce {
  0%   { transform: scale(1.6); opacity: 0; }
  40%  { transform: scale(.9);  opacity: 1; }
  70%  { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* ═══════════════════════════════════════════════════════════════
   EMOJI REACTIONS
═══════════════════════════════════════════════════════════════ */

/* Floating emoji bar above the cards */
.emoji-bar {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  padding: .6rem .9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.emoji-bar-label {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-right: .25rem;
}

.emoji-btn {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .35rem .55rem;
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
  transition: transform .15s ease, background var(--transition), border-color var(--transition);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.emoji-btn:hover {
  transform: scale(1.25) rotate(-5deg);
  background: var(--primary-light);
  border-color: var(--primary);
}
.emoji-btn:active { transform: scale(.95); }

/* Flying emoji animation */
.flying-emoji {
  position: fixed;
  pointer-events: none;
  z-index: 800;
  font-size: 2.2rem;
  line-height: 1;
  animation: flyArc var(--fly-dur, 1.4s) cubic-bezier(.25, .46, .45, .94) forwards;
  will-change: transform, opacity;
}

@keyframes flyArc {
  0%   { transform: translate(0, 0) scale(1);   opacity: 1; }
  60%  { opacity: 1; }
  100% { transform: translate(var(--fly-dx), var(--fly-dy)) scale(1.6); opacity: 0; }
}

/* Burst of emojis from the target */
.emoji-burst {
  position: fixed;
  pointer-events: none;
  z-index: 800;
  font-size: 2.5rem;
  line-height: 1;
  animation: burst .8s ease-out forwards;
  will-change: transform, opacity;
}

@keyframes burst {
  0%   { transform: scale(0) rotate(0deg);   opacity: 1; }
  50%  { transform: scale(1.4) rotate(20deg); opacity: 1; }
  100% { transform: scale(.6) rotate(-10deg); opacity: 0; }
}

/* Incoming emoji toast (bottom-left) */
.emoji-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 2100;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: .6rem 1rem;
  box-shadow: var(--shadow-lg);
  font-size: .9rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: .5rem;
  animation: emojiToastIn .3s ease forwards;
  max-width: 280px;
}
.emoji-toast.out { animation: emojiToastOut .3s ease forwards; }
@keyframes emojiToastIn  { from { opacity:0; transform: translateY(12px); } to { opacity:1; transform:translateY(0); } }
@keyframes emojiToastOut { from { opacity:1; transform: translateY(0); }    to { opacity:0; transform: translateY(12px); } }

/* ═══════════════════════════════════════════════════════════════
   POKER TABLE LAYOUT
═══════════════════════════════════════════════════════════════ */

/* The entire room area (below header) is now a single column */
.room-layout.table-mode {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 64px);
  grid-template-columns: unset;
}

/* Hide traditional sidebar in table mode */
.room-layout.table-mode .room-sidebar {
  display: none;
}

/* Table-mode main fills the space */
.room-layout.table-mode .room-main {
  flex: 1;
  padding: 0;
  gap: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── The poker table scene ──────────────────────────────────── */
.poker-scene {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  /* generous padding so seats at all positions are fully visible */
  padding: 130px 120px;
  min-height: 600px;
  overflow: visible; /* changed from hidden so nothing clips */
}

/* Felt background */
.poker-scene::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 90% 80% at 50% 50%,
      #1e6b30 0%, #155221 55%, #0d3315 100%);
  z-index: 0;
}

/* The oval table surface */
.poker-table {
  position: relative;
  z-index: 1;
  width: min(560px, 70vw);
  height: min(260px, 37vw);
  min-width: 280px;
  min-height: 160px;
  background: radial-gradient(ellipse at 40% 35%, #2e8040 0%, #1e6128 60%, #164a20 100%);
  border-radius: 50%;
  box-shadow:
    0 0 0 10px #9a7520,
    0 0 0 16px #6b5010,
    0 0 0 17px rgba(0,0,0,.5),
    0 24px 70px rgba(0,0,0,.8),
    inset 0 4px 24px rgba(255,255,255,.07),
    inset 0 -4px 24px rgba(0,0,0,.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: .3rem;
  overflow: hidden;
}

/* ── Table centre: voting state ─────────────────────────────── */
.table-voting-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
  padding: .5rem;
  width: 100%;
}

.table-center-label {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(255,255,255,.3);
}

.table-vote-count {
  font-size: 1rem;
  font-weight: 800;
  color: rgba(255,255,255,.8);
  letter-spacing: .03em;
}

.table-reveal-btn {
  margin-top: .3rem;
  padding: .4rem 1rem;
  background: var(--primary);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 2px 10px rgba(99,102,241,.6);
}
.table-reveal-btn:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: scale(1.06);
  box-shadow: 0 4px 16px rgba(99,102,241,.7);
}
.table-reveal-btn:disabled { opacity: .45; cursor: default; transform: none; }

.table-new-round-btn {
  margin-top: .3rem;
  padding: .4rem 1rem;
  background: rgba(255,255,255,.18);
  border: 1.5px solid rgba(255,255,255,.35);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}
.table-new-round-btn:hover { background: rgba(255,255,255,.3); transform: scale(1.06); }

/* ── Table centre: results state ────────────────────────────── */
.table-results-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  padding: .6rem .75rem;
  width: 100%;
  max-height: 100%;
  overflow: hidden;
}
.table-results-state.hidden { display: none; }

/* Stats row: average, min, max */
.table-results-stats {
  display: flex;
  gap: .8rem;
  align-items: flex-end;
  flex-wrap: wrap;
  justify-content: center;
}

.table-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
}
.table-stat-label {
  font-size: .52rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.45);
}
.table-stat-value {
  font-size: 1.5rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,.5);
}
.table-stat-value.big {
  font-size: 2rem;
  color: #fbbf24;
  text-shadow: 0 0 20px rgba(251,191,36,.5), 0 2px 8px rgba(0,0,0,.6);
}

/* Compact vote-group pills */
.table-results-groups {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  justify-content: center;
  max-width: 100%;
}

.table-vote-pill {
  display: flex;
  align-items: center;
  gap: .25rem;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 999px;
  padding: .2rem .6rem;
  font-size: .72rem;
  color: #fff;
  white-space: nowrap;
}
.table-vote-pill-val {
  font-weight: 900;
  font-size: .82rem;
}
.table-vote-pill-names {
  opacity: .75;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Seat positions around the table ───────────────────────── */
.table-seats {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.table-seat {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  pointer-events: all;
  /* JS sets left/top; we centre via transform */
}

/* Avatar circle */
.seat-avatar {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 12px rgba(0,0,0,.55), 0 0 0 2px rgba(255,255,255,.15);
  position: relative;
  flex-shrink: 0;
  border: 2.5px solid rgba(255,255,255,.2);
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: default;
}
.seat-avatar:hover { transform: scale(1.08); }
.seat-avatar.voted {
  border-color: var(--success);
  box-shadow: 0 0 0 3px rgba(34,197,94,.5), 0 3px 12px rgba(0,0,0,.55);
}
.seat-avatar.is-me {
  background: #7c3aed;
  border-color: #a78bfa;
}
.seat-avatar.is-creator { background: #d97706; border-color: #fbbf24; }
.seat-avatar.offline { opacity: .4; }

/* Online dot */
.seat-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  border: 2px solid #1a5c25;
  box-shadow: 0 0 4px rgba(34,197,94,.6);
}
.seat-dot.offline { background: #64748b; box-shadow: none; }

/* Name label — larger and higher contrast */
.seat-name {
  font-size: .78rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 6px rgba(0,0,0,.95), 0 0 12px rgba(0,0,0,.8);
  white-space: nowrap;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  background: rgba(0,0,0,.55);
  border-radius: 999px;
  padding: .15rem .55rem;
  letter-spacing: .01em;
  border: 1px solid rgba(255,255,255,.12);
}

/* Card on each seat */
.seat-card {
  width: 2.1rem;
  height: 2.9rem;
  border-radius: .4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  font-weight: 900;
  box-shadow: 0 3px 10px rgba(0,0,0,.6);
  transition: transform .35s cubic-bezier(.34,1.56,.64,1);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

/* Empty slot */
.seat-card.empty {
  background: transparent;
  border: 2px dashed rgba(255,255,255,.2);
  box-shadow: none;
}

/* Face-down: decorative blue back */
.seat-card.face-down {
  background: linear-gradient(145deg, #4361ee 0%, #3451c7 100%);
  border: 1.5px solid rgba(255,255,255,.25);
}
.seat-card.face-down::after {
  content: '';
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: .2rem;
  background:
    repeating-linear-gradient(45deg,
      transparent,
      transparent 4px,
      rgba(255,255,255,.04) 4px,
      rgba(255,255,255,.04) 8px);
}

/* Face-up: bright white */
.seat-card.face-up {
  background: #fff;
  border: 1.5px solid #ddd;
  color: #1a1a2e;
  animation: flipIn .4s cubic-bezier(.34,1.56,.64,1);
}
.seat-card.face-up.high-card { color: var(--primary); }

@keyframes flipIn {
  0%   { transform: rotateY(90deg) scale(.8); opacity: 0; }
  100% { transform: rotateY(0deg)  scale(1);  opacity: 1; }
}

/* Emoji trigger (hover on seat) */
.seat-emoji-trigger {
  position: absolute;
  top: -9px;
  right: -9px;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: rgba(0,0,0,.6);
  border: 1.5px solid rgba(255,255,255,.35);
  color: #fff;
  font-size: .75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition), transform var(--transition);
  line-height: 1;
}
.table-seat:hover .seat-emoji-trigger { opacity: 1; }
.seat-emoji-trigger:hover { transform: scale(1.2); }

/* Remove btn (facilitator, always visible) */
.seat-remove-btn {
  position: absolute;
  bottom: -6px;
  left: -6px;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  background: var(--danger);
  border: 1.5px solid rgba(255,255,255,.45);
  color: #fff;
  font-size: .62rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,.5);
  transition: transform var(--transition), background var(--transition);
}
.seat-remove-btn:hover { transform: scale(1.25); background: var(--danger-hover); }

/* Emoji picker popup */
.seat-emoji-picker {
  position: absolute;
  z-index: 50;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .4rem .5rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  gap: .3rem;
  white-space: nowrap;
  top: -3.8rem;
  left: 50%;
  transform: translateX(-50%);
  animation: popIn .18s ease;
}
@keyframes popIn {
  from { transform: translateX(-50%) scale(.8); opacity: 0; }
  to   { transform: translateX(-50%) scale(1);  opacity: 1; }
}
.seat-emoji-picker .emoji-btn { font-size: 1.1rem; padding: .25rem .35rem; }

/* ── Bottom strip: emoji bar + cards ────────────────────────── */
.table-bottom {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: .85rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .85rem;
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 35vh; /* reduced from 42vh so table scene has more room */
  flex-shrink: 0;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch; /* iOS momentum scrolling */
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* ── Table-mode responsive ──────────────────────────────────── */
@media (max-width: 900px) {
  .poker-scene {
    padding: 110px 90px;
    min-height: 520px;
  }
  .poker-table {
    width: min(480px, 72vw);
    height: min(220px, 33vw);
  }
}

@media (max-width: 680px) {
  .poker-scene {
    padding: 95px 70px;
    min-height: 450px;
  }
  .poker-table {
    width: min(320px, 78vw);
    height: min(160px, 40vw);
    min-width: 220px;
    min-height: 130px;
  }
  .seat-name { max-width: 72px; font-size: .7rem; }
  .seat-avatar { width: 2.4rem; height: 2.4rem; font-size: .9rem; }
  .seat-card { width: 1.7rem; height: 2.35rem; font-size: .75rem; }
  .table-stat-value.big { font-size: 1.5rem; }
  .table-stat-value { font-size: 1.1rem; }
  .table-bottom { max-height: 30vh; }
}

@media (max-width: 420px) {
  .poker-scene {
    padding: 80px 50px;
    min-height: 380px;
  }
  .poker-table {
    width: min(240px, 82vw);
    height: min(120px, 44vw);
  }
  .seat-name { max-width: 60px; font-size: .62rem; }
  .seat-avatar { width: 2rem; height: 2rem; font-size: .78rem; }
  .seat-card { width: 1.5rem; height: 2rem; font-size: .65rem; }
  .table-bottom { max-height: 28vh; }
}

/* ═══════════════════════════════════════════════════════════════
   ROUND TITLE BANNER  (shown to everyone when title is set)
═══════════════════════════════════════════════════════════════ */
.round-title-banner {
  background: var(--primary-light);
  border-bottom: 1px solid var(--border);
  padding: .6rem 1.25rem;
  display: flex;
  align-items: baseline;
  gap: .75rem;
  flex-wrap: wrap;
}
.round-title-banner.hidden { display: none; }

.round-title-badge {
  font-size: .7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--primary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .15rem .65rem;
  flex-shrink: 0;
}

.round-title-text {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  flex: 1;
  min-width: 0;
}

.round-desc-text {
  font-size: .82rem;
  color: var(--text-muted);
  width: 100%;
  margin-top: -.25rem;
}

[data-theme="dark"] .round-title-banner {
  background: #1e2a4a;
}

/* ═══════════════════════════════════════════════════════════════
   ROUND TITLE FORM  (facilitator only, inside table-bottom)
═══════════════════════════════════════════════════════════════ */
.round-title-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .65rem .9rem;
}
.round-title-form.hidden { display: none; }

.round-title-form-inner {
  display: flex;
  gap: .5rem;
  align-items: flex-start;
}

.round-form-fields {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  flex: 1;
  min-width: 0;
}

.round-title-input,
.round-desc-input {
  width: 100%;
  padding: .5rem .75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: .875rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.round-title-input::placeholder,
.round-desc-input::placeholder { color: var(--text-muted); }
.round-title-input:focus,
.round-desc-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
.round-desc-input { font-size: .82rem; }

/* ═══════════════════════════════════════════════════════════════
   FIB AVG stat value (golden accent)
═══════════════════════════════════════════════════════════════ */
.table-stat-value.fib {
  font-size: 1.6rem;
  color: #34d399;
  text-shadow: 0 0 16px rgba(52,211,153,.45), 0 2px 8px rgba(0,0,0,.5);
}

/* ═══════════════════════════════════════════════════════════════
   SESSION HISTORY TABLE (for modal)
═══════════════════════════════════════════════════════════════ */

.session-history-table-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  max-height: 60vh; /* Limit height in modal */
  overflow-y: auto;
}

.session-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
  min-width: 400px; /* Reduced from 560px since we have fewer columns */
}

.session-history-table thead tr {
  background: var(--surface-2);
}

.session-history-table th {
  padding: .55rem .85rem;
  text-align: left;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.session-history-table td {
  padding: .55rem .85rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: top;
}

.session-history-table tbody tr:last-child td {
  border-bottom: none;
}

.session-history-table tbody tr:hover {
  background: var(--surface-2);
}

.history-title-cell {
  min-width: 200px; /* Increased from 160px to give more space for titles */
}
.history-title {
  display: block;
  font-weight: 600;
}
.history-desc {
  display: block;
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: .1rem;
}
.history-votes-cell {
  max-width: 300px; /* Increased from 220px to give more space for votes */
  font-size: .8rem;
  color: var(--text-muted);
  word-break: break-word;
}
.fib-avg {
  font-weight: 700;
  color: #059669;
  text-align: center; /* Center the average values */
}
[data-theme="dark"] .fib-avg { color: #34d399; }

/* ═══════════════════════════════════════════════════════════════
   NEW ROUND MODAL  (facilitator sets next ticket before starting)
═══════════════════════════════════════════════════════════════ */
/* Re-uses existing .modal-overlay / .modal styles — no extra rules needed */

/* ═══════════════════════════════════════════════════════════════
   SOUND TOGGLE  (reuses .theme-toggle-inline styles)
═══════════════════════════════════════════════════════════════ */
/* Inherits from .theme-toggle — nothing extra required */

/* ═══════════════════════════════════════════════════════════════
   CONFETTI CANVAS  (full-screen, pointer-events: none)
═══════════════════════════════════════════════════════════════ */
#confettiCanvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 950;
  width: 100%;
  height: 100%;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE – session history on small screens
═══════════════════════════════════════════════════════════════ */
@media (max-width: 680px) {
  .round-title-banner { padding: .5rem 1rem; gap: .5rem; }
  .round-title-text   { font-size: .88rem; }
  .session-history    { padding: 1rem; }
  .round-title-form-inner { flex-direction: column; }
  .round-title-form-inner .btn { width: 100%; }
}
