/* ===== CSS Variables & Reset ===== */
:root {
  --primary: #6c5ce7;
  --primary-dark: #5a4bd1;
  --primary-light: #a29bfe;
  --secondary: #00cec9;
  --accent: #fd79a8;
  --gradient: linear-gradient(135deg, #6c5ce7 0%, #4834d4 50%, #686de0 100%);
  --gradient-soft: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --bg-dark: #1a1a2e;
  --bg-card: #ffffff;
  --bg-surface: #f8f9fc;
  --text-primary: #2d3436;
  --text-secondary: #636e72;
  --text-muted: #b2bec3;
  --border: #e2e8f0;
  --border-light: #f1f3f5;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.15);
  --shadow-card: 0 4px 20px rgba(108, 92, 231, 0.15);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --transition: all 0.2s ease;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--gradient);
  color: white;
  box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(108, 92, 231, 0.4);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
}

.btn-ghost:hover {
  background: var(--bg-surface);
  color: var(--primary);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-large {
  padding: 14px 32px;
  font-size: 1rem;
  border-radius: var(--radius-md);
}

.btn-danger {
  background: #ff7675;
  color: white;
}

.btn-danger:hover {
  background: #d63031;
}

/* ===== Forms ===== */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 1rem;
  transition: var(--transition);
  background: white;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

/* ===== Landing Page ===== */
.landing-page {
  background: var(--bg-dark);
  background-image: 
    radial-gradient(ellipse at top, rgba(108, 92, 231, 0.3) 0%, transparent 60%),
    radial-gradient(ellipse at bottom right, rgba(104, 109, 224, 0.2) 0%, transparent 50%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.landing-container {
  max-width: 900px;
  width: 100%;
  padding: 40px 20px;
}

.landing-header {
  text-align: center;
  margin-bottom: 48px;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}

.logo-icon {
  font-size: 2.5rem;
}

.logo h1 {
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #fff 0%, #a29bfe 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  color: var(--text-muted);
  font-size: 1.1rem;
}

.landing-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 48px;
}

.create-game-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
}

.create-game-card h2 {
  font-size: 1.4rem;
  margin-bottom: 24px;
  text-align: center;
}

.create-game-card .btn-large {
  width: 100%;
  justify-content: center;
  margin-top: 8px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  width: 100%;
}

.feature-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  backdrop-filter: blur(10px);
}

.feature-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.feature-card h3 {
  color: white;
  font-size: 1rem;
  margin-bottom: 8px;
}

.feature-card p {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.landing-footer {
  text-align: center;
  margin-top: 48px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 46, 0.9);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal {
  background: white;
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  text-align: center;
  margin-bottom: 24px;
}

.modal-header h2 {
  margin-top: 8px;
}

.modal .btn-large {
  width: 100%;
  justify-content: center;
}

/* ===== Game Page Layout ===== */
.game-page {
  background: var(--bg-surface);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.game-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: white;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon-sm {
  font-size: 1.5rem;
}

.header-left h1 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.current-issue-badge {
  background: var(--bg-surface);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.current-issue-badge.active {
  background: rgba(108, 92, 231, 0.1);
  color: var(--primary);
  border-color: var(--primary-light);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.deck-selector {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.85rem;
  background: white;
  cursor: pointer;
}

/* ===== Game Body ===== */
.game-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ===== Issues Sidebar ===== */
.issues-sidebar {
  width: 300px;
  background: white;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease, width 0.3s ease;
  overflow: hidden;
}

.issues-sidebar.collapsed {
  width: 0;
  border: none;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
}

.issues-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.empty-issues {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-issues p:first-child {
  font-weight: 500;
  color: var(--text-secondary);
}

.text-muted {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.issue-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  margin-bottom: 4px;
}

.issue-item:hover {
  background: var(--bg-surface);
}

.issue-item.active {
  background: rgba(108, 92, 231, 0.08);
  border-color: var(--primary-light);
}

.issue-item .issue-title {
  flex: 1;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.issue-item .issue-estimate {
  background: var(--primary);
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

.issue-item .issue-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}

.issue-item:hover .issue-actions {
  opacity: 1;
}

.issue-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.issue-action-btn:hover {
  background: var(--border);
  color: var(--text-primary);
}

/* ===== Game Main Area ===== */
.game-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 24px;
}

.table-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

.poker-table {
  position: relative;
  width: 100%;
  max-width: 800px;
}

.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 16px;
  justify-items: center;
}

.player-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
  border-radius: var(--radius-md);
  transition: var(--transition);
  min-width: 100px;
}

.player-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--gradient-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 1.2rem;
  position: relative;
}

.player-avatar.voted::after {
  content: '✓';
  position: absolute;
  bottom: -2px;
  right: -2px;
  background: #00b894;
  color: white;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}

.player-name {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-vote {
  width: 48px;
  height: 64px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.player-vote.hidden-vote {
  background: var(--gradient);
  color: transparent;
  box-shadow: var(--shadow-card);
  transform: rotateY(0deg);
}

.player-vote.hidden-vote::after {
  content: '?';
  position: absolute;
  color: rgba(255,255,255,0.5);
  font-size: 1.5rem;
}

.player-vote.no-vote {
  background: var(--border-light);
  border: 2px dashed var(--border);
  color: var(--text-muted);
}

.player-vote.revealed-vote {
  background: white;
  border: 2px solid var(--primary);
  color: var(--primary);
  box-shadow: var(--shadow-card);
  animation: flipIn 0.6s ease;
}

@keyframes flipIn {
  0% { transform: rotateY(90deg); opacity: 0; }
  50% { transform: rotateY(-10deg); }
  100% { transform: rotateY(0deg); opacity: 1; }
}

.player-moderator-badge {
  font-size: 0.65rem;
  background: rgba(108, 92, 231, 0.1);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}

.table-center {
  text-align: center;
  padding: 20px;
}

.table-status p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ===== Moderator Controls ===== */
.moderator-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  margin: 16px 0;
}

/* ===== Results Section ===== */
.results-section {
  background: white;
  border-radius: var(--radius-md);
  padding: 24px;
  margin: 16px 0;
  border: 1px solid var(--border);
  animation: slideUp 0.4s ease;
}

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

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.results-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.results-stats {
  display: flex;
  gap: 16px;
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.results-chart {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 120px;
  padding-top: 20px;
}

.chart-bar-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  height: 100%;
}

.chart-bar {
  width: 100%;
  max-width: 60px;
  background: var(--gradient);
  border-radius: 6px 6px 0 0;
  min-height: 8px;
  transition: height 0.5s ease;
  margin-top: auto;
}

.chart-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 8px;
  font-weight: 600;
}

.chart-count {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

/* ===== Card Deck ===== */
.card-deck-area {
  padding: 20px 0;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.deck-label {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.card-deck {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.poker-card {
  width: 60px;
  height: 84px;
  background: white;
  border: 2px solid var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  user-select: none;
  position: relative;
  overflow: hidden;
}

.poker-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient);
  opacity: 0;
  transition: opacity 0.2s;
  border-radius: 8px;
}

.poker-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
}

.poker-card:hover::before {
  opacity: 0.05;
}

.poker-card:active {
  transform: translateY(-4px);
}

.poker-card.selected {
  background: var(--gradient);
  color: white;
  border-color: var(--primary);
  transform: translateY(-12px);
  box-shadow: 0 8px 25px rgba(108, 92, 231, 0.35);
}

.poker-card.selected::before {
  opacity: 0;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text-primary);
  color: white;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s ease;
}

.toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ===== Utility ===== */
.hidden {
  display: none !important;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .landing-container {
    padding: 24px 16px;
  }

  .logo h1 {
    font-size: 1.8rem;
  }

  .create-game-card {
    padding: 28px 24px;
  }

  .features-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .feature-card {
    padding: 16px;
  }

  .game-header {
    padding: 10px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .header-center {
    order: 3;
    flex-basis: 100%;
    display: none;
  }

  .header-right > .btn-ghost span {
    display: none;
  }

  .mode-toggle {
    padding: 6px 10px;
    gap: 6px;
  }

  .mode-toggle-label {
    font-size: 0.7rem;
  }

  .mode-toggle-switch {
    width: 32px;
    height: 18px;
  }

  .mode-toggle-switch .mode-toggle-knob {
    width: 14px;
    height: 14px;
  }

  body.game-mode-fun .mode-toggle-switch .mode-toggle-knob {
    transform: translateX(14px);
  }

  .issues-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    z-index: 200;
    box-shadow: var(--shadow-lg);
    transform: translateX(-100%);
    width: 280px;
  }

  .issues-sidebar.open {
    transform: translateX(0);
  }

  .issues-sidebar.collapsed {
    transform: translateX(-100%);
    width: 280px;
  }

  .game-main {
    padding: 16px;
  }

  .players-grid {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 10px;
  }

  .player-avatar {
    width: 44px;
    height: 44px;
    font-size: 1rem;
  }

  .player-vote {
    width: 40px;
    height: 56px;
    font-size: 0.9rem;
  }

  .poker-card {
    width: 48px;
    height: 68px;
    font-size: 0.9rem;
  }

  .card-deck {
    gap: 6px;
  }

  .moderator-controls {
    flex-direction: column;
    align-items: center;
  }

  .moderator-controls .btn {
    width: 100%;
    max-width: 250px;
    justify-content: center;
  }

  .results-chart {
    height: 80px;
  }

  .results-stats {
    gap: 10px;
  }
}

@media (max-width: 480px) {
  .features-grid {
    grid-template-columns: 1fr;
  }

  .players-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .player-card {
    padding: 10px 6px;
  }

  .player-name {
    font-size: 0.7rem;
    max-width: 70px;
  }
}

/* ===== Sidebar overlay for mobile ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 199;
}

.sidebar-overlay.visible {
  display: block;
}

/* ===== Issue input ===== */
.issue-input-wrapper {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.issue-input-wrapper input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.85rem;
}

.issue-input-wrapper input:focus {
  outline: none;
  border-color: var(--primary);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}


/* ===== Jira Integration Panel ===== */
.jira-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 360px;
  height: 100%;
  background: white;
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  display: flex;
  flex-direction: column;
  animation: slideInRight 0.3s ease;
}

.jira-panel.hidden {
  display: none !important;
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.jira-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.jira-panel-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.jira-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.jira-not-connected {
  text-align: center;
  padding: 40px 20px;
}

.jira-not-connected p {
  color: var(--text-secondary);
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.jira-connected .jira-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.jira-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #b2bec3;
}

.jira-status-dot.active {
  background: #00b894;
}

.jira-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.jira-actions .btn {
  justify-content: center;
}

@media (max-width: 768px) {
  .jira-panel {
    width: 100%;
  }
}

/* Auth Styles */
.auth-tabs {
  display: flex;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid #e2e8f0;
}
.auth-tab {
  flex: 1;
  padding: 0.75rem;
  background: none;
  border: none;
  font-size: 1rem;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}
.auth-tab.active {
  color: #6c5ce7;
  border-bottom-color: #6c5ce7;
}
.auth-form.hidden { display: none; }
.auth-error {
  background: #fee2e2;
  color: #dc2626;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}
.auth-error.hidden { display: none; }
.auth-skip {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.875rem;
}
.auth-skip a {
  color: #6c5ce7;
  text-decoration: none;
}
.auth-skip a:hover { text-decoration: underline; }

.oauth-section {
  margin-top: 1.5rem;
  padding-top: 0;
}

.oauth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 1rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.oauth-divider::before,
.oauth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.oauth-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.oauth-btn {
  justify-content: center;
  width: 100%;
  text-decoration: none;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #e2e8f0;
}
.header-user .user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #6c5ce7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.75rem;
  color: white;
}
.btn-logout {
  background: none;
  border: 1px solid rgba(255,255,255,0.3);
  color: #e2e8f0;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
}
.btn-logout:hover { border-color: white; color: white; }
.nav-auth {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ===== Mode Toggle ===== */
.mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font);
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.mode-toggle:hover {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.08);
}

.mode-toggle-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  transition: color 0.2s;
  pointer-events: none;
}

.mode-label-boring.active-label {
  color: var(--text-primary);
}

.mode-label-fun.active-label {
  color: var(--primary);
}

.mode-toggle-switch {
  position: relative;
  width: 36px;
  height: 20px;
  background: var(--border);
  border-radius: 10px;
  transition: background 0.3s;
  pointer-events: none;
}

.mode-toggle-switch .mode-toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

body.game-mode-fun .mode-toggle-switch {
  background: var(--gradient);
}

body.game-mode-fun .mode-toggle-switch .mode-toggle-knob {
  transform: translateX(16px);
}

/* ===== Fun Mode Container ===== */
.fun-mode-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  padding: 20px;
}

.fun-table-surface {
  position: relative;
  width: 100%;
  max-width: 600px;
  height: 400px;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at center, #2d2b4e 0%, #1a1a2e 50%, #141425 80%, #0e0e1a 100%);
  border: 12px solid #3d3860;
  box-shadow:
    inset 0 0 60px rgba(0, 0, 0, 0.4),
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 0 0 4px #2a2550,
    0 0 0 8px #4a4478;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fun-players-ring {
  position: absolute;
  inset: 0;
}

.fun-player-seat {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transform: translate(-50%, -50%);
  z-index: 10;
}

.fun-player-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
  border: 3px solid rgba(255,255,255,0.3);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.fun-player-avatar.has-voted {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.3), 0 2px 8px rgba(0,0,0,0.3);
}

.fun-player-name {
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  background: rgba(0,0,0,0.4);
  padding: 1px 6px;
  border-radius: 8px;
}

/* ===== Fun Mode Player Hand ===== */
.fun-player-hand {
  position: relative;
  width: 50px;
  height: 30px;
  margin-top: 2px;
  transform: rotate(var(--hand-angle, 0deg));
  display: flex;
  align-items: center;
  justify-content: center;
}

.fun-hand-card {
  position: absolute;
  width: 20px;
  height: 30px;
  border-radius: 3px;
  background: linear-gradient(135deg, #6c5ce7 0%, #4834d4 100%);
  border: 1.5px solid rgba(255,255,255,0.3);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  transform-origin: center center;
  transform: rotate(var(--fan-angle, 0deg)) translateY(-2px);
  transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              opacity 0.3s ease,
              width 0.4s ease,
              height 0.4s ease,
              box-shadow 0.4s ease;
  z-index: 1;
}

.fun-hand-card::after {
  content: '';
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 2px;
}

/* Card has been thrown to the pile - it physically moves there */
.fun-hand-card.card-thrown {
  transform: translate(var(--pile-x, 0px), var(--pile-y, 0px)) rotate(var(--pile-rotation, 0deg));
  width: 32px;
  height: 46px;
  z-index: 20;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

/* Card revealed - flip to show value */
.fun-hand-card.card-thrown.card-revealed {
  background: white;
  border: 2px solid var(--primary);
  transform: translate(var(--pile-x, 0px), var(--pile-y, 0px)) rotate(var(--pile-rotation, 0deg));
}

.fun-hand-card.card-thrown.card-revealed::after {
  content: attr(data-value);
  position: absolute;
  inset: 0;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.8rem;
  color: var(--primary-dark);
}

.fun-player-avatar.is-self {
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(0, 206, 201, 0.4), 0 2px 8px rgba(0,0,0,0.3);
}

/* ===== Fun Mode Center Pile ===== */
.fun-center-pile {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
}

/* ===== Fun Table Status ===== */
.fun-table-status {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
}

.fun-table-status p {
  color: rgba(255,255,255,0.7);
  font-size: 0.8rem;
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  background: rgba(0,0,0,0.3);
  padding: 4px 12px;
  border-radius: 12px;
}

/* ===== Fun Mode Pulse on ready to reveal ===== */
.fun-center-pile.ready-to-reveal {
  animation: pileGlow 1.5s ease-in-out infinite;
}

@keyframes pileGlow {
  0%, 100% {
    filter: drop-shadow(0 0 6px rgba(108, 92, 231, 0.3));
  }
  50% {
    filter: drop-shadow(0 0 20px rgba(108, 92, 231, 0.8));
  }
}

/* ===== Responsive Fun Mode ===== */
@media (max-width: 768px) {
  .fun-mode-container {
    min-height: 320px;
    padding: 10px;
  }

  .fun-table-surface {
    max-width: 340px;
    height: 340px;
    border-width: 8px;
  }

  .fun-player-avatar {
    width: 34px;
    height: 34px;
    font-size: 0.75rem;
    border-width: 2px;
  }

  .fun-player-name {
    font-size: 0.6rem;
    max-width: 50px;
  }

  .fun-player-hand {
    width: 40px;
    height: 24px;
  }

  .fun-hand-card {
    width: 16px;
    height: 24px;
    border-radius: 2px;
  }

  .fun-hand-card.card-thrown {
    width: 26px;
    height: 38px;
  }

  .fun-pile-card {
    width: 36px;
    height: 52px;
    font-size: 0.8rem;
  }

  .fun-center-pile {
    width: 80px;
    height: 80px;
  }
}

@media (max-width: 480px) {
  .fun-table-surface {
    max-width: 280px;
    height: 280px;
    border-width: 6px;
  }

  .fun-player-avatar {
    width: 28px;
    height: 28px;
    font-size: 0.65rem;
  }

  .fun-player-name {
    display: none;
  }

  .fun-player-hand {
    width: 32px;
    height: 20px;
  }

  .fun-hand-card {
    width: 13px;
    height: 20px;
  }

  .fun-hand-card.card-thrown {
    width: 22px;
    height: 32px;
  }

  .fun-pile-card {
    width: 30px;
    height: 44px;
    font-size: 0.7rem;
  }
}
