*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #020617;
  --panel: #020617;
  --panel-elevated: #020617;
  --table-bg1: #0f172a;
  --table-bg2: #020617;
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.18);
  --accent-strong: #60a5fa;
  --danger: #ef4444;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --border: rgba(148, 163, 184, 0.4);
  --radius: 18px;
  --shadow: 0 22px 60px rgba(15, 23, 42, 0.9);
  --font: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
}

html,
body {
  height: 100%;
  min-height: 100%;
  margin: 0;
  padding: 0;
  font-family: var(--font);
  background: radial-gradient(circle at top, #1d2b64 0, #020617 55%, #000 100%);
  color: var(--text);
  overflow-x: hidden;
  overflow-y: auto;
  /* allow page scroll */
}


/* ========================
   Seasonal UI: December snow background
   ======================== */
.snow-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  opacity: 0.85;
}

/* Keep your app content above the snow canvas */
body {
  position: relative;
}

.app,
.page-shell,
.auth-wrapper {
  position: relative;
  z-index: 1;
}

/* Keep the game page full-screen with internal scrolling only */
/* Keep the game & history pages full-screen with internal scrolling only */
body[data-page="game"],
body[data-page="history"] {
  overflow: hidden;
  /* no page scroll, internal areas will scroll */
}

.app {
  max-width: 1200px;
  margin: 12px auto;
  padding: 12px;
  height: calc(100vh - 24px);
  /* ✅ fixed to viewport */
  display: flex;
  flex-direction: column;
}

/* Panels as flex columns so content can stretch vertically */
.left-panel,
.right-panel {
  display: flex;
  flex-direction: column;
}

.left-panel {
  min-height: 0;
  /* ✅ important so chat area can scroll */
}

.chat-panel {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  flex: 1;
  /* ✅ take up remaining height in left panel */
  min-height: 0;
  /* ✅ allow inner scroll */
}

.chat-messages {
  flex: 1;
  /* ✅ stretch to fill chat-panel */
  min-height: 0;
  /* ✅ key for scroll inside flex */
  overflow-y: auto;
  /* ✅ scroll here instead of page */
  padding-right: 4px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;

  /* 🔹 Modern scrollbar styling */
  /* Firefox */
  scrollbar-width: thin;
  scrollbar-color: var(--accent-strong) transparent;
}

/* WebKit (Chrome, Edge, Safari) */
.chat-messages::-webkit-scrollbar {
  width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: linear-gradient(180deg,
      var(--accent-soft),
      rgba(148, 163, 184, 0.8));
  border: 1px solid rgba(15, 23, 42, 0.95);
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.65);
}

.chat-messages:hover::-webkit-scrollbar-thumb {
  background: var(--accent-strong);
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.9);
}

.chat-messages::-webkit-scrollbar-corner {
  background: transparent;
}

.chat-message {
  font-size: 0.8rem;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.5);
}

/* (…keep your other .chat-message-* styles as you had them) */

.chat-panel h3 {
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.chat-message-header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
  color: var(--muted);
}

.chat-message-name {
  font-weight: 500;
}

.chat-message-time {
  font-size: 0.7rem;
}

.chat-message-text {
  color: var(--text);
  word-wrap: break-word;
  white-space: pre-wrap;
}

.chat-message.own {
  background: rgba(59, 130, 246, 0.18);
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.6);
  /* 🔹 clear blue border/glow */
}

.chat-form {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.chat-form input[type="text"] {
  flex: 1;
}

.chat-mention {
  color: var(--accent-strong);
  font-weight: 600;
}

.chat-mention-self {
  color: #fb923c;
  /* orange for mentions targeted at me / @everyone */
  font-weight: 700;
}

.chat-mention-panel {
  margin-top: 4px;
  padding: 4px 6px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(148, 163, 184, 0.5);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.9);
  max-height: 140px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-mention-option {
  border: none;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 0.8rem;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
}

.chat-mention-option:hover {
  background: rgba(30, 64, 175, 0.5);
}

.chat-mention-option.selected {
  background: rgba(30, 64, 175, 0.7);
}

/* Emoji trigger button in chat form */
.chat-emoji-btn {
  font-size: 1.3rem;
  flex-shrink: 0;
}

/* Emoji panel under the chat form */
.chat-emoji-panel {
  margin-top: 4px;
  padding: 4px 6px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.9);
  display: flex;
  flex-direction: column;
  /* ⬅️ sections stacked vertically */
  gap: 6px;
  max-height: 160px;
  /* still small, scrollable */
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-strong) transparent;
}

.chat-emoji-panel::-webkit-scrollbar {
  width: 6px;
}

.chat-emoji-panel::-webkit-scrollbar-track {
  background: transparent;
}

.chat-emoji-panel::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.8);
}

.chat-emoji-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-emoji-section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  opacity: 0.9;
}

.chat-emoji-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.chat-emoji-option {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  padding: 2px;
  border-radius: 6px;
  transition: transform 0.12s ease-out, background 0.12s ease-out;
}

.chat-emoji-option:hover {
  transform: translateY(-1px) scale(1.05);
  background: rgba(15, 23, 42, 0.9);
}

/* Top bar */

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-radius: 15px;
  background: rgba(15, 23, 42, 0.9);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.95);
  gap: 12px;
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.page-shell {
  max-width: 1100px;
  margin: 10px auto;
  min-height: calc(100vh - 20px);
  /* 100vh - (10px top + 10px bottom) */
  display: flex;
  flex-direction: column;
}

/* On history page, fix the shell height so only inner panels can scroll */
body[data-page="history"] .page-shell {
  height: calc(100vh - 20px);
  /* match the 10px top/bottom margin */
  min-height: 0;
}

/* Dashboard main layout */
.dashboard-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

/* Sticky header only on dashboard, including top space */
body[data-page="dashboard"] .top-bar.dashboard-top {
  position: sticky;
  top: 16px;
  /* this keeps the space above the header */
  z-index: 20;
}

.dashboard-credit {
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: right;
}

.dashboard-credit a {
  color: var(--accent-strong);
}

.auth-bar {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
}

.auth-user-email {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.my-rooms-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.my-rooms-list .my-room-btn {
  width: 100%;
  justify-content: flex-start;
  font-size: 0.78rem;
}

/* Scrollbars for Active / Previous rooms */
.room-list {
  max-height: 260px;
  /* you already have something like this */
  overflow-y: auto;
  scrollbar-width: thin;
  /* Firefox */
  scrollbar-color: rgba(96, 165, 250, 0.8) transparent;
}

/* WebKit (Chrome, Edge, Safari) */
.room-list::-webkit-scrollbar {
  width: 6px;
}

.room-list::-webkit-scrollbar-track {
  background: transparent;
}

.room-list::-webkit-scrollbar-thumb {
  background: linear-gradient(to bottom, #4f46e5, #38bdf8);
  border-radius: 999px;
}

.room-list::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(to bottom, #6366f1, #0ea5e9);
}

.room-closed-badge {
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.16);
  color: rgba(148, 163, 184, 0.9);
  font-size: 0.75rem;
}

/* three columns: left / center / right */

.top-left,
.top-center,
.top-right {
  flex: 1;
}

.top-left {
  display: flex;
  flex-direction: row;
  align-items: center;
  /* keep Room ID / You vertically centered with logo */
  gap: 10px;
}

.top-left-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  /* NEW: small vertical gap between rows */
}

.room-meta-row {
  margin-bottom: 0;
  /* reduce/remove extra bottom margin */
}

.top-left-leave {
  justify-content: flex-start;
  margin-top: 0;
  /* was 4px – remove to bring it closer */
}

.top-left-logo img {
  margin-top: 5px;
  margin-right: 10px;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  /* optional: soften corners */
}

.top-center {
  text-align: center;
  /* center title + subtitle */
}

.top-right-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.top-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  /* right-align content */
  gap: 4px;
}

.top-right-user {
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  gap: 6px;
  align-items: center;
}

.leave-label {
  font-size: 0.8rem;
  color: var(--text);
}

.logout-icon {
  width: 18px;
  height: 18px;
  display: block;
  fill: currentColor;
  /* uses icon-btn text color (white) */
}

.top-bar h1 {
  font-size: 1.25rem;
}

.subtitle {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 2px;
}

/* icon buttons (copy + logout) */

.icon-btn {
  border: none;
  background: transparent;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--text);
  /* white icon */
  cursor: pointer;
  transition: background 0.16s ease-out, transform 0.16s ease-out,
    box-shadow 0.16s ease-out;
}

.icon-btn:hover {
  background: rgba(15, 23, 42, 0.9);
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.6);
  transform: translateY(-1px);
}

.icon-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

/* caption + link on right */

.top-right-caption {
  font-size: 0.8rem;
  color: var(--muted);
}

.top-right-caption a {
  color: var(--text);
  /* remove default blue */
  text-decoration: underline;
  /* still looks like a link */
}

.top-right-caption a:hover {
  color: var(--accent-strong);
}

/* Old room meta styles reused on the left */

.room-meta {
  font-size: 0.8rem;
  text-align: right;
}

.label {
  color: var(--muted);
}

.mono {
  font-family: "SF Mono", ui-monospace, Menlo, Monaco, Consolas, monospace;
}

/* Layout */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
  flex: 1;
  align-items: stretch;
  min-height: 0;
  /* ✅ allow children to scroll instead of growing */
  overflow: hidden;
  /* ✅ no layout overflow */
}

/* When only the game panel should be visible (participants) */
.layout.full-width {
  grid-template-columns: minmax(0, 1fr);
}

/* Settings header with chevron */
.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.settings-header h2 {
  margin: 0;
}

/* Tiny chevron arrow inside the icon button */
.chevron-icon {
  width: 10px;
  height: 10px;
  border-style: solid;
  border-width: 2px 2px 0 0;
  transform: rotate(-45deg);
  /* pointing up (expanded) */
  transition: transform 0.18s ease-out;
}

.chevron-icon.collapsed {
  transform: rotate(135deg);
  /* pointing down (collapsed) */
}

.panel {
  border-radius: var(--radius);
  background: linear-gradient(135deg,
      rgba(15, 23, 42, 0.95),
      rgba(2, 6, 23, 1));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}

.left-panel h2,
.right-panel h2 {
  font-size: 1.05rem;
  margin-bottom: 8px;
}

/* Form / controls */

/* Form / controls */

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.field-group label {
  font-size: 0.8rem;
  color: var(--muted);
}

input[type="text"],
textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #020617;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
}

/* Optional: allow a little resize if you want */
textarea {
  resize: vertical;
  min-height: 48px;
}

input[type="text"]::placeholder,
textarea::placeholder {
  color: #6b7280;
}

input[type="text"]:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.5);
}

/* Buttons */

.btn {
  border: none;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.8rem;
  font-weight: 500;
  background: rgba(31, 41, 55, 0.9);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.16s ease-out, box-shadow 0.16s ease-out,
    background 0.16s ease-out, border-color 0.16s ease-out;
}

.btn.primary {
  background: linear-gradient(135deg, #4f46e5, #3b82f6);
  border: 1px solid rgba(129, 140, 248, 0.9);
}

.btn.danger {
  background: linear-gradient(135deg, #b91c1c, #ef4444);
  border: 1px solid rgba(248, 113, 113, 0.8);
}

.btn.small {
  padding: 4px 10px;
  font-size: 0.75rem;
}

.btn.wide {
  width: 100%;
  justify-content: center;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 40px rgba(15, 23, 42, 1);
}

.btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Hint / stats */

.hint {
  font-size: 0.8rem;
  color: var(--muted);
}

.hint.small {
  margin-top: 4px;
}

/* Right panel */

.room-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

#room-name-display {
  font-size: 1.05rem;
}

.scale-display {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 2px;
}

/* TABLE AREA */

.table-section {
  margin-bottom: 10px;
  flex: 1;
  /* take remaining height in right panel */
  display: flex;
  flex-direction: column;
}

.table-section h3 {
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.table-wrapper {
  margin-top: 4px;
  position: relative;
  width: 100%;
  flex: 1;
  /* grow to fill vertical space */
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.table-surface {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 36px;
  background: radial-gradient(circle at top,
      var(--table-bg1),
      var(--table-bg2));
  box-shadow: 0 22px 50px rgba(15, 23, 42, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.table-center-text {
  padding: 12px 30px;
  border-radius: 15px;
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  font-size: 0.85rem;
  text-align: center;
  max-width: 260px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  white-space: pre-line;
}

.table-players {
  position: absolute;
  inset: 10%;
}

/* Player around the table */

.table-player {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.throw-menu {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -115%);
  display: flex;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.97);
  border: 1px solid rgba(148, 163, 184, 0.6);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.9);
  font-size: 0.8rem;
  opacity: 0;
  pointer-events: none;
  z-index: 5;
  transition: opacity 0.15s ease-out, transform 0.15s ease-out;
}

/* Visible state – JS adds / removes this with a small debounce */
.throw-menu.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -135%);
}

/* button styling inside menu */
.throw-menu button {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 2px;
}

.throw-emoji-btn {
  border: none;
  background: transparent;
  padding: 0;
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.7));
  transition: transform 0.12s ease-out;
}

.throw-emoji-btn:hover {
  transform: translateY(-1px) scale(1.1);
}

/* Result card around the table */
.table-card {
  min-width: 26px;
  height: 48px;
  padding: 0 10px;
  border-radius: 10px;
  background: #111827;
  border: 2px dashed rgba(148, 163, 184, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: #9ca3af;
}

.table-card.card-hidden {
  background: var(--accent);
  border-color: var(--accent);
  color: transparent;
}

.table-card.card-revealed {
  background: #020617;
  border-color: var(--accent-strong);
  color: var(--accent-strong);
}

.table-avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: radial-gradient(circle at top, #1e293b, #020617 70%);
  border: 2px solid var(--accent-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-strong);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.8);
}

.table-player-name {
  font-size: 0.8rem;
  color: #e5e7eb;
}

.projectile {
  position: absolute;
  z-index: 8;
  font-size: 1.2rem;
  pointer-events: none;
  transform: translate(-50%, -50%);
  /* Match THROW_TRAVEL_MS = 1000 and THROW_FADE_MS = 400 */
  transition: left 1s cubic-bezier(0.15, 0.85, 0.25, 1),
    top 1s cubic-bezier(0.15, 0.85, 0.25, 1), opacity 0.4s ease-out 1s,
    transform 0.4s ease-out 1s;
}

.projectile-done {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.7);
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle-switch {
  position: relative;
  width: 40px;
  height: 20px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  width: 38px;
  position: absolute;
  cursor: pointer;
  inset: 0;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.4);
  transition: background 0.2s ease-out;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  height: 14px;
  width: 14px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #e5e7eb;
  transition: transform 0.2s ease-out;
}

.toggle-switch input:checked+.toggle-slider {
  background: var(--accent);
}

.toggle-switch input:checked+.toggle-slider::before {
  transform: translateX(18px);
}

/* Vote section / cards row */

.vote-section {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.vote-section h3 {
  font-size: 0.95rem;
  margin-bottom: 4px;
  text-align: center;
}

.your-status {
  font-size: 0.8rem;
  margin-bottom: 4px;
  text-align: center;
  color: var(--muted);
}

.choose-label {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 8px;
  text-align: center;
}

.vote-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.vote-edited-icon {
  margin-left: 4px;
  font-size: 0.7em;
  opacity: 0.9;
}

.vote-btn {
  min-width: 40px;
  height: 44px;
  text-align: center;
  border-radius: 12px;
  border: 2px solid rgba(148, 163, 184, 0.7);
  background: #020617;
  padding: 6px 10px;
  font-size: 0.85rem;
  color: var(--accent-strong);
  cursor: pointer;
  transition: background 0.16s ease-out, transform 0.16s ease-out,
    box-shadow 0.16s ease-out, border-color 0.16s ease-out;
}

.vote-btn:hover {
  background: var(--accent-soft);
  transform: translateY(-5px);
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.9);
}

.vote-btn.selected {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #0f172a;
  box-shadow: 0 18px 40px rgba(37, 99, 235, 0.9);
}

.vote-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.topic-display {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 2px;
}

/* Modal */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
}

.modal {
  width: 100%;
  max-width: 360px;
  background: #020617;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.modal h2 {
  font-size: 1.1rem;
  margin-bottom: 6px;
}

.modal .hint {
  margin-bottom: 10px;
}

/* Banner for create room */

.banner {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
}

.banner-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
}

.hidden {
  display: none;
}

/* Responsive */

@media (max-width: 860px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .room-meta {
    text-align: left;
  }

  .room-meta-row {
    justify-content: flex-start;
  }

  .table-wrapper {
    min-height: 150px;
  }
}

/* ===================== */
/* Auth page (index.html) */
/* ===================== */

body.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  /* keep your existing background from body {} – theme stays the same */
  overflow: hidden;
}

.auth-wrapper {
  width: 100%;
  max-width: 460px;
  padding: 24px 16px;
}

.auth-card {
  position: relative;
  width: 100%;
  border-radius: 28px;
  padding: 28px 24px 18px;
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.9), #020617);
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

/* Little icon circle at the top */
.auth-logo-circle {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.9);
}

.auth-logo-icon {
  font-size: 1.4rem;
  color: #e5e7eb;
}

.auth-logo-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  display: block;
}

.google-icon-img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}

/* Title & subtitle */
.auth-title {
  text-align: center;
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.auth-subtitle {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 18px;
}

/* Form fields */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.auth-field label {
  display: block;
  font-size: 0.78rem;
  margin-bottom: 4px;
}

.auth-field input {
  width: 100%;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: radial-gradient(circle at top, #020617, #020617);
  padding: 8px 14px;
  font-size: 0.82rem;
  color: var(--text);
  outline: none;
}

.auth-field input::placeholder {
  color: rgba(148, 163, 184, 0.7);
}

.auth-field input:focus {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.45);
}

/* Error message */
.auth-error {
  min-height: 1rem;
  font-size: 0.78rem;
  color: var(--danger);
  text-align: center;
  margin-bottom: 24px;
}

/* Primary sign-in button: wide & pill-shaped */
.auth-primary-btn {
  width: 100%;
  margin-top: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
}

/* Google button style */
.google-btn {
  width: 100%;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.4);
  padding: 8px 14px;
  font-size: 0.82rem;
}

.google-btn:hover {
  background: rgba(15, 23, 42, 1);
}

.google-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  color: #111827;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
}

/* Footer text & link-style sign up */
.auth-footer-text {
  margin-top: 14px;
  font-size: 0.8rem;
  text-align: center;
  color: var(--muted);
}

.link-button {
  border: none;
  padding: 0 0 0 4px;
  background: none;
  color: var(--accent-strong);
  cursor: pointer;
  font-size: 0.8rem;
}

.link-button:hover {
  text-decoration: underline;
}

/* Credit line */
.auth-footer-credit {
  margin-top: 28px;
  font-size: 0.75rem;
  text-align: center;
  color: var(--muted);
}

.auth-footer-credit a {
  color: var(--accent-strong);
}

/* Dashboard */

.dashboard-top {
  margin-bottom: 14px;
}

.dashboard-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
  padding-bottom: 32px;
}

.dashboard-panel h2 {
  margin-bottom: 10px;
}

.dashboard-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.room-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
}

.room-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.room-card-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.room-card-name {
  font-size: 0.9rem;
  font-weight: 500;
}

.room-card-id {
  font-size: 0.78rem;
  color: var(--muted);
}

.room-card-meta {
  font-size: 0.75rem;
  color: var(--muted);
}

.room-card-actions {
  display: flex;
  flex-direction: row;
  /* horizontal */
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

/* Make both buttons same width and nicely centered */
.room-card-actions .btn.small {
  min-width: 100px;
  justify-content: center;
  text-align: center;
}

.room-list-empty {
  align-items: center;
  justify-content: center;
}

/* History page */

.history-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
  padding-bottom: 32px;
  min-height: 0;
  /* important so children can flex */
}

.history-main-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.history-columns {
  flex: 1;
  min-height: 0;
  display: grid;
  /* Wider sessions list, slightly narrower details */
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
}

/* columns behave as vertical flex: title + scrollable content */
.history-sessions,
.history-details {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Add a bit of breathing room under the titles */
.history-sessions h3,
.history-details h3 {
  margin-bottom: 8px;
}

/* Space between the headings and the content below them */
.history-sessions-list,
.history-session-details {
  margin-top: 4px;
}

.history-sessions-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;

  /* nice scrollbar (Firefox) */
  scrollbar-width: thin;
  scrollbar-color: rgba(96, 165, 250, 0.8) transparent;
}

/* scrolling for the right details area */
.history-session-details {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* Ensure session text is white + support active state */
.history-session-item {
  width: 100%;
  text-align: left;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.35);
  padding: 8px 10px;
  cursor: pointer;
  transition: background 0.15s ease-out, border-color 0.15s ease-out,
    box-shadow 0.15s ease-out;
  font-size: 0.85rem;
  color: var(--text);
  /* ✅ make sure text is white */
}

.history-session-item:hover {
  background: rgba(30, 64, 175, 0.45);
  border-color: var(--accent-strong);
}

/* ✅ Highlight the active/selected session */
.history-session-item.active {
  background: rgba(59, 130, 246, 0.9);
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.9);
  color: #0f172a;
  /* better contrast on the blue background */
}

.history-session-title {
  font-weight: 500;
  color: white;
}

.history-session-meta {
  font-size: 0.75rem;
  color: #c9c9c9;
}

.history-session-details table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 32px;
  font-size: 0.85rem;
  table-layout: fixed;
  /* keep column widths stable */
}

/* Base cell styling */
.history-session-details th,
.history-session-details td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  word-wrap: break-word;
}

/* Header styling */
.history-session-details th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
}

/* Fixed column proportions: Player / Vote */
.history-session-details th:nth-child(1),
.history-session-details td:nth-child(1) {
  width: 45%;
}

.history-session-details th:nth-child(2),
.history-session-details td:nth-child(2) {
  width: 55%;
}

/* Keep the edited icon spacing */
.history-session-details td .vote-edited-icon {
  margin-left: 4px;
}

.history-session-details td .vote-edited-icon {
  margin-left: 4px;
}

/* History stats chart */

.history-stats-chart {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.35);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-stats-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
}

.history-stats-label {
  color: var(--muted);
}

.history-stats-bar-outer {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: rgba(30, 64, 175, 0.35);
  overflow: hidden;
}

.history-stats-bar-inner {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  /* nice blue gradient to match the app */
  background: linear-gradient(to right, #4f46e5, #38bdf8);
}

.history-stats-count {
  text-align: right;
  color: var(--text);
}

/* WebKit scrollbars for the history sessions list */
.history-sessions-list::-webkit-scrollbar {
  width: 6px;
}

.history-sessions-list::-webkit-scrollbar-track {
  background: transparent;
}

.history-sessions-list::-webkit-scrollbar-thumb {
  background: linear-gradient(to bottom, #4f46e5, #38bdf8);
  border-radius: 999px;
}

.history-sessions-list::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(to bottom, #6366f1, #0ea5e9);
}

/* History stats: min / max / avg bar */

.history-range-chart {
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.35);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
}

.history-range-label-row {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
}

.history-range-bar {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(to right, #4f46e5, #22c55e);
}

/* vertical marker + label for avg */
.history-range-avg-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
}

.history-range-avg-marker::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -4px;
  transform: translateX(-50%);
  width: 2px;
  height: 16px;
  border-radius: 999px;
  background: #facc15;
}

.history-range-avg-label {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 0.75rem;
  color: var(--muted);
}

/* Toast notifications */

.toast-container {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 40;
}

.toast {
  min-width: 220px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--accent-soft);
  color: var(--text-muted);
  font-size: 0.875rem;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.85);
  opacity: 0;
  transform: translateY(10px);
  animation: toast-in 0.18s ease-out forwards;
}

.toast-hide {
  animation: toast-out 0.16s ease-in forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }

  to {
    opacity: 0;
    transform: translateY(10px);
  }
}

.throw-menu-separator {
  align-self: center;
  padding: 0 4px;
  color: rgba(148, 163, 184, 0.75);
  font-size: 0.75rem;
}

.throw-kick-btn {
  font-size: 14px !important;
  letter-spacing: 0.06em;
  color: white;
}