:root {
  /* Cosy winter jazz theme - warm, muted colors */
  --bg-grad-start: #2a2d3a; /* Dark blue-gray like winter night sky */
  --bg-grad-end: #3a3f4f; /* Slightly lighter blue-gray */
  --panel-bg: rgba(58, 63, 79, 0.85); /* Warmer panel background */
  --panel-border: rgba(212, 164, 116, 0.4); /* Warm brown border */
  --accent: #d4a574; /* Warm caramel brown */
  --accent-soft: #e8b892; /* Lighter warm brown */
  --text-primary: #f0e6d2; /* Warm cream text */
  --text-muted: #c4b5a0; /* Muted warm beige */
  --success: #85c1e9; /* Soft blue for success */
  --warning: #f4d03f; /* Warm golden yellow */
  font-family: "Nunito", "Segoe UI", sans-serif;
  color: var(--text-primary);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  width: 100%;
  background: radial-gradient(circle at 12% 18%, #1f2636 0%, #111520 60%), linear-gradient(160deg, var(--bg-grad-start), var(--bg-grad-end));
  overflow: hidden;
  color: var(--text-primary);
}

canvas#stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.hidden {
  display: none !important;
}

/* Left and Right Panel Containers */
.left-panels {
  position: absolute;
  top: 1.8rem;
  left: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 280px;
}

.right-panels {
  position: absolute;
  top: 1.8rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 280px;
}

.hud {
  padding: 1.4rem 1.6rem;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  box-shadow: 0 20px 32px rgba(9, 12, 26, 0.45);
  backdrop-filter: blur(18px);
  display: grid;
  gap: 1.2rem;
}

.hud-section {
  display: grid;
  gap: 0.55rem;
}

.hud-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1rem;
}

.hud-row .label {
  font-weight: 650;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.12em;
}


/* WebGPU Status Styles */
.webgpu-status {
  transition: all 0.3s ease;
}

.webgpu-status[data-status="enabled"] {
  background: rgba(100, 210, 196, 0.1);
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  margin: 0.2rem -0.6rem;
}

.webgpu-status[data-status="disabled"] {
  background: rgba(255, 168, 122, 0.1);
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  margin: 0.2rem -0.6rem;
}

.webgpu-status[data-status="checking"] {
  background: rgba(124, 157, 255, 0.1);
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  margin: 0.2rem -0.6rem;
}

.webgpu-status .label {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.webgpu-status[data-status="enabled"] .label {
  color: var(--success);
}

.webgpu-status[data-status="disabled"] .label {
  color: var(--warning);
}

.webgpu-status[data-status="checking"] .label {
  color: var(--accent);
}

.webgpu-status span[data-ui="webgpu-status"] {
  font-weight: 600;
  font-size: 0.8rem;
}

.webgpu-status[data-status="enabled"] span[data-ui="webgpu-status"] {
  color: var(--success);
}

.webgpu-status[data-status="disabled"] span[data-ui="webgpu-status"] {
  color: var(--warning);
}

.webgpu-status[data-status="checking"] span[data-ui="webgpu-status"] {
  color: var(--accent);
}

/* Removed needs-flags styles since we're not using them */

.hud-button {
  justify-self: end;
  border: none;
  border-radius: 999px;
  background: rgba(124, 157, 255, 0.25);
  color: var(--accent);
  padding: 0.45rem 0.75rem;
  font-size: 1.05rem;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease;
}

.hud-button:hover {
  background: rgba(124, 157, 255, 0.4);
  transform: translateY(-1px);
}

/* Info panels now integrated into left-panels and right-panels */

.legend-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 1.4rem 1.6rem;
  box-shadow: 0 20px 32px rgba(9, 12, 26, 0.45);
  backdrop-filter: blur(18px);
  font-size: 0.9rem;
  line-height: 1.5;
}

.legend-panel h3 {
  margin: 0 0 0.6rem;
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}

.legend-panel ul {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.5rem;
}

.legend-panel strong {
  color: var(--accent);
}

\\.debug {
  position: absolute;
  top: calc(1.8rem + 5.8rem);
  right: 2rem;
  padding: 0.5rem 0.85rem;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  font-size: 0.9rem;
  color: var(--text-muted);
  backdrop-filter: blur(18px);
}

.settings-panel {
  position: absolute;
  top: 1.8rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 1.2rem 1.6rem;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  box-shadow: 0 20px 32px rgba(9, 12, 26, 0.45);
  backdrop-filter: blur(18px);
  display: none;
  min-width: 260px;
}

.settings-panel.open {
  display: block;
}

.settings-panel h2 {
  margin: 0 0 0.8rem;
  font-weight: 700;
}

.settings-panel label {
  display: grid;
  gap: 0.55rem;
  font-size: 0.95rem;
}

input[type="range"] {
  accent-color: var(--accent);
}

.modal {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(10, 12, 20, 0.6);
  backdrop-filter: blur(12px);
  padding: 2rem;
}

.modal.open {
  display: flex;
}

.modal-panel {
  background: rgba(20, 24, 35, 0.85);
  border: 1px solid rgba(124, 157, 255, 0.25);
  border-radius: 16px;
  padding: 1.5rem;
  width: min(480px, 85vw);
  box-shadow: 0 24px 40px rgba(6, 8, 16, 0.6);
}

.modal-panel h2 {
  margin: 0 0 0.8rem;
  font-size: 1.3rem;
  text-align: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.upgrade-cards {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

.card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.8rem 1.2rem;
  padding: 1.5rem 1.8rem;
  border-radius: 20px;
  border: 2px solid rgba(124, 157, 255, 0.4);
  background: linear-gradient(135deg, rgba(124, 157, 255, 0.12), rgba(111, 210, 196, 0.08));
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.card:hover,
.card:focus {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 20px 35px rgba(6, 8, 16, 0.65);
  border-color: rgba(124, 157, 255, 0.8);
  background: linear-gradient(135deg, rgba(124, 157, 255, 0.2), rgba(111, 210, 196, 0.15));
}

.card-index {
  font-weight: 800;
  color: var(--accent);
  font-size: 1.5rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.card-title {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text-primary);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.card-desc {
  grid-column: 1 / -1;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.4;
  margin-top: 0.3rem;
  font-style: italic;
}

.modal-actions {
  display: flex;
  gap: 0.8rem;
  margin-top: 1.2rem;
}

.btn {
  flex: 1;
  padding: 0.8rem 1.1rem;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: #0f121c;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 28px rgba(6, 8, 16, 0.55);
}

.modal-open {
  overflow: hidden;
}

code {
  background: rgba(124, 157, 255, 0.22);
  padding: 0.25rem 0.45rem;
  border-radius: 10px;
}

@media (max-width: 900px) {
  .hud {
    left: 1.2rem;
    right: 1.2rem;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }

  /* Info panels now integrated into left-panels and right-panels */

  .settings-panel {
    top: auto;
    bottom: 1.8rem;
  }
}

.control-panel {
  display: flex;
  gap: 0.6rem;
  padding: 0.8rem 1rem;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  box-shadow: 0 16px 30px rgba(6, 8, 16, 0.55);
  backdrop-filter: blur(18px);
  align-items: center;
  justify-content: center;
}

.control-btn {
  border: none;
  border-radius: 16px;
  background: rgba(124, 157, 255, 0.18);
  color: var(--accent);
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
}

.control-btn:hover {
  transform: translateY(-2px);
  background: rgba(124, 157, 255, 0.32);
}

.control-btn.active {
  background: rgba(111, 210, 196, 0.38);
  color: var(--success);
}

.control-btn.cooldown {
  background: rgba(244, 208, 63, 0.3);
  color: var(--warning);
  animation: pulse 0.5s ease-in-out infinite alternate;
}

@keyframes pulse {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.05);
  }
}

.control-btn span {
  pointer-events: none;
}


/* Unified Design System */
:root {
  --ui-bg: rgba(15, 23, 42, 0.95);
  --ui-border: rgba(148, 163, 184, 0.2);
  --ui-border-hover: rgba(148, 163, 184, 0.4);
  --ui-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --ui-radius: 16px;
  --ui-padding: 16px;
  --ui-gap: 12px;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --accent: #60a5fa;
  --accent-hover: #3b82f6;
}

/* Seamless UI Panel Base */
.ui-panel {
  position: fixed;
  background: var(--ui-bg);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  padding: var(--ui-padding);
  backdrop-filter: blur(20px);
  box-shadow: var(--ui-shadow);
  z-index: 100;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ui-panel:hover {
  border-color: var(--ui-border-hover);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

/* Left Column: Detailed Stats */
.stats-column {
  top: 20px;
  left: 20px;
  min-width: 240px;
  max-width: 280px;
}

.stats-header {
  margin-bottom: var(--ui-gap);
  padding-bottom: var(--ui-gap);
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.stats-header h3 {
  color: var(--text-primary);
  font-size: 1.1em;
  font-weight: 600;
  margin: 0;
}

.stats-grid {
  display: grid;
  gap: var(--ui-gap);
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  gap: 12px;
}

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

.stat-label {
  color: var(--text-secondary);
  font-size: 0.85em;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

.stat-value {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1em;
  text-align: right;
  flex: 1;
}

.stat-detail {
  color: var(--text-secondary);
  font-size: 0.8em;
  font-style: italic;
  display: block;
  text-align: right;
  margin-top: 2px;
}

.settings-btn {
  margin-top: var(--ui-gap);
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.1), rgba(59, 130, 246, 0.1));
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: 12px;
  color: var(--accent);
  padding: 12px 16px;
  cursor: pointer;
  font-size: 1em;
  font-weight: 500;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.settings-btn:hover {
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.2), rgba(59, 130, 246, 0.2));
  border-color: var(--accent);
  transform: translateY(-1px);
}



/* Control Panel */
.control-panel {
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  min-width: 56px;
}

/* Right Column: Game Elements */
.game-elements {
  bottom: 20px;
  right: 20px;
  max-width: 240px;
  min-width: 220px;
}

.elements-header {
  margin-bottom: var(--ui-gap);
  padding-bottom: var(--ui-gap);
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.elements-header h3 {
  color: var(--text-primary);
  font-size: 1.1em;
  font-weight: 600;
  margin: 0;
}

.elements-grid {
  display: grid;
  gap: 8px;
}

.element-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px;
  background: rgba(148, 163, 184, 0.05);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.element-item:hover {
  background: rgba(148, 163, 184, 0.1);
}

.element-icon {
  width: 32px;
  height: 32px;
  background: rgba(148, 163, 184, 0.1);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2em;
  flex-shrink: 0;
}

.element-text {
  color: var(--text-secondary);
  font-size: 0.9em;
  line-height: 1.4;
  flex: 1;
}

.element-text strong {
  color: var(--text-primary);
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
}

.guide-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: var(--ui-gap);
  padding-bottom: var(--ui-gap);
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.guide-icon-header {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #10b981, #059669);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2em;
}

.guide-title {
  color: var(--text-primary);
  font-size: 1.2em;
  font-weight: 600;
  margin: 0;
}

.guide-grid {
  display: grid;
  gap: 12px;
}

.guide-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: rgba(148, 163, 184, 0.05);
  border-radius: 12px;
  transition: all 0.2s ease;
}

.guide-item:hover {
  background: rgba(148, 163, 184, 0.1);
}

.guide-icon {
  width: 32px;
  height: 32px;
  background: rgba(148, 163, 184, 0.1);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2em;
  flex-shrink: 0;
}

.guide-text {
  color: var(--text-secondary);
  font-size: 0.9em;
  line-height: 1.4;
  flex: 1;
}

.guide-text strong {
  color: var(--text-primary);
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
}

.house-timers {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
}

.timer-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85em;
}

.timer-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.color-red { color: #ef4444; }
.color-purple { color: #a855f7; }
.color-green { color: #22c55e; }

/* Route Cooldown UI */
.route-cooldown {
  font-size: 0.9em;
  transition: all 0.3s ease;
}

.route-cooldown.active {
  color: var(--warning);
  font-weight: bold;
}

.route-cooldown-message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(244, 208, 63, 0.9);
  color: var(--text-primary);
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: bold;
  z-index: 1000;
  animation: fadeInOut 2s ease-in-out;
}

@keyframes fadeInOut {
  0%, 100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
  10%, 90% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* Social Button Styles */
.social-btn {
  background: rgba(124, 157, 255, 0.12) !important;
  color: var(--accent) !important;
  transition: all 0.2s ease;
}

.social-btn:hover {
  background: rgba(124, 157, 255, 0.25) !important;
  transform: translateY(-2px);
  color: var(--accent) !important;
}

.social-btn:active {
  transform: scale(0.95);
}

.social-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Twitter button specific styling */
.social-btn[data-action="twitter"]:hover {
  background: rgba(29, 161, 242, 0.2) !important;
  color: #1da1f2 !important;
}

/* itch.io button specific styling */
.social-btn[data-action="itch"]:hover {
  background: rgba(250, 95, 85, 0.2) !important;
  color: #fa5f55 !important;
}

/* Legend panel specific styles */
.legend-panel h3 {
  margin: 0 0 0.8rem;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  color: var(--accent);
  font-weight: 700;
}

.legend-panel ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.6rem;
}

.legend-panel li {
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--text-primary);
  padding: 0.4rem 0;
}

.legend-panel strong {
  color: var(--accent);
  font-weight: 600;
}

@media (max-width: 900px) {
  .left-panels {
    top: 1.2rem;
    left: 1.2rem;
    width: calc(50% - 1.8rem);
  }
  
  .right-panels {
    top: 1.2rem;
    right: 1.2rem;
    width: calc(50% - 1.8rem);
  }
  
  .hud {
    padding: 1.2rem 1.4rem;
  }
  
  .legend-panel {
    padding: 1.2rem 1.4rem;
  }
  
  .control-panel {
    gap: 0.4rem;
    padding: 0.6rem 0.8rem;
  }
  
  .control-btn {
    width: 40px;
    height: 40px;
    font-size: 0.9rem;
  }
  
  .social-btn svg {
    width: 16px;
    height: 16px;
  }
}

/* Timer Optimization Styles */
.timer-stats {
  position: fixed;
  top: 60px;
  right: 10px;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 12px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 11px;
  z-index: 1000;
  border: 1px solid #333;
  min-width: 200px;
}

.timer-stats-content h4 {
  margin: 0 0 8px 0;
  color: #4CAF50;
  font-size: 12px;
}

/* Loading Screen Styles */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 12% 18%, #1f2636 0%, #111520 60%), linear-gradient(160deg, var(--bg-grad-start), var(--bg-grad-end));
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
}

.loading-content {
  text-align: center;
  color: var(--text-primary);
}

.loading-content h2 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 2rem;
  color: var(--accent);
  text-shadow: 0 0 20px rgba(124, 157, 255, 0.3);
}

.loading-bar-container {
  margin-bottom: 1rem;
}

.loading-bar {
  width: 300px;
  height: 8px;
  background: rgba(124, 157, 255, 0.2);
  border-radius: 4px;
  overflow: hidden;
  margin: 0 auto 0.5rem;
}

.loading-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #64d2c4);
  border-radius: 4px;
  width: 0%;
  transition: width 0.3s ease;
  box-shadow: 0 0 10px rgba(124, 157, 255, 0.5);
}

.loading-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.loading-percentage {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--accent);
}

.timer-stat {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.timer-stat .label {
  color: #ccc;
}

.timer-stat .value {
  color: #fff;
  font-weight: bold;
}

/* Lobby Screen */
.lobby-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #0f172a, #1e293b);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.lobby-container {
  text-align: center;
  max-width: 500px;
  padding: 2rem;
}

.lobby-header {
  margin-bottom: 3rem;
}

.lobby-title {
  font-size: 3rem;
  font-weight: 700;
  color: #f1f5f9;
  margin: 0 0 1rem 0;
  text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.lobby-subtitle {
  font-size: 1.2rem;
  color: #94a3b8;
  margin: 0;
}

.lobby-buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

.lobby-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem 2rem;
  border: none;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 200px;
}

.lobby-btn.primary {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.lobby-btn.primary:hover {
  background: linear-gradient(135deg, #2563eb, #1e40af);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.lobby-btn.secondary {
  background: rgba(148, 163, 184, 0.1);
  color: #f1f5f9;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.lobby-btn.secondary:hover {
  background: rgba(148, 163, 184, 0.2);
  transform: translateY(-1px);
}

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

.lobby-footer {
  color: #64748b;
  font-size: 0.9rem;
}




/* Settings Panel */
.settings-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, #1e293b, #334155);
  border: 2px solid rgba(59, 130, 246, 0.3);
  border-radius: 24px;
  padding: 0;
  max-width: 520px;
  width: 92%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(59, 130, 246, 0.1);
  z-index: 1001;
  display: none;
  backdrop-filter: blur(10px);
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem;
  border-bottom: 2px solid rgba(59, 130, 246, 0.2);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(30, 41, 59, 0.2));
  border-radius: 24px 24px 0 0;
}

.settings-header h2 {
  color: #f1f5f9;
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.close-settings-btn {
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  color: #f1f5f9;
  cursor: pointer;
  padding: 0.5rem;
  transition: all 0.3s ease;
}

.close-settings-btn:hover {
  background: rgba(148, 163, 184, 0.2);
}

.settings-content {
  padding: 2rem;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.3), rgba(51, 65, 85, 0.2));
}

.settings-section {
  margin-bottom: 2rem;
}

.settings-section h3 {
  color: #f1f5f9;
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.setting-item {
  margin-bottom: 1.5rem;
}

.setting-item label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  color: #cbd5e1;
  font-size: 0.9rem;
}

.setting-label {
  font-weight: 500;
}

.setting-value {
  color: #60a5fa;
  font-weight: 600;
  font-size: 0.85rem;
}

.setting-item input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(148, 163, 184, 0.2);
  outline: none;
  -webkit-appearance: none;
}

.setting-item input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #3b82f6;
  cursor: pointer;
  border: 2px solid #1e293b;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.setting-item input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #3b82f6;
  cursor: pointer;
  border: 2px solid #1e293b;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.setting-item select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid rgba(148, 163, 184, 0.3);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(51, 65, 85, 0.8));
  color: #f1f5f9;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23f1f5f9' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.75rem center;
  background-repeat: no-repeat;
  background-size: 1rem;
  padding-right: 2.5rem;
}

.setting-item select:hover {
  border-color: rgba(59, 130, 246, 0.5);
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(51, 65, 85, 0.9));
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.setting-item select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(51, 65, 85, 0.95));
}

.setting-item select option {
  background: #1e293b;
  color: #f1f5f9;
  padding: 0.5rem;
  font-weight: 500;
}

.settings-actions {
  display: flex;
  justify-content: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.settings-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.settings-btn.secondary {
  background: rgba(148, 163, 184, 0.1);
  color: #f1f5f9;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.settings-btn.secondary:hover {
  background: rgba(148, 163, 184, 0.2);
}

/* ESC Menu */
.esc-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1003;
}

.esc-menu-overlay {
  background: linear-gradient(135deg, #1e293b, #334155);
  border-radius: 20px;
  padding: 0;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.esc-menu-content {
  padding: 2rem;
}

.esc-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.esc-menu-header h2 {
  color: #f1f5f9;
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
}

.close-esc-menu-btn {
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  color: #f1f5f9;
  cursor: pointer;
  padding: 0.5rem;
  transition: all 0.3s ease;
}

.close-esc-menu-btn:hover {
  background: rgba(148, 163, 184, 0.2);
}

.esc-menu-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.esc-menu-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: left;
}

.esc-menu-btn.primary {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
}

.esc-menu-btn.primary:hover {
  background: linear-gradient(135deg, #2563eb, #1e40af);
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(59, 130, 246, 0.3);
}

.esc-menu-btn.secondary {
  background: rgba(148, 163, 184, 0.1);
  color: #f1f5f9;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.esc-menu-btn.secondary:hover {
  background: rgba(148, 163, 184, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(148, 163, 184, 0.2);
}

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

.btn-text {
  font-weight: 600;
}

/* Lobby Settings Panel */
.lobby-settings-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1002;
}

.lobby-settings-overlay {
  background: linear-gradient(135deg, #1e293b, #334155);
  border: 2px solid rgba(59, 130, 246, 0.3);
  border-radius: 24px;
  padding: 0;
  max-width: 520px;
  width: 92%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(59, 130, 246, 0.1);
  backdrop-filter: blur(10px);
}

.lobby-settings-content {
  padding: 0;
}

.lobby-settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem;
  border-bottom: 2px solid rgba(59, 130, 246, 0.2);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(30, 41, 59, 0.2));
  border-radius: 24px 24px 0 0;
}

.lobby-settings-header h2 {
  color: #f1f5f9;
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.close-lobby-settings-btn {
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  color: #f1f5f9;
  cursor: pointer;
  padding: 0.5rem;
  transition: all 0.3s ease;
}

.close-lobby-settings-btn:hover {
  background: rgba(148, 163, 184, 0.2);
}

.lobby-settings-body {
  padding: 2rem;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.3), rgba(51, 65, 85, 0.2));
}

.lobby-settings-section {
  margin-bottom: 2rem;
}

.lobby-settings-section h3 {
  color: #f1f5f9;
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lobby-setting-item {
  margin-bottom: 1.5rem;
}

.lobby-setting-item label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  color: #cbd5e1;
  font-size: 0.9rem;
}

.lobby-setting-label {
  font-weight: 500;
}

.lobby-setting-value {
  color: #60a5fa;
  font-weight: 600;
  font-size: 0.85rem;
}

.lobby-setting-item input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(148, 163, 184, 0.2);
  outline: none;
  -webkit-appearance: none;
}

.lobby-setting-item input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #3b82f6;
  cursor: pointer;
  border: 2px solid #1e293b;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.lobby-setting-item input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #3b82f6;
  cursor: pointer;
  border: 2px solid #1e293b;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.lobby-setting-item select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid rgba(148, 163, 184, 0.3);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(51, 65, 85, 0.8));
  color: #f1f5f9;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23f1f5f9' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.75rem center;
  background-repeat: no-repeat;
  background-size: 1rem;
  padding-right: 2.5rem;
}

.lobby-setting-item select:hover {
  border-color: rgba(59, 130, 246, 0.5);
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(51, 65, 85, 0.9));
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.lobby-setting-item select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(51, 65, 85, 0.95));
}

.lobby-setting-item select option {
  background: #1e293b;
  color: #f1f5f9;
  padding: 0.5rem;
  font-weight: 500;
}

.lobby-settings-actions {
  display: flex;
  justify-content: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.lobby-settings-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.lobby-settings-btn.secondary {
  background: rgba(148, 163, 184, 0.1);
  color: #f1f5f9;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.lobby-settings-btn.secondary:hover {
  background: rgba(148, 163, 184, 0.2);
}

/* Tutorial Prompt Styles */
.tutorial-prompt-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1003;
  backdrop-filter: blur(8px);
}

.tutorial-prompt {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  border: 2px solid rgba(59, 130, 246, 0.3);
  border-radius: 24px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(59, 130, 246, 0.1);
  backdrop-filter: blur(10px);
  position: relative;
}

.tutorial-prompt-header {
  padding: 2rem 2rem 1rem 2rem;
  text-align: center;
  border-bottom: 2px solid rgba(59, 130, 246, 0.2);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(30, 41, 59, 0.2));
  border-radius: 24px 24px 0 0;
}

.tutorial-prompt-header h2 {
  color: #f1f5f9;
  font-size: 1.8rem;
  font-weight: 700;
  margin: 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.tutorial-prompt-content {
  padding: 2rem;
  text-align: center;
}

.tutorial-prompt-content p {
  color: #e2e8f0;
  font-size: 1.1rem;
  margin: 0 0 2rem 0;
  line-height: 1.6;
}

.tutorial-prompt-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.tutorial-prompt-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: all 0.2s ease;
  border: none;
  min-width: 150px;
  justify-content: center;
}

.tutorial-prompt-btn.primary {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.tutorial-prompt-btn.primary:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.tutorial-prompt-btn.secondary {
  background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(107, 114, 128, 0.3);
}

.tutorial-prompt-btn.secondary:hover {
  background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(107, 114, 128, 0.4);
}

/* Tutorial Flashcards Styles */
.tutorial-flashcards-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1004;
  backdrop-filter: blur(8px);
}

.tutorial-flashcards {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  border: 2px solid rgba(59, 130, 246, 0.3);
  border-radius: 24px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(59, 130, 246, 0.1);
  backdrop-filter: blur(10px);
  position: relative;
  display: flex;
  flex-direction: column;
}

.tutorial-flashcards-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  border-bottom: 2px solid rgba(59, 130, 246, 0.2);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(30, 41, 59, 0.2));
  border-radius: 24px 24px 0 0;
}

.tutorial-progress {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.tutorial-progress-text {
  color: #f1f5f9;
  font-size: 1rem;
  font-weight: 600;
  min-width: 60px;
}

.tutorial-progress-bar {
  width: 200px;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.tutorial-progress-fill {
  height: 100%;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border-radius: 4px;
  transition: width 0.3s ease;
  width: 14.28%; /* 1/7 */
}

.close-tutorial-flashcards-btn {
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  color: #f1f5f9;
  cursor: pointer;
  padding: 0.5rem;
  transition: all 0.3s ease;
  font-size: 1.2rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-tutorial-flashcards-btn:hover {
  background: rgba(148, 163, 184, 0.2);
  transform: scale(1.1);
}

.tutorial-flashcard {
  flex: 1;
  padding: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.3), rgba(51, 65, 85, 0.2));
}

.flashcard-content {
  text-align: center;
  max-width: 500px;
}

.flashcard-title {
  color: #60a5fa;
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 1.5rem 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.flashcard-body {
  color: #e2e8f0;
  font-size: 1.1rem;
  line-height: 1.6;
}

.flashcard-body p {
  margin: 0 0 1rem 0;
}

.flashcard-body ul {
  text-align: left;
  padding-left: 1.5rem;
  margin: 0;
}

.flashcard-body li {
  margin-bottom: 0.5rem;
}

.flashcard-body strong {
  color: #f1f5f9;
  font-weight: 600;
}

.house-indicator {
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  margin-right: 0.5rem;
  display: inline-block;
}

.house-indicator.red {
  background: rgba(248, 113, 113, 0.2);
  color: #f87171;
}

.house-indicator.purple {
  background: rgba(168, 85, 247, 0.2);
  color: #a855f7;
}

.house-indicator.green {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

.tutorial-flashcards-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  border-top: 2px solid rgba(59, 130, 246, 0.2);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(30, 41, 59, 0.2));
  border-radius: 0 0 24px 24px;
}

.tutorial-flashcard-btn {
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: all 0.2s ease;
  border: none;
  min-width: 120px;
}

.tutorial-flashcard-btn.primary {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.tutorial-flashcard-btn.primary:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.tutorial-flashcard-btn.secondary {
  background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(107, 114, 128, 0.3);
}

.tutorial-flashcard-btn.secondary:hover {
  background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(107, 114, 128, 0.4);
}

/* Responsive Tutorial */
@media (max-width: 768px) {
  .tutorial-prompt {
    width: 95%;
  }
  
  .tutorial-flashcards {
    width: 95%;
  }
  
  .tutorial-prompt-buttons {
    flex-direction: column;
  }
  
  .tutorial-prompt-btn {
    min-width: 200px;
  }
  
  .tutorial-progress {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .tutorial-progress-bar {
    width: 150px;
  }
  
  .flashcard-title {
    font-size: 1.5rem;
  }
  
  .flashcard-body {
    font-size: 1rem;
  }
}

