/* Global Styles for KeyTestPro V2 */
@import url('./tokens.css');

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

html, body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

body {
  font-family: var(--font-body);
  background: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  transition: background 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-title);
  font-weight: 700;
  color: var(--text-main);
}

a {
  color: inherit;
  text-decoration: none;
}

/* Layout Shell */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

main {
  flex: 1;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md);
  position: relative;
  min-height: 500px;
  box-sizing: border-box;
}

/* Navbar */
.navbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1000 !important;
  pointer-events: auto !important;
  padding: 0.75rem var(--space-xl);
  box-shadow: var(--shadow-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.3s ease, border 0.3s ease;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.4rem;
  font-weight: 800;
  font-family: var(--font-title);
  color: var(--primary);
  cursor: pointer;
  position: relative;
  z-index: 1001 !important;
  pointer-events: auto !important;
}

.logo-icon {
  background: linear-gradient(135deg, var(--primary) 0%, hsl(280, 85%, 55%) 100%);
  color: white;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-weight: 900;
  font-size: 1.2rem;
  box-shadow: 0 4px 10px rgba(114, 55, 239, 0.3);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
  position: relative;
  z-index: 1001 !important;
  pointer-events: auto !important;
}

.nav-item {
  position: relative;
  z-index: 1001 !important;
  pointer-events: auto !important;
  padding: 0.5rem 0.25rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.95rem;
}

.nav-item svg {
  width: 18px;
  height: 18px;
}

.nav-item:hover, .nav-item.active {
  color: var(--primary);
}

.nav-item.active::after {
  content: '';
  position: absolute;
  bottom: -0.85rem;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary);
  border-radius: var(--radius-full);
}

.nav-profile {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--primary-light);
  color: var(--primary);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.82rem;
  transition: var(--transition-fast);
  border: 1px solid transparent;
}

.nav-profile:hover {
  background: var(--primary);
  color: white;
}

.profile-avatar {
  width: 20px;
  height: 20px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  border: 1px solid white;
}

.nav-profile:hover .profile-avatar {
  background: white;
  color: var(--primary);
}

/* Dropdown Menu */
.profile-dropdown {
  position: absolute;
  top: 110%;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  width: 155px;
  display: none;
  flex-direction: column;
  padding: 0.35rem 0;
  z-index: 10000;
  animation: float-fast 0.2s ease;
}

.profile-dropdown.open {
  display: flex;
}

.dropdown-link {
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition-fast);
}

.dropdown-link:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.dropdown-link.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.dropdown-link.disabled:hover {
  background: transparent;
  color: var(--text-muted);
}

/* Modal styling (Settings Overlay) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 2.25rem 1rem;
}

.modal-overlay.open {
  display: flex;
}

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  max-height: calc(100vh - 4.5rem);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: float-fast 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-header {
  padding: 1.15rem var(--space-lg);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  background: var(--bg-surface);
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  border-radius: 50%;
  transition: var(--transition-fast);
}

.modal-close:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.modal-body {
  padding: var(--space-lg);
  overflow-y: auto;
  flex: 1;
}

/* Custom Scrollbar for entire Modal Body */
.modal-body::-webkit-scrollbar {
  width: 6px;
}
.modal-body::-webkit-scrollbar-track {
  background: transparent;
}
.modal-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
.modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border);
}

.setting-row:last-child {
  border-bottom: none;
}

.setting-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.setting-title {
  font-weight: 600;
  color: var(--text-main);
}

.setting-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Theme Options Scrollable List */
.theme-scroll-container {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 220px;
  overflow-y: auto;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  background: var(--bg-app);
}

/* Custom Scrollbar for theme picker */
.theme-scroll-container::-webkit-scrollbar {
  width: 6px;
}
.theme-scroll-container::-webkit-scrollbar-track {
  background: transparent;
}
.theme-scroll-container::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
.theme-scroll-container::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

.theme-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  text-align: left;
}

.theme-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.theme-btn.active {
  border-color: var(--primary);
  background: var(--primary-light);
  font-weight: 700;
}

.theme-swatch {
  width: 32px;
  height: 20px;
  border-radius: 4px;
  display: flex;
  overflow: hidden;
  border: 1px solid var(--border);
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.swatch-bg {
  flex: 2;
  height: 100%;
}

.swatch-accent {
  flex: 1;
  height: 100%;
}

.theme-item-name {
  font-size: 0.85rem;
  color: var(--text-main);
  flex: 1;
}

.theme-active-check {
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 800;
  opacity: 0;
  transition: var(--transition-fast);
}

.theme-btn.active .theme-active-check {
  opacity: 1;
}

/* Toggle Switch Control */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border);
  transition: .3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(24px);
}

/* Custom Select Dropdown */
.select-layout {
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  font-size: 0.85rem;
}

.select-layout:focus {
  border-color: var(--primary);
}

/* Footer Section */
.footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: var(--space-xxl) var(--space-xl) var(--space-lg);
  margin-top: var(--space-xxl);
  transition: background 0.3s ease, border 0.3s ease;
}

.footer-grid {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-xl);
}

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-title);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary);
}

.footer-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 250px;
}

.footer-socials {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.social-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  border: 1px solid transparent;
}

.social-icon:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-3px);
}

.social-icon svg {
  width: 16px;
  height: 16px;
}

.footer-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.footer-title {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-main);
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.footer-link {
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: var(--transition-fast);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.footer-link:hover {
  color: var(--primary);
  padding-left: 4px;
}

.footer-bottom {
  max-width: 1280px;
  margin: var(--space-xxl) auto 0;
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--primary-light);
  color: var(--primary);
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.footer-badge svg {
  width: 12px;
  height: 12px;
}

/* Floating Elements Base - Premium 3D Keycaps */
.floating-key {
  position: absolute;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.25rem;
  font-family: var(--font-title);
  color: white;
  user-select: none;
  pointer-events: none;
  animation: float 4s ease-in-out infinite;
  z-index: 5;
  
  /* 3D Keycap Face & Bevel Style */
  border-top: 2.5px solid rgba(255, 255, 255, 0.45);
  border-left: 2px solid rgba(255, 255, 255, 0.25);
  border-right: 2px solid rgba(0, 0, 0, 0.15);
  border-bottom: 2px solid rgba(0, 0, 0, 0.25);
  box-shadow: inset 0 -4px 0 rgba(0,0,0,0.18), 0 3px 0 rgba(0,0,0,0.2), 0 8px 16px rgba(0,0,0,0.15);
}

/* ================= REALISTIC 3D GLASS SOAP FLOATING BUBBLES / ORBS ================= */
.floating-3d-orb {
  position: absolute;
  border-radius: 50%;
  z-index: 1 !important;
  pointer-events: none !important;
  user-select: none !important;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  transform-style: preserve-3d;
}

/* Specular Glint Highlight on Top Left of Bubble */
.floating-3d-orb::after {
  content: '';
  position: absolute;
  top: 10%;
  left: 12%;
  width: 38%;
  height: 28%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.88) 0%, rgba(255, 255, 255, 0) 100%);
  transform: rotate(-30deg);
  pointer-events: none !important;
  user-select: none !important;
}

/* 3D Color & Gradient Profiles */
.orb-aqua-cyan {
  background: radial-gradient(circle at 35% 25%, #87E8DE 0%, #13C2C2 55%, #006D75 100%);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 
    inset -4px -5px 10px rgba(0, 109, 117, 0.6),
    inset 3px 3px 6px rgba(255, 255, 255, 0.75),
    0 10px 22px rgba(19, 194, 194, 0.45);
}

.orb-soft-pink {
  background: radial-gradient(circle at 35% 25%, #FF85C0 0%, #FF2A85 55%, #C40058 100%);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 
    inset -4px -4px 9px rgba(196, 0, 88, 0.6),
    inset 3px 3px 6px rgba(255, 255, 255, 0.75),
    0 10px 22px rgba(255, 42, 133, 0.45);
}

.orb-rose-pink {
  background: radial-gradient(circle at 35% 25%, #FFB3D9 0%, #FF59AC 55%, #C4006B 100%);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 
    inset -4px -4px 9px rgba(196, 0, 107, 0.6),
    inset 3px 3px 6px rgba(255, 255, 255, 0.75),
    0 10px 22px rgba(255, 89, 172, 0.45);
}

.orb-deep-magenta {
  background: radial-gradient(circle at 35% 25%, #F759AB 0%, #D3208B 55%, #780650 100%);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 
    inset -4px -4px 9px rgba(120, 6, 80, 0.6),
    inset 3px 3px 6px rgba(255, 255, 255, 0.7),
    0 10px 22px rgba(211, 32, 139, 0.45);
}

.orb-peach-orange {
  background: radial-gradient(circle at 35% 25%, #FFBB96 0%, #FA541C 60%, #AD2102 100%);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 
    inset -3px -4px 8px rgba(173, 33, 2, 0.6),
    inset 3px 3px 6px rgba(255, 255, 255, 0.75),
    0 8px 20px rgba(250, 84, 28, 0.45);
}

.orb-sky-blue {
  background: radial-gradient(circle at 35% 25%, #85E3FF 0%, #096DD9 60%, #003A8C 100%);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 
    inset -3px -4px 8px rgba(0, 58, 140, 0.6),
    inset 3px 3px 6px rgba(255, 255, 255, 0.75),
    0 8px 20px rgba(9, 109, 217, 0.45);
}

.orb-lavender-violet {
  background: radial-gradient(circle at 35% 25%, #D3ADF7 0%, #722ED1 60%, #391085 100%);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 
    inset -3px -4px 8px rgba(57, 16, 133, 0.6),
    inset 3px 3px 6px rgba(255, 255, 255, 0.7),
    0 8px 20px rgba(114, 46, 209, 0.45);
}

.orb-royal-purple {
  background: radial-gradient(circle at 35% 25%, #C084FC 0%, #9333EA 60%, #581C87 100%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 
    inset -3px -3px 7px rgba(88, 28, 135, 0.6),
    inset 2px 2px 5px rgba(255, 255, 255, 0.7),
    0 8px 18px rgba(147, 51, 234, 0.45);
}

.orb-emerald-mint {
  background: radial-gradient(circle at 35% 25%, #6EE7B7 0%, #10B981 60%, #047857 100%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 
    inset -2px -3px 6px rgba(4, 120, 87, 0.6),
    inset 2px 2px 4px rgba(255, 255, 255, 0.7),
    0 6px 16px rgba(16, 185, 129, 0.45);
}

.orb-sunshine-yellow {
  background: radial-gradient(circle at 35% 25%, #FFF566 0%, #FFD700 50%, #D48806 100%);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 
    inset -3px -3px 6px rgba(180, 115, 0, 0.6),
    inset 2px 2px 5px rgba(255, 255, 255, 0.85),
    0 8px 18px rgba(255, 215, 0, 0.55);
}

.orb-cobalt-blue {
  background: radial-gradient(circle at 35% 25%, #60A5FA 0%, #2563EB 60%, #1E3A8A 100%);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 
    inset -3px -4px 8px rgba(30, 58, 138, 0.6),
    inset 3px 3px 6px rgba(255, 255, 255, 0.7),
    0 8px 20px rgba(37, 99, 235, 0.45);
}

/* Physics Floating Keyframes */
@keyframes floatOrbPhysics1 { 0%, 100% { transform: translateY(0px) translateX(0px) scale(1); } 50% { transform: translateY(-14px) translateX(9px) scale(1.06); } }
@keyframes floatOrbPhysics2 { 0%, 100% { transform: translateY(0px) translateX(0px) scale(1); } 50% { transform: translateY(12px) translateX(-9px) scale(1.05); } }
@keyframes floatOrbPhysics3 { 0%, 100% { transform: translateY(0px) translateX(0px) scale(1); } 50% { transform: translateY(-10px) translateX(-8px) scale(1.08); } }
@keyframes floatOrbPhysics4 { 0%, 100% { transform: translateY(0px) translateX(0px) scale(1); } 50% { transform: translateY(11px) translateX(7px) scale(0.96); } }
@keyframes floatOrbPhysics5 { 0%, 100% { transform: translateY(0px) translateX(0px) scale(1); } 50% { transform: translateY(-12px) translateX(-6px) scale(1.07); } }
@keyframes floatOrbPhysics6 { 0%, 100% { transform: translateY(0px) translateX(0px) scale(1); } 50% { transform: translateY(10px) translateX(8px) scale(1.04); } }
@keyframes floatOrbPhysics7 { 0%, 100% { transform: translateY(0px) translateX(0px) scale(1); } 50% { transform: translateY(-8px) translateX(5px) scale(1.10); } }
@keyframes floatOrbPhysics8 { 0%, 100% { transform: translateY(0px) translateX(0px) scale(1); } 50% { transform: translateY(8px) translateX(-6px) scale(0.92); } }

.anim-orb-1 { animation: floatOrbPhysics1 4.4s ease-in-out infinite; }
.anim-orb-2 { animation: floatOrbPhysics2 4.8s ease-in-out infinite; }
.anim-orb-3 { animation: floatOrbPhysics3 5.2s ease-in-out infinite; }
.anim-orb-4 { animation: floatOrbPhysics4 4.1s ease-in-out infinite; }
.anim-orb-5 { animation: floatOrbPhysics5 4.6s ease-in-out infinite; }
.anim-orb-6 { animation: floatOrbPhysics6 3.9s ease-in-out infinite; }
.anim-orb-7 { animation: floatOrbPhysics7 3.5s ease-in-out infinite; }
.anim-orb-8 { animation: floatOrbPhysics8 4.2s ease-in-out infinite; }

/* 3D Keycaps inside Banner */
.banner-key {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--primary);
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #e6e6e6 100%);
  border-top: 2px solid rgba(255, 255, 255, 0.85);
  border-left: 1.5px solid rgba(255, 255, 255, 0.45);
  border-right: 1.5px solid rgba(0, 0, 0, 0.12);
  border-bottom: 1.5px solid rgba(0, 0, 0, 0.18);
  box-shadow: inset 0 -3.5px 0 rgba(0,0,0,0.12), 0 3.5px 0 #b3b3b3, 0 6px 12px rgba(0,0,0,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  cursor: default;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.15s ease, color 0.15s ease;
}

.banner-key.active-press {
  transform: translateY(3.5px) !important;
  background: linear-gradient(180deg, #e6e6e6 0%, #cccccc 100%) !important;
  color: hsl(280, 85%, 55%) !important;
  box-shadow: inset 0 -1px 0 rgba(0,0,0,0.1), 0 0px 0 #b3b3b3, 0 2px 4px rgba(0,0,0,0.15) !important;
}

/* Accordion FAQs styles */
.faq-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

.faq-item {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition-normal);
}

.faq-header {
  padding: 1.1rem 1.5rem;
  display: flex;
  justify-content: justify;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
  user-select: none;
  transition: var(--transition-fast);
}

.faq-header:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.faq-icon {
  transition: transform 0.3s ease;
  color: var(--text-muted);
}

.faq-header:hover .faq-icon {
  color: var(--primary);
}

.faq-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0 1.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.faq-item.open .faq-content {
  padding: 0 1.5rem 1.25rem 1.5rem;
  max-height: 200px;
}

.faq-item.open .faq-icon {
  transform: rotate(180deg);
  color: var(--primary);
}

/* Glass Card helper */
.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--glass-blur));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

/* Button style */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font-title);
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition-normal);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, hsl(280, 85%, 55%) 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(114, 55, 239, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(114, 55, 239, 0.4);
}

.btn-secondary {
  background: var(--bg-surface);
  border: 1.5px solid var(--primary);
  color: var(--primary);
}

.btn-secondary:hover {
  background: var(--primary-light);
  transform: translateY(-2px);
}

/* Quick Test Typography & Blinking Cursor Styles */
#qt-instructions {
  font-family: 'Consolas', 'Courier New', Courier, monospace;
  font-size: 1.05rem;
  line-height: 1.6;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  user-select: none;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.qt-char {
  position: relative;
  transition: color 0.1s ease, background-color 0.1s ease;
  border-left: 2px solid transparent;
}

.qt-char.current {
  color: var(--text-main);
  background-color: transparent !important;
  border-left: 2px solid var(--primary);
  animation: qt-cursor-blink 0.8s step-end infinite;
}

.qt-char.correct {
  color: #2ecc71 !important;
  background-color: rgba(46, 204, 113, 0.08);
  border-left-color: transparent;
}

.qt-char.incorrect {
  color: #e74c3c !important;
  background-color: rgba(231, 76, 60, 0.15);
  border-left-color: transparent;
}

@keyframes qt-cursor-blink {
  from, to { border-left-color: transparent; }
  50% { border-left-color: var(--primary); }
}

/* Hamburger Toggle Button Style */
.hamburger-btn {
  display: none;
  background: var(--bg-app);
  border: 1px solid var(--border);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
  align-items: center;
  justify-content: center;
  padding: 0;
}

.hamburger-btn svg line {
  transition: transform 0.3s ease, opacity 0.25s ease;
  transform-origin: 12px 12px;
}

.hamburger-btn:hover, .hamburger-btn.open {
  background: var(--primary);
  color: white !important;
  border-color: var(--primary);
}

.hamburger-btn.open .hamburger-line-1 {
  transform: translateY(6px) rotate(45deg);
}

.hamburger-btn.open .hamburger-line-2 {
  opacity: 0;
  transform: scaleX(0);
}

.hamburger-btn.open .hamburger-line-3 {
  transform: translateY(-6px) rotate(-45deg);
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ================= COMPREHENSIVE RESPONSIVE MEDIA QUERIES ================= */

/* Laptop L & Desktop (1440px and above) */
@media (min-width: 1440px) {
  main {
    max-width: 1360px;
    padding: var(--space-xl) var(--space-lg);
  }

  .navbar {
    padding: 0.85rem 3rem;
  }

  .footer-grid, .footer-bottom {
    max-width: 1360px;
  }
}

/* Laptop & Tablet Landscape (1024px) */
@media (max-width: 1024px) {
  main {
    max-width: 960px;
    padding: 1.25rem 1.5rem;
  }

  .navbar {
    padding: 0.75rem 1.5rem;
  }

  .nav-links {
    gap: 1.1rem;
  }

  .nav-item {
    font-size: 0.9rem;
  }

  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: var(--space-lg);
  }
}

/* Tablet (768px) */
@media (max-width: 768px) {
  /* Hide floating Quick Test hero widget on mobile/tablet */
  .hero-right-container {
    display: none !important;
  }

  main {
    padding: 1rem 1.25rem;
    min-height: 400px;
  }

  .navbar {
    padding: 0.65rem 1.25rem;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
  }

  .nav-brand {
    font-size: 1.2rem;
  }

  .logo-icon {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }

  /* Hamburger Menu toggle & collapsible nav dropdown */
  .hamburger-btn {
    display: flex !important;
  }

  header.navbar nav {
    display: none; /* Hidden by default on mobile */
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0.75rem;
    right: 0.75rem;
    width: auto;
    z-index: 1100;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 0.4rem;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
  }

  header.navbar nav.open {
    display: block !important;
    animation: slideDown 0.25s ease forwards;
  }

  .nav-links {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 0.15rem !important;
  }

  .nav-item {
    width: 100% !important;
    font-size: 0.92rem !important;
    font-weight: 500 !important;
    padding: 0.55rem 0.85rem !important;
    background: transparent !important;
    border: none !important;
    border-radius: var(--radius-md) !important;
    justify-content: flex-start !important;
    white-space: nowrap !important;
    transition: var(--transition-fast) !important;
  }

  .nav-item:hover {
    background: var(--primary-light) !important;
    color: var(--primary) !important;
  }

  .nav-item.active::after {
    display: none;
  }

  .nav-item.active {
    background: linear-gradient(135deg, var(--primary) 0%, hsl(330, 85%, 55%) 100%) !important;
    color: white !important;
    font-weight: 700 !important;
    border: none !important;
    box-shadow: 0 4px 12px rgba(114, 55, 239, 0.25);
  }

  .nav-item.active svg {
    stroke: white !important;
  }

  .footer {
    padding: var(--space-xl) 1.25rem var(--space-md);
    text-align: center;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
    text-align: center;
  }

  .footer-brand, .footer-logo, .footer-col, .footer-links {
    align-items: center;
    text-align: center;
    justify-content: center;
  }

  .footer-desc {
    max-width: 100%;
    margin: 0 auto;
    text-align: center;
  }

  .footer-socials {
    justify-content: center;
  }

  .footer-link {
    justify-content: center;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
    justify-content: center;
    align-items: center;
    gap: 0.6rem;
    margin-top: var(--space-xl);
  }

  #key-assistant-container {
    bottom: 15px !important;
    right: 15px !important;
  }

  #key-chat-popup {
    width: calc(100vw - 30px) !important;
    max-width: 320px !important;
  }
}

/* Settings modal responsive rows */
@media (max-width: 640px) {
  .setting-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
  }

  .setting-row select,
  .setting-row .select-layout,
  #keyboard-sound-select {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}

/* Mobile L (425px) */
@media (max-width: 425px) {
  main {
    padding: 0.75rem 0.85rem;
  }

  .navbar {
    padding: 0.55rem 0.85rem;
  }

  .nav-brand {
    font-size: 1.15rem;
  }

  .nav-profile {
    padding: 0.2rem 0.5rem;
    font-size: 0.78rem;
    gap: 0.35rem;
  }

  .footer {
    padding: var(--space-lg) 0.85rem var(--space-md);
  }

  .modal-content {
    width: 95%;
    max-height: calc(100vh - 2.5rem);
  }

  .floating-key {
    display: none !important;
  }

  .theme-picker {
    flex-wrap: wrap;
  }
}

/* Mobile M (375px) */
@media (max-width: 375px) {
  main {
    padding: 0.65rem 0.75rem;
  }

  .navbar {
    padding: 0.5rem 0.75rem;
  }

  .nav-brand {
    font-size: 1.1rem;
    gap: 0.35rem;
  }

  .btn {
    padding: 0.6rem 1.1rem;
    font-size: 0.88rem;
  }

  .modal-body {
    padding: 1rem;
  }

  #key-chat-popup {
    width: calc(100vw - 24px) !important;
    max-width: 310px !important;
  }
}

/* Mobile S (320px) */
@media (max-width: 320px) {
  main {
    padding: 0.5rem 0.5rem;
  }

  .navbar {
    padding: 0.45rem 0.5rem;
  }

  .nav-brand {
    font-size: 1.02rem;
  }

  .logo-icon {
    width: 28px;
    height: 28px;
    font-size: 0.9rem;
    border-radius: 7px;
  }

  .hamburger-btn {
    width: 34px;
    height: 34px;
  }

  .btn {
    padding: 0.5rem 0.85rem;
    font-size: 0.82rem;
  }

  .footer {
    padding: 1rem 0.5rem 0.75rem;
    text-align: center;
  }

  .footer-bottom {
    font-size: 0.75rem;
  }

  .modal-content {
    width: 98%;
    border-radius: var(--radius-md);
  }

  #key-assistant-container {
    bottom: 8px !important;
    right: 8px !important;
  }

  #key-chat-popup {
    width: calc(100vw - 16px) !important;
    max-width: 304px !important;
  }

  #key-avatar-btn {
    width: 48px !important;
    height: 48px !important;
    font-size: 1.3rem !important;
  }
}
