/* Wordle Battle - Styles */

:root {
  --bg-primary: #121213;
  --bg-secondary: #1a1a1b;
  --bg-tile: #3a3a3c;
  --text-primary: #ffffff;
  --text-secondary: #818384;
  --correct: #538d4e;
  --present: #b59f3b;
  --absent: #3a3a3c;
  --border: #3a3a3c;
  --key-bg: #818384;
  --key-text: #ffffff;
  --accent: #538d4e;
  --danger: #d32f2f;
  --gold: #c9a227;
  --gold-dark: #9a7b1c;
}

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

/* Generic hidden class */
.hidden {
  display: none !important;
}

body {
  font-family: 'Clear Sans', 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh; /* Dynamic viewport height for mobile */
  display: flex;
  justify-content: center;
  overflow-x: hidden;
}

.container {
  width: 100%;
  max-width: 1200px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.header {
  text-align: center;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.header h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.2rem;
  margin-bottom: 5px;
}

.tagline {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Views */
.view {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.view.hidden {
  display: none;
}

/* Buttons */
.btn {
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn:hover {
  opacity: 0.9;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background-color: var(--accent);
  color: var(--text-primary);
}

.btn-secondary {
  background-color: var(--bg-tile);
  color: var(--text-primary);
}

.btn-danger {
  background-color: var(--danger);
  color: var(--text-primary);
}

.btn-icon {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 5px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: underline;
  padding: 0;
}

.btn-link:hover {
  opacity: 0.8;
}

/* Auth Section */
.auth-section {
  margin-bottom: 24px;
  padding: 20px;
  background-color: var(--bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.auth-prompt {
  text-align: center;
}

.auth-message {
  margin-bottom: 16px;
  line-height: 1.5;
}

.auth-submessage {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.auth-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 12px;
}

.auth-buttons .btn {
  padding: 10px 24px;
}

.guest-option {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin: 0;
}

.guest-option a {
  color: var(--accent);
  text-decoration: underline;
}

.guest-option a:hover {
  opacity: 0.8;
}

.auth-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  background-color: rgba(83, 141, 78, 0.15);
  border: 1px solid var(--correct);
  border-radius: 8px;
}

.auth-check {
  color: var(--correct);
  font-weight: bold;
  font-size: 1.1rem;
}

.auth-status .user-info {
  color: var(--text-primary);
  flex: 1;
}

.auth-status .user-info strong {
  color: var(--text-primary);
}

/* Daily Challenge Section */
.daily-challenge-section {
  margin-bottom: 24px;
  text-align: center;
}

.btn-daily {
  width: 100%;
  padding: 16px 24px;
  font-size: 1.1rem;
  font-weight: 700;
  background: linear-gradient(135deg, #b59f3b 0%, #8b7c2a 100%);
  color: var(--text-primary);
  border: 2px solid #c9b458;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.btn-daily:not(:disabled):hover {
  background: linear-gradient(135deg, #c9b458 0%, #9a8a32 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(181, 159, 59, 0.3);
}

.btn-daily:disabled {
  background: var(--bg-tile);
  border-color: var(--border);
  cursor: not-allowed;
  opacity: 0.6;
}

.daily-guest-msg {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 8px;
  font-style: italic;
}

.daily-guest-msg.hidden {
  display: none;
}

.divider-or {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 16px 0;
  position: relative;
}

.divider-or::before,
.divider-or::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 30%;
  height: 1px;
  background: var(--border);
}

.divider-or::before {
  left: 0;
}

.divider-or::after {
  right: 0;
}

/* Daily Completed View */
.daily-completed-content {
  max-width: 400px;
  margin: 0 auto;
  padding: 40px 20px;
  text-align: center;
}

.daily-completed-content h2 {
  font-size: 1.5rem;
  margin-bottom: 8px;
  color: #c9b458;
}

.completed-status {
  color: var(--correct);
  font-size: 1rem;
  margin-bottom: 24px;
}

/* Daily Completed Notice (in results view) */
.daily-completed-notice {
  background: var(--correct);
  color: white;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 500;
}

.daily-completed-notice .check-icon {
  font-size: 1.2rem;
}

.completed-grid-container {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.completed-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.completed-grid .grid-row {
  display: flex;
  gap: 6px;
}

.completed-grid .tile {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: bold;
  text-transform: uppercase;
  border: 2px solid var(--border);
  border-radius: 4px;
  background-color: var(--bg-tile);
}

.completed-grid .tile.correct {
  background-color: var(--correct);
  border-color: var(--correct);
  color: white;
}

.completed-grid .tile.present {
  background-color: var(--present);
  border-color: var(--present);
  color: white;
}

.completed-grid .tile.absent {
  background-color: var(--absent);
  border-color: var(--absent);
  color: white;
}

.completion-stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin: 24px 0;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-secondary);
  padding: 12px 20px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.stat-item .stat-value {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--text-primary);
}

.stat-item .stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.completion-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal.hidden {
  display: none;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.7);
}

.modal-content {
  position: relative;
  background-color: var(--bg-secondary);
  padding: 30px;
  border-radius: 12px;
  width: 90%;
  max-width: 400px;
  border: 1px solid var(--border);
}

.modal-content h2 {
  text-align: center;
  margin-bottom: 24px;
  font-size: 1.5rem;
}

.form-group {
  margin-bottom: 16px;
}

.form-group.hidden {
  display: none;
}

.form-group input {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent);
}

.error-message {
  color: var(--danger);
  font-size: 0.85rem;
  text-align: center;
  margin-bottom: 16px;
}

.error-message.hidden {
  display: none;
}

.modal-buttons {
  display: flex;
  gap: 12px;
}

.modal-buttons .btn {
  flex: 1;
}

.auth-toggle {
  text-align: center;
  margin-top: 20px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.auth-toggle a {
  color: var(--accent);
  text-decoration: underline;
}

.auth-toggle a:hover {
  opacity: 0.8;
}

/* Forgot Password */
.forgot-password-link {
  text-align: center;
  margin-top: 12px;
  font-size: 0.85rem;
}

.forgot-password-link a {
  color: var(--text-secondary);
  text-decoration: none;
}

.forgot-password-link a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* Password Reset Forms */
.reset-instructions {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 16px;
  text-align: center;
}

.success-message {
  color: var(--correct);
  font-size: 0.9rem;
  margin-bottom: 12px;
  text-align: center;
}

/* Daily Mode Selection Modal */
.daily-mode-modal {
  max-width: 320px;
  text-align: center;
}

.daily-mode-modal h2 {
  margin-bottom: 1.5rem;
  color: var(--gold);
}

.mode-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.mode-option-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  border-radius: 8px;
  border: 2px solid var(--border);
  background: var(--bg-tile);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-option-btn:hover {
  border-color: var(--correct);
  transform: translateY(-2px);
}

.mode-option-btn.primary {
  background: linear-gradient(135deg, #538d4e 0%, #3a6b38 100%);
  border-color: #538d4e;
}

.mode-option-btn.primary:hover {
  background: linear-gradient(135deg, #5a9654 0%, #427a40 100%);
}

.mode-option-btn .mode-icon {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

.mode-option-btn .mode-title {
  font-weight: 700;
  font-size: 1.1rem;
}

.mode-option-btn .mode-desc {
  font-size: 0.85rem;
  opacity: 0.8;
}

/* Confirmation Modal */
.confirm-modal {
  max-width: 340px;
  text-align: center;
}

.confirm-modal h2 {
  margin-bottom: 0.75rem;
}

.confirm-warning {
  color: var(--gold);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.confirm-note {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  line-height: 1.4;
}

.confirm-actions {
  display: flex;
  gap: 12px;
}

.confirm-actions .btn {
  flex: 1;
}

.btn-danger {
  background: var(--danger);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
}

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

/* Lobby View */
.lobby-content {
  max-width: 400px;
  margin: 0 auto;
  width: 100%;
  padding: 40px 20px;
}

/* Auth Banner (for guests) */
.auth-banner {
  background: linear-gradient(135deg, rgba(201, 162, 39, 0.15) 0%, rgba(83, 141, 78, 0.15) 100%);
  border: 1px solid var(--gold);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.auth-banner.hidden {
  display: none;
}

.auth-banner-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.auth-banner-benefits {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.4;
}

.auth-banner-actions {
  display: flex;
  gap: 10px;
}

.auth-btn {
  flex: 1;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: opacity 0.2s ease;
}

.auth-btn:hover {
  opacity: 0.9;
}

.auth-btn-primary {
  background: var(--gold);
  border: none;
  color: #1a1a1b;
}

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

.name-input {
  margin-bottom: 30px;
}

.name-input label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.name-input input {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
}

/* Player Stats */
.player-stats {
  background-color: var(--bg-secondary);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 24px;
}

.player-stats.hidden {
  display: none;
}

.stats-row {
  display: flex;
  justify-content: space-around;
  gap: 8px;
}

.stat {
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--text-primary);
}

.stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.room-actions {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.room-actions .btn-primary {
  width: 100%;
}

.divider {
  display: flex;
  align-items: center;
  gap: 15px;
  color: var(--text-secondary);
}

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

.join-section {
  display: flex;
  gap: 10px;
}

.join-section input {
  flex: 1;
  padding: 12px;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.2rem;
  text-align: center;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
}

/* Waiting Room View */
.waiting-content {
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
  padding: 20px;
}

.room-code-display {
  text-align: center;
  padding: 20px;
  background-color: var(--bg-secondary);
  border-radius: 8px;
  margin-bottom: 20px;
}

.room-code-display .label {
  display: block;
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 10px;
}

.room-code-display .code {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: 0.5rem;
  color: var(--accent);
}

.mode-selector {
  margin-bottom: 20px;
}

.mode-selector label {
  display: block;
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 10px;
}

.mode-buttons {
  display: flex;
  gap: 10px;
}

.mode-btn {
  flex: 1;
  padding: 12px 16px;
  font-size: 0.9rem;
  background-color: var(--bg-tile);
  border: 2px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
  min-width: 0; /* Allow shrinking in flex */
}

.mode-btn.active {
  border-color: var(--accent);
  background-color: rgba(83, 141, 78, 0.2);
}

.mode-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.player-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background-color: var(--bg-tile);
  border-radius: 8px;
  overflow: hidden;
}

.player-list li {
  padding: 12px 15px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background-color 0.3s ease;
}

.player-list li:last-child {
  border-bottom: none;
}

/* Highlight animation for new players */
.player-list li.player-joined {
  animation: playerJoinFlash 1s ease-out;
}

@keyframes playerJoinFlash {
  0% {
    background-color: rgba(83, 141, 78, 0.4);
  }
  100% {
    background-color: transparent;
  }
}

.player-list .host-badge {
  font-size: 0.75rem;
  padding: 2px 8px;
  background-color: var(--accent);
  border-radius: 4px;
}

.waiting-msg {
  color: var(--text-secondary);
  font-style: italic;
  font-size: 0.9rem;
  text-align: center;
  margin-top: 12px;
  margin-bottom: 0;
}

/* Game View */
.game-layout {
  display: flex;
  gap: 30px;
  flex: 1;
  justify-content: center;
}

.opponents-panel {
  width: 200px;
  flex-shrink: 0;
}

.opponents-panel h3 {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 15px;
}

#opponentBoards {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.opponent-board {
  background-color: var(--bg-secondary);
  padding: 10px;
  border-radius: 8px;
}

.opponent-board .player-name {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.opponent-board .status-badge {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 3px;
}

.opponent-board .status-badge.won {
  background-color: var(--correct);
}

.opponent-board .status-badge.lost {
  background-color: var(--danger);
}

.opponent-board .mini-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
}

.opponent-board .mini-tile {
  aspect-ratio: 1;
  background-color: var(--bg-tile);
  border-radius: 2px;
}

.opponent-board .mini-tile.correct {
  background-color: var(--correct);
}

.opponent-board .mini-tile.present {
  background-color: var(--present);
}

.opponent-board .mini-tile.absent {
  background-color: var(--absent);
}

/* Mobile Compact Opponent View */
.opponent-board.compact {
  padding: 8px 10px;
}

.opponent-board.compact .player-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
}

.opponent-board.compact .player-name {
  font-weight: 600;
  font-size: 0.8rem;
  margin-bottom: 0;
  min-width: 60px;
}

.opponent-board.compact .player-name .check {
  color: var(--correct);
  margin-right: 2px;
}

.opponent-board.compact .opponent-timer {
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.opponent-board.compact .position-cells {
  display: flex;
  gap: 3px;
  flex: 1;
  justify-content: center;
}

.opponent-board.compact .pos-cell {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  background-color: var(--bg-tile);
  transition: all 0.2s ease;
}

.opponent-board.compact .pos-cell.correct {
  background-color: var(--correct);
}

.opponent-board.compact .pos-cell.present {
  background-color: var(--present);
}

.opponent-board.compact .row-progress {
  display: flex;
  gap: 2px;
  margin-left: 8px;
}

.opponent-board.compact .row-segment {
  width: 5px;
  height: 14px;
  border-radius: 2px;
  background-color: var(--bg-tile);
}

.opponent-board.compact .row-segment.filled {
  background-color: var(--absent);
}

.opponent-board.compact .row-segment.active {
  background-color: var(--correct);
  animation: pulse 1s infinite;
}

.opponent-board.compact.solved .row-segment.filled {
  background-color: var(--correct);
}

.opponent-board.compact.solved {
  opacity: 0.8;
}

.opponent-board.compact.solved .player-name {
  color: var(--correct);
}

/* Hide mini-grid in compact mode */
.opponent-board.compact .mini-grid {
  display: none;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes cellPop {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.15);
  }
  100% {
    transform: scale(1);
  }
}

.pos-cell.animate {
  animation: cellPop 0.2s ease;
}

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

/* Grid */
.grid {
  display: grid;
  grid-template-rows: repeat(6, 1fr);
  gap: 5px;
}

.grid-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}

.tile {
  width: 62px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  text-transform: uppercase;
  border: 2px solid var(--border);
  background-color: transparent;
  transition: transform 0.1s;
}

.tile.filled {
  border-color: #565758;
  animation: pop 0.1s;
}

.tile.correct {
  background-color: var(--correct);
  border-color: var(--correct);
}

.tile.present {
  background-color: var(--present);
  border-color: var(--present);
}

.tile.absent {
  background-color: var(--absent);
  border-color: var(--absent);
}

@keyframes pop {
  50% {
    transform: scale(1.1);
  }
}

.game-message {
  min-height: 30px;
  font-size: 1rem;
  color: var(--text-secondary);
  text-align: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.game-message.visible {
  opacity: 1;
}

.game-message.error {
  color: var(--danger);
}

.game-message.success {
  color: var(--correct);
}

/* Grid row shake animation for invalid words */
.grid-row.shake {
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  10%,
  30%,
  50%,
  70%,
  90% {
    transform: translateX(-5px);
  }
  20%,
  40%,
  60%,
  80% {
    transform: translateX(5px);
  }
}

/* Keyboard */
.keyboard {
  display: flex;
  flex-direction: column;
  gap: 6px;
  touch-action: manipulation; /* Prevent double-tap zoom, remove 300ms delay */
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  padding: 0 2px;
}

.keyboard-row {
  display: flex;
  justify-content: center;
  gap: 5px;
  width: 100%;
}

.keyboard button {
  flex: 1;
  max-width: 44px;
  height: 58px;
  padding: 0;
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  background-color: var(--key-bg);
  color: var(--key-text);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.1s;
  -webkit-tap-highlight-color: transparent; /* Remove tap highlight on iOS */
}

.keyboard button:hover {
  opacity: 0.9;
}

.keyboard button.key-wide {
  flex: 1.5;
  max-width: 66px;
  font-size: 0.75rem;
}

/* ENTER button stands out */
.keyboard button.key-enter {
  background-color: var(--correct);
  color: var(--text-primary);
}

.keyboard button.key-enter:hover {
  opacity: 0.85;
}

.keyboard button.correct {
  background-color: var(--correct);
}

.keyboard button.present {
  background-color: var(--present);
}

.keyboard button.absent {
  background-color: #3a3a3c;
}

/* Results View */
.results-content {
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
  padding: 40px 20px;
  text-align: center;
}

.results-content h2 {
  font-size: 1.5rem;
  margin-bottom: 30px;
}

.word-reveal {
  margin-bottom: 30px;
}

.word-reveal .label {
  display: block;
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 10px;
}

.revealed-word {
  display: inline-block;
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: 0.3rem;
  padding: 15px 25px;
  background-color: var(--correct);
  border-radius: 8px;
}

.leaderboard {
  margin-bottom: 30px;
  text-align: left;
}

.leaderboard h3 {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 15px;
  text-align: center;
}

.leaderboard ol {
  list-style: none;
  background-color: var(--bg-secondary);
  border-radius: 8px;
  overflow: hidden;
}

.leaderboard li {
  padding: 15px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 15px;
}

.leaderboard li:last-child {
  border-bottom: none;
}

.leaderboard .rank {
  font-size: 1.2rem;
  font-weight: 700;
  width: 30px;
}

.leaderboard .rank.gold {
  color: #ffd700;
}

.leaderboard .rank.silver {
  color: #c0c0c0;
}

.leaderboard .rank.bronze {
  color: #cd7f32;
}

.leaderboard .player-info {
  flex: 1;
}

.leaderboard .player-name {
  font-weight: 600;
}

.leaderboard .player-stats {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.leaderboard .result-badge {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
}

.leaderboard .result-badge.won {
  background-color: var(--correct);
}

.leaderboard .result-badge.lost {
  background-color: var(--absent);
}

.results-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
}

/* Sabotage Mode - Word Assignment in Results */
.sabotage-word-info {
  margin-top: 4px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.sabotage-word-info strong {
  color: var(--present);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.picked-by {
  font-style: italic;
  margin-left: 6px;
  color: var(--text-secondary);
}

/* Connection Status */
.connection-status {
  position: fixed;
  top: 10px;
  left: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background-color: var(--bg-secondary);
  border-radius: 20px;
  font-size: 0.75rem;
  z-index: 100;
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}

/* Auto-minimize when connected - only show dot */
.connection-status.connected {
  padding: 6px;
  gap: 0;
}

.connection-status.connected .status-text {
  display: none;
}

/* Show full status on hover when connected */
.connection-status.connected:hover {
  padding: 6px 12px;
  gap: 6px;
}

.connection-status.connected:hover .status-text {
  display: inline;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #ffa500;
  flex-shrink: 0;
}

.connection-status.connected .status-dot {
  background-color: var(--correct);
}

.connection-status.disconnected .status-dot {
  background-color: var(--danger);
  animation: pulse-disconnect 1.5s infinite;
}

@keyframes pulse-disconnect {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Toast */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  z-index: 100;
  animation: fadeIn 0.3s;
}

.toast.error {
  border-color: var(--danger);
  color: var(--danger);
}

.toast.info {
  border-color: var(--accent);
  color: var(--text-primary);
}

.toast.success {
  border-color: var(--correct);
  color: var(--correct);
}

.toast.warning {
  border-color: var(--present);
  color: var(--present);
}

.toast.hidden {
  display: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 10px;
    padding-bottom: 0;
  }

  .header {
    padding: 10px 0;
    margin-bottom: 10px;
  }

  .header h1 {
    font-size: 1.5rem;
  }

  /* Game view layout for mobile - use svh for stability */
  #game.view {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: calc(100vh - 80px);
    height: calc(100svh - 80px);
    touch-action: manipulation;
  }

  .game-layout {
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    gap: 6px;
  }

  .opponents-panel {
    width: 100%;
    order: -1; /* Show at top on mobile */
    padding: 8px;
    max-height: 120px;
    overflow-y: auto;
    overflow-x: hidden;
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
  }

  .opponents-panel h3 {
    display: none; /* Hide "Opponents" header in compact mode */
  }

  #opponentBoards {
    flex-direction: column;
    gap: 6px;
  }

  .opponent-board.compact {
    flex: none;
    min-width: auto;
    width: 100%;
  }

  /* Fallback for non-compact (shouldn't happen on mobile, but just in case) */
  .opponent-board:not(.compact) {
    flex: 1;
    min-width: 120px;
  }

  /* Main game area fills remaining space */
  .main-game {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 6px;
    padding-bottom: 6px;
  }

  .timer-display {
    flex-shrink: 0;
  }

  /* Grid scales to fit available space */
  .grid {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 0;
    touch-action: manipulation;
  }

  .tile {
    width: 48px;
    height: 48px;
    font-size: 1.4rem;
  }

  /* Keyboard stays at bottom - flex-based sizing */
  .keyboard {
    flex-shrink: 0;
    padding-bottom: env(safe-area-inset-bottom, 8px);
  }

  .keyboard button {
    max-width: 40px;
    height: 54px;
    font-size: 0.8rem;
  }

  .keyboard button.key-wide {
    max-width: 60px;
  }
}

/* Mobile - standard phones (iPhone, Pixel, Galaxy) */
@media (max-width: 480px) {
  .container {
    padding: 6px;
    padding-bottom: 0;
  }

  .header {
    padding: 6px 0;
    margin-bottom: 6px;
  }

  .header h1 {
    font-size: 1.25rem;
  }

  .header .tagline {
    font-size: 0.7rem;
  }

  .auth-section {
    padding: 12px;
  }

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

  .auth-buttons .btn {
    width: 100%;
  }

  .auth-message {
    font-size: 0.9rem;
  }

  .auth-submessage {
    font-size: 0.8rem;
  }

  .modal-content {
    width: 95%;
    padding: 16px;
    margin: 10px;
  }

  .join-section {
    flex-direction: column;
  }

  .join-section input {
    width: 100%;
  }

  .join-section .btn {
    width: 100%;
  }

  /* Game view on phones - use svh for stable layout */
  #game.view {
    height: calc(100vh - 50px);
    height: calc(100svh - 50px);
  }

  .opponents-panel {
    max-height: 100px;
    padding: 6px;
  }

  .main-game {
    gap: 4px;
    padding-bottom: 4px;
  }

  /* Smaller tiles to give keyboard more room */
  .tile {
    width: 42px;
    height: 42px;
    font-size: 1.25rem;
  }

  .grid {
    gap: 4px;
  }

  .grid-row {
    gap: 4px;
  }

  /* Keyboard - taller keys, flex fills width */
  .keyboard {
    gap: 5px;
    padding: 0 4px;
  }

  .keyboard-row {
    gap: 4px;
  }

  .keyboard button {
    max-width: none; /* Remove cap, let flex fill */
    height: 52px;
    font-size: 0.8rem;
    border-radius: 4px;
  }

  .keyboard button.key-wide {
    max-width: none;
    font-size: 0.7rem;
  }

  .timer-display {
    font-size: 1.1rem;
    padding: 4px 0;
  }

  /* Game header mobile adjustments */
  .game-header {
    max-width: 100%;
    padding: 0 10px;
  }

  .btn-leave {
    padding: 4px 8px;
    font-size: 0.75rem;
  }

  .btn-leave .leave-text {
    display: none;
  }

  .game-header::after {
    width: 30px;
  }
}

/* Small phones (iPhone SE, Mini, budget Android) */
@media (max-width: 375px) {
  .header {
    padding: 4px 0;
    margin-bottom: 4px;
  }

  .header h1 {
    font-size: 1.1rem;
  }

  .opponents-panel {
    max-height: 85px;
  }

  .tile {
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
  }

  .keyboard button {
    height: 48px;
    font-size: 0.75rem;
  }
}

/* Very small screens (iPhone SE 1st gen, etc.) */
@media (max-width: 340px) {
  .tile {
    width: 34px;
    height: 34px;
    font-size: 1rem;
  }

  .keyboard button {
    height: 44px;
    font-size: 0.7rem;
  }

  .keyboard button.key-wide {
    min-width: 38px;
  }

  .opponents-panel {
    max-height: 80px;
  }
}

/* Ready System */
.ready-section {
  text-align: center;
  margin-bottom: 20px;
}

.btn-ready {
  width: 100%;
  padding: 14px 24px;
  font-size: 1.1rem;
  font-weight: 600;
  background-color: var(--bg-tile);
  border: 2px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 12px;
}

.btn-ready:hover {
  border-color: var(--accent);
  background-color: rgba(83, 141, 78, 0.2);
}

.btn-ready.ready {
  background-color: var(--correct);
  border-color: var(--correct);
  color: var(--text-primary);
}

.btn-ready.ready:hover {
  background-color: #477841;
}

/* Ready indicators in player list */
.ready-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 0.85rem;
  margin-right: 10px;
  flex-shrink: 0;
}

.ready-indicator.ready {
  background-color: var(--correct);
  color: var(--text-primary);
}

.ready-indicator.not-ready {
  background-color: var(--bg-tile);
  color: var(--text-secondary);
}

.player-list li .player-name {
  flex: 1;
}

/* Disabled start button */
.btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Countdown Overlay */
.countdown-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
}

.countdown-overlay.hidden {
  display: none;
}

.countdown-content {
  text-align: center;
}

.countdown-number {
  font-size: 10rem;
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 0 40px rgba(83, 141, 78, 0.5);
}

.countdown-number.pulse {
  animation: countdownPulse 0.5s ease-out;
}

@keyframes countdownPulse {
  0% {
    transform: scale(1.5);
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Reconnecting Overlay */
.reconnecting-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 400;
}

.reconnecting-overlay.hidden {
  display: none;
}

.reconnecting-content {
  text-align: center;
}

.reconnecting-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.reconnecting-text {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 8px 0;
}

.reconnecting-subtext {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0;
}

/* Game Header (timer + leave button) */
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
  width: 100%;
  max-width: 350px;
  margin-left: auto;
  margin-right: auto;
}

.btn-leave {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--text-secondary);
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-leave:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.btn-leave .leave-icon {
  font-size: 1rem;
}

/* Spacer to balance the layout */
.game-header::after {
  content: '';
  width: 70px; /* Approximate width of leave button */
  flex-shrink: 0;
}

/* Timer Display */
.timer-display {
  text-align: center;
  flex-grow: 1;
}

/* Remove margin when inside game-header */
.game-header .timer-display {
  margin-bottom: 0;
}

.timer-display #gameTimer {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.timer-display #gameTimer.finished {
  color: var(--correct);
}

/* Opponent Timer */
.player-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.player-header .player-name {
  font-weight: 600;
  font-size: 0.85rem;
}

.opponent-timer {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  background-color: var(--bg-tile);
  padding: 2px 6px;
  border-radius: 4px;
}

.opponent-timer.finished {
  color: var(--correct);
  background-color: rgba(83, 141, 78, 0.2);
}

/* Word Mode Selector */
.word-mode-selector {
  margin-bottom: 20px;
}

.word-mode-selector label {
  display: block;
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 10px;
}

.daily-number {
  color: var(--accent);
  font-weight: 600;
  margin-left: 5px;
}

.daily-number.hidden {
  display: none;
}

/* Historical Dailies Button */
.btn-historical {
  width: 100%;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
  color: var(--text-primary);
  border: 2px solid #4a5568;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 12px;
}

.btn-historical:hover {
  background: linear-gradient(135deg, #5a6578 0%, #3d4758 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(74, 85, 104, 0.3);
}

.btn-historical:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Historical Dailies View */
.historical-content {
  max-width: 500px;
  margin: 0 auto;
  padding: 40px 20px;
  text-align: center;
}

.historical-content h2 {
  font-size: 1.75rem;
  margin-bottom: 8px;
}

.historical-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 32px;
}

/* Quick Play Section */
.quick-play-section {
  margin-bottom: 32px;
}

.btn-large {
  padding: 18px 32px;
  font-size: 1.1rem;
}

.quick-play-info {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 12px;
}

/* Recent Dailies Section */
.recent-section {
  margin-bottom: 32px;
  text-align: left;
}

.recent-section h3 {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.recent-dailies-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recent-daily-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background-color: var(--bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s ease;
}

.recent-daily-item:hover:not(.completed) {
  border-color: var(--accent);
  background-color: rgba(83, 141, 78, 0.1);
}

.recent-daily-item.completed {
  opacity: 0.6;
}

.recent-daily-item.completed:hover {
  opacity: 0.8;
}

.daily-item-number {
  font-weight: 700;
  font-size: 1rem;
  min-width: 80px;
  text-align: left;
}

.daily-item-date {
  flex: 1;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.daily-item-status {
  font-size: 0.85rem;
}

.daily-item-status.completed {
  color: var(--correct);
}

.daily-item-status.not-played {
  color: var(--text-secondary);
}

/* Browse Section */
.browse-section {
  margin-bottom: 32px;
  text-align: left;
}

.browse-section h3 {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.browse-controls {
  display: flex;
  gap: 12px;
}

.browse-input {
  flex: 1;
  padding: 12px;
  font-size: 1rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
}

.browse-input:focus {
  outline: none;
  border-color: var(--accent);
}

.browse-range {
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin-top: 8px;
}

/* Historical Modal Date */
.historical-modal-date {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: -12px;
  margin-bottom: 20px;
}

/* Public Rooms Section */
.public-rooms-section {
  margin-bottom: 20px;
}

.public-rooms-section h3 {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.public-rooms-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.public-room-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background-color: var(--bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s ease;
}

.public-room-item:hover {
  border-color: var(--accent);
  background-color: rgba(83, 141, 78, 0.1);
}

.public-room-info {
  flex: 1;
  text-align: left;
}

.public-room-creator {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.public-room-details {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.public-room-players {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-right: 12px;
}

.public-room-join {
  padding: 6px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  background-color: var(--accent);
  color: var(--text-primary);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.public-room-join:hover {
  opacity: 0.9;
}

/* FEAT-002: Completed daily room styles */
.public-room-item.completed-daily {
  opacity: 0.7;
  border-color: var(--correct);
}

.public-room-join.completed {
  background-color: var(--correct);
  cursor: not-allowed;
  opacity: 0.8;
}

.public-room-join.completed:hover {
  opacity: 0.8;
}

.public-room-join:disabled {
  cursor: not-allowed;
}

.no-rooms-msg {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-style: italic;
  text-align: center;
  padding: 16px;
  background-color: var(--bg-secondary);
  border-radius: 8px;
  border: 1px dashed var(--border);
}

/* Visibility Selector (Waiting Room) */
.visibility-selector {
  margin-bottom: 20px;
}

.visibility-selector label {
  display: block;
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 10px;
}

.visibility-buttons {
  display: flex;
  gap: 10px;
}

.vis-btn {
  flex: 1;
  padding: 12px 16px;
  font-size: 0.9rem;
  background-color: var(--bg-tile);
  border: 2px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
  min-width: 0; /* Allow shrinking in flex */
}

.vis-btn.active {
  border-color: var(--accent);
  background-color: rgba(83, 141, 78, 0.2);
}

.vis-btn:hover:not(.active) {
  border-color: var(--text-secondary);
}

.visibility-hint {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 8px;
  text-align: center;
}

/* Daily Challenge Completed Button State */
.btn-daily.completed {
  background: linear-gradient(135deg, #538d4e 0%, #3a6b38 100%);
  border-color: #538d4e;
  opacity: 0.85;
}

.btn-daily.completed:hover {
  transform: none;
  box-shadow: none;
  opacity: 0.9;
}

.daily-check {
  color: var(--text-primary);
  font-weight: bold;
  margin-right: 4px;
}

/* Daily Mode Modal Note */
.daily-mode-note {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: -12px;
  margin-bottom: 16px;
  text-align: center;
  font-style: italic;
}

/* Word Reveal Section in Daily Completed View */
.word-reveal-section {
  margin-bottom: 24px;
  text-align: center;
}

.word-reveal-label {
  display: block;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 8px;
}

/* Next Daily Countdown Message */
.next-daily-msg {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 16px 0;
  text-align: center;
}

/* ===========================================
   Waiting Room Card Layout (Phase 1 UI Update)
   =========================================== */

/* Card wrapper for grouped content */
.waiting-card {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.waiting-card-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Actions card with slightly different emphasis */
.actions-card {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 16px;
  margin-top: 8px;
}

/* Secondary actions row (Start Game + Leave Room side by side) */
.secondary-actions {
  display: flex;
  gap: 12px;
}

.secondary-actions .btn {
  flex: 1;
  padding: 12px 16px;
  font-size: 0.95rem;
}

/* Leave button outline style (placed in actions card) */
.btn-leave-outline {
  background: transparent;
  border: 2px solid var(--absent);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-leave-outline:hover {
  border-color: #c0392b;
  color: #c0392b;
}

/* ===========================================
   Room Config View (Phase 2: Pre-Creation)
   =========================================== */

.config-content {
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
  padding: 20px;
}

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

.view-header h2 {
  font-size: 1.5rem;
  color: var(--text-primary);
  margin: 0 0 8px 0;
}

.view-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0;
}

.config-card {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.config-card label {
  display: block;
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 10px;
}

.config-hint {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 8px;
  text-align: center;
}

.config-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.config-actions .btn {
  flex: 1;
  padding: 14px 24px;
  font-size: 1rem;
}

.config-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.config-toggle-label {
  color: var(--text-primary);
  font-size: 0.95rem;
}

/* ===========================================
   Stats Dashboard View
   =========================================== */

.stats-view-content {
  max-width: 500px;
  margin: 0 auto;
  padding: 40px 20px;
  text-align: center;
}

.stats-view-content h2 {
  font-size: 1.75rem;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.stats-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 32px;
}

/* Stats Grid - 2 rows x 3 columns */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border);
}

.stat-card-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

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

/* Guess Distribution Section */
.distribution-section {
  text-align: left;
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
}

.distribution-section h3 {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.distribution-chart {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.distribution-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.distribution-label {
  width: 16px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: right;
  flex-shrink: 0;
}

.distribution-bar-container {
  flex: 1;
  height: 24px;
  display: flex;
  align-items: center;
}

.distribution-bar {
  height: 100%;
  min-width: 24px;
  background-color: var(--absent);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  transition: width 0.3s ease;
}

.distribution-bar.highlight {
  background-color: var(--correct);
}

.distribution-bar.losses {
  background-color: var(--danger);
}

.distribution-count {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
}

.distribution-percent {
  width: 50px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: right;
  flex-shrink: 0;
}

/* Back button for stats view */
#backFromStats {
  margin-top: 8px;
}

/* ===========================================
   Enhanced Stats Sections (Mock Preview)
   =========================================== */

.stats-section {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  text-align: left;
}

.stats-section h3 {
  font-size: 0.85rem;
  margin-bottom: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Daily Challenge Stats */
.daily-stats-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.daily-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 100px;
}

.daily-stat-icon {
  font-size: 1.1rem;
}

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

.daily-stat-label {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

/* Mode Breakdown */
.mode-stats-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mode-stat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.mode-stat-row:last-child {
  border-bottom: none;
}

.mode-icon {
  font-size: 1.2rem;
  width: 28px;
  text-align: center;
}

.mode-name {
  font-weight: 600;
  color: var(--text-primary);
  width: 80px;
}

.mode-games {
  color: var(--text-secondary);
  font-size: 0.85rem;
  flex: 1;
}

.mode-winrate {
  font-weight: 700;
  min-width: 45px;
  text-align: right;
}

.mode-avg {
  color: var(--text-secondary);
  font-size: 0.8rem;
  min-width: 55px;
  text-align: right;
}

.win-high {
  color: var(--correct);
}

.win-low {
  color: var(--danger);
}

/* Achievements */
.achievements-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.achievement {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    background 0.2s ease;
}

.achievement:hover {
  transform: scale(1.1);
}

.achievement.unlocked {
  background: var(--bg-tile);
}

.achievement.locked {
  background: transparent;
  opacity: 0.4;
}

.achievement-icon {
  font-size: 1.6rem;
}

.achievement-progress {
  font-size: 0.6rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Achievement count badge in header */
.achievement-count {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--accent);
  margin-left: 8px;
}

/* Secret achievements (locked) */
.achievement.secret {
  background: transparent;
  opacity: 0.5;
}

.achievement.secret .achievement-icon {
  filter: grayscale(0);
}

/* Unlocked glow effect */
.achievement.unlocked {
  background: var(--bg-tile);
  box-shadow: 0 0 8px rgba(83, 141, 78, 0.3);
}

/* Achievement Tooltip */
.achievement-tooltip {
  position: fixed;
  z-index: 1000;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  max-width: 240px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  animation: tooltipFade 0.15s ease;
}

@keyframes tooltipFade {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tooltip-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.tooltip-icon {
  font-size: 1.4rem;
}

.tooltip-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
}

.tooltip-flavor {
  font-style: italic;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.tooltip-requirement {
  font-size: 0.8rem;
  color: var(--text-primary);
  padding: 6px 8px;
  background: var(--bg-tile);
  border-radius: 4px;
  margin-bottom: 6px;
}

.tooltip-status {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.tooltip-status.unlocked {
  color: var(--correct);
}

/* Head-to-Head */
.h2h-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.h2h-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.h2h-row:last-child {
  border-bottom: none;
}

.h2h-opponent {
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.h2h-record {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.h2h-pct {
  font-weight: 700;
  min-width: 60px;
  text-align: right;
}

/* Trends */
.trends-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.trend-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.trend-label {
  color: var(--text-secondary);
  font-size: 0.85rem;
  width: 85px;
}

.trend-sparkline {
  font-family: monospace;
  font-size: 1.1rem;
  letter-spacing: -1px;
  color: var(--accent);
  flex: 1;
}

.trend-current {
  font-weight: 700;
  color: var(--text-primary);
  min-width: 45px;
  text-align: right;
}

.trend-change {
  font-size: 0.8rem;
  min-width: 55px;
  text-align: right;
}

.trend-up {
  color: var(--correct);
}

.trend-down {
  color: var(--danger);
}

/* Recent Games */
.recent-games-list {
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.recent-game-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.recent-game-row:last-child {
  border-bottom: none;
}

.game-mode {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}

.game-desc {
  flex: 1;
  color: var(--text-primary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-result {
  font-weight: 600;
  min-width: 55px;
}

.game-result.win {
  color: var(--correct);
}

.game-result.loss {
  color: var(--danger);
}

.game-time {
  color: var(--text-secondary);
  font-size: 0.8rem;
  min-width: 40px;
  text-align: right;
}

.game-date {
  color: var(--text-secondary);
  font-size: 0.75rem;
  min-width: 65px;
  text-align: right;
}

/* Opening Words */
.opening-words-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.opening-word-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.opening-word-row:last-child {
  border-bottom: none;
}

.opening-word-row.best {
  background: rgba(83, 141, 78, 0.1);
  margin: 0 -12px;
  padding: 8px 12px;
  border-radius: 6px;
  border-bottom: none;
}

.opening-word-rank {
  color: var(--text-secondary);
  font-size: 0.85rem;
  width: 20px;
}

.opening-word-word {
  font-weight: 700;
  font-family: monospace;
  font-size: 1rem;
  color: var(--text-primary);
  width: 60px;
  letter-spacing: 1px;
}

.opening-word-games {
  color: var(--text-secondary);
  font-size: 0.8rem;
  flex: 1;
}

.opening-word-winrate {
  font-weight: 600;
  font-size: 0.85rem;
  min-width: 55px;
}

.opening-word-avg {
  color: var(--text-secondary);
  font-size: 0.8rem;
  min-width: 50px;
  text-align: right;
}

.opening-word-badge {
  font-size: 0.75rem;
  background: var(--gold);
  color: #000;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

/* View Stats Button in lobby */
.btn-stats {
  width: 100%;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  background: var(--bg-tile);
  color: var(--text-primary);
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 12px;
}

.btn-stats:hover {
  border-color: var(--accent);
  background-color: rgba(83, 141, 78, 0.15);
}

/* Responsive adjustments for stats view */
@media (max-width: 480px) {
  .stats-view-content {
    padding: 20px 16px;
  }

  .stats-grid {
    gap: 8px;
  }

  .stat-card {
    padding: 12px 8px;
  }

  .stat-card-value {
    font-size: 1.4rem;
  }

  .stat-card-label {
    font-size: 0.65rem;
  }

  .distribution-section {
    padding: 16px;
  }

  .distribution-percent {
    width: 40px;
    font-size: 0.7rem;
  }

  /* Enhanced stats sections - mobile */
  .stats-section {
    padding: 12px 14px;
    margin-bottom: 12px;
  }

  .daily-stats-row {
    flex-direction: column;
    gap: 8px;
  }

  .daily-stat {
    min-width: unset;
  }

  .mode-stat-row {
    flex-wrap: wrap;
    gap: 6px;
  }

  .mode-name {
    width: 65px;
  }

  .mode-avg {
    display: none;
  }

  .achievement {
    padding: 8px 10px;
  }

  .achievement-icon {
    font-size: 1.4rem;
  }

  .trend-label {
    width: 70px;
    font-size: 0.8rem;
  }

  .trend-sparkline {
    font-size: 0.95rem;
  }

  .recent-game-row {
    font-size: 0.8rem;
  }

  .game-time {
    display: none;
  }

  .opening-word-row {
    flex-wrap: wrap;
    gap: 6px;
  }

  .opening-word-games,
  .opening-word-avg {
    display: none;
  }
}

/* ===========================================
   Header Toolbar (Lobby Redesign Phase 1)
   =========================================== */

.header-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

.header-title {
  text-align: center;
  flex: 1;
}

.header-title h1 {
  margin: 0;
}

.header-title .tagline {
  margin: 0;
}

.toolbar-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 8px;
  font-size: 1.25rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.toolbar-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.toolbar-btn.back-btn {
  font-size: 1.5rem;
}

.toolbar-right {
  display: flex;
  gap: 4px;
}

/* ===========================================
   Profile Dropdown
   =========================================== */

.profile-dropdown {
  position: absolute;
  top: 60px;
  right: 10px;
  width: 240px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 200;
  overflow: hidden;
  animation: dropdownSlide 0.2s ease;
}

@keyframes dropdownSlide {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-content {
  padding: 8px 0;
}

.dropdown-header {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.profile-email {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.dropdown-item {
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: none;
  text-align: left;
  font-size: 0.95rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.15s ease;
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.dropdown-item-danger {
  color: var(--danger);
}

.dropdown-item-danger:hover {
  background: rgba(231, 76, 60, 0.1);
}

/* ===========================================
   Simplified Lobby (Phase 3)
   =========================================== */

.lobby-simplified {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px 20px;
  max-width: 400px;
  margin: 0 auto;
}

/* ===========================================
   UNIFIED LOBBY BUTTON SYSTEM
   =========================================== */

.btn-lobby {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  width: 100%;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.btn-lobby-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.btn-lobby-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.btn-lobby-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.btn-lobby-subtitle {
  font-size: 0.8rem;
  opacity: 0.7;
}

/* Primary - Daily Challenge (slightly taller) */
.btn-lobby-primary {
  padding: 20px 18px;
  background: linear-gradient(135deg, #c9a227 0%, #9a7b1c 100%);
  border: 2px solid #c9a227;
  color: var(--text-primary);
}

.btn-lobby-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(201, 162, 39, 0.35);
}

.btn-lobby-primary:disabled {
  background: var(--bg-secondary);
  border-color: var(--border);
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-lobby-primary .btn-lobby-icon {
  font-size: 1.75rem;
}

.btn-lobby-primary .btn-lobby-title {
  font-size: 1.1rem;
}

/* Secondary - Play With Friends */
.btn-lobby-secondary {
  background: var(--accent);
  border: 2px solid var(--accent);
  color: var(--text-primary);
}

.btn-lobby-secondary:hover {
  background: #477841;
  border-color: #477841;
  transform: translateY(-1px);
}

/* Tertiary - Solo, Past Dailies */
.btn-lobby-tertiary {
  background: var(--bg-primary);
  border: 2px solid var(--border);
  color: var(--text-primary);
}

.btn-lobby-tertiary:hover {
  border-color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
}

.btn-lobby-tertiary .btn-lobby-subtitle {
  color: var(--text-secondary);
  opacity: 1;
}

/* Hover only on devices that support it */
@media (hover: hover) {
  .btn-lobby:hover:not(:disabled) {
    transform: translateY(-2px);
  }
}

/* Desktop max-width */
@media (min-width: 600px) {
  .lobby-simplified {
    max-width: 400px;
    margin: 0 auto;
  }
}

/* ===========================================
   SOLO SETTINGS VIEW
   =========================================== */

.solo-settings-content {
  max-width: 400px;
  margin: 0 auto;
  padding: 20px;
}

/* Quick Play CTA */
.btn-solo-quick {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px;
  margin-bottom: 20px;
  background: var(--accent);
  border: 2px solid var(--accent);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-solo-quick:hover {
  background: #477841;
  border-color: #477841;
  transform: translateY(-1px);
}

.btn-solo-quick .quick-icon {
  font-size: 1.25rem;
}

/* Hint with inline link */
.config-hint-link {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 10px;
}

.config-hint-link a {
  color: #c9a227;
  text-decoration: underline;
  cursor: pointer;
}

.config-hint-link a:hover {
  color: #dab32e;
}

/* Mode button with description */
.mode-btn-rich {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  flex: 1;
  padding: 12px 14px;
  background: var(--accent);
  border: 2px solid var(--accent);
  border-radius: 8px;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
}

.mode-btn-rich .mode-title {
  font-size: 0.9rem;
  font-weight: 600;
}

.mode-btn-rich .mode-desc {
  font-size: 0.75rem;
  opacity: 0.85;
}

/* Sabotage Teaser */
.sabotage-teaser {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin-top: 12px;
  background: rgba(83, 141, 78, 0.1);
  border: 1px dashed var(--accent);
  border-radius: 8px;
  opacity: 0.7;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sabotage-teaser:hover {
  opacity: 0.9;
  border-color: var(--accent);
  background: rgba(83, 141, 78, 0.15);
}

.teaser-icon {
  font-size: 1.2rem;
}

.teaser-content {
  flex: 1;
}

.teaser-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.teaser-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.teaser-badge {
  font-size: 0.65rem;
  padding: 3px 8px;
  background: var(--accent);
  color: white;
  border-radius: 10px;
  font-weight: 600;
}

/* Sabotage Expanded */
.sabotage-expanded {
  padding: 14px;
  margin-top: 10px;
  background: rgba(83, 141, 78, 0.15);
  border: 1px solid var(--accent);
  border-radius: 8px;
}

.sabotage-expanded .expanded-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sabotage-expanded .expanded-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 12px;
}

.btn-try-multiplayer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-try-multiplayer:hover {
  background: #477841;
}

/* ===========================================
   LEGACY BUTTON STYLES (kept for compatibility)
   =========================================== */

/* Primary CTA - Daily Challenge */
.btn-daily-large {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 24px 20px;
  background: linear-gradient(135deg, #c9a227 0%, #9a7b1c 100%);
  border: 2px solid #c9a227;
  border-radius: 12px;
  color: var(--text-primary);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.btn-daily-large:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(201, 162, 39, 0.35);
}

.btn-daily-large:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-daily-large .btn-icon {
  font-size: 1.75rem;
}

.btn-daily-large .btn-text {
  font-size: 1.15rem;
}

.btn-daily-large .btn-number {
  font-size: 0.9rem;
  opacity: 0.9;
}

.btn-daily-large.completed {
  background: linear-gradient(135deg, #538d4e 0%, #3a6b38 100%);
  border-color: #538d4e;
}

/* Secondary CTA - Play With Friends */
.btn-friends {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 20px;
  background: var(--accent);
  border: 2px solid var(--accent);
  border-radius: 12px;
  color: var(--text-primary);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.btn-friends:hover {
  background: #477841;
  border-color: #477841;
  transform: translateY(-1px);
}

.btn-friends .btn-icon {
  font-size: 1.5rem;
}

.btn-friends .btn-text {
  font-size: 1.05rem;
}

/* Solo Practice Button */
.btn-practice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 20px;
  background: var(--bg-secondary);
  border: 2px solid var(--present);
  border-radius: 12px;
  color: var(--text-primary);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.btn-practice:hover {
  background: var(--present);
  transform: translateY(-1px);
}

.btn-practice .btn-icon {
  font-size: 1.4rem;
}

.btn-practice .btn-text {
  font-size: 1rem;
  font-weight: 600;
}

.btn-practice .btn-subtitle {
  font-size: 0.8rem;
  opacity: 0.7;
}

/* Tertiary CTA - Past Dailies */
.btn-tertiary {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 20px;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: 12px;
  color: var(--text-primary);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.btn-tertiary:hover {
  border-color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
}

.btn-tertiary .btn-icon {
  font-size: 1.25rem;
}

.btn-tertiary .btn-text {
  font-size: 0.95rem;
}

.btn-tertiary .btn-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 400;
}

/* ===========================================
   Compact Stats Strip
   =========================================== */

.stats-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 16px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.stats-strip:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.stats-separator {
  opacity: 0.5;
}

/* ===========================================
   Guest Prompt
   =========================================== */

.guest-prompt {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0;
  padding-top: 8px;
}

.guest-prompt a {
  color: var(--accent);
  text-decoration: none;
}

.guest-prompt a:hover {
  text-decoration: underline;
}

/* ===========================================
   Bottom Sheet (Play With Friends)
   =========================================== */

.bottom-sheet {
  position: fixed;
  inset: 0;
  z-index: 250;
  visibility: hidden;
  opacity: 0;
  transition:
    visibility 0s 0.3s,
    opacity 0.3s ease;
}

.bottom-sheet.visible {
  visibility: visible;
  opacity: 1;
  transition:
    visibility 0s,
    opacity 0.3s ease;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.sheet-container {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg);
  border-radius: 16px 16px 0 0;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.bottom-sheet.visible .sheet-container {
  transform: translateY(0);
}

/* Desktop: Convert bottom sheet to centered modal */
@media (min-width: 768px) {
  .bottom-sheet .sheet-container {
    position: fixed;
    bottom: auto;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    opacity: 0;
    max-width: 400px;
    width: 90%;
    border-radius: 16px;
    max-height: 80vh;
    background: var(--bg-secondary);
    box-shadow:
      0 25px 50px -12px rgba(0, 0, 0, 0.5),
      0 0 0 1px rgba(255, 255, 255, 0.05);
    transition:
      transform 0.2s ease-out,
      opacity 0.2s ease-out;
  }

  .bottom-sheet.visible .sheet-container {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: sticky;
  top: 0;
  background: var(--bg-tile);
  z-index: 1;
}

.sheet-header h3 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--text-primary);
}

.sheet-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: none;
  border-radius: 50%;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.sheet-close:hover {
  background: var(--bg-tile);
  color: var(--text-primary);
}

.sheet-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sheet-btn {
  width: 100%;
}

.sheet-join-section {
  display: flex;
  gap: 10px;
}

.sheet-join-section input {
  flex: 1;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 1rem;
  text-transform: uppercase;
}

.sheet-join-section input::placeholder {
  text-transform: none;
  color: var(--text-secondary);
}

.sheet-join-section input:focus {
  outline: none;
  border-color: var(--accent);
}

.sheet-join-section .btn {
  padding: 14px 24px;
}

/* Public rooms in sheet */
.bottom-sheet .public-rooms-section {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 8px;
}

.bottom-sheet .public-rooms-section h4 {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* ===========================================
   Settings View
   =========================================== */

.settings-content {
  max-width: 500px;
  margin: 0 auto;
  padding: 40px 20px;
}

.settings-content h2 {
  font-size: 1.5rem;
  margin-bottom: 24px;
  color: var(--text-primary);
}

.settings-card {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.settings-card label {
  display: block;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.settings-card input[type='text'] {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-tile);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 1rem;
}

.settings-card input[type='text']:focus {
  outline: none;
  border-color: var(--accent);
}

.settings-hint {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 8px;
}

.settings-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toggle-btn {
  padding: 8px 20px;
  background: var(--accent);
  border: none;
  border-radius: 20px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.toggle-btn[aria-pressed='false'] {
  background: var(--absent);
}

.toggle-btn:hover {
  opacity: 0.9;
}

#backFromSettings {
  margin-top: 24px;
}

/* Settings Account Section */
.settings-action-btn {
  width: 100%;
  margin-top: 8px;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.settings-form input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-tile);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.settings-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.settings-form-actions {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

.settings-form-actions .btn {
  flex: 1;
  padding: 10px 16px;
}

/* ===========================================
   Mobile Adjustments for Lobby Redesign
   =========================================== */

@media (max-width: 480px) {
  .header-toolbar {
    padding: 0 8px;
  }

  .toolbar-btn {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }

  .lobby-simplified {
    padding: 16px 16px;
    gap: 14px;
  }

  .btn-daily-large {
    padding: 20px 16px;
  }

  .btn-daily-large .btn-icon {
    font-size: 1.5rem;
  }

  .btn-daily-large .btn-text {
    font-size: 1.05rem;
  }

  .btn-friends {
    padding: 16px;
  }

  .btn-friends .btn-icon {
    font-size: 1.3rem;
  }

  .btn-friends .btn-text {
    font-size: 1rem;
  }

  .btn-tertiary {
    padding: 14px 16px;
  }

  .stats-strip {
    padding: 12px 14px;
    font-size: 0.85rem;
  }

  .profile-dropdown {
    right: 8px;
    left: 8px;
    width: auto;
  }

  .settings-content {
    padding: 20px 16px;
  }
}

/* Position dropdown relative to header */
.header {
  position: relative;
}

/* ===========================================
   Profile Button States (UX-001)
   =========================================== */

.profile-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 20px;
  transition: all 0.2s ease;
  width: auto;
}

.profile-icon {
  font-size: 1rem;
}

.profile-label {
  font-size: 0.85rem;
  font-weight: 500;
}

/* Logged out - muted, inviting */
.profile-btn.logged-out {
  background: rgba(255, 255, 255, 0.08);
  border: 1px dashed var(--border);
}

.profile-btn.logged-out:hover {
  background: rgba(255, 255, 255, 0.12);
  border-style: solid;
}

.profile-btn.logged-out .profile-label {
  color: var(--text-secondary);
}

/* Logged in - confident, complete */
.profile-btn.logged-in {
  background: rgba(83, 141, 78, 0.2);
  border: 1px solid var(--correct);
}

.profile-btn.logged-in:hover {
  background: rgba(83, 141, 78, 0.3);
}

.profile-btn.logged-in .profile-icon {
  color: var(--correct);
}

/* Mobile: hide label on small screens */
@media (max-width: 480px) {
  .profile-btn .profile-label {
    display: none;
  }

  .profile-btn {
    padding: 8px;
    width: 40px;
  }
}

/* ===========================================
   Feature Tooltip (UX-001)
   =========================================== */

.feature-tooltip {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 8px;
  padding: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 150;
  width: 280px;
  text-align: center;
  animation: tooltipFade 0.2s ease;
}

@keyframes tooltipFade {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.feature-tooltip::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-bottom-color: var(--border);
}

.feature-tooltip::after {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-bottom-color: var(--bg-secondary);
}

.feature-tooltip p {
  margin: 0 0 12px 0;
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.4;
}

.tooltip-cta {
  padding: 10px 24px;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tooltip-cta:hover {
  background: #477841;
}

/* Daily button container for tooltip positioning */
.daily-btn-container {
  position: relative;
  width: 100%;
}

/* =============================================================================
   Sabotage Mode - Triple Button Layout
   ============================================================================= */

.mode-buttons-triple {
  display: flex;
  gap: 8px;
}

.mode-buttons-triple .mode-btn {
  flex: 1;
  padding: 10px 8px;
  font-size: 0.85rem;
  white-space: nowrap;
}

.config-hint,
.mode-hint {
  font-size: 0.8rem;
  color: var(--present);
  margin-top: 8px;
  text-align: center;
}

/* =============================================================================
   Word Selection Phase (Sabotage Mode)
   ============================================================================= */

#wordSelection {
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.selection-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  max-width: 400px;
  width: 100%;
}

.selection-header {
  text-align: center;
}

.selection-header h2 {
  font-size: 1.8rem;
  margin-bottom: 8px;
}

.selection-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
}

.selection-timer {
  font-size: 2rem;
  font-weight: 700;
  color: var(--present);
  padding: 8px 20px;
  background-color: var(--bg-secondary);
  border-radius: 8px;
}

.selection-grid {
  display: flex;
  justify-content: center;
  width: 100%;
}

.selection-row {
  display: flex;
  gap: 8px;
}

.selection-tile {
  width: 52px;
  height: 52px;
  border: 2px solid var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 700;
  text-transform: uppercase;
  background-color: var(--bg-secondary);
  transition: border-color 0.2s;
}

.selection-tile.filled {
  border-color: var(--text-secondary);
}

.selection-tile.valid {
  border-color: var(--correct);
  background-color: rgba(83, 141, 78, 0.2);
}

.selection-tile.invalid {
  border-color: var(--danger);
  background-color: rgba(211, 47, 47, 0.1);
}

.selection-status {
  font-size: 0.9rem;
  min-height: 1.2em;
  transition: color 0.2s;
}

.selection-status.valid {
  color: var(--correct);
}

.selection-status.invalid {
  color: var(--danger);
}

.selection-submit {
  padding: 14px 32px;
  font-size: 1rem;
}

.selection-submit:disabled {
  background-color: var(--bg-tile);
  cursor: not-allowed;
}

.selection-progress {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.selection-keyboard {
  margin-top: 10px;
}

.selection-keyboard button {
  background-color: var(--key-bg);
}

/* Submitted state */
#wordSelection.submitted .selection-tile {
  border-color: var(--correct);
  background-color: rgba(83, 141, 78, 0.3);
}

#wordSelection.submitted .selection-submit {
  background-color: var(--correct);
  cursor: default;
}

#wordSelection.submitted .selection-keyboard button {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Mobile adjustments for selection phase */
@media (max-width: 480px) {
  .selection-tile {
    width: 48px;
    height: 48px;
    font-size: 1.6rem;
  }

  .selection-header h2 {
    font-size: 1.5rem;
  }

  .selection-timer {
    font-size: 1.6rem;
  }
}
