/* Neon Word Defense — original sci-fi typing shooter UI for TapTapTyping. */

.nwd-wrap {
  --nwd-bg: #061018;
  --nwd-panel: #0c1b2a;
  --nwd-accent: #22d3ee;
  --nwd-accent2: #38bdf8;
  --nwd-danger: #f87171;
  --nwd-warn: #fb923c;
  --nwd-good: #4ade80;
  background: var(--nwd-bg);
  border-radius: 14px;
  padding: 1rem;
  color: #e2e8f0;
  font-family: 'Inter', 'Manrope', 'Poppins', system-ui, sans-serif;
  box-shadow: 0 0 40px rgba(34, 211, 238, 0.08) inset;
}

.nwd-topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.1rem;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.8rem;
  background: rgba(12, 27, 42, 0.55);
  border: 1px solid rgba(34, 211, 238, 0.15);
  border-radius: 10px;
  margin-bottom: 0.75rem;
  font-weight: 600;
  font-size: 0.82rem;
  backdrop-filter: blur(3px);
}
.nwd-topbar .nwd-brand { color: var(--nwd-accent); letter-spacing: 0.5px; }
.nwd-topbar .nwd-stat { color: var(--nwd-accent2); }
.nwd-topbar .nwd-shield-low { color: var(--nwd-danger) !important; }

.nwd-emp-btn {
  position: relative;
  background: var(--nwd-panel);
  border: 2px solid rgba(34, 211, 238, 0.4);
  color: #e2e8f0;
  border-radius: 999px;
  width: 42px;
  height: 42px;
  font-size: 1.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nwd-emp-btn::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 999px;
  border: 3px solid var(--nwd-accent);
  clip-path: inset(0 0 0 0);
  opacity: var(--emp-ready, 0);
}
.nwd-emp-btn[data-ready="0"] { opacity: 0.45; }

.nwd-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
@media (min-width: 900px) {
  .nwd-layout { grid-template-columns: 3fr 1fr; }
}

.nwd-canvas-holder {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(34, 211, 238, 0.22);
  background: radial-gradient(ellipse at 50% 0%, #0a1830 0%, #050c16 70%);
}
.nwd-canvas-holder svg { display: block; width: 100%; height: auto; }

/* ── word labels: highest-priority readability rules ─────────────────── */
.nwd-label-bg {
  fill: rgba(6, 12, 20, 0.94);
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 1.5;
  transition: stroke 0.15s ease;
}
.nwd-label-bg.nwd-label-warn { stroke: var(--nwd-warn); stroke-width: 2; }
.nwd-label-bg.nwd-label-danger { stroke: var(--nwd-danger); stroke-width: 2.5; }
.nwd-label-bg.nwd-label-active-bg { stroke: var(--nwd-accent); stroke-width: 2.5; fill: rgba(6, 30, 40, 0.96); }
.nwd-label-bg.nwd-label-powerup { stroke: var(--nwd-good); }
.nwd-label-bg.nwd-label-boss { fill: rgba(20, 6, 10, 0.94); }

.nwd-label-text {
  font: 700 26px 'Inter', 'Manrope', 'Roboto', system-ui, sans-serif;
  letter-spacing: 0.5px;
}
.nwd-label-text .typed { fill: var(--nwd-accent); }
.nwd-label-text .remaining { fill: #ffffff; }
.nwd-label-text.nwd-label-active .remaining { fill: #ffd700; }

.nwd-boss-word-pending { opacity: 0.35; }
.nwd-boss-word-active .nwd-label-bg { stroke: var(--nwd-danger); stroke-width: 2.5; }
.nwd-boss-word-done { opacity: 0.15; }

.nwd-ship { filter: drop-shadow(0 0 6px currentColor); }
.nwd-boss-shape { filter: drop-shadow(0 0 16px rgba(248, 113, 113, 0.7)); }
.nwd-boss-bar-bg { fill: rgba(255, 255, 255, 0.12); }
.nwd-boss-bar-fg { fill: var(--nwd-danger); transition: width 0.2s ease; }

.nwd-powerup-shape { filter: drop-shadow(0 0 8px currentColor); }
.nwd-powerup-glyph { font-size: 22px; }

.nwd-particle { pointer-events: none; }
.nwd-laser {
  stroke: var(--nwd-accent);
  stroke-width: 3;
  stroke-linecap: round;
  filter: drop-shadow(0 0 5px var(--nwd-accent));
}
.nwd-emp-ring {
  fill: none;
  stroke: var(--nwd-accent);
  stroke-width: 4;
  opacity: 0.8;
  animation: nwd-emp-expand 0.6s ease-out forwards;
}
@keyframes nwd-emp-expand { to { r: 620; opacity: 0; stroke-width: 1; } }

.nwd-grid-line { stroke: #1b3a52; stroke-width: 1; opacity: 0.12; }
.nwd-star { fill: #ffffff; }
.nwd-defense-line { stroke: rgba(34, 211, 238, 0.35); stroke-width: 2; stroke-dasharray: 10 8; }

/* ── central hive: decorative focal point the enemies swarm around ────── */
.nwd-hive {
  filter: drop-shadow(0 0 18px rgba(251, 146, 60, 0.85)) drop-shadow(0 0 34px rgba(251, 146, 60, 0.4));
  animation: nwd-hive-pulse 3.2s ease-in-out infinite;
  transform-origin: center;
}
@keyframes nwd-hive-pulse {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.06) rotate(4deg); }
}

/* ── small radar-style target marker on each word label ────────────────── */
.nwd-target-ring {
  fill: none;
  stroke: rgba(255, 255, 255, 0.4);
  stroke-width: 1.4;
  stroke-dasharray: 2.5 3.5;
  animation: nwd-ring-spin 6s linear infinite;
  transform-origin: center;
}
.nwd-target-ring-dot { fill: rgba(255, 255, 255, 0.65); }
@keyframes nwd-ring-spin { to { transform: rotate(360deg); } }

/* ── bottom-center persistent instructions ──────────────────────────── */
.nwd-bottom-hint {
  position: absolute;
  left: 50%;
  bottom: 7%;
  transform: translateX(-50%);
  text-align: center;
  color: #e2e8f0;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.7;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.75);
  pointer-events: none;
  z-index: 3;
  white-space: nowrap;
}
.nwd-bottom-hint .nwd-hint-sub { display: block; opacity: 0.7; font-size: 0.85rem; font-weight: 500; }

/* ── bottom-right hex shield counter ─────────────────────────────────── */
.nwd-hex-counter {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--nwd-good);
  clip-path: polygon(25% 6%, 75% 6%, 100% 50%, 75% 94%, 25% 94%, 0% 50%);
  color: #08131a;
  font-weight: 800;
  font-size: 1.1rem;
  z-index: 3;
  transition: background 0.2s ease;
}
.nwd-hex-counter.nwd-hex-warn { background: var(--nwd-warn); }
.nwd-hex-counter.nwd-hex-danger { background: var(--nwd-danger); }

.nwd-mission-panel {
  background: var(--nwd-panel);
  border-radius: 10px;
  padding: 0.9rem;
  font-size: 0.85rem;
}
.nwd-mission-panel h3 { color: var(--nwd-accent); font-size: 0.9rem; margin-bottom: 0.5rem; }
.nwd-mission-item { margin-bottom: 0.5rem; }
.nwd-mission-item .progress { height: 6px; background: rgba(255, 255, 255, 0.08); }
.nwd-mission-item .progress-bar { background: var(--nwd-accent2); }
.nwd-mission-item.done { color: var(--nwd-good); text-decoration: line-through; opacity: 0.7; }

.nwd-overlay {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 16, 0.93);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem;
  z-index: 6;
}
.nwd-overlay h1, .nwd-overlay h2 { color: #ffffff; }
.nwd-overlay .nwd-title-glow { color: var(--nwd-accent); text-shadow: 0 0 18px rgba(34, 211, 238, 0.6); }

.nwd-countdown {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  font-weight: 800;
  color: var(--nwd-accent);
  text-shadow: 0 0 24px rgba(34, 211, 238, 0.8);
  z-index: 7;
  pointer-events: none;
}

.nwd-toast {
  position: absolute;
  left: 50%;
  top: 26%;
  transform: translate(-50%, -50%);
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--nwd-accent);
  text-shadow: 0 0 12px rgba(34, 211, 238, 0.7);
  animation: nwd-toast-pop 0.7s ease forwards;
  pointer-events: none;
  z-index: 6;
  white-space: nowrap;
}
.nwd-toast.nwd-toast-perfect { color: var(--nwd-good); text-shadow: 0 0 12px rgba(74, 222, 128, 0.7); }
.nwd-toast.nwd-toast-boss { color: var(--nwd-danger); text-shadow: 0 0 12px rgba(248, 113, 113, 0.7); font-size: 2rem; }
.nwd-toast.nwd-toast-level { color: #ffd700; text-shadow: 0 0 12px rgba(255, 215, 0, 0.7); }
.nwd-toast.nwd-toast-focus { color: #94a3b8; font-size: 1.2rem; }
@keyframes nwd-toast-pop {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.6); }
  30% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  100% { opacity: 0; transform: translate(-50%, -68%) scale(1); }
}

.nwd-hit-flash {
  position: absolute;
  inset: 0;
  background: rgba(248, 113, 113, 0.32);
  animation: nwd-hit-fade 0.4s ease forwards;
  pointer-events: none;
  z-index: 4;
}
@keyframes nwd-hit-fade { to { opacity: 0; } }

.nwd-shield-bar {
  height: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  overflow: hidden;
  width: 120px;
  display: inline-block;
  vertical-align: middle;
  margin-left: 4px;
}
.nwd-shield-bar-fill { height: 100%; background: var(--nwd-good); transition: width 0.2s ease, background 0.2s ease; }

.nwd-hidden-input {
  position: absolute;
  opacity: 0.01;
  width: 1px;
  height: 1px;
  overflow: hidden;
  font-size: 16px;
  border: 0;
  padding: 0;
  pointer-events: none;
}

.nwd-tap-resume {
  position: absolute;
  inset: 0;
  z-index: 5;
  cursor: pointer;
}

.nwd-share-card {
  background: linear-gradient(135deg, #0c1b2a, #142451);
  border: 1px solid var(--nwd-accent);
  border-radius: 12px;
  padding: 1.2rem;
  max-width: 340px;
  margin: 1rem auto;
}
.nwd-share-card h4 { color: var(--nwd-accent); }
.nwd-share-card .nwd-share-stat { font-size: 1.3rem; font-weight: 700; }

.nwd-new-best {
  color: #ffd700;
  font-weight: 700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
}

.nwd-weak-keys {
  font-size: 0.85rem;
  color: #94a3b8;
}
.nwd-weak-keys strong { color: var(--nwd-accent); letter-spacing: 2px; }

.nwd-mobile-banner {
  background: #fff8e1;
  color: #7c5800;
  border-radius: 8px;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.nwd-seo-section h2, .nwd-seo-section h3 { color: #0d6073; }

@media (prefers-reduced-motion: reduce) {
  .nwd-toast, .nwd-emp-ring, .nwd-hit-flash { animation: none !important; opacity: 0.9; }
  .nwd-label-bg, .nwd-boss-bar-fg { transition: none !important; }
  .nwd-hive, .nwd-target-ring { animation: none !important; }
}
