/* ==================== CSS VARIABLES & RESET ==================== */
:root {
  --primary: #3a3aff;
  --primary-light: #818cf8;
  --primary-dark: #2020cc;
  --secondary: #06b6d4;
  --secondary-light: #67e8f9;
  --success: #22c55e;
  --success-light: #86efac;
  --danger: #ef4444;
  --danger-light: #fca5a5;
  --warning: #f59e0b;
  --warning-light: #fcd34d;
  --dark: #101010;
  --dark-light: #1f2937;
  --gray: #6b7280;
  --gray-light: #d1d5db;
  --gray-lighter: #f3f4f6;
  --light: #f9fafb;
  --white: #ffffff;
  --shadow: 3px 3px 0 #000;
  --shadow-lg: 5px 5px 0 #000;
  --shadow-xl: 7px 7px 0 #000;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --transition: all 0.2s ease;
}

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

body {
  font-family: 'Nunito', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  background:
    linear-gradient(45deg, rgba(0,0,0,0.035) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(0,0,0,0.035) 25%, transparent 25%),
    radial-gradient(circle at 10% 20%, #b8f5b0 0%, transparent 35%),
    radial-gradient(circle at 90% 80%, #d6e8ff 0%, transparent 38%),
    radial-gradient(circle at 50% 50%, #ffe1a8 0%, transparent 55%),
    #e9f7ff;
  background-size: 34px 34px, 34px 34px, auto, auto, auto;
  min-height: 100vh;
  color: var(--dark);
  overflow-x: hidden;
}

.game-home-link {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 18px;
  border: 3px solid #000;
  border-radius: 10px;
  background: #ffd600;
  color: #101010;
  box-shadow: 4px 4px 0 #000;
  font-family: 'Fredoka One', cursive;
  font-size: 14px;
  text-decoration: none;
}

.game-home-link:hover {
  transform: translate(calc(-50% + 1px), 1px);
  box-shadow: 3px 3px 0 #000;
}

/* ==================== SCREENS ==================== */
.screen {
  display: none;
  min-height: 100vh;
  padding: 76px 20px 20px;
}

.screen.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: 3px solid #000;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  transform: translate(1px, 1px);
  box-shadow: var(--shadow);
}

.btn:active {
  transform: translateY(0);
}

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

.btn-primary {
  background: var(--primary);
  color: var(--white);
  box-shadow: var(--shadow);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn-secondary {
  background: #d6f0ff;
  color: var(--dark);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--gray);
  color: var(--white);
}

.btn-success {
  background: var(--success);
  color: var(--white);
  box-shadow: var(--shadow);
}

.btn-success:hover:not(:disabled) {
  background: #16a34a;
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
  box-shadow: var(--shadow);
}

.btn-danger:hover:not(:disabled) {
  background: #dc2626;
}

.btn-large {
  padding: 14px 28px;
  font-size: 16px;
  border-radius: var(--radius);
}

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-tiny {
  padding: 4px 10px;
  font-size: 12px;
  background: var(--gray-lighter);
  border: 1px solid var(--gray-light);
  border-radius: 6px;
  cursor: pointer;
}

.btn-tiny:hover {
  background: var(--gray-light);
}

.btn-icon {
  font-size: 18px;
}

/* ==================== INPUTS ==================== */
input[type="text"],
input[type="number"] {
  padding: 12px 16px;
  border: 3px solid #000;
  border-radius: var(--radius-sm);
  font-size: 16px;
  transition: var(--transition);
  outline: none;
  width: 100%;
}

input[type="text"]:focus,
input[type="number"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

input[type="range"] {
  -webkit-appearance: none;
  height: 6px;
  border-radius: 3px;
  background: var(--gray-light);
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
}

input[type="color"] {
  width: 32px;
  height: 32px;
  border: 3px solid #000;
  border-radius: 6px;
  cursor: pointer;
  padding: 2px;
}

/* ==================== LANDING SCREEN ==================== */
.landing-container {
  max-width: 500px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.logo-area {
  text-align: center;
}

.game-title {
  font-size: 48px;
  color: var(--primary);
  font-family: 'Fredoka One', cursive;
  text-shadow: 4px 4px 0 #ffd600, 7px 7px 0 #000;
  margin-bottom: 8px;
}

.title-icon {
  display: inline-block;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.subtitle {
  font-size: 18px;
  color: #222;
  font-weight: 900;
}

.landing-card {
  background: var(--white);
  border: 3px solid #000;
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  box-shadow: var(--shadow-xl);
}

.input-group {
  margin-bottom: 20px;
}

.input-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--dark);
}

.divider {
  display: flex;
  align-items: center;
  margin: 20px 0;
  color: var(--gray);
  font-size: 12px;
  font-weight: 600;
}

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

.divider span {
  padding: 0 12px;
}

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

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

.join-group {
  display: flex;
  gap: 12px;
}

.join-group input {
  flex: 1;
}

.rules-card {
  background: #fff7d6;
  border: 3px solid #000;
  border-radius: var(--radius);
  padding: 20px;
  width: 100%;
  color: var(--dark);
  box-shadow: var(--shadow-lg);
}

.rules-card h3 {
  margin-bottom: 12px;
}

.rules-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rules-card li {
  font-size: 14px;
  opacity: 0.9;
}

.stats-area {
  color: #333;
  font-size: 13px;
  text-align: center;
}

.active-rooms-card {
  background: var(--white);
  border: 3px solid #000;
  border-radius: var(--radius);
  padding: 20px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}

.active-rooms-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.active-rooms-header h3 {
  font-size: 16px;
  color: var(--dark);
}

.active-rooms-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
}

.active-room-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
  padding: 12px;
  border: 3px solid #000;
  border-radius: var(--radius-sm);
  background: var(--light);
}

.active-room-item.disabled {
  opacity: 0.75;
}

.active-room-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.active-room-code {
  font-family: monospace;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 2px;
}

.active-room-status {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(79, 70, 229, 0.12);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
}

.active-room-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: var(--gray);
  font-size: 12px;
}

.active-room-item .btn {
  grid-row: 1 / span 2;
  grid-column: 2;
}

.empty-rooms {
  padding: 14px;
  color: var(--gray);
  font-size: 13px;
  text-align: center;
}

/* ==================== LOBBY SCREEN ==================== */
.lobby-container {
  max-width: 1000px;
  width: 100%;
  background: var(--white);
  border: 3px solid #000;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

.lobby-header {
  background: #d6f0ff;
  color: var(--dark);
  border-bottom: 3px solid #000;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.lobby-header h2 {
  font-size: 24px;
  font-family: 'Fredoka One', cursive;
  color: var(--primary);
  text-shadow: 2px 2px 0 #ffd600, 4px 4px 0 #000;
}

.room-code-display {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 3px solid #000;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
}

.room-code-display .label {
  font-size: 12px;
  opacity: 0.8;
}

.room-code-display .code {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 3px;
  font-family: monospace;
}

.lobby-content {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  flex: 1;
  overflow: hidden;
}

.players-panel,
.settings-panel,
.lobby-chat-panel {
  padding: 20px;
  border-right: 3px solid #000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.lobby-chat-panel {
  border-right: none;
}

.players-panel h3,
.settings-panel h3,
.lobby-chat-panel h3 {
  font-size: 16px;
  margin-bottom: 16px;
  color: var(--dark);
}

.players-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--gray-lighter);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.player-item:hover {
  background: var(--gray-light);
}

.player-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.player-name {
  flex: 1;
  font-weight: 500;
}

.player-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.badge-host {
  background: var(--warning);
  color: var(--white);
}

.badge-you {
  background: var(--secondary);
  color: var(--white);
}

/* Settings */
.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-lighter);
}

.setting-item label {
  font-weight: 500;
  font-size: 14px;
}

.setting-control {
  display: flex;
  align-items: center;
  gap: 12px;
}

.setting-control span {
  font-weight: 700;
  font-size: 18px;
  min-width: 30px;
  text-align: center;
}

.settings-note {
  font-size: 12px;
  color: var(--gray);
  margin-top: 16px;
  font-style: italic;
}

/* Lobby Chat */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background: var(--gray-lighter);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  min-height: 150px;
}

.chat-msg {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
  word-wrap: break-word;
}

.chat-msg .sender {
  font-weight: 700;
  margin-right: 4px;
}

.chat-msg.system {
  background: rgba(79, 70, 229, 0.1);
  color: var(--primary);
  text-align: center;
  font-style: italic;
  font-size: 12px;
}

.chat-msg.correct {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
  text-align: center;
  font-weight: 600;
}

.chat-msg.close-guess {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.chat-msg.guess {
  background: var(--white);
  border: 1px solid var(--gray-light);
}

.chat-input-area {
  display: flex;
  gap: 8px;
}

.chat-input-area input {
  flex: 1;
  padding: 10px 14px;
  font-size: 14px;
}

.lobby-footer {
  padding: 16px 24px;
  border-top: 3px solid #000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--gray-lighter);
}

/* ==================== GAME SCREEN ==================== */
#game-screen {
  padding: 0;
  align-items: flex-start;
}

.game-container {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--light);
}

/* Game Header */
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--white);
  border-bottom: 3px solid #000;
  box-shadow: var(--shadow);
  z-index: 10;
  flex-shrink: 0;
}

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

.room-badge {
  background: var(--dark);
  color: var(--white);
  padding: 4px 12px;
  border: 3px solid #000;
  border-radius: 6px;
  font-family: monospace;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 2px;
}

.round-badge {
  background: var(--primary);
  color: var(--white);
  padding: 4px 12px;
  border: 3px solid #000;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
}

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

.timer-container {
  position: relative;
}

.timer-circle {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: conic-gradient(var(--success) 100%, var(--gray-light) 0%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.timer-circle::before {
  content: '';
  position: absolute;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--white);
}

.timer-circle span {
  position: relative;
  z-index: 1;
  font-weight: 800;
  font-size: 16px;
}

.timer-circle.warning {
  background: conic-gradient(var(--warning) var(--progress), var(--gray-light) 0%);
}

.timer-circle.danger {
  background: conic-gradient(var(--danger) var(--progress), var(--gray-light) 0%);
  animation: pulse 0.5s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.word-hint-area {
  text-align: center;
}

.word-language-clue {
  min-height: 20px;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--gray);
  letter-spacing: 0;
}

.word-language-clue .language-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 20px;
  padding: 0 8px;
  border: 1px solid var(--gray-light);
  border-radius: 999px;
  background: var(--white);
  color: var(--dark);
}

.word-hint {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 6px;
  font-family: monospace;
  color: var(--dark);
  min-height: 36px;
}

.drawer-info {
  font-size: 13px;
  color: var(--gray);
  margin-top: 2px;
}

/* Game Main */
.game-main {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

/* Canvas Area */
.canvas-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  gap: 12px;
  overflow: hidden;
  min-width: 0;
}

#drawing-canvas {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: crosshair;
  max-width: 100%;
  touch-action: none;
}

/* Drawing Tools */
.drawing-tools {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  flex-wrap: wrap;
  justify-content: center;
}

.drawing-tools.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.tool-group {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border-right: 1px solid var(--gray-lighter);
}

.tool-group:last-child {
  border-right: none;
}

.tool-group.colors {
  flex-wrap: wrap;
  max-width: 280px;
}

.tool-btn {
  width: 36px;
  height: 36px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: var(--gray-lighter);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: var(--transition);
}

.tool-btn:hover {
  background: var(--gray-light);
}

.tool-btn.active {
  border-color: var(--primary);
  background: rgba(79, 70, 229, 0.1);
}

.color-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition);
}

.color-btn:hover {
  transform: scale(1.2);
}

.color-btn.active {
  border-color: var(--dark);
  transform: scale(1.2);
  box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--dark);
}

.size-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray);
}

.size-slider {
  width: 80px;
}

#size-display {
  font-size: 12px;
  font-weight: 600;
  min-width: 20px;
}

/* Right Panel */
.right-panel {
  width: 300px;
  display: flex;
  flex-direction: column;
  border-left: 2px solid var(--gray-lighter);
  background: var(--white);
  min-height: 0;
}

/* Scoreboard */
.scoreboard-panel {
  padding: 12px;
  border-bottom: 1px solid var(--gray-lighter);
  max-height: 200px;
  overflow-y: auto;
}

.scoreboard-panel h3 {
  font-size: 14px;
  margin-bottom: 8px;
}

.scoreboard-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.score-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 13px;
  transition: var(--transition);
}

.score-item:nth-child(odd) {
  background: var(--gray-lighter);
}

.score-item.drawer {
  background: rgba(79, 70, 229, 0.1);
  border: 1px solid rgba(79, 70, 229, 0.3);
}

.score-item.guessed {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.score-rank {
  font-weight: 800;
  width: 20px;
  color: var(--gray);
}

.score-name {
  flex: 1;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-points {
  font-weight: 800;
  color: var(--primary);
}

.score-status {
  font-size: 16px;
}

/* Game Chat */
.game-chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 12px;
  overflow: hidden;
  min-height: 0;
}

.game-chat-panel .chat-messages {
  flex: 1;
  min-height: 0;
}

/* ==================== MODALS ==================== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.active {
  display: flex;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 500px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  animation: slideUp 0.3s ease;
  text-align: center;
}

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

.modal-content h2 {
  font-size: 24px;
  margin-bottom: 8px;
}

.modal-subtitle {
  color: var(--gray);
  margin-bottom: 24px;
}

/* Word Selection */
.word-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 24px 0;
}

.word-option-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px;
  border: 2px solid var(--gray-light);
  border-radius: var(--radius);
  background: var(--white);
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-transform: capitalize;
}

.word-option-btn .option-language {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--gray-light);
  color: var(--dark);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.word-option-btn:hover {
  border-color: var(--primary);
  background: rgba(79, 70, 229, 0.05);
  transform: scale(1.02);
}

.auto-select-note {
  font-size: 12px;
  color: var(--gray);
}

/* Round Result */
.result-word {
  margin: 20px 0;
}

.result-word .label {
  display: block;
  font-size: 14px;
  color: var(--gray);
  margin-bottom: 8px;
}

.word-reveal {
  font-size: 32px;
  font-weight: 800;
  color: var(--primary);
  text-transform: capitalize;
}

.correct-guessers {
  margin: 16px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.guesser-badge {
  background: var(--success);
  color: var(--white);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.round-scoreboard {
  max-height: 200px;
  overflow-y: auto;
  margin: 16px 0;
}

.next-round-info {
  color: var(--gray);
  font-size: 14px;
  margin-top: 16px;
}

/* Game End */
.winner-announcement {
  margin: 24px 0;
}

.winner-crown {
  font-size: 48px;
  margin-bottom: 8px;
}

.winner-name {
  font-size: 28px;
  font-weight: 800;
  color: var(--warning);
}

.winner-score {
  font-size: 16px;
  color: var(--gray);
}

.final-scoreboard {
  max-height: 250px;
  overflow-y: auto;
  margin: 16px 0;
}

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

/* ==================== TOAST ==================== */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--danger);
  color: var(--white);
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 2000;
  animation: slideUp 0.3s ease;
}

.toast.hidden {
  display: none;
}

.toast-close {
  background: none;
  border: none;
  color: var(--white);
  font-size: 20px;
  cursor: pointer;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 900px), (pointer: coarse) {
  .lobby-content {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
  }

  .players-panel,
  .settings-panel,
  .lobby-chat-panel {
    border-right: none;
    border-bottom: 1px solid var(--gray-lighter);
  }

  .game-main {
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .right-panel {
    width: 100%;
    border-left: none;
    border-top: 2px solid var(--gray-lighter);
    max-height: none;
    flex: 0 0 auto;
  }

  .scoreboard-panel {
    max-height: 62px;
    overflow: hidden;
    flex: 0 0 auto;
  }

  .scoreboard-panel h3 {
    display: none;
  }

  .scoreboard-list {
    flex-direction: row !important;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 4px;
    scroll-snap-type: x proximity;
  }

  .score-item {
    flex: 0 0 142px;
    min-height: 38px;
    scroll-snap-align: start;
  }

  .game-chat-panel {
    flex: 0 0 auto;
  }

  .game-chat-panel .chat-messages {
    max-height: 120px;
  }

  #drawing-canvas {
    width: 100%;
    height: auto;
  }

  .drawing-tools {
    padding: 8px;
    gap: 8px;
  }

  .tool-group.colors {
    max-width: 200px;
  }

  .game-title {
    font-size: 32px;
  }

  .word-hint {
    font-size: 20px;
    letter-spacing: 4px;
  }
}

@media (max-width: 600px), (pointer: coarse) {
  .screen {
    padding: 10px;
  }

  #game-screen {
    padding: 0;
  }

  .game-container {
    min-height: 100dvh;
    padding-top: 104px;
  }

  .lobby-header {
    flex-direction: column;
    text-align: center;
  }

  .game-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px 8px;
    padding: 8px;
    z-index: 100;
  }

  .header-left {
    gap: 6px;
    min-width: 0;
  }

  .header-center {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    gap: 8px;
    min-width: 0;
    width: 100%;
  }

  .header-right {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .header-right .btn {
    min-height: 38px;
    padding: 8px 12px;
  }

  .room-badge,
  .round-badge {
    padding: 4px 8px;
    font-size: 12px;
    letter-spacing: 1px;
  }

  .timer-circle {
    width: 42px;
    height: 42px;
  }

  .timer-circle::before {
    width: 34px;
    height: 34px;
  }

  .word-hint-area {
    flex: 1;
    min-width: 0;
    text-align: left;
  }

  .word-language-clue {
    min-height: 16px;
    margin-bottom: 2px;
  }

  .word-language-clue .language-badge {
    height: 18px;
    min-width: 28px;
    padding: 0 6px;
    font-size: 11px;
  }

  .word-hint {
    min-height: 28px;
    font-size: 18px;
    letter-spacing: 3px;
    overflow-x: auto;
    white-space: nowrap;
  }

  .drawer-info {
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .canvas-area {
    padding: 8px;
    gap: 8px;
    overflow: visible;
    flex: 0 0 auto;
  }

  #drawing-canvas {
    border-radius: var(--radius-sm);
  }

  #game-screen.is-guesser .drawing-tools.disabled {
    display: none;
  }

  body.guess-input-focused #game-screen.is-guesser .scoreboard-panel,
  body.guess-input-focused #game-screen.is-guesser .game-chat-panel .chat-messages {
    display: none;
  }

  body.guess-input-focused #game-screen.is-guesser .canvas-area {
    padding-bottom: 4px;
  }

  .drawing-tools {
    width: 100%;
    align-items: stretch;
    justify-content: flex-start;
    gap: 8px;
    padding: 8px;
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .tool-group {
    flex: 0 0 auto;
    padding: 0 8px 0 0;
  }

  .tool-group.colors {
    max-width: none;
    flex-wrap: nowrap;
  }

  .tool-btn {
    width: 38px;
    height: 38px;
  }

  .color-btn {
    width: 30px;
    height: 30px;
  }

  .size-slider {
    width: 92px;
  }

  .scoreboard-panel {
    padding: 6px 8px 4px;
    max-height: 52px;
  }

  .scoreboard-panel h3 {
    display: none;
  }

  .score-item {
    flex-basis: 126px;
    padding: 5px 6px;
    font-size: 12px;
  }

  .score-rank {
    width: 16px;
  }

  .score-status {
    font-size: 14px;
  }

  .game-chat-panel {
    padding: 8px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }

  .game-chat-panel .chat-messages {
    min-height: 72px;
    max-height: 104px;
    margin-bottom: 8px;
  }

  .right-panel:focus-within .scoreboard-panel {
    max-height: 44px;
  }

  .right-panel:focus-within .game-chat-panel .chat-messages {
    min-height: 44px;
    max-height: 72px;
  }

  .chat-input-area {
    gap: 6px;
  }

  .chat-input-area input {
    min-width: 0;
    font-size: 16px;
    padding: 10px 12px;
  }

  .chat-input-area .btn {
    padding: 10px 12px;
  }

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

  .active-room-item {
    grid-template-columns: 1fr;
  }

  .active-room-main {
    flex-wrap: wrap;
  }

  .active-room-item .btn {
    grid-row: auto;
    grid-column: auto;
    width: 100%;
  }

  .gameend-actions {
    flex-direction: column;
  }
}

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

::-webkit-scrollbar-track {
  background: var(--gray-lighter);
  border-radius: 3px;
}

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

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

/* ==================== ANIMATIONS ==================== */
.score-pop {
  animation: scorePop 0.5s ease;
}

@keyframes scorePop {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); color: var(--success); }
  100% { transform: scale(1); }
}

.guess-flash {
  animation: guessFlash 0.3s ease;
}

@keyframes guessFlash {
  0% { background: rgba(34, 197, 94, 0.3); }
  100% { background: transparent; }
}
