/* ==========================================================================
   TYPE & PLAY - PRACTICE & GAME MODES STYLING
   ========================================================================== */

/* Mode Workspace Container */
.tp-practice-workspace {
  margin: 2rem auto;
  max-width: 960px;
}

/* Practice Header Controls (Time selector / Category buttons) */
.tp-mode-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  margin-bottom: 1.5rem;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.toolbar-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 0.25rem;
}

.tp-pill-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
}

.tp-pill-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: var(--cyan);
}

.tp-pill-btn.active {
  background: var(--cyan);
  color: #04101e;
  border-color: var(--cyan);
  box-shadow: 0 0 15px var(--cyan-glow);
}

/* Live HUD Gauges Bar */
.tp-live-hud {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.hud-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition-fast);
}

.hud-stat-card.glow-pulse {
  border-color: var(--cyan);
  box-shadow: 0 0 20px var(--cyan-glow);
}

.hud-stat-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.hud-stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  color: #fff;
  line-height: 1;
}

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

.color-cyan { color: var(--cyan); }
.color-emerald { color: var(--emerald); }
.color-amber { color: var(--amber); }
.color-purple { color: var(--purple); }
.color-crimson { color: var(--crimson); }

/* Progress Track Bar */
.tp-progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.tp-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--cyan), var(--emerald));
  box-shadow: 0 0 10px var(--cyan-glow);
  transition: width 0.15s ease-out;
}

/* Typing Display Box */
.tp-typing-box {
  background: rgba(13, 20, 36, 0.95);
  border: 2px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 2.2rem;
  min-height: 180px;
  font-family: var(--font-mono);
  font-size: 1.55rem;
  line-height: 1.85;
  color: var(--text-muted);
  position: relative;
  user-select: none;
  cursor: text;
  box-shadow: var(--shadow-lg), inset 0 2px 10px rgba(0, 0, 0, 0.5);
  transition: border-color var(--transition-fast);
  outline: none;
}

.tp-typing-box:focus-within, .tp-typing-box.focused {
  border-color: var(--cyan);
  box-shadow: var(--shadow-lg), 0 0 30px rgba(0, 240, 255, 0.2);
}

.tp-text-display {
  word-break: break-word;
  white-space: pre-wrap;
}

/* Character States */
.char-correct {
  color: var(--emerald);
  text-shadow: 0 0 10px var(--emerald-glow);
}

.char-incorrect {
  color: var(--crimson);
  background: rgba(239, 68, 68, 0.25);
  border-bottom: 2px solid var(--crimson);
  text-shadow: 0 0 10px var(--crimson-glow);
  border-radius: 2px;
}

.char-current {
  color: #fff;
  background: rgba(0, 240, 255, 0.3);
  border-radius: 4px;
  box-shadow: 0 0 12px var(--cyan);
  animation: cursorPulse 0.9s infinite alternate;
}

@keyframes cursorPulse {
  0% { background: rgba(0, 240, 255, 0.2); box-shadow: 0 0 4px var(--cyan); }
  100% { background: rgba(0, 240, 255, 0.5); box-shadow: 0 0 16px var(--cyan); }
}

/* Hidden Input Capture */
.tp-hidden-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 10;
}

/* Practice Action Bar (Restart, Next, Keyboard Toggle) */
.tp-practice-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Level Grid Cards for Key Practice */
.tp-level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.tp-level-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  transition: all var(--transition-normal);
  cursor: pointer;
  position: relative;
}

.tp-level-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--cyan);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.tp-level-card.locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.tp-level-card.locked:hover {
  transform: none;
  border-color: var(--border-subtle);
}

.level-badge-num {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.8rem;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.4rem;
}

.level-card-name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.4rem;
}

.level-card-keys {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--emerald);
  background: rgba(0, 0, 0, 0.3);
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  margin-bottom: 0.75rem;
}

.level-card-status {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Result Modal Breakdown */
.result-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 1.5rem 0;
}

.result-stat-item {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}

.result-stat-item .val {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.8rem;
  line-height: 1;
}

.result-stat-item .lbl {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  margin-top: 4px;
}

.mistakes-breakdown-box {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.mistakes-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--crimson);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.mistakes-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.mistake-chip {
  background: rgba(239, 68, 68, 0.2);
  color: #ff9999;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.result-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}
