/* ==========================================================================
   COSMIC MATH - LA CONQUÊTE SPATIALE
   Modern Glassmorphism, Space Cyberpunk Theme & Full Portrait Dialogue Layout
   ========================================================================== */

:root {
  --bg-deep: #070913;
  --bg-card: rgba(15, 22, 41, 0.85);
  --primary-cyan: #00F0FF;
  --secondary-magenta: #FF007A;
  --accent-gold: #FFD700;
  --accent-purple: #8B5CF6;
  --accent-red: #FF3B30;
  --text-main: #FFFFFF;
  --text-dim: #A0AEC0;
  --glass-border: rgba(0, 240, 255, 0.25);
  --glass-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  --font-heading: 'Orbitron', sans-serif;
  --font-body: 'Outfit', sans-serif;
}

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

body {
  background-color: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

/* Background Space Canvas */
#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  pointer-events: none;
}

.app-container {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 1240px;
  padding: 16px;
  display: flex;
  justify-content: center;
  transition: transform 0.1s ease;
}

/* Grandiloquent Screen Shake Animation */
.app-container.shake {
  animation: epicShake 0.45s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes epicShake {
  10%, 90% { transform: translate3d(-4px, 2px, 0) rotate(-1deg); }
  20%, 80% { transform: translate3d(6px, -4px, 0) rotate(1.5deg); }
  30%, 50%, 70% { transform: translate3d(-8px, 6px, 0) rotate(-2deg); }
  40%, 60% { transform: translate3d(8px, -6px, 0) rotate(2deg); }
}

/* Red Flash Effect on Ship Damage/Destruction */
.red-flash-overlay {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(255, 0, 50, 0.45);
  z-index: 999;
  pointer-events: none;
  animation: fadeOutFlash 0.5s forwards;
}

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

/* Screen Management */
.screen {
  display: none;
  width: 100%;
  animation: fadeIn 0.4s ease-out;
}

.screen.active {
  display: block;
}

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

/* Glassmorphism Panel */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  box-shadow: var(--glass-shadow), inset 0 0 20px rgba(0, 240, 255, 0.05);
  padding: 20px;
}

/* ==========================================================================
   1. SELECTION / HOME SCREEN
   ========================================================================== */

.home-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  max-width: 650px;
  margin: 0 auto;
}

.badge-tag {
  background: rgba(0, 240, 255, 0.15);
  color: var(--primary-cyan);
  border: 1px solid rgba(0, 240, 255, 0.4);
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 6px 14px;
  border-radius: 20px;
}

.game-title {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 900;
  background: linear-gradient(135deg, #FFFFFF 0%, var(--primary-cyan) 60%, var(--secondary-magenta) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 30px rgba(0, 240, 255, 0.4);
  letter-spacing: 1px;
}

.game-subtitle {
  color: var(--text-dim);
  font-size: 0.95rem;
  max-width: 480px;
  line-height: 1.4;
}

.selection-section {
  width: 100%;
}

.selection-section h2 {
  font-size: 0.95rem;
  margin-bottom: 10px;
  color: var(--primary-cyan);
  text-align: left;
}

.table-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  width: 100%;
}

.table-btn, .timer-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  padding: 10px 6px;
  border-radius: 12px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.timer-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  width: 100%;
}

.table-btn:hover, .timer-btn:hover {
  background: rgba(0, 240, 255, 0.2);
  border-color: var(--primary-cyan);
  transform: translateY(-2px);
}

.table-btn.active, .timer-btn.active {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.3), rgba(255, 0, 122, 0.3));
  border: 2px solid var(--primary-cyan);
  color: #FFF;
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.5);
}

.options-section {
  display: flex;
  gap: 20px;
  margin-top: 4px;
}

.toggle-label {
  font-size: 0.85rem;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Primary Glow Button */
.primary-btn {
  background: linear-gradient(135deg, var(--primary-cyan), var(--accent-purple));
  color: #000;
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 1.05rem;
  padding: 14px 32px;
  border-radius: 50px;
  border: none;
  cursor: pointer;
  transition: all 0.25s ease;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.5);
}

.primary-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 35px rgba(0, 240, 255, 0.8), 0 0 15px rgba(255, 0, 122, 0.5);
}

.primary-btn:active {
  transform: scale(0.98);
}


/* ==========================================================================
   2. GAME SCREEN GRID (PILOT LEFT - GAME CENTER - INSTRUCTOR RIGHT)
   ========================================================================== */

.game-layout-grid {
  display: flex;
  gap: 18px;
  align-items: stretch;
  justify-content: center;
  width: 100%;
}

/* SIDEBAR CHARACTER PANELS (GRAND FORMAT FULL PORTRAITS) */
.character-sidebar {
  width: 250px;
  flex-shrink: 0;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 2px solid var(--glass-border);
  border-radius: 24px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--glass-shadow);
  transition: all 0.3s ease;
}

.left-sidebar {
  border-color: var(--primary-cyan);
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.2);
}

.right-sidebar {
  border-color: var(--secondary-magenta);
  box-shadow: 0 0 25px rgba(255, 0, 122, 0.2);
}

.sidebar-portrait-frame {
  width: 100%;
  height: 330px;
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.15);
  background: #060914;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
}

.full-portrait-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: transform 0.3s ease;
}

.sidebar-character-name {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 2px;
  margin: 10px 0 6px 0;
  padding: 4px 14px;
  border-radius: 12px;
  text-align: center;
  width: 100%;
}

.left-sidebar .sidebar-character-name {
  background: rgba(0, 240, 255, 0.15);
  color: var(--primary-cyan);
  border: 1px solid rgba(0, 240, 255, 0.4);
}

.right-sidebar .sidebar-character-name {
  background: rgba(255, 0, 122, 0.15);
  color: var(--secondary-magenta);
  border: 1px solid rgba(255, 0, 122, 0.4);
}

/* Speech Bubbles */
.speech-bubble {
  background: rgba(15, 23, 42, 0.95);
  border: 2px solid var(--primary-cyan);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 0.85rem;
  color: #FFF;
  text-align: center;
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.3);
  width: 100%;
  min-height: 65px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.35;
}

.right-bubble {
  border-color: var(--secondary-magenta);
  box-shadow: 0 0 14px rgba(255, 0, 122, 0.3);
}


/* CENTER GAME COCKPIT FRAME */
.sketch-card {
  flex: 1;
  max-width: 660px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 2px solid rgba(0, 240, 255, 0.3);
}

/* Top Viewport Frame (Visual Screen containing step dots + Rocket Canvas) */
.top-viewport {
  position: relative;
  background: #04060E;
  border-radius: 16px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  overflow: hidden;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8);
}

/* 10 Step Dots Header */
.step-dots-header {
  position: absolute;
  top: 10px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  z-index: 20;
}

.step-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.4);
  transition: all 0.3s ease;
  position: relative;
}

.step-dot.active {
  background: var(--primary-cyan);
  border-color: #FFF;
  box-shadow: 0 0 12px var(--primary-cyan);
  transform: scale(1.25);
}

.step-dot.passed {
  background: var(--accent-purple);
  border-color: var(--primary-cyan);
}

.step-dot.boss-dot {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border-color: var(--secondary-magenta);
}

.step-dot.boss-dot::after {
  content: '👑';
  font-size: 10px;
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
}

.step-dot.boss-dot.active {
  background: var(--secondary-magenta);
  box-shadow: 0 0 15px var(--secondary-magenta);
}

/* Boss HUD Header */
.boss-hud {
  width: 90%;
  margin: 4px auto 2px auto;
  background: rgba(15, 7, 25, 0.85);
  border: 1px solid var(--secondary-magenta);
  border-radius: 12px;
  padding: 6px 14px;
  text-align: center;
  box-shadow: 0 0 15px rgba(255, 0, 122, 0.4);
}

.boss-title {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--secondary-magenta);
  margin-bottom: 4px;
}

.boss-hp-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  overflow: hidden;
}

.boss-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--secondary-magenta), var(--accent-gold));
  transition: width 0.3s ease;
}

/* Game Canvas */
#game-canvas {
  display: block;
  width: 100%;
  height: 280px;
}

/* Timer Progress Bar */
.timer-bar-container {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 2px;
}

.timer-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--primary-cyan), var(--accent-purple), var(--secondary-magenta));
  box-shadow: 0 0 10px var(--primary-cyan);
  transition: width 0.1s linear, background-color 0.3s ease;
}

.timer-bar-fill.danger {
  background: linear-gradient(90deg, var(--accent-gold), var(--accent-red));
  box-shadow: 0 0 12px var(--accent-red);
}

/* Middle Calculation Section */
.middle-calc-section {
  text-align: center;
  padding: 6px 0 4px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.boss-alert-text {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--secondary-magenta);
  letter-spacing: 2px;
  animation: blink 1s infinite alternate;
  margin-bottom: 2px;
}

@keyframes blink {
  from { opacity: 0.4; }
  to { opacity: 1; }
}

.calc-display {
  font-family: var(--font-heading);
  font-size: 3.6rem;
  font-weight: 900;
  letter-spacing: 4px;
  color: var(--text-main);
  text-shadow: 0 0 20px rgba(0, 240, 255, 0.6);
}

/* Divider Line */
.divider-line {
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent 0%, var(--primary-cyan) 30%, var(--secondary-magenta) 70%, transparent 100%);
  box-shadow: 0 0 10px var(--primary-cyan);
  margin: 4px 0 8px 0;
}

/* Bottom Choices Section */
.bottom-choices-section {
  display: flex;
  justify-content: space-around;
  align-items: center;
  gap: 16px;
  padding: 2px 0 4px 0;
}

.choice-btn {
  flex: 1;
  background: linear-gradient(180deg, rgba(20, 30, 55, 0.9), rgba(10, 16, 32, 0.9));
  border: 2px solid var(--glass-border);
  color: var(--primary-cyan);
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  padding: 16px 10px;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  text-align: center;
}

.choice-btn:hover {
  background: linear-gradient(180deg, rgba(0, 240, 255, 0.25), rgba(10, 16, 32, 0.9));
  border-color: var(--primary-cyan);
  color: #FFF;
  transform: translateY(-4px);
  box-shadow: 0 12px 25px rgba(0, 240, 255, 0.4);
}

.choice-btn:active {
  transform: translateY(2px) scale(0.97);
}

.choice-btn.correct-glow {
  background: linear-gradient(135deg, #10B981, #059669) !important;
  border-color: #34D399 !important;
  color: #FFF !important;
  box-shadow: 0 0 30px #10B981 !important;
}

.choice-btn.wrong-glow {
  background: linear-gradient(135deg, #EF4444, #DC2626) !important;
  border-color: #F87171 !important;
  color: #FFF !important;
  box-shadow: 0 0 30px #EF4444 !important;
}


/* ==========================================================================
   3. MODAL (ERROR / RETRY)
   ========================================================================== */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(3, 5, 12, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  overflow-y: auto;
}

.modal-content {
  max-height: 90vh;
  overflow-y: auto;
  margin: auto;
  width: 100%;
}

.modal-content::-webkit-scrollbar {
  width: 6px;
}

.modal-content::-webkit-scrollbar-thumb {
  background: var(--primary-cyan);
  border-radius: 3px;
}

.modal.hidden {
  display: none !important;
}

.error-panel {
  text-align: center;
  max-width: 520px;
  width: 100%;
  border-color: rgba(255, 59, 48, 0.5);
  box-shadow: 0 0 40px rgba(255, 59, 48, 0.3);
}

.modal-icon {
  font-size: 3rem;
  margin-bottom: 8px;
}

.error-panel h2 {
  font-family: var(--font-heading);
  color: var(--accent-red);
  font-size: 1.5rem;
  margin-bottom: 10px;
}

.error-msg {
  color: var(--text-dim);
  font-size: 0.95rem;
  margin-bottom: 14px;
}

.correction-box {
  background: rgba(255, 59, 48, 0.15);
  border: 1px solid rgba(255, 59, 48, 0.4);
  padding: 14px;
  border-radius: 12px;
  font-family: var(--font-heading);
  font-size: 1.6rem;
  color: #FFF;
  margin-bottom: 14px;
}

.correction-box strong {
  color: var(--primary-cyan);
  font-size: 2rem;
}

/* Full Multiplication Table Display inside Defeat Screen */
.full-table-box {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(0, 240, 255, 0.3);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 16px;
  text-align: left;
}

.full-table-title {
  font-family: var(--font-heading);
  font-size: 0.92rem;
  color: var(--accent-gold);
  margin-bottom: 10px;
  text-align: center;
  letter-spacing: 0.5px;
}

.full-table-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px 12px;
}

.full-table-line {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-family: var(--font-body);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-dim);
}

.full-table-line.failed-line {
  background: rgba(255, 59, 48, 0.25);
  border-color: var(--accent-red);
  color: #FFF;
  font-weight: 700;
  box-shadow: 0 0 12px rgba(255, 59, 48, 0.4);
}

.full-table-line.failed-line span {
  color: var(--accent-gold);
}

.tip-msg {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.error-actions-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.secondary-btn.home-btn {
  background: rgba(0, 240, 255, 0.1);
  border: 1px solid rgba(0, 240, 255, 0.4);
  color: var(--primary-cyan);
  font-weight: 700;
}

.secondary-btn.home-btn:hover {
  background: rgba(0, 240, 255, 0.25);
  border-color: var(--primary-cyan);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.3);
}

.primary-btn.red-glow {
  background: linear-gradient(135deg, var(--accent-red), var(--secondary-magenta));
  box-shadow: 0 0 25px rgba(255, 59, 48, 0.6);
}


/* ==========================================================================
   4. VICTORY SCREEN
   ========================================================================== */

.victory-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.trophy-icon {
  font-size: 4rem;
  filter: drop-shadow(0 0 20px var(--accent-gold));
  animation: floatTrophy 2s ease-in-out infinite alternate;
}

@keyframes floatTrophy {
  from { transform: translateY(0); }
  to { transform: translateY(-10px); }
}

.victory-title {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 900;
  background: linear-gradient(135deg, #FFF, var(--accent-gold), var(--primary-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.victory-subtitle {
  color: var(--text-dim);
  font-size: 0.95rem;
  max-width: 480px;
  line-height: 1.5;
}

.stats-grid {
  display: flex;
  gap: 14px;
  width: 100%;
  justify-content: center;
}

.stat-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  padding: 12px 18px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary-cyan);
}

.victory-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 320px;
}

.secondary-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-dim);
  font-family: var(--font-heading);
  font-size: 0.85rem;
  padding: 12px;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.secondary-btn:hover {
  border-color: var(--primary-cyan);
  color: #FFF;
}

/* Player Name Input Styling */
.player-name-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 240, 255, 0.06);
  border: 1.5px solid rgba(0, 240, 255, 0.3);
  padding: 8px 16px;
  border-radius: 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.player-name-wrapper:focus-within {
  border-color: var(--primary-cyan);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.25);
}

.input-icon {
  font-size: 1.3rem;
}

.player-name-input {
  background: transparent;
  border: none;
  outline: none;
  color: #FFFFFF;
  font-family: var(--font-heading);
  font-size: 1.05rem;
  width: 100%;
  letter-spacing: 0.5px;
}

.player-name-input::placeholder {
  color: rgba(160, 174, 192, 0.5);
  font-family: var(--font-body);
}

/* Home Actions Group */
.home-actions-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  margin-top: 10px;
}

.leaderboard-btn {
  border-color: rgba(255, 215, 0, 0.4);
  color: var(--accent-gold);
}

.leaderboard-btn:hover {
  border-color: var(--accent-gold);
  background: rgba(255, 215, 0, 0.1);
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.2);
}

/* Leaderboard Modal & Table Styling */
.leaderboard-panel {
  max-width: 680px;
  width: 92%;
  padding: 24px;
  text-align: left;
}

.modal-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header-row h2 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  color: var(--accent-gold);
  letter-spacing: 0.5px;
}

.close-icon-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #FFF;
  font-size: 1.1rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s ease;
}

.close-icon-btn:hover {
  background: rgba(255, 0, 122, 0.4);
}

.modal-subtext {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 4px;
  margin-bottom: 16px;
}

.leaderboard-table-wrapper {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
  margin-bottom: 18px;
}

/* Custom Scrollbar for Leaderboard */
.leaderboard-table-wrapper::-webkit-scrollbar {
  width: 6px;
}
.leaderboard-table-wrapper::-webkit-scrollbar-thumb {
  background: var(--primary-cyan);
  border-radius: 3px;
}

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

.leaderboard-table th {
  background: rgba(0, 240, 255, 0.12);
  color: var(--primary-cyan);
  font-family: var(--font-heading);
  font-size: 0.75rem;
  padding: 10px 12px;
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 2;
}

.leaderboard-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

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

.rank-cell {
  font-weight: bold;
  font-family: var(--font-heading);
}

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

.player-cell {
  font-weight: 600;
  color: #FFF;
}

.score-cell {
  color: var(--primary-cyan);
  font-family: var(--font-heading);
}

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

.danger-text-btn {
  background: transparent;
  border: none;
  color: rgba(255, 59, 48, 0.8);
  font-size: 0.8rem;
  cursor: pointer;
  transition: color 0.2s ease;
}

.danger-text-btn:hover {
  color: #FF3B30;
  text-decoration: underline;
}

.sm-glow {
  padding: 8px 20px;
  font-size: 0.85rem;
}

.empty-leaderboard {
  text-align: center;
  padding: 30px;
  color: var(--text-dim);
  font-style: italic;
}

.hidden {
  display: none !important;
}

/* Floating Notice Toast FX (+1s & Second Chance) */
.floating-notice {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 100;
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 900;
  background: rgba(15, 22, 41, 0.92);
  padding: 10px 22px;
  border-radius: 16px;
  border: 2px solid var(--primary-cyan);
  box-shadow: 0 0 30px rgba(0, 240, 255, 0.4);
  pointer-events: none;
  animation: floatUpFade 1.2s forwards cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes floatUpFade {
  0% { opacity: 0; transform: translate(-50%, -20%) scale(0.7); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  75% { opacity: 1; transform: translate(-50%, -60%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -85%) scale(0.85); }
}

/* Responsive adjustments for mobile screens */
@media (max-width: 960px) {
  .game-layout-grid {
    flex-direction: column;
    align-items: center;
  }
  .character-sidebar {
    width: 100%;
    max-width: 500px;
    flex-direction: row;
    align-items: center;
    gap: 14px;
  }
  .sidebar-portrait-frame {
    width: 110px;
    height: 110px;
    border-radius: 50%;
  }
  .sketch-card {
    max-width: 100%;
  }
}
