/* =============================================
   TYPESTRIKE - Cyberpunk Typing Game Styles
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Share+Tech+Mono&display=swap');

:root,
html[data-theme="neon"] {
  --cyan:    #00FFFF;
  --magenta: #FF00FF;
  --green:   #00FF41;
  --gold:    #FFD700;
  --red:     #FF003C;
  --orange:  #FF6B35;
  --bg:      #0A0A1A;
  --bg2:     #0D1F3C;
  --dim:     #4466AA;
  --bright:  #CCDDFF;
  --hud-bg:  rgba(0, 20, 50, 0.85);
  --font-main: 'Orbitron', monospace;
  --font-mono: 'Share Tech Mono', monospace;
}

html[data-theme="matrix"] {
  --cyan:    #00FF41;
  --magenta: #AAFF00;
  --green:   #00FF41;
  --gold:    #88FF44;
  --red:     #FF2200;
  --orange:  #CCFF00;
  --bg:      #050A05;
  --bg2:     #0A1A0A;
  --dim:     #337733;
  --bright:  #BBFFBB;
  --hud-bg:  rgba(0, 20, 0, 0.85);
}

html[data-theme="sunset"] {
  --cyan:    #FF6B35;
  --magenta: #FFD700;
  --green:   #FF9F1C;
  --gold:    #FFD700;
  --red:     #FF003C;
  --orange:  #FF6B35;
  --bg:      #1A0A05;
  --bg2:     #2A1508;
  --dim:     #886644;
  --bright:  #FFEEDD;
  --hud-bg:  rgba(30, 10, 0, 0.85);
}

html[data-theme="ghost"] {
  --cyan:    #E0E0E0;
  --magenta: #8B5CF6;
  --green:   #A78BFA;
  --gold:    #C4B5FD;
  --red:     #EF4444;
  --orange:  #DDD6FE;
  --bg:      #0A0A10;
  --bg2:     #12121F;
  --dim:     #555577;
  --bright:  #E0E0EE;
  --hud-bg:  rgba(10, 10, 20, 0.85);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: var(--font-mono);
  color: var(--bright);
  cursor: default;
  user-select: none;
}

/* ---- Game Root ---- */
#game-root {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* ---- Canvases ---- */
#bg-canvas,
#fx-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#bg-canvas { z-index: 0; }
#fx-canvas { z-index: 2; }

/* ---- Word Container ---- */
#word-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* ---- Falling Word Elements ---- */
.word-el {
  position: absolute;
  font-family: var(--font-main);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 3px;
  white-space: nowrap;
  pointer-events: none;
  transition: none;
}

.word-el.is-target {
  filter: drop-shadow(0 0 6px var(--cyan));
}

.word-el .char-matched {
  color: var(--cyan);
  text-shadow:
    0 0 6px var(--cyan),
    0 0 14px var(--cyan),
    0 0 28px #007FFF;
  animation: char-hit 0.22s ease-out;
}
@keyframes char-hit {
  0%   { text-shadow: 0 0 30px #fff, 0 0 60px var(--cyan); transform: scale(1.45) translateY(-3px); }
  100% { text-shadow: 0 0 6px var(--cyan), 0 0 14px var(--cyan), 0 0 28px #007FFF; transform: scale(1) translateY(0); }
}

.word-el .char-unmatched {
  color: var(--dim);
  text-shadow: none;
}

.word-el.powerup-word {
  font-size: 20px;
  letter-spacing: 4px;
}

.word-el.powerup-word .char-unmatched {
  color: var(--gold);
  text-shadow:
    0 0 6px var(--gold),
    0 0 14px #FF8C00;
}

.word-el.flash-error .char-unmatched,
.word-el.flash-error .char-matched {
  color: var(--red) !important;
  text-shadow: 0 0 8px var(--red), 0 0 20px var(--red) !important;
}

/* Shatter animation for individual chars – uses inline JS-set vars */
.word-el.shattering span {
  display: inline-block;
}

@keyframes shatter-char {
  0%   { opacity: 1; transform: translate(0, 0) rotate(0deg) scale(1); }
  100% { opacity: 0; transform: translate(var(--end-tx, 40px), var(--end-ty, -30px)) rotate(var(--end-rot, 90deg)) scale(0.1); }
}

/* Ground danger line */
#word-container::after {
  content: '';
  position: absolute;
  bottom: 80px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--red), var(--red), transparent);
  opacity: 0.25;
  animation: danger-pulse 2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes danger-pulse {
  0%, 100% { opacity: 0.15; }
  50%       { opacity: 0.45; }
}

/* ---- Global hidden utility ---- */
.hidden { display: none !important; }

/* ---- HUD ---- */
#hud.hud-inactive {
  opacity: 0;
  pointer-events: none;
}

#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 20px 14px;
  background: linear-gradient(180deg, rgba(0,6,20,0.97) 60%, transparent 100%);
  border-bottom: 1px solid rgba(0, 255, 255, 0.12);
  pointer-events: none;
  flex-wrap: nowrap;
}

/* Each HUD cell */
.hud-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

#score-block { display: flex; flex-direction: column; align-items: flex-start; flex: 2; }
#level-block { display: flex; flex-direction: column; align-items: center;     flex: 1; }
#center-hud  { display: flex; flex-direction: column; align-items: center;     flex: 2; gap: 2px; }
#right-hud   { display: flex; flex-direction: row;    align-items: flex-start; flex: 3; gap: 18px; justify-content: flex-end; }
#lives-block, #wpm-block, #streak-block, #timer-block { display: flex; flex-direction: column; align-items: center; }

.hud-label {
  font-family: var(--font-main);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--dim);
  margin-bottom: 2px;
}

#score {
  font-family: var(--font-main);
  font-size: 26px;
  font-weight: 900;
  color: var(--cyan);
  text-shadow: 0 0 10px var(--cyan), 0 0 20px #007FFF;
  transition: text-shadow 0.1s;
}

#level {
  font-family: var(--font-main);
  font-size: 26px;
  font-weight: 900;
  color: var(--magenta);
  text-shadow: 0 0 10px var(--magenta);
}

#lives {
  display: flex;
  gap: 5px;
}

.heart {
  font-size: 18px;
  color: var(--red);
  text-shadow: 0 0 8px var(--red);
  transition: all 0.3s;
}

.heart.lost {
  color: #331122;
  text-shadow: none;
  opacity: 0.3;
}

/* ---- Combo Badge ---- */
#combo-block {
  pointer-events: none;
}

#combo-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3px 10px;
  border: 1px solid currentColor;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 4px;
  animation: combo-pulse 1s ease-in-out infinite;
}

#combo-mult {
  font-family: var(--font-main);
  font-size: 16px;
  font-weight: 900;
}

#combo-count {
  font-family: var(--font-main);
  font-size: 8px;
  letter-spacing: 2px;
  opacity: 0.8;
}

#combo-badge.combo-1 { color: var(--bright); border-color: rgba(200,220,255,0.3); }
#combo-badge.combo-2 { color: #FFE066; border-color: #FFE066; text-shadow: 0 0 10px #FFE066; }
#combo-badge.combo-3 { color: var(--orange); border-color: var(--orange); text-shadow: 0 0 10px var(--orange); }
#combo-badge.combo-4 { color: #FF5599; border-color: #FF5599; text-shadow: 0 0 10px #FF5599; }
#combo-badge.combo-5 { color: var(--cyan); border-color: var(--cyan); text-shadow: 0 0 14px var(--cyan); animation: rainbow-combo 0.8s linear infinite; }

@keyframes combo-pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.04); }
}

@keyframes rainbow-combo {
  0%   { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}

/* ---- Floating Score Text ---- */
.float-score {
  position: absolute;
  font-family: var(--font-main);
  font-size: 16px;
  font-weight: 700;
  color: var(--cyan);
  text-shadow: 0 0 8px var(--cyan);
  pointer-events: none;
  z-index: 15;
  animation: float-up 0.9s ease-out forwards;
}

@keyframes float-up {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  60%  { opacity: 1; transform: translateY(-40px) scale(1.1); }
  100% { opacity: 0; transform: translateY(-70px) scale(0.8); }
}

/* ---- Zone Vignette (flow state indicator) ---- */
#zone-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  box-shadow: inset 0 0 0px transparent;
  transition: box-shadow 1s ease;
}
#zone-vignette.zone-mid  { box-shadow: inset 0 0 80px  rgba(0,255,255,0.10); }
#zone-vignette.zone-high { box-shadow: inset 0 0 120px rgba(0,255,255,0.20); }
#zone-vignette.zone-peak {
  box-shadow:
    inset 0 0 140px rgba(255,0,255,0.25),
    inset 0 0 80px  rgba(0,255,255,0.15);
  animation: zone-breathe 1.8s ease-in-out infinite;
}
@keyframes zone-breathe {
  0%, 100% { opacity: 0.9; }
  50%       { opacity: 1.0; }
}

/* ---- Shield Ring ---- */
#shield-ring {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border: 3px solid #00FFC8;
  box-shadow: inset 0 0 30px rgba(0,255,200,0.15), 0 0 30px rgba(0,255,200,0.25);
  pointer-events: none;
  z-index: 9;
  animation: shield-pulse 1.5s ease-in-out infinite;
}

@keyframes shield-pulse {
  0%, 100% { opacity: 0.6; }
  50%       { opacity: 1; }
}

/* ---- Overlays ---- */
.overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 5, 20, 0.88);
  backdrop-filter: blur(4px);
}

.overlay.hidden {
  display: none;
}

/* Game-over overlay scrolls when content is tall */
#overlay-gameover {
  align-items: flex-start;
  overflow-y: auto;
  padding: 20px 0;
}

.overlay-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* Game-over content gets constrained width */
#overlay-gameover .overlay-content {
  width: 100%;
  max-width: 640px;
  padding: 0 16px 24px;
}

/* ---- Menu ---- */
.game-title {
  font-family: var(--font-main);
  font-size: clamp(40px, 8vw, 80px);
  font-weight: 900;
  color: var(--cyan);
  text-shadow: 0 0 20px var(--cyan), 0 0 60px #007FFF, 0 0 100px #003FFF;
  letter-spacing: 8px;
  animation: title-flicker 4s ease-in-out infinite;
}

.title-accent {
  color: var(--magenta);
  text-shadow: 0 0 20px var(--magenta), 0 0 60px #7F007F;
}

@keyframes title-flicker {
  0%, 90%, 100% { opacity: 1; }
  92%            { opacity: 0.8; }
  94%            { opacity: 1; }
  96%            { opacity: 0.85; }
}

.subtitle {
  font-family: var(--font-main);
  font-size: 12px;
  letter-spacing: 6px;
  color: var(--dim);
  margin-top: -14px;
}

.instructions {
  font-size: 14px;
  color: var(--bright);
  opacity: 0.7;
  line-height: 1.8;
  max-width: 400px;
}

.power-hint { font-size: 12px; margin-top: 6px; line-height: 2; }
.hint-sub { color: #6677AA; font-size: 11px; display: block; margin-top: 2px; }
.gold   { color: var(--gold);    text-shadow: 0 0 6px var(--gold); }
.red    { color: var(--red);     text-shadow: 0 0 6px var(--red); }
.green  { color: var(--green);   text-shadow: 0 0 6px var(--green); }
.cyan   { color: var(--cyan);    text-shadow: 0 0 6px var(--cyan); }
.purple { color: #AA44FF;        text-shadow: 0 0 6px #AA44FF; }
.yellow { color: #FFD700;        text-shadow: 0 0 6px #FFD700; }

/* ---- Buttons ---- */
.neon-btn {
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--bg);
  background: var(--cyan);
  border: none;
  padding: 14px 40px;
  cursor: pointer;
  clip-path: polygon(8px 0%, 100% 0%, calc(100% - 8px) 100%, 0% 100%);
  transition: all 0.15s;
  box-shadow: 0 0 20px var(--cyan), 0 0 40px rgba(0,255,255,0.3);
  text-transform: uppercase;
}

.neon-btn:hover {
  background: #fff;
  box-shadow: 0 0 30px #fff, 0 0 60px var(--cyan);
  transform: scale(1.04);
}

.neon-btn:active {
  transform: scale(0.97);
}

.neon-btn-start {
  display: block;
  margin: 18px auto 0;
  font-size: 18px;
  letter-spacing: 8px;
  padding: 16px 60px;
  background: var(--magenta);
  box-shadow: 0 0 20px var(--magenta), 0 0 50px rgba(255,0,255,0.4);
  animation: start-pulse 1.8s ease-in-out infinite;
}
.neon-btn-start:hover {
  background: #fff;
  box-shadow: 0 0 40px #fff, 0 0 80px var(--magenta);
}
@keyframes start-pulse {
  0%, 100% { box-shadow: 0 0 20px var(--magenta), 0 0 50px rgba(255,0,255,0.4); }
  50%       { box-shadow: 0 0 35px var(--magenta), 0 0 80px rgba(255,0,255,0.6); }
}
.start-hint {
  font-size: 11px;
  color: #4455AA;
  letter-spacing: 2px;
  margin-top: 8px;
  text-align: center;
}

#highscore-display {
  font-family: var(--font-main);
  font-size: 13px;
  color: var(--dim);
  letter-spacing: 2px;
}

#best-score {
  color: var(--gold);
  text-shadow: 0 0 8px var(--gold);
}

/* ---- Level Up ---- */
.levelup-content {
  gap: 10px;
}

.levelup-text {
  font-family: var(--font-main);
  font-size: clamp(20px, 4vw, 36px);
  font-weight: 700;
  letter-spacing: 8px;
  color: var(--magenta);
  text-shadow: 0 0 20px var(--magenta), 0 0 60px #7F007F;
}

.levelup-number {
  font-family: var(--font-main);
  font-size: clamp(60px, 14vw, 130px);
  font-weight: 900;
  color: var(--cyan);
  text-shadow: 0 0 30px var(--cyan), 0 0 80px #007FFF;
  animation: levelup-zoom 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes levelup-zoom {
  0%   { transform: scale(0.3); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ---- Game Over ---- */
.gameover-title {
  font-family: var(--font-main);
  font-size: clamp(24px, 5vw, 44px);
  font-weight: 900;
  color: var(--red);
  text-shadow: 0 0 20px var(--red), 0 0 50px #7F0020;
  letter-spacing: 6px;
  margin-bottom: 2px;
}

/* 2-column grid layout for game over screen */
.gameover-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  max-width: 640px;
}

.gameover-grid .gameover-col-full {
  grid-column: 1 / -1;
}

.final-stats {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 100%;
  border: 1px solid rgba(0,255,255,0.15);
  padding: 14px 18px;
  background: rgba(0,10,30,0.5);
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-main);
  font-size: 14px;
  color: var(--bright);
}

.stat-row span:last-child {
  color: var(--cyan);
  text-shadow: 0 0 8px var(--cyan);
  font-size: 18px;
  font-weight: 700;
}

.stat-row.highlight span:last-child {
  color: var(--gold);
  text-shadow: 0 0 10px var(--gold);
}

/* ---- Mobile Input (hidden but inside viewport so focus doesn't trigger scroll) ---- */
#mobile-input {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

/* ---- Freeze Overlay ---- */
#word-container.frozen .word-el .char-unmatched {
  color: #89CFF0 !important;
  text-shadow: 0 0 8px #89CFF0, 0 0 20px #004488 !important;
}

/* ---- Scrollbar (hide) ---- */
::-webkit-scrollbar { display: none; }

/* =============================================
   NEW FEATURES STYLES
   ============================================= */

/* ---- HUD layout (new elements) — flex properties set in main HUD section above ---- */

/* ---- Timer (Time Attack) ---- */
#timer-block { text-align: center; }

#timer-display {
  font-family: var(--font-main);
  font-size: 26px;
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 12px var(--gold);
  transition: color 0.3s;
}

#timer-display.urgent {
  color: var(--red);
  text-shadow: 0 0 16px var(--red);
  animation: timer-pulse 0.5s ease-in-out infinite;
}

@keyframes timer-pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.12); }
}

/* ---- WPM & Streak ---- */
#wpm-display, #streak-display {
  font-family: var(--font-main);
  font-size: 20px;
  font-weight: 700;
}

#wpm-display {
  color: var(--green);
  text-shadow: 0 0 8px var(--green);
}

#streak-display {
  color: #FF88FF;
  text-shadow: 0 0 8px #FF88FF;
}

/* ---- Mode Select Buttons ---- */
#mode-select {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.mode-btn {
  font-size: 12px;
  padding: 10px 22px;
  letter-spacing: 3px;
  opacity: 0.4;
  transform: scale(0.93);
  transition: transform 0.15s, opacity 0.15s, box-shadow 0.15s;
}
.mode-btn:hover { opacity: 0.75; }

.mode-btn-alt {
  background: var(--gold);
  box-shadow: 0 0 16px var(--gold);
  color: #1a1000;
}

.mode-btn-daily {
  background: var(--magenta);
  box-shadow: 0 0 16px var(--magenta);
  color: #1a001a;
}

.active-mode {
  opacity: 1 !important;
  transform: scale(1.1) !important;
  outline: 2px solid white;
  outline-offset: 4px;
  box-shadow: 0 0 30px rgba(255,255,255,0.5), 0 0 60px rgba(255,255,255,0.15) !important;
}

#mode-desc {
  font-size: 12px;
  color: var(--dim);
  letter-spacing: 1px;
  min-height: 20px;
}

#daily-played-notice {
  font-family: var(--font-main);
  font-size: 12px;
  letter-spacing: 2px;
}

/* ---- Boss Word ---- */
.word-el.boss-word {
  font-size: 24px;
  letter-spacing: 5px;
}

.word-el.boss-word .char-unmatched {
  color: var(--gold);
  text-shadow:
    0 0 8px var(--gold),
    0 0 20px #FF8C00,
    0 0 40px #FF6000;
  animation: boss-glow 0.6s ease-in-out infinite alternate;
}

@keyframes boss-glow {
  from { text-shadow: 0 0 8px var(--gold), 0 0 20px #FF8C00; }
  to   { text-shadow: 0 0 16px #fff, 0 0 40px var(--gold), 0 0 80px #FF4400; }
}

/* ---- Danger Zone (word near ground) ---- */
.word-el.danger .char-unmatched {
  animation: danger-flicker 0.3s ease-in-out infinite alternate;
}

@keyframes danger-flicker {
  from { color: var(--dim); }
  to   { color: var(--red); text-shadow: 0 0 8px var(--red); }
}

/* ---- Word Speed Color ---- */
.word-el.word-slow .char-unmatched  { color: #44CC44; text-shadow: 0 0 6px #44CC44; }
.word-el.word-fast .char-unmatched  { color: var(--orange); text-shadow: 0 0 6px var(--orange); }
.word-el.word-vfast .char-unmatched { color: #FF2255; text-shadow: 0 0 8px #FF2255; }

/* ---- Boss Incoming Warning ---- */
.boss-warn {
  font-family: var(--font-main);
  font-size: clamp(14px, 3vw, 22px);
  letter-spacing: 5px;
  color: var(--gold);
  text-shadow: 0 0 16px var(--gold);
  animation: boss-warn-pulse 0.4s ease-in-out infinite alternate;
  margin-top: -10px;
}

@keyframes boss-warn-pulse {
  from { opacity: 0.6; }
  to   { opacity: 1; transform: scale(1.05); }
}

/* ---- Achievement Popup ---- */
#achievement-popup {
  position: absolute;
  top: 80px;
  right: -320px;
  width: 280px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 10, 30, 0.95);
  border: 1px solid var(--gold);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
  padding: 12px 16px;
  z-index: 300;
  transition: right 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

#achievement-popup.show {
  right: 16px;
}

#achievement-icon {
  font-size: 28px;
  line-height: 1;
}

#achievement-title {
  font-family: var(--font-main);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 3px;
  color: var(--gold);
  text-shadow: 0 0 8px var(--gold);
}

#achievement-desc {
  font-size: 11px;
  color: var(--bright);
  opacity: 0.8;
  margin-top: 2px;
}

/* ---- New Achievements list on Game Over ---- */
#new-achievements {
  border: 1px solid rgba(255,215,0,0.3);
  padding: 12px 16px;
  text-align: left;
  background: rgba(20,10,0,0.5);
  max-width: 280px;
  width: 100%;
}

#new-achievements-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ach-row {
  font-size: 12px;
  color: var(--gold);
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ---- WPM Timeline Chart ---- */
.wpm-chart-wrap {
  width: 100%;
  text-align: center;
}

#wpm-chart {
  width: 100%;
  height: 70px;
  border: 1px solid rgba(0,255,255,0.12);
  background: rgba(0,10,30,0.4);
}

/* ---- Problem Keys ---- */
.problem-keys {
  width: 100%;
  border: 1px solid rgba(255,60,60,0.2);
  background: rgba(30,5,5,0.4);
  padding: 10px 14px;
}

.problem-keys-list {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.problem-key {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.problem-key-char {
  font-family: var(--font-main);
  font-size: 18px;
  font-weight: 900;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid;
  background: rgba(0,0,0,0.5);
}

.problem-key-pct {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
}

.problem-key.key-good .problem-key-char { color: var(--cyan); border-color: rgba(0,255,255,0.4); }
.problem-key.key-good .problem-key-pct  { color: var(--cyan); }
.problem-key.key-warn .problem-key-char { color: var(--gold); border-color: rgba(255,215,0,0.4); text-shadow: 0 0 6px var(--gold); }
.problem-key.key-warn .problem-key-pct  { color: var(--gold); }
.problem-key.key-bad  .problem-key-char { color: var(--red); border-color: rgba(255,0,60,0.5); text-shadow: 0 0 8px var(--red); }
.problem-key.key-bad  .problem-key-pct  { color: var(--red); }

/* ---- Keyboard Heatmap ---- */
.keyboard-heatmap {
  width: 100%;
  border: 1px solid rgba(0,255,255,0.12);
  background: rgba(0,10,30,0.5);
  padding: 10px 12px;
  text-align: center;
}

.heatmap-keyboard {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.heatmap-row {
  display: flex;
  gap: 3px;
  justify-content: center;
}

.heatmap-key {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-main);
  font-size: 9px;
  font-weight: 700;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.2);
  transition: all 0.3s;
  position: relative;
}

.heatmap-key[data-hits]::after {
  content: attr(data-hits);
  position: absolute;
  bottom: -1px;
  right: 1px;
  font-size: 5px;
  font-family: var(--font-mono);
  opacity: 0.5;
}

.heatmap-key.hm-good {
  color: var(--cyan);
  border-color: rgba(0,255,255,0.5);
  background: rgba(0,255,255,0.12);
  text-shadow: 0 0 6px var(--cyan);
  box-shadow: 0 0 4px rgba(0,255,255,0.2);
}

.heatmap-key.hm-ok {
  color: var(--green);
  border-color: rgba(0,255,65,0.4);
  background: rgba(0,255,65,0.1);
  text-shadow: 0 0 5px var(--green);
  box-shadow: 0 0 3px rgba(0,255,65,0.15);
}

.heatmap-key.hm-warn {
  color: var(--gold);
  border-color: rgba(255,215,0,0.5);
  background: rgba(255,215,0,0.12);
  text-shadow: 0 0 6px var(--gold);
  box-shadow: 0 0 4px rgba(255,215,0,0.2);
}

.heatmap-key.hm-bad {
  color: var(--red);
  border-color: rgba(255,0,60,0.6);
  background: rgba(255,0,60,0.15);
  text-shadow: 0 0 8px var(--red);
  box-shadow: 0 0 6px rgba(255,0,60,0.3);
  animation: heatmap-pulse 1.5s ease-in-out infinite alternate;
}

@keyframes heatmap-pulse {
  from { box-shadow: 0 0 4px rgba(255,0,60,0.2); }
  to   { box-shadow: 0 0 10px rgba(255,0,60,0.5); }
}

.heatmap-legend {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 6px;
  flex-wrap: wrap;
}

.heatmap-legend-item {
  display: flex;
  align-items: center;
  gap: 3px;
  font-family: var(--font-mono);
  font-size: 8px;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.5px;
}

.heatmap-swatch {
  width: 8px;
  height: 8px;
  display: inline-block;
}

.heatmap-sw-good { background: var(--cyan); box-shadow: 0 0 4px var(--cyan); }
.heatmap-sw-ok   { background: var(--green); box-shadow: 0 0 4px var(--green); }
.heatmap-sw-warn { background: var(--gold); box-shadow: 0 0 4px var(--gold); }
.heatmap-sw-bad  { background: var(--red); box-shadow: 0 0 4px var(--red); }
.heatmap-sw-none { background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.15); }

/* ---- Settings Panel ---- */
.settings-panel {
  width: 260px;
  border: 1px solid rgba(0,255,255,0.15);
  background: rgba(0,10,30,0.85);
  padding: 14px 18px;
}

.settings-title {
  font-family: var(--font-main);
  font-size: 11px;
  letter-spacing: 4px;
  color: var(--dim);
  text-align: center;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(0,255,255,0.1);
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--bright);
}

.setting-toggle {
  font-family: var(--font-main);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 4px 14px;
  border: 1px solid;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s;
}

.setting-toggle.on {
  color: var(--cyan);
  border-color: var(--cyan);
  text-shadow: 0 0 6px var(--cyan);
}

.setting-toggle.off {
  color: var(--dim);
  border-color: rgba(68,102,170,0.3);
  text-shadow: none;
  opacity: 0.5;
}

.setting-toggle:hover {
  transform: scale(1.05);
}

/* ---- Menu Secondary Buttons ---- */
.menu-secondary-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 8px;
}

/* ---- Personal Best Badges ---- */
.pb-badges {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.pb-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 12px;
  border: 1px solid;
  background: rgba(0,10,30,0.5);
  min-width: 80px;
}

.pb-mode {
  font-family: var(--font-main);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 2px;
}

.pb-val {
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 700;
  color: var(--bright);
}

.pb-wpm {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--dim);
}

/* ---- New Record Flash ---- */
.new-record {
  font-family: var(--font-main);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 6px;
  color: var(--gold);
  text-shadow: 0 0 20px var(--gold), 0 0 40px #FF8C00;
  animation: record-flash 0.6s ease-in-out infinite alternate;
}

@keyframes record-flash {
  from { opacity: 0.7; transform: scale(1); }
  to   { opacity: 1; transform: scale(1.08); text-shadow: 0 0 30px var(--gold), 0 0 60px #FF8C00; }
}

/* ---- Session History ---- */
#history-panel {
  width: 340px;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid rgba(0,255,255,0.15);
  background: rgba(0,10,30,0.7);
  padding: 8px;
}

.history-header,
.history-row {
  display: grid;
  grid-template-columns: 50px 40px 80px 35px 45px 45px;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 3px 4px;
  text-align: right;
}

.history-header {
  color: var(--dim);
  font-family: var(--font-main);
  font-size: 9px;
  letter-spacing: 1px;
  border-bottom: 1px solid rgba(0,255,255,0.1);
  margin-bottom: 2px;
  padding-bottom: 4px;
}

.history-row {
  color: var(--bright);
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.history-row:hover {
  background: rgba(0,255,255,0.05);
}

.history-row span:nth-child(3) {
  color: var(--cyan);
}

.history-row span:nth-child(5) {
  color: var(--green);
}

/* ---- Game Over extras ---- */
#btn-menu {
  margin-top: -10px;
}

.neon-btn-ghost {
  background: transparent;
  color: var(--dim);
  box-shadow: none;
  border: 1px solid var(--dim);
  clip-path: none;
  font-size: 11px;
  padding: 8px 24px;
}

.neon-btn-ghost:hover {
  color: var(--bright);
  border-color: var(--bright);
  box-shadow: 0 0 10px rgba(200,220,255,0.3);
  background: transparent;
  transform: none;
}

/* ---- PERFECT floating text override ---- */
.float-score.perfect-text {
  font-size: 20px;
  color: #FFD700;
  text-shadow: 0 0 12px #FFD700, 0 0 30px #FF8C00;
}

/* ---- Daily badge on menu ---- */
#daily-played-notice {
  font-family: var(--font-main);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--gold);
}

/* ---- Word Behaviors ---- */
.word-el.word-accel .char-unmatched {
  color: #FF8844;
  text-shadow: 0 0 6px #FF8844;
}

.word-el.word-zigzag .char-unmatched {
  color: #88FFCC;
  text-shadow: 0 0 6px #88FFCC;
}

.word-el.word-split .char-unmatched {
  color: #FF88FF;
  text-shadow: 0 0 8px #FF88FF;
}

/* ---- Hacker Mission Text (Level Up overlay) ---- */
.mission-text {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--green);
  text-shadow: 0 0 8px var(--green);
  letter-spacing: 2px;
  max-width: 380px;
  text-align: center;
  opacity: 0.85;
  animation: mission-type 0.5s steps(40, end);
  overflow: hidden;
  white-space: normal;
}

@keyframes mission-type {
  from { opacity: 0; }
  to   { opacity: 0.85; }
}

/* ---- Upgrade Choice ---- */
.upgrade-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.upgrade-title {
  font-family: var(--font-main);
  font-size: 11px;
  letter-spacing: 4px;
  color: var(--dim);
}

.upgrade-buttons {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.upgrade-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: rgba(0, 10, 30, 0.85);
  border: 1px solid var(--cyan);
  color: var(--bright);
  padding: 16px 22px;
  cursor: pointer;
  min-width: 130px;
  font-family: var(--font-main);
  transition: all 0.15s;
  clip-path: polygon(6px 0%, 100% 0%, calc(100% - 6px) 100%, 0% 100%);
}

.upgrade-btn:hover {
  background: rgba(0, 255, 255, 0.1);
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.4);
  transform: scale(1.05);
}

.upgrade-btn:active {
  transform: scale(0.97);
}

.upgrade-icon {
  font-size: 26px;
  line-height: 1;
}

.upgrade-label {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 3px;
  color: var(--cyan);
  text-shadow: 0 0 6px var(--cyan);
}

.upgrade-desc {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--dim);
  font-family: var(--font-mono);
}

/* ---- Laser Beam Power-up ---- */
@keyframes laser-beam {
  0%   { opacity: 1; transform: scaleY(0); transform-origin: top center; }
  60%  { opacity: 1; transform: scaleY(1); transform-origin: top center; }
  100% { opacity: 0; transform: scaleY(1); transform-origin: top center; }
}

/* ---- Turbo Power-up ---- */
#score.turbo-score {
  color: var(--gold) !important;
  text-shadow: 0 0 16px var(--gold), 0 0 40px #FF8C00, 0 0 80px #FF4400 !important;
  animation: turbo-pulse 0.4s ease-in-out infinite;
}

@keyframes turbo-pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.1); }
}
