/* ==========================================================================
   ROMANIZED NEPALI UNICODE TYPING TUTOR — PRODUCTION STYLESHEET
   Ultra-Compact Header (50px Height), Auto Line-by-Line Target Box (No Scrollbars)
   Reference Standard: Romanize Keyboard copy.jpg
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Noto+Sans+Devanagari:wght@400;500;600;700;800&display=swap');

:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --bg-color: #0f172a;
  --surface-color: #1e293b;
  --card-bg: #1e293b;
  --card-border: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --success-color: #10b981;
  --error-color: #ef4444;
  --warning-color: #f59e0b;

  --key-bg: #334155;
  --key-border: #475569;
  --key-text: #f8fafc;
  --key-highlight: #2563eb;
  --key-highlight-glow: rgba(37, 99, 235, 0.4);

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-devnagari: 'Noto Sans Devanagari', 'Inter', sans-serif;
}

/* Light Theme overrides when needed */
body.light-theme {
  --bg-color: #f8fafc;
  --surface-color: #ffffff;
  --card-bg: #ffffff;
  --card-border: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --key-bg: #e2e8f0;
  --key-border: #cbd5e1;
  --key-text: #0f172a;
}

/* High Contrast Mode */
body.high-contrast-mode {
  --bg-color: #000000;
  --surface-color: #111111;
  --card-bg: #181818;
  --card-border: #ffffff;
  --text-main: #ffffff;
  --text-muted: #dddddd;
  --key-bg: #222222;
  --key-border: #ffffff;
  --key-text: #ffffff;
  --key-highlight: #ffcc00;
  --key-highlight-glow: rgba(255, 204, 0, 0.6);
}

/* Large Font Mode */
body.large-font-mode {
  font-size: 105%;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.4;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Devnagari Font Utility */
.devnagari-text, .target-symbol-display, .char-span, .key-top-shift, .key-bottom-normal, .devnagari-symbol {
  font-family: var(--font-devnagari);
}

/* ==========================================================================
   ULTRA-COMPACT SINGLE-LINE HEADER (Max Height 50px)
   ========================================================================== */
.app-header {
  background-color: var(--surface-color);
  border-bottom: 1px solid var(--card-border);
  padding: 0.35rem 1rem;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  gap: 0.5rem;
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.brand-flag { 
  font-size: 1.3rem; 
  cursor: default;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
  justify-content: flex-start;
  overflow-x: auto;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
  -webkit-overflow-scrolling: touch;
  margin: 0 0.5rem;
}

.main-nav::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.28rem 0.6rem;
  border-radius: 0.35rem;
  font-weight: 600;
  font-size: 0.82rem;
  transition: all 0.15s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.nav-link:hover, .nav-link.active {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.1);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

.btn-compact {
  padding: 0.25rem 0.55rem;
  height: 32px;
  font-size: 0.78rem;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.action-btn-text {
  display: inline;
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS FOR HEADER
   ========================================================================== */

/* 1. Laptops & Medium Desktops (<= 1200px) */
@media (max-width: 1200px) {
  .app-header {
    padding: 0.3rem 0.75rem;
    gap: 0.35rem;
  }

  .nav-link {
    padding: 0.24rem 0.45rem;
    font-size: 0.78rem;
  }

  /* Compact button labels to icons on medium screens */
  .action-btn-text {
    display: none;
  }

  .btn-compact {
    padding: 0.2rem 0.4rem;
  }

  .auto-next-label {
    padding: 0.2rem 0.35rem;
  }
}

/* 2. Tablets & Small Laptops (<= 960px): 2-Tier Clean Sticky Header */
@media (max-width: 960px) {
  .app-header {
    flex-wrap: wrap;
    padding: 0.4rem 0.75rem 0.35rem 0.75rem;
    gap: 0.35rem 0.5rem;
  }

  .brand-container {
    order: 1;
  }

  .header-actions {
    order: 2;
    margin-left: auto;
    gap: 0.25rem;
  }

  .main-nav {
    order: 3;
    width: 100%;
    justify-content: flex-start;
    padding-top: 0.3rem;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
  }
}

/* 3. Mobile Phones (<= 640px) */
@media (max-width: 640px) {
  .app-header {
    padding: 0.35rem 0.5rem;
  }

  #user-role-badge {
    display: none;
  }

  #nav-active-student-name {
    max-width: 65px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
  }

  .btn-compact {
    height: 30px;
    padding: 0.2rem 0.35rem;
    font-size: 0.75rem;
  }

  .nav-link {
    font-size: 0.76rem;
    padding: 0.25rem 0.55rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 9999px;
  }
}

.auto-next-label {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: #60a5fa;
  cursor: pointer;
  background: rgba(37, 99, 235, 0.15);
  padding: 0.2rem 0.5rem;
  border-radius: 0.35rem;
  border: 1px solid rgba(96, 165, 250, 0.3);
  height: 32px;
  white-space: nowrap;
}

/* Main Container & Views */
.main-container {
  flex: 1;
  padding: 0.85rem 1rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.app-view {
  display: none;
  animation: fadeIn 0.2s ease-in-out;
}

.app-view.active { display: block; }

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

/* Row-by-Row Quick Practice Toolbar */
.row-practice-toolbar {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--card-border);
  padding: 0.45rem 0.85rem;
  border-radius: 0.6rem;
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.row-toolbar-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #60a5fa;
  white-space: nowrap;
}

.row-buttons-group {
  display: flex;
  gap: 0.4rem;
  flex-wrap: nowrap;
}

.btn-row-select {
  padding: 0.3rem 0.7rem;
  border-radius: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--card-border);
  background: #1e293b;
  color: var(--text-main);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-row-select:hover, .btn-row-select.active {
  background: var(--primary-color);
  color: #ffffff;
  border-color: #60a5fa;
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.4);
}

/* Finger Check Component */
.finger-check-box {
  background: #0f172a;
  border: 1px solid var(--card-border);
  border-radius: 0.75rem;
  padding: 1.25rem;
  text-align: center;
}

.step-indicator-pill {
  display: inline-block;
  background: #1e3a8a;
  color: #60a5fa;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 1rem;
}

.finger-key-preview {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  margin: 1rem 0;
}

.key-cap-symbol {
  font-size: 2.5rem;
  font-weight: 800;
  background: #2563eb;
  color: #ffffff;
  width: 70px;
  height: 70px;
  border-radius: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px rgba(37, 99, 235, 0.5);
}

.devnagari-symbol {
  font-size: 2.8rem;
  font-weight: 800;
  color: #4ade80;
}

.finger-name-tag {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.15);
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  display: inline-block;
}

/* Dashboard View */
.dashboard-hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e293b 100%);
  border: 1px solid var(--card-border);
  border-radius: 0.75rem;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.hero-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.6rem;
  margin-top: 1rem;
}

.stat-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.85rem;
  border-radius: 0.5rem;
  text-align: center;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary-color);
  display: block;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Virtual Keyboard Component — Computer Screen Fit */
.virtual-keyboard-wrapper {
  background-color: #090d16;
  border: 2px solid var(--card-border);
  border-radius: 0.75rem;
  padding: 0.5rem 0.6rem;
  box-shadow: 0 8px 20px -5px rgba(0, 0, 0, 0.5);
  user-select: none;
  max-width: 960px;
  margin: 0.65rem auto 0;
  width: 100%;
}

.keyboard-row {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: 4px;
}

.key {
  background-color: var(--key-bg);
  border: 1px solid var(--key-border);
  border-radius: 0.35rem;
  flex: 1;
  min-width: 42px;
  max-width: 62px;
  height: 46px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2px 4px;
  cursor: pointer;
  transition: all 0.1s ease;
  position: relative;
}

.key:hover { background-color: #475569; }

.key-top-shift {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--text-muted);
  line-height: 1;
}

.shift-unicode {
  color: #38bdf8;
  font-weight: 700;
  font-size: 0.78rem;
}

.key-bottom-normal {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  font-size: 0.75rem;
  line-height: 1;
}

.normal-roman {
  font-weight: 700;
  color: #f8fafc;
}

.normal-unicode {
  color: #4ade80;
  font-weight: 700;
  font-size: 1rem;
}

/* Key Modifiers & Sizing for Screen Adjustments */
.key-backspace { min-width: 70px; max-width: 85px; }
.key-tab { min-width: 55px; max-width: 65px; }
.key-caps { min-width: 62px; max-width: 72px; }
.key-enter { min-width: 75px; max-width: 90px; background-color: #1e3a8a; }
.key-shift { min-width: 90px; max-width: 105px; background-color: #1e3a8a; }
.key-space { min-width: 220px; max-width: 340px; }

/* Active Key Highlights */
.key-required-highlight {
  background-color: var(--key-highlight) !important;
  border-color: #60a5fa !important;
  box-shadow: 0 0 12px var(--key-highlight-glow) !important;
  transform: scale(1.04);
}

.key-pressed {
  transform: translateY(2px) scale(0.96) !important;
  background-color: #16a34a !important;
}

.shift-active {
  background-color: #2563eb !important;
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.8);
}

/* Professional Typing Screen — Auto Line-by-Line Target Box (No Scrollbars) */
.typing-screen-card {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 0.75rem;
  padding: 1rem;
}

.metrics-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #0f172a;
  padding: 0.5rem 0.85rem;
  border-radius: 0.5rem;
  margin-bottom: 0.65rem;
}

.metric-pill .val {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--primary-color);
  display: block;
}

.metric-pill .lbl {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* AUTO-SCROLL TARGET DISPLAY BOX — NO SCROLLBAR, AUTO LINE-BY-LINE FOLLOW */
.target-text-display-box {
  background-color: #090d16;
  border: 2px solid var(--card-border);
  border-radius: 0.5rem;
  padding: 0.85rem 1rem;
  font-size: 1.6rem;
  line-height: 1.8;
  letter-spacing: 0.04em;
  height: 110px;
  max-height: 110px;
  overflow: hidden; /* Scrollbar hidden completely */
  position: relative;
  user-select: none;
  word-break: break-word;
}

/* Hide scrollbar for Chrome, Safari, and Opera */
.target-text-display-box::-webkit-scrollbar {
  display: none;
}
/* Hide scrollbar for IE, Edge and Firefox */
.target-text-display-box {
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}

.char-span.pending { color: #64748b; }
.char-span.correct { color: #4ade80; }
.char-span.incorrect {
  color: #f87171;
  background-color: rgba(239, 68, 68, 0.2);
  border-radius: 2px;
}

.char-span.current-target-char {
  border-bottom: 3px solid var(--primary-color);
  background-color: rgba(37, 99, 235, 0.25);
}

.guided-instruction-bar {
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(37, 99, 235, 0.3);
  padding: 0.4rem 0.75rem;
  border-radius: 0.35rem;
  margin-top: 0.6rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
}

/* Profiles Selector Grid */
.profiles-select-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.profile-select-card {
  background: #0f172a;
  border: 1px solid var(--card-border);
  padding: 0.65rem 0.75rem;
  border-radius: 0.35rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.profile-select-card.active-profile {
  border-color: var(--primary-color);
  background: rgba(37, 99, 235, 0.15);
}

.profile-card-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.profile-avatar-icon { font-size: 1.2rem; }

.auto-next-banner {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
  padding: 0.4rem 0.75rem;
  border-radius: 0.35rem;
  font-size: 0.82rem;
}

/* Conjunct Step-by-Step Breakdown */
.conjunct-breakdown-card {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 0.75rem;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.conjunct-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.target-symbol-display {
  font-size: 3rem;
  font-weight: 800;
  background: #1e3a8a;
  color: #ffffff;
  width: 80px;
  height: 80px;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #3b82f6;
}

.formula-sequence {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0.6rem 0;
  background: #0f172a;
  padding: 0.6rem 0.85rem;
  border-radius: 0.5rem;
}

.key-step-pill {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  background: #334155;
  border: 1px solid #475569;
  padding: 0.35rem 0.75rem;
  border-radius: 0.35rem;
  margin-right: 0.35rem;
}

.key-step-pill.active {
  background: var(--primary-color);
  border-color: #60a5fa;
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.6);
}

.key-step-pill .step-num { font-size: 0.6rem; color: var(--text-muted); }
.key-step-pill .step-key { font-weight: 800; font-size: 0.95rem; }

/* Learning Path Grid */
.learning-levels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 0.85rem;
}

.lesson-card {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 0.5rem;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.lesson-card.completed { border-color: var(--success-color); }
.lesson-card.locked { opacity: 0.6; }

.lesson-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

.lesson-card-title { font-size: 0.95rem; font-weight: 700; margin-bottom: 0.3rem; }
.lesson-card-desc { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 0.75rem; }

/* Buttons & Badges */
.btn {
  padding: 0.4rem 0.85rem;
  border-radius: 0.35rem;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-primary { background-color: var(--primary-color); color: #ffffff; }
.btn-primary:hover { background-color: var(--primary-hover); }
.btn-secondary { background-color: #334155; color: #ffffff; }
.btn-secondary:hover { background-color: #475569; }
.btn-danger { background-color: var(--error-color); color: #ffffff; }
.btn-disabled { background-color: #334155; color: #64748b; cursor: not-allowed; }
.btn-sm, .btn-compact { padding: 0.25rem 0.6rem; font-size: 0.78rem; }

.badge {
  font-size: 0.68rem;
  padding: 0.18rem 0.4rem;
  border-radius: 0.2rem;
  font-weight: 600;
}

.badge-level { background: #1e3a8a; color: #60a5fa; }
.badge-difficulty.basic { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.badge-difficulty.intermediate { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.badge-difficulty.advanced { background: rgba(239, 68, 68, 0.2); color: #f87171; }

/* Admin Data Table */
.admin-data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.65rem;
  font-size: 0.82rem;
}

.admin-data-table th, .admin-data-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--card-border);
  text-align: left;
}

.admin-data-table th { background-color: #0f172a; color: var(--text-muted); }

.input-inline {
  background: #0f172a;
  border: 1px solid var(--card-border);
  color: #ffffff;
  padding: 0.25rem 0.4rem;
  border-radius: 0.2rem;
  font-size: 0.82rem;
  width: 100%;
}

/* Modal Popup */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-backdrop.active,
#test-results-modal.active,
#result-modal.active {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.modal-card {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 0.75rem;
  padding: 1.25rem;
  max-width: 460px;
  width: 90%;
  text-align: center;
  box-shadow: 0 15px 25px -5px rgba(0,0,0,0.5);
  position: relative;
}

.modal-close-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
  font-size: 1.1rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
  z-index: 10;
}

.modal-close-btn:hover {
  color: #ffffff;
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
}

/* Next Level Up Confirmation Prompt */
.next-level-prompt-card {
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.35), rgba(15, 23, 42, 0.9));
  border: 2px solid #3b82f6;
  border-radius: 0.75rem;
  padding: 1rem 0.85rem;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
  text-align: center;
  animation: pulseGlow 2.5s infinite alternate;
}

@keyframes pulseGlow {
  from { box-shadow: 0 0 10px rgba(59, 130, 246, 0.25); border-color: #3b82f6; }
  to { box-shadow: 0 0 22px rgba(59, 130, 246, 0.55); border-color: #60a5fa; }
}

.next-level-icon {
  font-size: 2.2rem;
  margin-bottom: 0.2rem;
}

.next-level-question {
  font-size: 1.25rem;
  font-weight: 800;
  color: #60a5fa;
  margin: 0.4rem 0;
  letter-spacing: 0.3px;
}

/* Printable Certificate */
.certificate-wrapper {
  background: #ffffff;
  color: #0f172a;
  padding: 2rem;
  border-radius: 0.75rem;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  margin: 1rem auto;
  max-width: 800px;
}

.certificate-border {
  border: 5px double #1e3a8a;
  padding: 1.25rem;
}

.cert-header { text-align: center; margin-bottom: 1.25rem; }
.cert-title { font-size: 1.8rem; font-weight: 800; color: #1e3a8a; }
.cert-subtitle { font-size: 0.9rem; color: #475569; text-transform: uppercase; letter-spacing: 0.1em; }
.cert-student-name { font-size: 2rem; font-weight: 800; color: #2563eb; margin: 0.75rem 0; border-bottom: 2px solid #cbd5e1; display: inline-block; padding: 0 1.25rem; }

.cert-metrics-row {
  display: flex;
  justify-content: space-around;
  margin: 1.25rem 0;
  background: #f8fafc;
  padding: 1rem;
  border-radius: 0.35rem;
}

.cert-metric-value { font-size: 1.4rem; font-weight: 800; color: #1e3a8a; display: block; }
.cert-metric-label { font-size: 0.65rem; color: #64748b; text-transform: uppercase; }

.cert-footer { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 2rem; }
.cert-sig-line { width: 140px; height: 1px; background: #0f172a; margin-bottom: 0.35rem; }

@media print {
  body * { visibility: hidden; }
  #printable-certificate, #printable-certificate * { visibility: visible; }
  #printable-certificate { position: absolute; left: 0; top: 0; width: 100%; }
}

/* ==========================================
   BUBBLE TYPING GAME COMPONENT
   ========================================== */
.game-container-card {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 0.75rem;
  padding: 1.25rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.game-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.game-hud-bar {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.game-hud-item {
  background: #0f172a;
  border: 1px solid var(--card-border);
  border-radius: 0.5rem;
  padding: 0.35rem 0.75rem;
  text-align: center;
  min-width: 75px;
}

.hud-label {
  display: block;
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.hud-val {
  display: block;
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.2;
}

.game-config-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.85rem;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--card-border);
  padding: 0.6rem 0.85rem;
  border-radius: 0.5rem;
}

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

.config-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #94a3b8;
}

.btn-group-pill {
  display: inline-flex;
  gap: 0.25rem;
  background: #020617;
  padding: 0.2rem;
  border-radius: 0.4rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-game-opt {
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 0.25rem 0.6rem;
  font-size: 0.76rem;
  font-weight: 600;
  border-radius: 0.3rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-game-opt:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.btn-game-opt.active {
  background: var(--primary-color);
  color: #ffffff;
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.5);
}

.toggle-game-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text-muted);
}

.toggle-game-label input {
  cursor: pointer;
}

.game-actions-group {
  display: flex;
  gap: 0.4rem;
}

/* Bubble Arena */
.bubble-arena-wrapper {
  position: relative;
  width: 100%;
  border-radius: 0.75rem;
  overflow: hidden;
  border: 2px solid #1e3a8a;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(30, 58, 138, 0.2);
}

.bubble-arena {
  position: relative;
  width: 100%;
  height: 520px;
  background: radial-gradient(ellipse at 50% 100%, #172554 0%, #0b132b 55%, #050814 100%);
  overflow: hidden;
  outline: none;
  user-select: none;
}

.bubble-arena.arena-flash-red {
  animation: flashRed 0.2s ease-out;
}

@keyframes flashRed {
  0% { box-shadow: inset 0 0 40px rgba(239, 68, 68, 0.7); }
  100% { box-shadow: inset 0 0 0px transparent; }
}

/* Ceiling Warning Danger Line */
.bubble-arena::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, #ef4444, #f59e0b, #ef4444);
  opacity: 0.75;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.8);
  z-index: 5;
}

/* Individual Floating Bubble */
.bubble-item {
  position: absolute;
  top: 0;
  left: 0;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  z-index: 10;
  will-change: transform;
  transition: box-shadow 0.15s ease;
}

/* Glassmorphic Bubble Glow Variations */
.bubble-theme-blue {
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.7), rgba(59, 130, 246, 0.35) 45%, rgba(30, 58, 138, 0.75) 90%);
  border: 2px solid rgba(147, 197, 253, 0.8);
  box-shadow: inset 0 0 16px rgba(255, 255, 255, 0.45), 0 0 18px rgba(59, 130, 246, 0.45);
}

.bubble-theme-emerald {
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.7), rgba(16, 185, 129, 0.35) 45%, rgba(6, 78, 59, 0.75) 90%);
  border: 2px solid rgba(110, 231, 183, 0.8);
  box-shadow: inset 0 0 16px rgba(255, 255, 255, 0.45), 0 0 18px rgba(16, 185, 129, 0.45);
}

.bubble-theme-amber {
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.7), rgba(245, 158, 11, 0.35) 45%, rgba(120, 53, 15, 0.75) 90%);
  border: 2px solid rgba(252, 211, 77, 0.8);
  box-shadow: inset 0 0 16px rgba(255, 255, 255, 0.45), 0 0 18px rgba(245, 158, 11, 0.45);
}

.bubble-theme-purple {
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.7), rgba(168, 85, 247, 0.35) 45%, rgba(88, 28, 135, 0.75) 90%);
  border: 2px solid rgba(216, 180, 254, 0.8);
  box-shadow: inset 0 0 16px rgba(255, 255, 255, 0.45), 0 0 18px rgba(168, 85, 247, 0.45);
}

.bubble-theme-rose {
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.7), rgba(244, 63, 94, 0.35) 45%, rgba(136, 19, 55, 0.75) 90%);
  border: 2px solid rgba(253, 164, 175, 0.8);
  box-shadow: inset 0 0 16px rgba(255, 255, 255, 0.45), 0 0 18px rgba(244, 63, 94, 0.45);
}

.bubble-char {
  font-family: var(--font-devnagari);
  font-size: 1.95rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.85);
  pointer-events: none;
}

.bubble-key-hint {
  font-size: 0.68rem;
  font-weight: 700;
  color: #f1f5f9;
  background: rgba(0, 0, 0, 0.65);
  padding: 0.05rem 0.35rem;
  border-radius: 0.6rem;
  margin-top: 1px;
  line-height: 1.2;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Popping Burst Animation */
.bubble-pop-burst {
  position: absolute;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  pointer-events: none;
  animation: bubblePopEffect 0.35s ease-out forwards;
  z-index: 20;
}

@keyframes bubblePopEffect {
  0% { transform: scale(1); opacity: 1; border: 3px solid #ffffff; }
  50% { transform: scale(1.6); opacity: 0.8; border: 2px solid #60a5fa; }
  100% { transform: scale(2.2); opacity: 0; border: 1px solid transparent; }
}

.floating-score-tag {
  position: absolute;
  font-size: 1.1rem;
  font-weight: 800;
  color: #fbbf24;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
  pointer-events: none;
  animation: floatScore 0.7s ease-out forwards;
  z-index: 30;
}

@keyframes floatScore {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(-40px); opacity: 0; }
}

/* Overlay Banners (Start / Pause / Game Over) */
.game-arena-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(2, 6, 23, 0.85);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  text-align: center;
  padding: 1.5rem;
}

.overlay-content {
  max-width: 480px;
  background: #0f172a;
  border: 1px solid var(--card-border);
  padding: 1.75rem;
  border-radius: 0.75rem;
  box-shadow: 0 20px 35px rgba(0, 0, 0, 0.6);
}

.game-footer-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ==========================================================================
   GAME HUB: SUB-GAME SWITCHER TABS
   ========================================================================== */
.game-hub-switcher-bar {
  display: flex;
  gap: 0.6rem;
  background: #090d16;
  padding: 0.4rem;
  border-radius: 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 0.85rem;
  max-width: 600px;
}

.btn-subgame-tab {
  flex: 1;
  background: transparent;
  border: 1px solid transparent;
  color: #94a3b8;
  padding: 0.6rem 1.1rem;
  font-size: 0.92rem;
  font-weight: 700;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  user-select: none;
}

.btn-subgame-tab:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
}

.btn-subgame-tab.active {
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  color: #ffffff;
  border-color: rgba(147, 197, 253, 0.4);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

.btn-subgame-tab[data-subgame="shooter"].active {
  background: linear-gradient(135deg, #b45309, #ea580c, #dc2626);
  border-color: rgba(253, 186, 116, 0.5);
  box-shadow: 0 4px 16px rgba(234, 88, 12, 0.45);
}

.subgame-panel {
  width: 100%;
}

/* ==========================================================================
   FREE FIRE STYLE WORD SHOOTER BATTLEGROUND
   ========================================================================== */
.ff-container-theme {
  border: 1px solid rgba(234, 88, 12, 0.35);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 25px rgba(234, 88, 12, 0.12);
}

.ff-top-bar {
  border-bottom: 1px solid rgba(234, 88, 12, 0.25);
}

.ff-brand-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.25rem;
}

.ff-badge-flame {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, #dc2626, #ea580c);
  color: #ffffff;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  box-shadow: 0 0 8px rgba(234, 88, 12, 0.6);
}

.ff-hud-bar {
  gap: 0.65rem;
}

/* Free Fire Health (HP) HUD Bar */
.ff-hp-hud-item {
  min-width: 150px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(234, 88, 12, 0.35);
}

.ff-hp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 0.25rem;
}

.ff-hp-digits {
  font-size: 0.78rem;
  font-weight: 800;
  color: #10b981;
}

.ff-hp-track {
  width: 100%;
  height: 8px;
  background: #1e293b;
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
}

.ff-hp-fill {
  height: 100%;
  background: #10b981;
  border-radius: 999px;
  transition: width 0.2s ease, background-color 0.25s ease;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.8);
}

.ff-config-bar {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.btn-game-opt[data-weapon].active {
  background: linear-gradient(135deg, #b45309, #ea580c);
  box-shadow: 0 0 10px rgba(234, 88, 12, 0.6);
}

/* Battleground Arena Container */
.ff-battleground-wrapper {
  position: relative;
  width: 100%;
  border-radius: 0.75rem;
  overflow: hidden;
  border: 2px solid #b45309;
  box-shadow: inset 0 0 35px rgba(0, 0, 0, 0.8), 0 0 25px rgba(234, 88, 12, 0.2);
}

.ff-battleground-arena {
  position: relative;
  width: 100%;
  height: 520px;
  background: #070b14;
  overflow: hidden;
  outline: none;
  user-select: none;
  perspective: 600px;
}

/* Sky and 3D Perspective Battlefield Grid */
.ff-arena-sky {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 140px;
  background: radial-gradient(ellipse at 50% 0%, #311b92 0%, #1e1b4b 45%, #070b14 100%);
  opacity: 0.85;
  pointer-events: none;
}

.ff-arena-grid {
  position: absolute;
  top: 60px;
  left: -20%;
  width: 140%;
  height: 500px;
  background-image: 
    linear-gradient(rgba(234, 88, 12, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(234, 88, 12, 0.12) 1px, transparent 1px);
  background-size: 50px 50px;
  transform: rotateX(60deg);
  transform-origin: top center;
  opacity: 0.55;
  pointer-events: none;
}

/* Danger Perimeter Line */
.ff-defense-line {
  position: absolute;
  bottom: 92px;
  left: 0;
  right: 0;
  height: 24px;
  background: repeating-linear-gradient(
    45deg,
    rgba(220, 38, 38, 0.85),
    rgba(220, 38, 38, 0.85) 15px,
    rgba(15, 23, 42, 0.95) 15px,
    rgba(15, 23, 42, 0.95) 30px
  );
  border-top: 2px solid #ef4444;
  border-bottom: 2px solid #ef4444;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  pointer-events: none;
}

.ff-defense-line span {
  font-size: 0.65rem;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 1px;
  text-shadow: 0 0 4px #000000;
  background: rgba(0, 0, 0, 0.6);
  padding: 0 0.5rem;
  border-radius: 4px;
}

/* Layer for Enemies, Tracers, Particles */
.ff-enemies-layer,
.ff-particles-layer {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 15;
}

.ff-tracers-svg {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
  z-index: 20;
}

/* Laser Bullet Tracer Beam */
.laser-tracer-beam {
  filter: drop-shadow(0 0 8px #ff9100) drop-shadow(0 0 14px #ff5722);
  animation: tracerFlash 0.12s ease-out forwards;
}

@keyframes tracerFlash {
  0% { opacity: 1; stroke-width: 4px; }
  100% { opacity: 0.15; stroke-width: 1.5px; }
}

/* Individual Advancing Combat Bot */
.ff-combat-bot {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  user-select: none;
  will-change: transform;
  transition: filter 0.1s ease;
  pointer-events: auto;
  z-index: 16;
}

.bot-avatar-wrap {
  position: relative;
  width: 46px;
  height: 46px;
  background: radial-gradient(circle, #1e293b 0%, #0b0f19 90%);
  border: 2px solid #ea580c;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 12px rgba(234, 88, 12, 0.45);
}

.bot-avatar {
  font-size: 1.45rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.8));
}

.bot-radar-ping {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 1px solid #ea580c;
  animation: botRadar 1.6s infinite ease-out;
  pointer-events: none;
}

@keyframes botRadar {
  0% { transform: scale(1); opacity: 0.9; }
  100% { transform: scale(1.7); opacity: 0; }
}

/* Bot Word Card */
.bot-word-card {
  margin-top: 0.35rem;
  background: rgba(15, 23, 42, 0.92);
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  border-radius: 0.5rem;
  padding: 0.35rem 0.65rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  backdrop-filter: blur(4px);
  min-width: 90px;
}

.bot-target-word {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

/* Character highlight states */
.char-hit {
  color: #10b981;
  text-shadow: 0 0 8px rgba(16, 185, 129, 0.85);
}

.char-active {
  color: #f59e0b;
  text-shadow: 0 0 10px rgba(245, 158, 11, 0.95);
  text-decoration: underline;
  text-underline-offset: 3px;
  animation: activeCharPulse 0.4s infinite alternate ease-in-out;
}

@keyframes activeCharPulse {
  0% { opacity: 0.8; transform: scale(1); }
  100% { opacity: 1; transform: scale(1.15); }
}

.char-pending {
  color: #f8fafc;
}

/* Key Hints Crumb under Word */
.bot-key-hints {
  display: flex;
  gap: 0.2rem;
  margin-top: 0.25rem;
  flex-wrap: wrap;
  justify-content: center;
}

.key-crumb {
  font-size: 0.65rem;
  font-weight: 700;
  background: #334155;
  color: #cbd5e1;
  padding: 0.08rem 0.32rem;
  border-radius: 0.25rem;
  border: 1px solid #475569;
}

.key-crumb.crumb-done {
  background: #065f46;
  border-color: #10b981;
  color: #a7f3d0;
}

.key-crumb.crumb-next {
  background: #d97706;
  border-color: #fbbf24;
  color: #ffffff;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.8);
}

/* Locked Bot State */
.bot-locked .bot-avatar-wrap {
  border-color: #ef4444;
  box-shadow: 0 0 18px rgba(239, 68, 68, 0.9);
}

.bot-locked .bot-word-card {
  border-color: #ef4444;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.6);
}

/* Player Crosshair Sight Reticle */
.ff-crosshair {
  position: absolute;
  top: 0;
  left: 0;
  width: 70px;
  height: 70px;
  pointer-events: none;
  z-index: 22;
  transition: transform 0.08s ease-out, opacity 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ff-crosshair-ring {
  position: absolute;
  width: 52px;
  height: 52px;
  border: 2px dashed #00e5ff;
  border-radius: 50%;
  animation: crosshairRotate 5s linear infinite;
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.6);
}

@keyframes crosshairRotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.ff-crosshair.locked .ff-crosshair-ring {
  border-color: #ef4444;
  border-style: solid;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.9);
}

.ff-crosshair-dot {
  width: 6px;
  height: 6px;
  background: #00e5ff;
  border-radius: 50%;
  box-shadow: 0 0 8px #00e5ff;
}

.ff-crosshair.locked .ff-crosshair-dot {
  background: #ef4444;
  box-shadow: 0 0 10px #ef4444;
}

.ff-crosshair-target-tag {
  position: absolute;
  bottom: -18px;
  font-size: 0.6rem;
  font-weight: 800;
  color: #ef4444;
  background: rgba(0, 0, 0, 0.75);
  padding: 0.05rem 0.35rem;
  border-radius: 3px;
  letter-spacing: 0.5px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.ff-crosshair.locked .ff-crosshair-target-tag {
  opacity: 1;
}

/* ==========================================================================
   FIRST-PERSON SHOOTER WEAPON RIG & ACTION DYNAMICS
   ========================================================================== */
.ff-gun-rig {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 220px;
  height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  pointer-events: none;
  z-index: 26;
  perspective: 500px;
}

.ff-gun-model {
  position: relative;
  width: 140px;
  height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  transform-origin: bottom center;
  transition: transform 0.06s cubic-bezier(0.1, 0.9, 0.2, 1);
}

.ff-gun-model.recoil {
  animation: fpsGunKick 0.12s ease-out forwards;
}

@keyframes fpsGunKick {
  0% { transform: translateY(0) scale(1); }
  25% { transform: translateY(18px) scale(0.92) rotate(-1.5deg); }
  60% { transform: translateY(8px) scale(0.97); }
  100% { transform: translateY(0) scale(1); }
}

/* Gun Components */
.gun-muzzle-brake {
  width: 20px;
  height: 16px;
  background: linear-gradient(90deg, #1e293b, #475569, #1e293b);
  border: 1px solid #94a3b8;
  border-radius: 3px;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.8);
  margin-bottom: -2px;
  z-index: 3;
}

.gun-barrel-tube {
  width: 14px;
  height: 38px;
  background: linear-gradient(90deg, #0f172a, #334155, #0f172a);
  border-left: 1px solid #475569;
  border-right: 1px solid #475569;
  z-index: 2;
}

.gun-handguard {
  width: 38px;
  height: 35px;
  background: linear-gradient(90deg, #78350f, #b45309, #78350f);
  border-radius: 6px 6px 4px 4px;
  border: 1px solid rgba(251, 191, 36, 0.4);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.7);
  z-index: 4;
}

.gun-holographic-optic {
  position: absolute;
  top: 32px;
  width: 32px;
  height: 22px;
  background: rgba(15, 23, 42, 0.9);
  border: 2px solid #38bdf8;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
  z-index: 6;
}

.optic-reticle-dot {
  width: 5px;
  height: 5px;
  background: #ff0055;
  border-radius: 50%;
  box-shadow: 0 0 8px #ff0055, 0 0 14px #ff0055;
  animation: dotPulse 1.5s infinite alternate ease-in-out;
}

@keyframes dotPulse {
  0% { transform: scale(0.9); opacity: 0.8; }
  100% { transform: scale(1.2); opacity: 1; }
}

.gun-receiver {
  position: relative;
  width: 52px;
  height: 48px;
  background: linear-gradient(180deg, #334155 0%, #1e293b 60%, #0f172a 100%);
  border: 1.5px solid #64748b;
  border-radius: 6px 6px 0 0;
  box-shadow: inset 0 2px 6px rgba(255, 255, 255, 0.15), 0 5px 15px rgba(0, 0, 0, 0.8);
  z-index: 5;
}

.gun-bolt {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 14px;
  height: 8px;
  background: #f59e0b;
  border-radius: 2px;
}

.gun-magazine {
  position: absolute;
  bottom: -22px;
  left: 14px;
  width: 24px;
  height: 32px;
  background: linear-gradient(135deg, #1e293b, #090d16);
  border: 1px solid #475569;
  border-radius: 3px;
  transform: rotate(-12deg);
}

/* Combat Tactical Hands Gripping Gun */
.tactical-hand {
  position: absolute;
  width: 42px;
  height: 46px;
  background: linear-gradient(135deg, #475569 0%, #1e293b 100%);
  border: 1.5px solid #64748b;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.8);
  z-index: 7;
}

.tactical-hand.hand-l {
  left: -22px;
  bottom: 24px;
  transform: rotate(-25deg);
}

.tactical-hand.hand-r {
  right: -22px;
  bottom: 12px;
  transform: rotate(20deg);
}

/* Weapon Skins: AK47, MP40, AWM */
.ff-gun-model.mp40 .gun-handguard {
  background: linear-gradient(90deg, #1e293b, #334155, #1e293b);
  border-color: #fbbf24;
  height: 28px;
}

.ff-gun-model.awm .gun-barrel-tube {
  height: 52px;
  border-left-color: #00e5ff;
  border-right-color: #00e5ff;
}

.ff-gun-model.awm .gun-handguard {
  background: linear-gradient(90deg, #064e3b, #047857, #064e3b);
  border-color: #34d399;
}

/* Explosive Muzzle Flash */
.ff-muzzle-flash {
  position: absolute;
  top: -38px;
  left: 50%;
  transform: translateX(-50%) scale(0.3);
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, #ffffff 0%, #fff7ed 25%, #ffb703 45%, #ea580c 75%, transparent 100%);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  z-index: 28;
  filter: drop-shadow(0 0 20px #ff9100) drop-shadow(0 0 35px #dc2626);
}

.ff-muzzle-flash.active {
  animation: explosiveMuzzleFire 0.09s ease-out forwards;
}

@keyframes explosiveMuzzleFire {
  0% { opacity: 1; transform: translateX(-50%) scale(1.6) rotate(15deg); }
  50% { opacity: 0.9; transform: translateX(-50%) scale(1.8) rotate(-10deg); }
  100% { opacity: 0; transform: translateX(-50%) scale(0.5); }
}

/* Brass Shell Ejection */
.ejected-shell {
  position: absolute;
  top: 50px;
  right: 40px;
  width: 12px;
  height: 5px;
  background: linear-gradient(90deg, #fef08a, #d97706);
  border-radius: 2px;
  box-shadow: 0 0 4px #fbbf24;
  pointer-events: none;
  z-index: 25;
  animation: shellSpinEject 0.4s cubic-bezier(0.2, 0.8, 0.4, 1) forwards;
}

@keyframes shellSpinEject {
  0% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  60% { transform: translate(45px, -35px) rotate(360deg); opacity: 0.9; }
  100% { transform: translate(75px, 30px) rotate(720deg); opacity: 0; }
}

/* Rising Barrel Smoke */
.barrel-smoke-puff {
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 16px;
  background: radial-gradient(circle, rgba(203, 213, 225, 0.6) 0%, rgba(148, 163, 184, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
  animation: smokeRise 0.6s ease-out forwards;
}

@keyframes smokeRise {
  0% { transform: translateX(-50%) scale(0.6); opacity: 0.8; }
  100% { transform: translateX(calc(-50% + 15px)) translateY(-45px) scale(2.5); opacity: 0; }
}

/* Arena Camera Recoil Micro-Kick */
.ff-battleground-arena.arena-cam-kick {
  animation: camMicroKick 0.08s ease-out;
}

@keyframes camMicroKick {
  0% { transform: translateY(0); }
  40% { transform: translateY(3px) scale(0.998); }
  100% { transform: translateY(0) scale(1); }
}

/* Floating Free Fire Damage Numbers (Yellow & Red) */
.ff-damage-layer {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 32;
}

.ff-dmg-num {
  position: absolute;
  font-family: 'Impact', sans-serif, system-ui;
  font-size: 1.45rem;
  font-weight: 900;
  color: #ffea00;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.9), 0 2px 4px #b45309;
  pointer-events: none;
  animation: dmgFloat 0.65s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
  letter-spacing: 0.5px;
}

.ff-dmg-num.critical {
  font-size: 2.2rem;
  color: #ff1744;
  text-shadow: 0 0 12px #ff1744, 0 0 20px #ff6b00, 0 2px 6px #000;
  animation: criticalJump 0.85s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes dmgFloat {
  0% { transform: translate(-50%, 0) scale(0.5); opacity: 1; }
  30% { transform: translate(-50%, -18px) scale(1.3); opacity: 1; }
  100% { transform: translate(-50%, -45px) scale(0.9); opacity: 0; }
}

@keyframes criticalJump {
  0% { transform: translate(-50%, 0) scale(0.4) rotate(-8deg); opacity: 1; }
  35% { transform: translate(-50%, -28px) scale(1.45) rotate(4deg); opacity: 1; }
  75% { transform: translate(-50%, -48px) scale(1.2) rotate(0deg); opacity: 1; }
  100% { transform: translate(-50%, -75px) scale(0.85); opacity: 0; }
}

/* Atmospheric Warzone Fire Embers Layer */
.ff-embers-layer {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 8;
  overflow: hidden;
}

.warzone-ember {
  position: absolute;
  width: 4px;
  height: 4px;
  background: #ff9100;
  border-radius: 50%;
  box-shadow: 0 0 6px #ff5722, 0 0 10px #ff9100;
  opacity: 0.8;
  animation: emberDrift var(--duration) linear infinite;
}

@keyframes emberDrift {
  0% { transform: translate(0, 520px) scale(1); opacity: 0; }
  15% { opacity: 0.85; }
  85% { opacity: 0.7; }
  100% { transform: translate(var(--drift-x), -30px) scale(0.3); opacity: 0; }
}

.ff-muzzle-flash.active {
  animation: muzzleBlast 0.08s ease-out forwards;
}

@keyframes muzzleBlast {
  0% { opacity: 1; transform: scale(1.4); }
  100% { opacity: 0; transform: scale(0.6); }
}

/* Hit Sparks & Explosion Particles */
.hit-spark-particle {
  position: absolute;
  width: 5px;
  height: 5px;
  background: #ffea00;
  border-radius: 50%;
  pointer-events: none;
  animation: hitSparkFly 0.32s ease-out forwards;
}

@keyframes hitSparkFly {
  0% { transform: translate(0, 0) scale(1.4); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0.2); opacity: 0; }
}

.ff-shockwave-ring {
  position: absolute;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 3px solid #ff6b00;
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: shockwaveExpand 0.45s ease-out forwards;
}

@keyframes shockwaveExpand {
  0% { transform: translate(-50%, -50%) scale(0.3); opacity: 1; border-width: 4px; }
  100% { transform: translate(-50%, -50%) scale(2.4); opacity: 0; border-width: 1px; }
}

.explosion-fire-particle {
  position: absolute;
  width: 7px;
  height: 7px;
  background: radial-gradient(circle, #fff, #ff9100, #dc2626);
  border-radius: 50%;
  pointer-events: none;
  animation: fireFly 0.42s ease-out forwards;
}

@keyframes fireFly {
  0% { transform: translate(0, 0) scale(1.5); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0.1); opacity: 0; }
}

/* Free Fire Kill Announcement Banner */
.ff-announcement-banner {
  position: absolute;
  top: 65px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.95), rgba(180, 83, 9, 0.95));
  border: 2px solid #fde047;
  padding: 0.5rem 1.6rem;
  border-radius: 0.5rem;
  box-shadow: 0 0 25px rgba(234, 88, 12, 0.8), 0 8px 20px rgba(0, 0, 0, 0.8);
  text-align: center;
  pointer-events: none;
  z-index: 35;
}

.ff-announcement-banner.banner-pop {
  animation: bannerPopIn 1.1s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes bannerPopIn {
  0% { opacity: 0; transform: translateX(-50%) scale(0.4) rotate(-4deg); }
  25% { opacity: 1; transform: translateX(-50%) scale(1.15) rotate(0deg); }
  35% { transform: translateX(-50%) scale(1); }
  85% { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-25px); }
}

.ff-banner-title {
  font-size: 1.45rem;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 1px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
}

.ff-banner-sub {
  font-size: 0.82rem;
  font-weight: 700;
  color: #fef08a;
  letter-spacing: 0.5px;
}

/* Arena Damage Shake */
.ff-shake-red {
  animation: shakeDamage 0.35s ease-out;
}

@keyframes shakeDamage {
  0% { box-shadow: inset 0 0 60px rgba(239, 68, 68, 0.9); transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(4px); }
  100% { box-shadow: inset 0 0 0px transparent; transform: translateX(0); }
}

/* Free Fire Overlays */
.ff-overlay {
  background: rgba(3, 7, 18, 0.88);
}

.ff-overlay-card {
  max-width: 520px;
  background: #0b0f19;
  border: 1.5px solid rgba(234, 88, 12, 0.5);
  box-shadow: 0 0 35px rgba(234, 88, 12, 0.3), 0 20px 40px rgba(0, 0, 0, 0.8);
}

.ff-title-gold {
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #fef08a 0%, #f59e0b 50%, #ea580c 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.ff-flame-icon {
  font-size: 3.5rem;
  animation: flameBounce 1.5s infinite alternate ease-in-out;
}

@keyframes flameBounce {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(-8px) scale(1.08); }
}

.ff-features-pills {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.86rem;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.6rem 0.85rem;
  border-radius: 0.5rem;
}

.ff-btn-glow {
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.75);
  font-weight: 800;
  letter-spacing: 0.5px;
}

/* BOOYAH Celebration Overlay */
.booyah-card {
  border-color: #eab308;
  box-shadow: 0 0 50px rgba(234, 179, 8, 0.5), 0 25px 50px rgba(0, 0, 0, 0.9);
}

.booyah-trophy-anim {
  font-size: 3.8rem;
  animation: booyahTrophy 1.2s infinite alternate ease-in-out;
}

@keyframes booyahTrophy {
  0% { transform: scale(1) rotate(-4deg); }
  100% { transform: scale(1.18) rotate(4deg); }
}

.ff-booyah-text {
  font-size: 3.8rem;
  font-weight: 900;
  letter-spacing: 3px;
  background: linear-gradient(180deg, #ffffff 0%, #fef08a 35%, #eab308 70%, #ca8a04 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 15px rgba(234, 179, 8, 0.8));
  margin: 0.2rem 0;
}

/* ------------------------------------------------------------- */
/* 10FASTFINGERS SPEED TYPING TEST SYSTEM STYLES                */
/* ------------------------------------------------------------- */

.test-container-card {
  max-width: 960px;
  margin: 0 auto;
  background: var(--bg-card, #1e293b);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
  border-radius: 1rem;
  padding: 1.75rem 2rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.test-toolbar-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 1.5rem;
}

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

.test-control-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #94a3b8;
}

.test-select {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f8fafc;
  padding: 0.4rem 0.85rem;
  border-radius: 0.45rem;
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

.test-select:focus {
  border-color: #3b82f6;
}

.btn-group-segmented {
  display: inline-flex;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.45rem;
  padding: 2px;
}

.btn-test-diff,
.btn-test-time {
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 0.35rem 0.75rem;
  font-size: 0.84rem;
  font-weight: 600;
  border-radius: 0.35rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-test-diff:hover,
.btn-test-time:hover {
  color: #f8fafc;
}

.btn-test-diff.active,
.btn-test-time.active {
  background: #3b82f6;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

/* 10FastFingers Word Stream Box (2 Visible Lines with Smooth Shift) */
.test-words-wrapper {
  background: rgba(15, 23, 42, 0.65);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.75rem;
  padding: 0.75rem 1.25rem;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.3);
}

.test-words-stream-box {
  height: 92px; /* Exactly 2 lines of words */
  overflow-y: hidden;
  font-size: 1.48rem;
  line-height: 46px;
  font-family: inherit;
  user-select: none;
  scroll-behavior: smooth;
  outline: none;
  cursor: text;
}

.stream-word {
  display: inline-block;
  padding: 0 0.4rem;
  margin: 0 3px;
  border-radius: 4px;
  transition: color 0.15s, background-color 0.15s;
  color: #cbd5e1;
}

.stream-word.current {
  background: rgba(59, 130, 246, 0.25);
  color: #ffffff;
  border-bottom: 2.5px solid #3b82f6;
  font-weight: 600;
}

.stream-word.current.has-error {
  background: rgba(239, 68, 68, 0.32) !important;
  color: #fca5a5 !important;
  border-bottom-color: #ef4444 !important;
}

.stream-word.correct {
  color: #10b981;
  font-weight: 500;
}

.stream-word.wrong {
  color: #ef4444;
  text-decoration: line-through;
  opacity: 0.85;
}

/* Input Box and Live Timer */
.test-input-action-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

.test-input-wrapper {
  flex: 1;
}

.test-typing-input {
  width: 100%;
  padding: 0.85rem 1.25rem;
  font-size: 1.35rem;
  font-family: inherit;
  background: rgba(15, 23, 42, 0.85);
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 0.6rem;
  color: #ffffff;
  outline: none;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.test-typing-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.25);
}

.test-typing-input.input-has-error {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.2);
}

.test-timer-badge {
  min-width: 105px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #3b82f6;
  color: #ffffff;
  font-size: 1.5rem;
  font-weight: 800;
  border-radius: 0.6rem;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
  letter-spacing: 1px;
  transition: background-color 0.3s;
}

.test-timer-badge.timer-warning {
  background: #ef4444;
  box-shadow: 0 0 18px rgba(239, 68, 68, 0.6);
  animation: timerPulse 0.8s infinite alternate ease-in-out;
}

@keyframes timerPulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.05); }
}

.test-hints-footer {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.86rem;
  color: #94a3b8;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* 10FastFingers Result Scorecard Modal */
.test-results-card {
  max-width: 520px;
  text-align: center;
  padding: 2.2rem 2rem;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 1rem;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.7);
}

.test-res-rank-badge {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: #ffffff;
  background: #3b82f6;
  padding: 0.3rem 0.85rem;
  border-radius: 9999px;
  margin-bottom: 0.5rem;
}

.test-score-hero {
  margin: 1.5rem 0;
  background: rgba(15, 23, 42, 0.7);
  padding: 1.25rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.test-hero-wpm {
  display: block;
  font-size: 4rem;
  font-weight: 900;
  color: #10b981;
  line-height: 1;
}

.test-hero-label {
  font-size: 0.95rem;
  color: #94a3b8;
  font-weight: 600;
  margin-top: 0.35rem;
}

.test-results-stats-grid {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  text-align: left;
  background: rgba(255, 255, 255, 0.03);
  padding: 1rem 1.25rem;
  border-radius: 0.6rem;
}

.test-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
}

.test-stat-row .lbl {
  color: #94a3b8;
}

.test-stat-row .val {
  font-weight: 700;
  color: #f8fafc;
}

.test-stat-row .val-correct {
  color: #10b981;
}

.test-stat-row .val-wrong {
  color: #ef4444;
}

.test-res-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}


