/* ==========================================================================
   SYNTHWAVE TYPING GAME - STYLESHEET
   ========================================================================== */

/* --- CSS VARIABLES & THEMES --- */
:root {
  --bg-color: #0b031a;
  --bg-card: rgba(22, 10, 48, 0.85);
  --bg-card-border: #4d0099;
  
  --neon-magenta: #ff007f;
  --neon-cyan: #00f0ff;
  --neon-purple: #9d00ff;
  --neon-gold: #ffbd39;
  --neon-green: #00ff66;
  --neon-red: #ff3333;
  
  --text-primary: #ffffff;
  --text-muted: #8b7ca3;
  
  --font-title: 'Orbitron', sans-serif;
  --font-mono: 'Share Tech Mono', monospace;
  
  --glow-magenta: 0 0 8px var(--neon-magenta), 0 0 20px rgba(255, 0, 127, 0.4);
  --glow-cyan: 0 0 8px var(--neon-cyan), 0 0 20px rgba(0, 240, 255, 0.4);
  --glow-gold: 0 0 8px var(--neon-gold), 0 0 20px rgba(255, 189, 57, 0.4);
  --glow-green: 0 0 8px var(--neon-green), 0 0 20px rgba(0, 255, 102, 0.4);
}

/* --- RESET & GLOBAL STYLE --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  background-image: 
    linear-gradient(to bottom, #0b031a 40%, #1c0a35 70%, #3d0c4f 100%);
  color: var(--text-primary);
  font-family: var(--font-title);
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
}

/* --- CRT & FLICKER retro filters --- */
#crt-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
  background-size: 100% 4px, 6px 100%;
  z-index: 9999;
  pointer-events: none;
  display: none;
}

#crt-overlay.crt-active {
  display: block;
}

#crt-overlay::after {
  content: " ";
  display: block;
  position: absolute;
  top: 0; left: 0; bottom: 0; right: 0;
  background: rgba(18, 16, 16, 0.1);
  opacity: 0;
  z-index: 9999;
  pointer-events: none;
  animation: crt-flicker 0.15s infinite;
}

@keyframes crt-flicker {
  0% { opacity: 0.18; }
  50% { opacity: 0.22; }
  100% { opacity: 0.18; }
}

/* Scanline moving overlay */
#crt-flicker {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.02);
  z-index: 9998;
  pointer-events: none;
  animation: scanline 8s linear infinite;
  display: none;
}

.crt-active + #crt-flicker {
  display: block;
}

@keyframes scanline {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100%); }
}

/* --- APP MAIN LAYOUT --- */
#app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Settings panel - Floating top right */
#settings-panel {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 10px;
  z-index: 100;
}

.panel-btn {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: 5px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.2s ease;
  box-shadow: 0 0 5px rgba(157, 0, 255, 0.3);
}

.panel-btn:hover {
  border-color: var(--neon-cyan);
  box-shadow: var(--glow-cyan);
  transform: translateY(-2px);
}

.panel-btn.active {
  border-color: var(--neon-magenta);
  box-shadow: var(--glow-magenta);
  background: rgba(255, 0, 127, 0.1);
}

/* HEADER styling */
.main-header {
  text-align: center;
  margin-bottom: 15px;
}

.logo {
  font-size: 2.8rem;
  font-weight: 900;
  letter-spacing: 4px;
  margin-bottom: 3px;
}

.subtitle {
  font-size: 1.2rem;
  font-family: var(--font-mono);
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* --- GLOW EFFECTS (Utility) --- */
.glow-text {
  color: var(--text-primary);
  text-shadow: 0 0 4px #fff, 0 0 10px var(--neon-magenta), 0 0 20px var(--neon-purple);
}

.glow-text-pink {
  color: var(--neon-magenta);
  text-shadow: var(--glow-magenta);
}

.glow-text-cyan {
  color: var(--neon-cyan);
  text-shadow: var(--glow-cyan);
}

.glow-text-gold {
  color: var(--neon-gold);
  text-shadow: var(--glow-gold);
}

.glow-text-green {
  color: var(--neon-green);
  text-shadow: var(--glow-green);
}

/* --- VIEW CONTAINER CONTROL --- */
.view-container {
  display: none;
  flex-grow: 1;
  width: 100%;
  animation: fadeIn 0.4s ease-out forwards;
}

.view-container.active {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

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

/* --- BUTTONS --- */
.btn {
  background: var(--bg-card);
  border: 2px solid var(--bg-card-border);
  color: var(--text-primary);
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: bold;
  padding: 15px 30px;
  border-radius: 8px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 2px;
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
}

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

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

.btn:hover {
  transform: scale(1.04) translateY(-3px);
}

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

.btn-primary {
  border-color: var(--neon-magenta);
  box-shadow: 0 0 10px rgba(255, 0, 127, 0.2);
}
.btn-primary:hover {
  box-shadow: var(--glow-magenta);
  background: rgba(255, 0, 127, 0.15);
}

.btn-secondary {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}
.btn-secondary:hover {
  box-shadow: var(--glow-cyan);
  background: rgba(0, 240, 255, 0.15);
}

.btn-accent {
  border-color: var(--neon-gold);
  box-shadow: 0 0 10px rgba(255, 189, 57, 0.2);
}
.btn-accent:hover {
  box-shadow: var(--glow-gold);
  background: rgba(255, 189, 57, 0.15);
}

.btn-danger {
  border-color: var(--neon-red);
  box-shadow: 0 0 10px rgba(255, 51, 51, 0.2);
}
.btn-danger:hover {
  box-shadow: 0 0 15px var(--neon-red);
  background: rgba(255, 51, 51, 0.15);
}

/* --- MENU / DIALOG BOXES --- */
.menu-box {
  background: var(--bg-card);
  border: 2px solid var(--bg-card-border);
  box-shadow: 0 0 25px rgba(77, 0, 153, 0.3), inset 0 0 15px rgba(77, 0, 153, 0.1);
  padding: 40px;
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  text-align: center;
  backdrop-filter: blur(10px);
}

.menu-box h2 {
  font-size: 2.2rem;
  margin-bottom: 30px;
  letter-spacing: 2px;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* --- FORMS --- */
.form-box {
  display: flex;
  flex-direction: column;
  gap: 20px;
  text-align: left;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--text-muted);
  letter-spacing: 1px;
}

.form-group input, .form-group select {
  background: rgba(10, 5, 25, 0.8);
  border: 1px solid var(--bg-card-border);
  color: #fff;
  padding: 12px 15px;
  border-radius: 6px;
  font-family: var(--font-title);
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus, .form-group select:focus {
  outline: none;
  border-color: var(--neon-cyan);
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.3);
}

.join-buttons {
  display: flex;
  gap: 15px;
  margin-top: 15px;
}

.join-buttons button {
  flex: 1;
}

.error-msg {
  color: var(--neon-red);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  text-align: center;
  min-height: 20px;
}

/* --- 2. HOST VIEW SCREEN (TEACHER) --- */
#view-host.view-container.active {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
}

body.host-view-active {
  overflow: hidden;
  height: 100vh;
  max-height: 100vh;
}

body.host-view-active #app {
  height: 100vh;
  max-height: 100vh;
  padding: 15px 20px;
  box-sizing: border-box;
}

body.host-view-active .main-header {
  display: none;
}

.host-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  width: 100%;
  height: 100%;
  margin-top: 5px;
}

.host-left-col {
  display: flex;
  flex-direction: column;
  gap: 15px;
  height: 100%;
}

.settings-panel-horizontal {
  background: var(--bg-card);
  border: 2px solid var(--bg-card-border);
  border-radius: 12px;
  padding: 15px;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  height: auto;
  flex-shrink: 0;
}

.settings-horizontal-group {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-grow: 1;
}

.settings-horizontal-group h3 {
  font-size: 0.95rem;
  margin-bottom: 0;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--neon-magenta);
  text-shadow: var(--glow-magenta);
}

.form-row {
  display: flex;
  gap: 15px;
  flex-grow: 1;
}

.form-group-inline {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.form-group-inline label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.form-group-inline select {
  background: rgba(10, 5, 25, 0.8);
  border: 1px solid var(--bg-card-border);
  color: #fff;
  padding: 8px 10px;
  border-radius: 6px;
  font-family: var(--font-title);
  font-size: 0.85rem;
  transition: all 0.2s;
  width: 100%;
}

.form-group-inline select:focus {
  outline: none;
  border-color: var(--neon-cyan);
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.3);
}

.actions-horizontal-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 260px;
  flex-shrink: 0;
}

.actions-horizontal-group button {
  width: 100%;
}

.actions-horizontal-group .btn {
  padding: 8px 15px;
  font-size: 0.9rem;
}

.actions-horizontal-group .action-row {
  display: flex;
  gap: 10px;
  width: 100%;
}

.actions-horizontal-group .action-row button {
  flex: 1;
}

.canvas-container {
  position: relative;
  background: #05010a;
  border: 2px solid var(--bg-card-border);
  border-radius: 12px;
  box-shadow: 0 0 15px rgba(77, 0, 153, 0.2);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-grow: 1;
  height: 0;
  width: 100%;
}

#race-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

#host-canvas-overlay {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(5, 1, 10, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: opacity 0.3s ease;
}

#host-overlay-text {
  font-size: 8rem;
  font-weight: 900;
}

.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Host panel controls */
.control-panel {
  background: var(--bg-card);
  border: 2px solid var(--bg-card-border);
  border-radius: 12px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  height: 100%;
  overflow-y: auto;
}

.panel-section {
  border-bottom: 1px solid rgba(139, 124, 163, 0.15);
  padding-bottom: 15px;
}

.panel-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.panel-section h3 {
  font-size: 1.05rem;
  margin-bottom: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.info-section p {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.room-code-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 10px 0;
  padding: 10px;
  background: rgba(255, 0, 127, 0.05);
  border: 1px dashed rgba(255, 0, 127, 0.3);
  border-radius: 8px;
}

.room-code-display #host-room-code {
  font-size: 3.2rem;
  letter-spacing: 5px;
  color: var(--neon-magenta);
  text-shadow: var(--glow-magenta);
  font-family: var(--font-title);
  margin-top: 5px;
  line-height: 1.1;
  font-weight: 900;
}

.action-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.action-section button {
  width: 100%;
}

/* Connected players list in Host screen */
.leaderboard-section {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

#host-leaderboard-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 5px;
  margin-top: 10px;
  flex-grow: 1;
}

.host-player-row {
  display: flex;
  flex-direction: column;
  background: rgba(10, 5, 25, 0.6);
  border: 1px solid rgba(77, 0, 153, 0.5);
  padding: 8px 12px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.host-player-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.host-player-name {
  font-weight: bold;
  letter-spacing: 0.5px;
}

.host-player-stats {
  font-size: 0.8rem;
  color: var(--neon-cyan);
}

.host-player-bar-bg {
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.host-player-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  transition: width 0.2s ease-out;
}

/* --- 3. PLAYER LOBBY VIEW (WAITING SCREEN) --- */
.lobby-room-display {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  margin: 15px 0;
}

.lobby-room-display strong {
  font-size: 1.6rem;
  margin-left: 5px;
}

.player-color-preview {
  margin: 15px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.player-color-preview p {
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.car-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 10px currentColor;
}

.waiting-sub {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--neon-magenta);
  margin-bottom: 25px;
  animation: pulse-opacity 1.5s ease-in-out infinite;
}

@keyframes pulse-opacity {
  0% { opacity: 0.4; }
  50% { opacity: 1; }
  100% { opacity: 0.4; }
}

.lobby-players-list-wrapper {
  background: rgba(10, 5, 25, 0.6);
  border: 1px solid var(--bg-card-border);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 25px;
  text-align: left;
  max-height: 180px;
  overflow-y: auto;
}

.lobby-players-list-wrapper h3 {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(139, 124, 163, 0.15);
  padding-bottom: 5px;
}

#lobby-players-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lobby-player-tag {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid currentColor;
  padding: 4px 10px;
  border-radius: 20px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

/* --- 4. PLAYER GAMEPLAY VIEW --- */
.player-game-layout {
  width: 100%;
  max-width: 950px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* HUD Panel */
.game-hud {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  width: 100%;
}

.hud-item {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  padding: 12px;
  border-radius: 8px;
  text-align: center;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.hud-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-bottom: 5px;
}

.hud-value {
  font-size: 1.8rem;
  font-weight: bold;
  font-family: var(--font-title);
  line-height: 1;
}

.hud-unit {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Nitro Boost Bar */
.nitro-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  padding: 10px 15px;
  border-radius: 8px;
  display: grid;
  grid-template-columns: 120px 1fr 140px;
  align-items: center;
  gap: 15px;
}

.nitro-label {
  font-size: 0.8rem;
  color: var(--neon-gold);
  text-shadow: var(--glow-gold);
  font-weight: bold;
  letter-spacing: 1px;
}

.nitro-bar-container {
  height: 10px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(77, 0, 153, 0.6);
  border-radius: 5px;
  overflow: hidden;
}

#nitro-bar {
  height: 100%;
  background: linear-gradient(to right, var(--neon-gold), #ff5e00, var(--neon-magenta));
  box-shadow: 0 0 8px #ff5e00;
  transition: width 0.15s ease-out;
}

.nitro-ready-text {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: right;
  letter-spacing: 0.5px;
}

.nitro-active-pulse {
  animation: nitro-pulse 0.4s infinite alternate;
}

@keyframes nitro-pulse {
  from { box-shadow: 0 0 5px var(--neon-magenta); }
  to { box-shadow: 0 0 15px var(--neon-magenta); }
}

/* Mini racetrack map */
.minimap-container {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  padding: 12px 15px;
  border-radius: 8px;
}

.minimap-container h3 {
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.minimap-track {
  height: 60px;
  background: #050110;
  border-radius: 8px;
  border: 1px solid var(--bg-card-border);
  position: relative;
  overflow: hidden;
}

#player-minimap-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Word Typing Area */
.typing-container {
  background: var(--bg-card);
  border: 2px solid var(--bg-card-border);
  box-shadow: inset 0 0 15px rgba(77, 0, 153, 0.2);
  padding: 30px;
  border-radius: 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.word-display-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  height: 60px;
  width: 100%;
  overflow: hidden;
}

.word-fade {
  font-size: 1.2rem;
  color: var(--text-muted);
  opacity: 0.4;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.word-focus {
  font-size: 2.2rem;
  font-weight: bold;
  font-family: var(--font-mono);
  letter-spacing: 2px;
  white-space: nowrap;
}

/* Character highlight states */
.char-correct {
  color: var(--neon-cyan);
  text-shadow: var(--glow-cyan);
}

.char-incorrect {
  color: var(--neon-red);
  background: rgba(255, 51, 51, 0.2);
  text-shadow: 0 0 5px var(--neon-red);
  border-radius: 3px;
  animation: shake 0.15s infinite;
}

@keyframes shake {
  0% { transform: translateX(-1px); }
  50% { transform: translateX(1px); }
  100% { transform: translateX(0); }
}

.input-wrapper {
  width: 100%;
  max-width: 400px;
}

.typing-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid var(--bg-card-border);
  color: #fff;
  padding: 15px 20px;
  font-size: 1.3rem;
  font-family: var(--font-mono);
  letter-spacing: 1.5px;
  border-radius: 8px;
  text-align: center;
  transition: all 0.2s;
}

.typing-input:focus {
  outline: none;
  border-color: var(--neon-magenta);
  box-shadow: var(--glow-magenta);
}

.typing-warning-text {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--neon-red);
  min-height: 18px;
}

/* Visual Keyboard */
.keyboard-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  background: rgba(10, 5, 25, 0.7);
  border: 1px solid var(--bg-card-border);
  padding: 12px;
  border-radius: 10px;
}

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

.key {
  height: 38px;
  min-width: 32px;
  background: rgba(20, 10, 45, 0.8);
  border: 1px solid rgba(77, 0, 153, 0.6);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.08s ease;
  user-select: none;
}

.key.key-wide {
  min-width: 50px;
}

.key.key-space {
  min-width: 220px;
}

/* Keyboard active glow states */
.key.key-active {
  background: var(--neon-cyan);
  color: #000;
  border-color: var(--neon-cyan);
  box-shadow: var(--glow-cyan);
  transform: translateY(1px) scale(0.95);
}

.key.key-error {
  background: var(--neon-red);
  color: #fff;
  border-color: var(--neon-red);
  box-shadow: 0 0 10px var(--neon-red);
  transform: translateY(1px) scale(0.95);
}

/* Screen Shake effect for typing errors */
.screen-shake {
  animation: screen-shake-anim 0.2s ease-in-out;
}

@keyframes screen-shake-anim {
  0%, 100% { transform: translate(0, 0); }
  20%, 60% { transform: translate(-3px, 3px); }
  40%, 80% { transform: translate(3px, -3px); }
}

/* --- 5. RESULTS VIEW (PODIUM & LEADERBOARD) --- */
.results-layout {
  width: 100%;
  max-width: 900px;
  background: var(--bg-card);
  border: 2px solid var(--bg-card-border);
  border-radius: 16px;
  padding: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  box-shadow: 0 0 30px rgba(77, 0, 153, 0.4);
}

.results-layout h2 {
  font-size: 2.5rem;
  letter-spacing: 2px;
}

/* Podium design */
.podium-container {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 15px;
  width: 100%;
  max-width: 600px;
  margin: 20px 0;
  height: 220px;
  border-bottom: 2px dashed rgba(77, 0, 153, 0.8);
  padding-bottom: 10px;
}

.podium-place {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  transition: all 0.3s ease;
}

.podium-avatar {
  font-size: 2.2rem;
  margin-bottom: 8px;
  animation: float-podium 2s ease-in-out infinite alternate;
}

.podium-crown {
  position: absolute;
  top: -38px;
  font-size: 1.5rem;
}

@keyframes float-podium {
  from { transform: translateY(0px); }
  to { transform: translateY(-8px); }
}

.podium-name {
  font-size: 1rem;
  font-weight: bold;
  margin-bottom: 4px;
  text-align: center;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.podium-stat {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--neon-cyan);
  margin-bottom: 10px;
}

.podium-step {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: bold;
  border: 1px solid rgba(77, 0, 153, 0.8);
  border-bottom: none;
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
  color: var(--text-primary);
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.2);
}

.place-1 .podium-step {
  height: 120px;
  background: linear-gradient(to top, rgba(255, 189, 57, 0.3), rgba(255, 189, 57, 0.05));
  border-color: var(--neon-gold);
  box-shadow: 0 0 15px rgba(255, 189, 57, 0.1);
}

.place-2 .podium-step {
  height: 80px;
  background: linear-gradient(to top, rgba(0, 240, 255, 0.25), rgba(0, 240, 255, 0.05));
  border-color: var(--neon-cyan);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.05);
}

.place-3 .podium-step {
  height: 55px;
  background: linear-gradient(to top, rgba(255, 0, 127, 0.25), rgba(255, 0, 127, 0.05));
  border-color: var(--neon-magenta);
  box-shadow: 0 0 15px rgba(255, 0, 127, 0.05);
}

/* Leaderboard Table */
.results-leaderboard {
  width: 100%;
}

.results-leaderboard h3 {
  font-size: 1.2rem;
  margin-bottom: 15px;
  letter-spacing: 1px;
}

.table-wrapper {
  max-height: 250px;
  overflow-y: auto;
  border: 1px solid var(--bg-card-border);
  border-radius: 8px;
  background: rgba(10, 5, 25, 0.6);
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  text-align: left;
}

.leaderboard-table th {
  background: rgba(22, 10, 48, 0.9);
  padding: 12px 15px;
  font-family: var(--font-title);
  font-size: 0.85rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--bg-card-border);
  position: sticky;
  top: 0;
  z-index: 2;
}

.leaderboard-table td {
  padding: 10px 15px;
  border-bottom: 1px solid rgba(139, 124, 163, 0.1);
}

.leaderboard-table tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.leaderboard-table tr.my-row {
  background: rgba(0, 240, 255, 0.08);
  border-left: 3px solid var(--neon-cyan);
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-card-border);
  border-radius: 4px;
}

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

/* Responsive adjustment for Mobile and Small Screens */
@media (max-width: 900px) {
  #app {
    padding: 10px;
  }
  
  .main-header {
    margin-bottom: 20px;
    display: block !important;
  }
  
  .logo {
    font-size: 2.2rem;
  }
  
  .host-grid {
    grid-template-columns: 1fr;
  }
  
  .settings-panel-horizontal {
    flex-direction: column;
    align-items: stretch;
    gap: 15px;
  }
  
  .settings-horizontal-group {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  
  .form-row {
    flex-direction: column;
    gap: 10px;
  }
  
  .actions-horizontal-group {
    width: 100%;
  }
  
  .game-hud {
    grid-template-columns: 1fr 1fr;
  }
  
  .nitro-wrapper {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 8px;
  }
  
  .nitro-ready-text {
    text-align: center;
  }
  
  .podium-container {
    height: 180px;
  }
}
