:root {
  --bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --panel: rgba(255, 255, 255, 0.95);
  --text: #2d3748;
  --muted: #718096;
  --border: rgba(226, 232, 240, 0.8);
  --accent: #667eea;
  --danger: #e53e3e;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  --glass: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.2);
}

body,
html {
  height: 100%;
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 80%, rgba(102, 126, 234, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(118, 75, 162, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(102, 126, 234, 0.05) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

* {
  box-sizing: border-box;
}

.app-shell {
  min-height: 100%;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  margin: 10px;
  box-shadow: var(--shadow);
  border: 1px solid var(--glass-border);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.app-shell::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  z-index: 1;
}

.mode-menu {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 8px;
  animation: fadeInUp 520ms ease;
}

.mode-btn {
  border: 1px solid var(--glass-border);
  background: var(--glass);
  backdrop-filter: blur(10px);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 18px;
  cursor: pointer;
  position: relative;
  font-weight: 600;
  transform: translateY(0);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.mode-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.mode-btn:hover::before {
  left: 100%;
}

.mode-btn.active {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--accent) 0%, #5a67d8 100%);
  color: #fff;
  animation: pulseActive 450ms ease;
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
  transform: translateY(-2px);
}

.mode-btn:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.15);
}

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

.coming-soon {
  display: inline-block;
  margin-left: 10px;
  background: #e63946;
  color: white;
  border-radius: 8px;
  font-size: 0.7rem;
  padding: 2px 6px;
  line-height: 1;
}

header {
  text-align: center;
  animation: slideInLeft 420ms ease;
  position: relative;
  z-index: 10;
}

h1 {
  margin: 0;
  font-size: clamp(1.8rem, 2.5vw, 2.8rem);
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent) 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
  animation: float 3s ease-in-out infinite;
}

p {
  margin: 8px 0;
}

.language-switcher {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 8px 16px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  border-radius: 25px;
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  animation: scaleIn 500ms ease;
}

.language-switcher label {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
}

.language-switcher select {
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  color: var(--text);
  font: inherit;
  min-width: 140px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.language-switcher select:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: var(--accent);
}

.language-switcher select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

main {
  display: grid;
  grid-template-columns: 1.45fr 0.55fr;
  gap: 12px;
  align-items: flex-start;
}

.game-panel,
.sidebar {
  background: var(--glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 20px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.game-panel::before,
.sidebar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  z-index: 1;
}

.game-panel {
  animation: fadeInUp 640ms ease;
}

.sidebar {
  animation: fadeInUp 740ms ease;
}

canvas {
  width: 100%;
  max-height: 840px;
  min-height: 680px;
  border-radius: 16px;
  border: 2px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.95);
  display: block;
  touch-action: none;
  margin: 12px 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

canvas:hover {
  border-color: var(--accent);
  box-shadow: 0 12px 40px rgba(102, 126, 234, 0.2);
  transform: translateY(-2px);
}

canvas.drawing {
  animation: glow 2s ease-in-out infinite;
}

canvas.is-fullscreen,
canvas:fullscreen {
  width: 100vw;
  height: 100vh;
  max-height: none;
  min-height: 0;
  margin: 0;
  border-radius: 0;
}

@media (max-width: 1210px) {
  canvas {
    min-height: 560px;
  }
}

.controls,
.guess-panel,
.game-info,
.round-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
  margin-top: 6px;
}

.controls .group,
.guess-panel .group {
  display: flex;
  align-items: center;
  gap: 8px;
}

button,
input[type= text],
input[type=range],
input[type=color] {
  font: inherit;
}

button {
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 10px 14px;
  min-height: 40px;
  color: var(--text);
  background: var(--glass);
  backdrop-filter: blur(10px);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

button:hover::before {
  left: 100%;
}

button:active {
  transform: scale(0.98);
}

button.active {
  background: linear-gradient(135deg, var(--accent) 0%, #5a67d8 100%);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

button:not(.active) {
  color: var(--text);
  background: var(--glass);
}

button:hover {
  border-color: var(--accent);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.2);
}

input[type=text] {
  width: clamp(170px, 37vw, 360px);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  color: var(--text);
  transition: all 0.3s ease;
  font-weight: 500;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

input[type=text]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2), 0 4px 15px rgba(102, 126, 234, 0.3);
  background: rgba(255, 255, 255, 0.3);
}

.game-info {
  justify-content: space-between;
  background: var(--glass);
  backdrop-filter: blur(10px);
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.game-info div {
  font-size: 0.95rem;
}

.rank-display {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
}

.rank-info {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}

.rating-score {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
}

.rank-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
  border: 1px solid #ccc;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  animation: rankShine 2s ease-in-out infinite;
}

.rank-icon {
  font-size: 1.1rem;
  animation: bounce 1s ease-in-out infinite;
}

.rank-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: #333;
}

.rank-progress {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #e0e0e0;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4CAF50, #8BC34A);
  border-radius: 10px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 2s infinite;
}

.progress-text {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

.prompt-box {
  display: flex;
  flex-direction: column;
  gap: 3px;
  animation: fadeIn 360ms ease;
}

.prompt-box h2 {
  margin: 0;
  font-size: 1rem;
  color: var(--muted);
}

.target-text {
  margin: 0;
  color: #111;
  font-size: 1.25rem;
  letter-spacing: 0.01em;
}

.sidebar h3 {
  margin: 6px 0;
}

.category-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.category-row label {
  font-size: 0.85rem;
  color: var(--muted);
}

ul {
  margin: 6px 0 12px;
  padding-left: 20px;
}

.control-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.8em;
  height: 1.45em;
  padding: 0 0.35em;
  border-radius: 999px;
  background: linear-gradient(135deg, #0b5bcb 0%, #4aa3ff 100%);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 1px 6px rgba(34, 91, 180, 0.25);
}

.icon-glyph {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  line-height: 1;
  font-family: Inter, system-ui, sans-serif;
}

.prompt-flash {
  animation: softFlash 360ms ease;
}

.mode-transition {
  animation: modeSwitch 380ms ease;
}

body[dir="rtl"] {
  text-align: right;
}

body[dir="rtl"] .mode-menu,
body[dir="rtl"] .controls,
body[dir="rtl"] .guess-panel,
body[dir="rtl"] .round-controls,
body[dir="rtl"] .game-info {
  direction: rtl;
}

body.light-mode {
  --bg: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  --panel: rgba(255, 255, 255, 0.95);
  --text: #1e293b;
  --muted: #64748b;
  --border: rgba(226, 232, 240, 0.8);
  --accent: #3b82f6;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  --glass: rgba(255, 255, 255, 0.3);
  --glass-border: rgba(255, 255, 255, 0.5);
}

html.light-mode {
  background: #f8fafc;
}

body.light-mode .app-shell {
  background: var(--glass);
  border-color: var(--glass-border);
}

body.light-mode .game-panel,
body.light-mode .sidebar {
  background: rgba(255, 255, 255, 0.95);
  border-color: var(--border);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

body.light-mode .game-info {
  background: rgba(248, 250, 252, 0.95);
  border-color: var(--border);
}

body.light-mode .prompt-box h2 {
  color: var(--muted);
}

body.light-mode .target-text,
body.light-mode header p,
body.light-mode ul,
body.light-mode li {
  color: var(--text);
}

body.light-mode .language-switcher label {
  color: var(--muted);
}

body.light-mode .language-switcher {
  background: var(--glass);
  border-color: var(--glass-border);
}

body.light-mode .language-switcher select {
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
  border-color: var(--border);
}

body.light-mode .control-icon {
  background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
  border-color: rgba(255, 255, 255, 0.6);
}

body.light-mode button,
body.light-mode .mode-btn {
  color: var(--text);
  background: var(--glass);
  border-color: var(--glass-border);
}

body.light-mode button:not(.active):hover,
body.light-mode .mode-btn:not(.active):hover {
  border-color: var(--accent);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.2);
  background: rgba(255, 255, 255, 0.6);
}

body.light-mode button.active,
body.light-mode .mode-btn.active {
  background: linear-gradient(135deg, var(--accent) 0%, #2563eb 100%);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

body.light-mode input[type=text] {
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
  border-color: var(--border);
}

body.light-mode input[type=text]::placeholder {
  color: var(--muted);
}

body.light-mode input[type=text]:focus {
  background: rgba(255, 255, 255, 0.9);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15), 0 4px 15px rgba(59, 130, 246, 0.2);
}

body.light-mode canvas {
  background: rgba(255, 255, 255, 0.98);
  border-color: var(--border);
}

body.light-mode canvas:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 30px rgba(59, 130, 246, 0.15);
}

body.dark-mode {
  --bg: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  --panel: rgba(15, 23, 42, 0.95);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --border: rgba(51, 65, 85, 0.8);
  --accent: #3b82f6;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  --glass: rgba(15, 23, 42, 0.1);
  --glass-border: rgba(51, 65, 85, 0.2);
}

html.dark-mode {
  background: #0f172a;
}

body.dark-mode .app-shell {
  background: var(--glass);
  border-color: var(--glass-border);
}

body.dark-mode .game-panel,
body.dark-mode .sidebar {
  background: rgba(15, 23, 42, 0.95);
  border-color: var(--border);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

body.dark-mode .game-info {
  background: rgba(30, 41, 59, 0.95);
  border-color: var(--border);
}

body.dark-mode .prompt-box h2 {
  color: var(--muted);
}

body.dark-mode .target-text,
body.dark-mode header p,
body.dark-mode ul,
body.dark-mode li {
  color: var(--text);
}

body.dark-mode .language-switcher label {
  color: var(--muted);
}

body.dark-mode .language-switcher {
  background: var(--glass);
  border-color: var(--glass-border);
}

body.dark-mode .language-switcher select {
  background: rgba(30, 41, 59, 0.8);
  color: var(--text);
  border-color: var(--border);
}

body.dark-mode .control-icon {
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  border-color: rgba(255, 255, 255, 0.2);
}

body.dark-mode button,
body.dark-mode .mode-btn {
  color: var(--text);
  background: var(--glass);
  border-color: var(--glass-border);
}

body.dark-mode button:not(.active):hover,
body.dark-mode .mode-btn:not(.active):hover {
  border-color: var(--accent);
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3);
  background: rgba(255, 255, 255, 0.1);
}

body.dark-mode button.active,
body.dark-mode .mode-btn.active {
  background: linear-gradient(135deg, var(--accent) 0%, #2563eb 100%);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

body.dark-mode input[type=text] {
  background: rgba(30, 41, 59, 0.8);
  color: var(--text);
  border-color: var(--border);
}

body.dark-mode input[type=text]::placeholder {
  color: var(--muted);
}

body.dark-mode input[type=text]:focus {
  background: rgba(30, 41, 59, 0.9);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2), 0 4px 15px rgba(59, 130, 246, 0.3);
}

body.dark-mode canvas {
  background: rgba(255, 255, 255, 0.95);
  border-color: var(--border);
}

body.dark-mode canvas:hover {
  border-color: var(--accent);
  box-shadow: 0 12px 40px rgba(59, 130, 246, 0.2);
}

@media (max-width: 1210px) {
  main {
    grid-template-columns: 1fr;
  }
}

@keyframes slideInLeft {
  0% {
    opacity: 0;
    transform: translateX(-30px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  0% {
    opacity: 0;
    transform: translateX(30px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(102, 126, 234, 0.5);
  }
  50% {
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.8), 0 0 30px rgba(102, 126, 234, 0.4);
  }
}

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

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

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

@keyframes rankShine {
  0%, 100% { 
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: scale(1);
  }
  50% { 
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    transform: scale(1.02);
  }
}

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

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

@keyframes pulseActive {
  0% {
    transform: scale(0.98);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes modeSwitch {
  0% {
    transform: scale(0.994);
    opacity: 0.85;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes softFlash {
  0% {
    opacity: 0.5;
  }
  100% {
    opacity: 1;
  }
}

/* Account Modal Styles */
.account-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.3s ease;
}

.account-modal-content {
  background: var(--glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 30px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: scaleIn 0.3s ease;
  color: #ffffff;
}

.account-modal-content h2 {
  margin: 0 0 10px 0;
  color: #ffffff;
  font-size: 1.5rem;
}

.account-modal-content p {
  margin: 0 0 20px 0;
  color: rgba(255, 255, 255, 0.8);
}

.account-modal-content input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-size: 1rem;
  margin-bottom: 20px;
  transition: all 0.3s ease;
}

.account-modal-content input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.account-modal-content input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.account-modal-buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.account-modal-buttons button {
  flex: 1;
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.account-modal-buttons button:first-child {
  background: linear-gradient(135deg, var(--accent), #5a67d8);
  color: white;
}

.account-modal-buttons button:first-child:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.account-modal-buttons button:last-child {
  background: var(--glass);
  color: var(--text);
  border: 1px solid var(--glass-border);
}

.account-modal-buttons button:last-child:hover {
  background: rgba(255, 255, 255, 0.2);
}

.account-info {
  text-align: center;
}

.account-info small {
  color: var(--muted);
  font-size: 0.8rem;
}

/* Account Notifications */
@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* Account Display in Header */
.account-display {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 15px;
  padding: 8px 15px;
  font-size: 0.9rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: fadeIn 0.5s ease;
}

.account-display .username {
  font-weight: 600;
  color: var(--accent);
}

.account-display .sessions {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Save Modal Styles */
.save-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.3s ease;
}

.save-modal-content {
  background: var(--glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 30px;
  max-width: 500px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: scaleIn 0.3s ease;
}

.save-modal-content h3 {
  margin: 0 0 15px 0;
  color: var(--text);
}

.save-modal-content p {
  margin: 0 0 20px 0;
  color: var(--muted);
}

.save-modal-content textarea {
  width: 100%;
  height: 120px;
  padding: 12px;
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  font-family: monospace;
  font-size: 0.9rem;
  resize: vertical;
  margin-bottom: 20px;
}

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

.save-modal-buttons button {
  flex: 1;
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.save-modal-buttons button:first-child {
  background: linear-gradient(135deg, var(--accent), #5a67d8);
  color: white;
}

.save-modal-buttons button:last-child {
  background: var(--glass);
  color: var(--text);
  border: 1px solid var(--glass-border);
}

/* Save Indicator */
.save-indicator {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 10px 15px;
  border-radius: 10px;
  color: white;
  font-weight: 600;
  z-index: 9999;
  animation: slideInRight 0.3s ease;
  display: none;
}

.save-indicator.success {
  background: linear-gradient(135deg, #10b981, #059669);
}

.save-indicator.error {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.save-indicator.warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

/* AI Status Indicator */
.ai-status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: linear-gradient(135deg, var(--accent), #5a67d8);
  color: white;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  margin-top: 8px;
  animation: pulse 2s infinite;
}

.ai-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

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

/* Modern Color Picker Styling */
input[type=color] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 52px;
  height: 52px;
  border: 3px solid var(--glass-border);
  border-radius: 14px;
  padding: 4px;
  background: linear-gradient(145deg, #f5f5f5, #ffffff);
  backdrop-filter: blur(10px);
  cursor: pointer;
  box-shadow: 
    0 4px 15px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

input[type=color]:hover {
  transform: scale(1.08) translateY(-2px);
  border-color: var(--accent);
  box-shadow: 
    0 8px 25px rgba(102, 126, 234, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

input[type=color]:active {
  transform: scale(0.95);
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

input[type=color]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 
    0 0 0 4px rgba(102, 126, 234, 0.15),
    0 4px 15px rgba(0, 0, 0, 0.1);
}

input[type=color]::-webkit-color-swatch-wrapper {
  padding: 0;
  border-radius: 10px;
}

input[type=color]::-webkit-color-swatch {
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 10px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

input[type=color]::-moz-color-swatch {
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 10px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Mobile and iPad Responsive Styles */
@media (max-width: 1024px) {
  .app-shell {
    margin: 5px;
    padding: 10px;
    gap: 8px;
  }
  
  main {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  canvas {
    min-height: 400px;
    max-height: 500px;
    touch-action: none;
  }
  
  .controls,
  .guess-panel,
  .game-info,
  .round-controls {
    gap: 8px;
    justify-content: center;
  }
  
  button {
    padding: 12px 16px;
    min-height: 44px;
    font-size: 0.95rem;
  }
  
  input[type=text] {
    width: 100%;
    max-width: 300px;
  }
}

@media (max-width: 768px) {
  h1 {
    font-size: 1.6rem;
  }
  
  .mode-menu {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .mode-btn {
    padding: 8px 12px;
    font-size: 0.85rem;
    flex: 1;
    min-width: 120px;
  }
  
  canvas {
    min-height: 350px;
    max-height: 450px;
  }
  
  .game-panel,
  .sidebar {
    padding: 15px;
  }
  
  .controls .group,
  .guess-panel .group {
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
  }
  
  button {
    flex: 1;
    min-width: 80px;
    font-size: 0.9rem;
  }
  
  input[type=color] {
    width: 44px;
    height: 44px;
  }
  
  .rank-display {
    font-size: 0.9rem;
  }
  
  .account-display {
    position: relative;
    top: auto;
    right: auto;
    margin: 10px auto;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .app-shell {
    margin: 2px;
    padding: 8px;
    border-radius: 12px;
  }
  
  .mode-btn {
    font-size: 0.8rem;
    padding: 6px 10px;
    min-width: 100px;
  }
  
  canvas {
    min-height: 300px;
    max-height: 380px;
    border-radius: 12px;
  }
  
  .game-panel,
  .sidebar {
    padding: 12px;
    border-radius: 12px;
  }
  
  button {
    padding: 10px 12px;
    font-size: 0.85rem;
    border-radius: 8px;
  }
  
  .controls,
  .guess-panel,
  .round-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .controls .group,
  .guess-panel .group {
    justify-content: center;
    gap: 6px;
  }
  
  input[type=text] {
    width: 100%;
    padding: 12px;
  }
  
  .game-info {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
  
  .game-info div {
    font-size: 0.9rem;
  }
  
  .language-switcher {
    flex-direction: column;
    gap: 6px;
    padding: 6px 12px;
  }
  
  .language-switcher select {
    min-width: 120px;
    padding: 6px 10px;
  }
  
  input[type=range] {
    width: 100px;
  }
  
  .account-modal-content,
  .save-modal-content {
    padding: 20px;
    margin: 10px;
  }
}

/* Touch-specific improvements */
@media (pointer: coarse) {
  button,
  input[type=color],
  .mode-btn {
    min-height: 44px;
  }
  
  canvas {
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
  }
  
  input[type=text] {
    font-size: 16px;
  }
}

/* iPad specific optimizations */
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
  .app-shell {
    margin: 8px;
  }
  
  canvas {
    min-height: 500px;
  }
  
  button {
    min-height: 48px;
    font-size: 1rem;
  }
}

/* Sidebar Leaderboard Styles */
.sidebar-leaderboard {
  max-height: 300px;
  overflow-y: auto;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  padding: 10px;
}

.sidebar-leaderboard table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.sidebar-leaderboard th {
  text-align: left;
  padding: 8px 5px;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 0.8rem;
}

.sidebar-leaderboard td {
  padding: 8px 5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
}

.sidebar-leaderboard tr:last-child td {
  border-bottom: none;
}

.sidebar-leaderboard tr.current-user {
  background: rgba(102, 126, 234, 0.3);
  border-radius: 6px;
}

.sidebar-leaderboard .rank-number {
  font-weight: 700;
  width: 30px;
}

.sidebar-leaderboard .rank-1 { color: #FFD700; }
.sidebar-leaderboard .rank-2 { color: #C0C0C0; }
.sidebar-leaderboard .rank-3 { color: #CD7F32; }

.sidebar-leaderboard .player-name {
  font-weight: 500;
}

.sidebar-leaderboard .player-score {
  text-align: right;
  font-weight: 600;
  color: #4CAF50;
}

.your-rank {
  transition: all 0.3s ease;
}

.your-rank:hover {
  background: rgba(255, 255, 255, 0.15) !important;
  transform: translateY(-2px);
}

/* Light mode adjustments for leaderboard */
body.light-mode .sidebar-leaderboard {
  background: rgba(0, 0, 0, 0.05);
}

body.light-mode .sidebar-leaderboard th {
  color: rgba(0, 0, 0, 0.6);
  border-bottom-color: rgba(0, 0, 0, 0.1);
}

body.light-mode .sidebar-leaderboard td {
  color: rgba(0, 0, 0, 0.8);
  border-bottom-color: rgba(0, 0, 0, 0.05);
}

body.light-mode .your-rank {
  background: rgba(0, 0, 0, 0.05) !important;
  border-color: rgba(0, 0, 0, 0.1) !important;
}

body.light-mode .your-rank p:first-child {
  color: rgba(0, 0, 0, 0.6) !important;
}

body.light-mode .your-rank p:last-child {
  color: #667eea !important;
}

/* Compact View Styles */
.compact-toggle-btn {
  font-size: 0.9rem;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.compact-toggle-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.sidebar-compact .updates-section {
  display: none;
}

.sidebar-compact .leaderboard-section {
  margin-top: 0 !important;
  padding-top: 0 !important;
  border-top: none !important;
}

.sidebar-compact .sidebar-leaderboard {
  max-height: 500px;
}

/* Light mode adjustments for compact button */
body.light-mode .compact-toggle-btn {
  background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
}

/* Transition for smooth sidebar view switching */
.updates-section {
  transition: all 0.3s ease;
}

.leaderboard-section {
  transition: all 0.3s ease;
}

/* Online Status Indicator */
.online-status {
  font-size: 0.6rem;
  margin-left: auto;
  transition: all 0.3s ease;
  cursor: help;
}

.online-status.online {
  color: #4CAF50;
  text-shadow: 0 0 8px rgba(76, 175, 80, 0.5);
  animation: pulseOnline 2s infinite;
}

.online-status.offline {
  color: #ef4444;
  opacity: 0.7;
}

@keyframes pulseOnline {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
