/**
 * WPMType - Word Rush Typing Game Stylesheet
 * Ultra-lightweight, high-performance CSS without external frameworks
 */

/* Game Container & Layout */
.word-rush-container {
  max-width: 860px;
  margin: 0 auto 3rem auto;
  position: relative;
}

/* Game Controls Card */
.rush-controls-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}

.rush-ctrl-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.rush-ctrl-label {
  font-size: 0.775rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-right: 0.25rem;
}

.rush-tab-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.825rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.rush-tab-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.rush-tab-btn.active {
  background: var(--accent-cyan);
  color: #ffffff;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px var(--accent-cyan-glow);
  font-weight: 700;
}

/* Font Dropdown in Word Rush */
.rush-font-wrap {
  position: relative;
}

.rush-font-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.825rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: border-color var(--transition-fast);
}

.rush-font-btn:hover,
.rush-font-btn.open {
  border-color: var(--accent-cyan);
}

.rush-font-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  max-height: 250px;
  overflow-y: auto;
  padding: 0.35rem;
  display: none;
  z-index: 100;
}

.rush-font-menu.show {
  display: block;
}

.rush-font-item {
  padding: 0.45rem 0.75rem;
  font-size: 0.825rem;
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.rush-font-item:hover,
.rush-font-item.active {
  background: var(--bg-elevated);
  color: var(--accent-cyan);
}

/* Game Arena Card */
.rush-arena-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 2.25rem 2rem;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  text-align: center;
}

/* HUD Bar */
.rush-hud-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-subtle);
}

.rush-hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.rush-hud-label {
  font-size: 0.725rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.rush-hud-val {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

/* Score Highlight */
.rush-hud-val.score-val {
  color: var(--accent-cyan);
}

/* Combo Highlight & Badges */
.rush-combo-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent-amber);
  transition: transform 0.15s ease, color 0.2s ease;
}

.rush-combo-badge.pulse {
  transform: scale(1.15);
}

.rush-combo-badge.tier-super {
  color: var(--accent-emerald);
  text-shadow: 0 0 10px var(--accent-emerald-glow);
}

.rush-combo-badge.tier-ultra {
  color: #ec4899;
  text-shadow: 0 0 12px rgba(236, 72, 153, 0.4);
}

/* Timer Display */
.rush-hud-val.timer-val {
  color: var(--text-primary);
}

.rush-hud-val.timer-val.warning {
  color: var(--accent-red);
  animation: rushPulse 0.8s infinite alternate;
}

/* Lives Display (Endless Mode) */
.rush-lives-wrap {
  display: flex;
  gap: 0.25rem;
  font-size: 1.25rem;
}

.rush-heart {
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.rush-heart.lost {
  opacity: 0.25;
  filter: grayscale(1);
  transform: scale(0.8);
}

/* Floating Points Feedback */
.rush-float-score {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent-emerald);
  pointer-events: none;
  z-index: 50;
  animation: rushFloatUp 0.55s ease-out forwards;
}

@keyframes rushFloatUp {
  0% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -35px) scale(1.15);
  }
}

@keyframes rushPulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.06); }
}

/* Target Word Stage */
.rush-word-stage {
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 2rem;
  position: relative;
}

.rush-target-word {
  font-size: clamp(2.4rem, 7vw, 4rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  line-height: 1.2;
  user-select: none;
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  padding: 0 0.5rem;
  transition: transform 0.15s ease;
}

.rush-target-word.shake {
  animation: rushShake 0.25s ease-in-out;
}

@keyframes rushShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.rush-char {
  position: relative;
  transition: color 0.08s ease;
}

.rush-char.correct {
  color: var(--accent-emerald);
}

.rush-char.incorrect {
  color: var(--accent-red);
  background: var(--accent-red-glow);
  border-radius: 3px;
}

.rush-char.current {
  border-bottom: 3px solid var(--accent-cyan);
}

/* Typing Input Box */
.rush-input-wrap {
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

.rush-input-box {
  width: 100%;
  background: var(--input-bg);
  color: var(--input-text);
  border: 2px solid var(--input-border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  font-size: 1.35rem;
  text-align: center;
  font-family: inherit;
  font-weight: 600;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.rush-input-box:focus {
  border-color: var(--input-border-focus);
  box-shadow: 0 0 16px var(--shadow-glow);
}

.rush-input-hint {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Start Overlay / Pause State */
.rush-start-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 80;
  border-radius: var(--radius-xl);
  padding: 2rem;
}

[data-theme="light"] .rush-start-overlay {
  background: rgba(255, 255, 255, 0.95);
}

.rush-start-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.rush-start-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 420px;
  margin-bottom: 1.75rem;
}

.rush-start-btn {
  font-size: 1.1rem;
  padding: 0.85rem 2rem;
  border-radius: var(--radius-md);
  font-weight: 700;
}

/* Result Modal */
.rush-result-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.rush-result-modal.active {
  display: flex;
}

.rush-result-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  max-width: 680px;
  width: min(92vw, 680px);
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem 1.75rem;
  box-shadow: var(--shadow-lg);
  text-align: center;
  position: relative;
  animation: rushFadeIn 0.25s ease-out;
}

@keyframes rushFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.rush-result-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--accent-cyan-glow);
  color: var(--accent-cyan);
  margin-bottom: 0.65rem;
}

.rush-result-score-wrap {
  margin-bottom: 1.15rem;
}

.rush-result-score-num {
  font-family: var(--font-mono);
  font-size: clamp(2.75rem, 5vw, 3.5rem);
  font-weight: 800;
  color: var(--accent-cyan);
  line-height: 1;
}

.rush-result-score-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.rush-pb-banner {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid var(--accent-amber);
  color: var(--accent-amber);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.825rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.rush-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.65rem;
  margin-bottom: 1.35rem;
}

.rush-stat-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.45rem;
  text-align: center;
}

.rush-stat-box-val {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.rush-stat-box-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.rush-modal-buttons {
  display: flex;
  gap: 0.75rem;
  flex-direction: column;
}

@media (min-width: 480px) {
  .rush-modal-buttons {
    flex-direction: row;
    justify-content: center;
    max-width: 380px;
    margin: 0 auto;
  }
  .rush-modal-buttons .btn {
    flex: 1;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
  .rush-controls-card {
    flex-direction: column;
    align-items: stretch;
    padding: 0.85rem 1rem;
    gap: 0.75rem;
  }

  .rush-ctrl-group {
    justify-content: flex-start;
  }

  .rush-hud-bar {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.85rem;
    margin-bottom: 1.5rem;
  }

  .rush-arena-card {
    padding: 1.5rem 1rem;
  }

  .rush-target-word {
    font-size: 2.2rem;
  }

  .rush-input-box {
    font-size: 1.15rem;
    padding: 0.85rem 1rem;
  }

  .rush-result-card {
    padding: 1.25rem 1rem;
    width: calc(100% - 24px);
    max-width: 100%;
  }

  .rush-result-score-num {
    font-size: clamp(2.25rem, 8vw, 2.75rem);
  }

  .rush-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 1.15rem;
  }
}

@media (max-width: 360px) {
  .rush-tab-btn {
    padding: 0.35rem 0.65rem;
    font-size: 0.775rem;
  }

  .rush-target-word {
    font-size: 1.85rem;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .rush-target-word.shake,
  .rush-float-score,
  .rush-hud-val.timer-val.warning,
  .rush-combo-badge.pulse {
    animation: none !important;
    transform: none !important;
  }
}

/* Explicit High-Contrast Light Mode Overrides */
[data-theme="light"] .rush-controls-card,
[data-theme="light"] .rush-arena-card,
[data-theme="light"] .rush-result-card {
  background: #ffffff;
  border-color: #e2e8f0;
}

[data-theme="light"] .rush-target-word {
  color: #0f172a;
}

[data-theme="light"] .rush-char.current {
  border-bottom-color: #0284c7;
}

[data-theme="light"] .rush-char.correct {
  color: #059669;
}

[data-theme="light"] .rush-char.incorrect {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.1);
}

[data-theme="light"] .rush-hud-val {
  color: #0f172a;
}

[data-theme="light"] .rush-hud-val.score-val {
  color: #0284c7;
}

[data-theme="light"] .rush-combo-badge {
  color: #d97706;
}

[data-theme="light"] .rush-result-score-num {
  color: #0284c7;
}

[data-theme="light"] .rush-stat-box {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .rush-stat-box-val {
  color: #0f172a;
}

[data-theme="light"] .rush-input-box {
  background: #ffffff;
  color: #0f172a;
  border-color: #cbd5e1;
}

[data-theme="light"] .rush-start-title {
  color: #0f172a;
}

[data-theme="light"] .rush-start-subtitle {
  color: #475569;
}

