/* Quizzman-Wiki Enhanced Styles */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #3b82f6;
  --accent: #f59e0b;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --text: #1f2937;
  --text-muted: #6b7280;
  --bg: #ffffff;
  --bg-alt: #f9fafb;
  --bg-hover: #f3f4f6;
  --border: #e5e7eb;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.1);
  --radius: 8px;
  --radius-lg: 16px;
  --max-width: 1280px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', sans-serif;
  --font-mono: ui-monospace, 'SF Mono', monospace;
  --header-bg: rgba(255,255,255,0.95);
}

/* Dark Theme Variables */
[data-theme="dark"] {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #60a5fa;
  --accent: #fbbf24;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --bg: #0f172a;
  --bg-alt: #1e293b;
  --bg-hover: #334155;
  --border: #334155;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.4);
  --header-bg: rgba(15,23,42,0.95);
}

/* Theme Toggle Button */
.theme-toggle {
  background: transparent;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  color: var(--text);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.theme-toggle:hover { background: var(--bg-hover); }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .sun-icon { display: none; }
.theme-toggle .moon-icon { display: block; }
[data-theme="dark"] .theme-toggle .sun-icon { display: block; }
[data-theme="dark"] .theme-toggle .moon-icon { display: none; }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: var(--font); font-size: 16px; line-height: 1.7; color: var(--text); background: var(--bg); margin: 0; }

/* Global link reset */
a { text-decoration: none; color: inherit; }
a:hover { text-decoration: none; }

/* Image defaults */
img { max-width: 100%; height: auto; display: block; }

/* ==========================================
   Header
   ========================================== */
.wiki-header {
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}
.header-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 60px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.25rem;
}
.logo-icon { color: var(--primary); }
.logo-text { font-size: 1.1rem; }
.main-nav {
  display: flex;
  gap: 0.25rem;
}
.main-nav a {
  padding: 0.5rem 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  transition: all 0.2s;
}
.main-nav a:hover, .main-nav a.active {
  background: var(--bg-hover);
  color: var(--text);
}
.search-container {
  flex: 1;
  max-width: 400px;
  position: relative;
}

/* Header Search Form */
.search-form {
  display: flex;
  width: 100%;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 50px;
  overflow: hidden;
  transition: all 0.2s;
}
.search-form:focus-within {
  border-color: var(--primary);
  background: var(--bg);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.search-form input[type="search"] {
  flex: 1;
  border: none;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  background: transparent;
  color: var(--text);
  outline: none;
}
.search-form input[type="search"]::placeholder {
  color: var(--text-muted);
}
.search-form .search-btn {
  background: transparent;
  border: none;
  padding: 0.5rem 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}
.search-form .search-btn:hover {
  color: var(--primary);
}
.search-form .search-btn svg {
  width: 18px;
  height: 18px;
}

.search-box {
  width: 100%;
  padding: 0.5rem 1rem 0.5rem 2.5rem;
  border: 1px solid var(--border);
  border-radius: 50px;
  font-size: 0.9rem;
  background: var(--bg-alt);
  color: var(--text);
  transition: all 0.2s;
}
.search-box:focus { outline: none; border-color: var(--primary); background: var(--bg); }
.search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}
.header-actions { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }
.login-btn {
  padding: 0.5rem 1rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.login-btn:hover { background: var(--primary-dark); }
.nav-create { display: flex; align-items: center; gap: 0.3rem; }
.nav-create svg { width: 16px; height: 16px; }

/* ==========================================
   Hero Section - Dynamic Island Style
   ========================================== */
.hero {
  background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
  color: white;
  padding: 2rem 1rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.2) 0%, transparent 50%),
              radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.15) 0%, transparent 40%);
  animation: auroraMove 20s ease-in-out infinite;
  pointer-events: none;
}
@keyframes auroraMove {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(2%, -2%); }
}
[data-theme="dark"] .hero {
  background: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 50%, #16213e 100%);
}

/* Hero Island */
.hero-island {
  max-width: 500px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 20px;
  padding: 1.25rem 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 15px 35px -10px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 1;
}
.hero-island h1 {
  font-size: 1.5rem;
  margin: 0 0 0.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}
.hero-island h1 svg { width: 24px; height: 24px; }
.hero-island > p {
  font-size: 0.85rem;
  opacity: 0.8;
  margin: 0 0 1rem;
}

/* Hero Search */
.hero-search { margin: 0 0 1rem; position: relative; }
.hero-search-form {
  display: flex;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  position: relative;
}
[data-theme="dark"] .hero-search-form { background: rgba(30, 41, 59, 0.95); }
.hero-search-input {
  flex: 1;
  border: none;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  outline: none;
  background: transparent;
  color: var(--text);
}
.hero-search-input::placeholder { color: var(--text-muted); }
.hero-search-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
}
.hero-search-btn:hover { opacity: 0.9; }
.hero-search-btn svg { width: 18px; height: 18px; }

/* Hero Stats */
.hero-stats {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.stat {
  background: rgba(255, 255, 255, 0.08);
  padding: 0.35rem 0.75rem;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.stat strong { font-weight: 600; }
.stat span { opacity: 0.8; }

/* ==========================================
   Featured Banner Carousel
   ========================================== */
.featured-banner {
  padding: 1rem 0;
}
.dynamic-island {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  background: var(--bg);
}
.banner-carousel {
  position: relative;
  height: 180px;
}
.banner-slide {
  position: absolute;
  inset: 0;
  display: flex;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease;
  text-decoration: none;
  color: white;
}
.banner-slide.active {
  opacity: 1;
  visibility: visible;
}
.banner-image {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}
.banner-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.3) 60%, transparent 100%);
}
.banner-content {
  position: relative;
  z-index: 2;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 65%;
}
.banner-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--accent);
  color: #000;
  padding: 0.2rem 0.5rem;
  border-radius: 12px;
  font-size: 0.65rem;
  font-weight: 600;
  width: fit-content;
  margin-bottom: 0.5rem;
}
.banner-content h2 {
  font-size: 1.1rem;
  margin: 0 0 0.4rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.banner-content p {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  opacity: 0.85;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.banner-author { font-size: 0.7rem; opacity: 0.7; }
.banner-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(4px);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 5;
}
.banner-nav:hover { background: rgba(255,255,255,0.3); }
.banner-prev { left: 1rem; }
.banner-next { right: 1rem; }
.banner-dots {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.5rem;
  z-index: 5;
}
.banner-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.4);
  cursor: pointer;
  transition: all 0.2s;
}
.banner-dot.active,
.banner-dot:hover {
  background: white;
  transform: scale(1.2);
}

/* ==========================================
   Categories Section
   ========================================== */
.categories-section { padding: 1rem 0; }
.categories-grid {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scrollbar-width: thin;
}
.categories-grid::-webkit-scrollbar { height: 4px; }
.categories-grid::-webkit-scrollbar-track { background: var(--bg-alt); }
.categories-grid::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Banner Style Categories */
.categories-banner {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  padding-bottom: 1rem;
  overflow: visible;
}

.category-card.category-banner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background: linear-gradient(135deg, var(--cat-color, #667eea) 0%, color-mix(in srgb, var(--cat-color, #667eea) 70%, #000) 100%);
  border-radius: 16px;
  text-decoration: none;
  color: #fff !important;
  overflow: hidden;
  min-height: 80px;
  transition: all 0.3s ease;
  border: none;
  white-space: normal;
  flex-shrink: initial;
}

.category-card.category-banner:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 12px 32px rgba(0,0,0,0.25);
  color: #fff !important;
  background: linear-gradient(135deg, var(--cat-color, #667eea) 0%, color-mix(in srgb, var(--cat-color, #667eea) 60%, #000) 100%);
  border-color: transparent;
}

.category-card.category-banner .category-bg {
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.08'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.6;
  pointer-events: none;
}

.category-card.category-banner .category-icon {
  width: 48px;
  height: 48px;
  background: rgba(255,255,255,0.2);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

.category-card.category-banner .category-icon i {
  color: #fff !important;
  font-size: 1.25rem;
}

.category-card.category-banner .category-info {
  position: relative;
  z-index: 1;
  flex: 1;
}

.category-card.category-banner .category-info h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.25rem 0;
  color: #fff !important;
}

.category-card.category-banner .category-info .article-count {
  font-size: 0.8rem;
  opacity: 0.9;
  color: rgba(255,255,255,0.9) !important;
  margin: 0;
}

/* Pill Style Categories (fallback) */
.category-card {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-alt);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  transition: all 0.2s;
}
.category-card:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
  color: var(--primary);
}
.category-icon { font-size: 1rem; }
.category-card h3 { margin: 0; font-size: 0.8rem; font-weight: 500; }
.article-count { font-size: 0.7rem; color: var(--text-muted); margin-left: 0.25rem; }

/* ==========================================
   Home Layout
   ========================================== */
.home-page { max-width: var(--max-width); margin: 0 auto; padding: 1rem; }
.home-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.5rem;
  margin-top: 1rem;
}

/* Section Headers */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.section-header h2 { margin: 0; font-size: 1rem; font-weight: 600; }
.see-all {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
}
.see-all:hover { text-decoration: underline; }

/* Latest Section */
.latest-section { }

/* ==========================================
   Article Cards - Compact Style
   ========================================== */
.articles-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.article-card {
  background: var(--bg);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
  border: 1px solid var(--border);
}
.article-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  border-color: var(--primary-light);
}
.article-card-link {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem;
  text-decoration: none;
  color: inherit;
}
.article-card-thumbnail {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--bg-alt) 0%, var(--bg-hover) 100%);
}
.article-card-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}
.article-card:hover .article-card-thumbnail img { transform: scale(1.05); }
.article-card-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.article-card-title {
  margin: 0 0 0.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.article-card:hover .article-card-title { color: var(--primary); }
.article-card-excerpt {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.article-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}
.article-card-meta .author,
.article-card-meta .date {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

/* Locked Article Styles */
.article-card.locked {
  position: relative;
}
.article-card.locked .article-card-thumbnail {
  position: relative;
}
.article-card.locked .lock-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}
.article-card.locked .lock-overlay i {
  color: #fbbf24;
  font-size: 1.5rem;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.article-card-title .lock-icon {
  color: #f59e0b;
  font-size: 0.8em;
  margin-right: 0.25rem;
}

/* ==========================================
   Key Access Modal - Modern Glass Style
   ========================================== */
.key-access-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  animation: modalFadeIn 0.3s ease forwards;
}
@keyframes modalFadeIn {
  to { opacity: 1; }
}
.key-access-content {
  background: linear-gradient(145deg, rgba(30, 30, 50, 0.95), rgba(20, 20, 35, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 2.5rem;
  max-width: 420px;
  width: 90%;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5),
              0 0 0 1px rgba(255, 255, 255, 0.05);
  transform: scale(0.9) translateY(20px);
  animation: modalSlideIn 0.4s ease forwards;
}
@keyframes modalSlideIn {
  to {
    transform: scale(1) translateY(0);
  }
}
.key-access-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 1.5rem;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px -5px rgba(245, 158, 11, 0.4);
  animation: lockPulse 2s ease-in-out infinite;
}
@keyframes lockPulse {
  0%, 100% { box-shadow: 0 10px 30px -5px rgba(245, 158, 11, 0.4); }
  50% { box-shadow: 0 10px 40px -5px rgba(245, 158, 11, 0.6); }
}
.key-access-icon i {
  font-size: 2rem;
  color: white;
}
.key-access-title {
  color: white;
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
}
.key-access-article {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
  margin: 0 0 1.5rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  display: inline-block;
}
.key-access-desc {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.875rem;
  margin: 0 0 1.5rem;
  line-height: 1.5;
}
.key-input-wrapper {
  position: relative;
  margin-bottom: 1rem;
}
.key-input-wrapper i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.4);
}
.key-input {
  width: 100%;
  padding: 1rem 1rem 1rem 3rem;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: white;
  font-size: 1rem;
  font-family: monospace;
  letter-spacing: 1px;
  transition: all 0.3s;
  box-sizing: border-box;
}
.key-input:focus {
  outline: none;
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.15);
}
.key-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}
.key-submit-btn {
  width: 100%;
  padding: 1rem;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.key-submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(245, 158, 11, 0.4);
}
.key-submit-btn:active {
  transform: translateY(0);
}
.key-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
.key-submit-btn .spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.key-error {
  color: #ef4444;
  font-size: 0.85rem;
  margin-top: 0.75rem;
  padding: 0.5rem;
  background: rgba(239, 68, 68, 0.1);
  border-radius: 8px;
  display: none;
}
.key-error.show {
  display: block;
  animation: shake 0.4s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}
.key-access-divider {
  display: flex;
  align-items: center;
  margin: 1.5rem 0;
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.8rem;
}
.key-access-divider::before,
.key-access-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}
.key-access-divider span {
  padding: 0 1rem;
}
.key-login-link {
  color: #06b6d4;
  font-size: 0.9rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: color 0.2s;
}
.key-login-link:hover {
  color: #22d3ee;
}
.key-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.key-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

/* ==========================================
   Sidebar
   ========================================== */
.home-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.sidebar-section {
  background: var(--bg-alt);
  border-radius: 12px;
  padding: 1rem;
  border: 1px solid var(--border);
}
.sidebar-section h3 {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Trending Section */
.trending-section { }
.trending-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: trending;
}
.trending-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.trending-list li:last-child { border-bottom: none; }
.trending-list .rank {
  background: var(--primary);
  color: white;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  flex-shrink: 0;
}
.trending-list li:nth-child(1) .rank { background: #fbbf24; color: #000; }
.trending-list li:nth-child(2) .rank { background: #94a3b8; color: #000; }
.trending-list li:nth-child(3) .rank { background: #cd7f32; color: #fff; }
.trending-list a {
  flex: 1;
  color: var(--text);
  text-decoration: none;
  font-size: 0.8rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.trending-list a:hover { color: var(--primary); }
.trending-list .views {
  font-size: 0.65rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Quick Links */
.quick-links ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.quick-links li { margin-bottom: 0.25rem; }
.quick-links a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.8rem;
  border-radius: 6px;
  transition: all 0.2s;
}
.quick-links a:hover {
  background: var(--bg-hover);
  color: var(--primary);
}

/* ==========================================
   Search Suggestions
   ========================================== */
.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  z-index: 1000;
  max-height: 350px;
  overflow-y: auto;
  margin-top: 6px;
  display: none;
}
.search-suggestions.active {
  display: block;
}
.search-suggestions.hidden { display: none; }
.suggestion-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover { background: var(--bg-hover); }
.suggestion-item strong {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}
.suggestion-item small {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.suggestion-item.text-muted {
  color: var(--text-muted);
  text-align: center;
  padding: 1.5rem 1rem;
}
.suggestion-thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--bg-alt);
}
.suggestion-info { flex: 1; min-width: 0; }
.suggestion-title {
  font-size: 0.85rem;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.suggestion-category {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Hero Search Suggestions */
.hero-search .search-suggestions {
  background: var(--bg);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

/* ==========================================
   Responsive
   ========================================== */
@media (max-width: 900px) {
  .home-grid { grid-template-columns: 1fr; }
  .hero-island { max-width: 100%; }
  .hero-island h1 { font-size: 1.25rem; }
  .header-container { gap: 0.75rem; flex-wrap: wrap; height: auto; padding: 0.5rem 0.75rem; }
  .search-container { order: 3; flex-basis: 100%; max-width: none; }
  .main-nav { display: none; }
  .banner-carousel { height: 160px; }
  .banner-content { max-width: 75%; }
  .banner-content h2 { font-size: 1rem; }
  .categories-banner {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

@media (max-width: 640px) {
  .home-page { padding: 0.75rem; }
  .article-card-thumbnail { width: 64px; height: 64px; }
  .article-card-title { font-size: 0.85rem; }
  .banner-carousel { height: 140px; }
  .banner-nav { width: 28px; height: 28px; font-size: 1rem; }
  .categories-banner {
    grid-template-columns: 1fr;
  }
  .category-card.category-banner {
    min-height: 70px;
    padding: 1rem 1.25rem;
  }
  .category-card.category-banner .category-icon {
    width: 40px;
    height: 40px;
  }
  .category-card.category-banner .category-info h3 {
    font-size: 0.9rem;
  }
}

/* ==========================================
   Article Page
   ========================================== */
.article-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}
.article-header { margin-bottom: 2rem; }
.article-header h1 {
  font-size: 2rem;
  margin: 0 0 1rem;
  line-height: 1.3;
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.article-content {
  font-size: 1.05rem;
  line-height: 1.8;
}
.article-content h2 { font-size: 1.5rem; margin: 2rem 0 1rem; }
.article-content h3 { font-size: 1.25rem; margin: 1.5rem 0 0.75rem; }
.article-content p { margin: 0 0 1.25rem; }
.article-content ul, .article-content ol { margin: 0 0 1.25rem; padding-left: 1.5rem; }
.article-content li { margin-bottom: 0.5rem; }
.article-content blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.5rem;
  background: var(--bg-alt);
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.article-content code {
  font-family: var(--font-mono);
  background: var(--bg-alt);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9em;
}
.article-content pre {
  background: var(--bg-alt);
  padding: 1rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 1.5rem 0;
}
.article-content pre code {
  background: transparent;
  padding: 0;
}

/* ==========================================
   Footer
   ========================================== */
.qmf-footer {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  margin-top: 3rem;
}
.qmf-footer__container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.qmf-footer__copyright {
  color: var(--text-muted);
  font-size: 0.85rem;
}
.qmf-footer__links {
  display: flex;
  gap: 1.5rem;
}
.qmf-footer__links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
}
.qmf-footer__links a:hover { color: var(--primary); }

/* ==========================================
   Categories Page
   ========================================== */
.categories-page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem;
}
.categories-page h1 { font-size: 2rem; margin-bottom: 2rem; }
.categories-full-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}
.category-card-large {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  background: var(--bg-alt);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s;
  border: 2px solid transparent;
}
.category-card-large:hover {
  background: var(--bg);
  border-color: var(--primary);
  box-shadow: var(--shadow);
}
.category-card-large .category-icon { font-size: 2.5rem; }
.category-info h2 { margin: 0 0 0.25rem; font-size: 1.2rem; }
.category-info p { margin: 0 0 0.5rem; color: var(--text-muted); font-size: 0.9rem; }

/* ==========================================
   Search Page
   ========================================== */
.search-page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem;
}
.search-header { margin-bottom: 2rem; }
.search-header h1 { font-size: 1.5rem; margin: 0 0 0.5rem; }
.search-meta { color: var(--text-muted); font-size: 0.9rem; }
.search-results { display: flex; flex-direction: column; gap: 1rem; }
.search-result {
  padding: 1rem;
  background: var(--bg-alt);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.search-result h2 {
  font-size: 1.1rem;
  margin: 0 0 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.search-result h2 a {
  color: var(--primary);
  text-decoration: none;
}
.search-result h2 a:hover {
  text-decoration: underline;
}
.search-result p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0 0 0.5rem;
}
.search-result .result-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.search-result.is-locked {
  border-color: rgba(245, 158, 11, 0.3);
  background: linear-gradient(135deg, var(--bg-alt), rgba(245, 158, 11, 0.05));
}
.search-result .lock-badge {
  color: #f59e0b;
  font-size: 0.9em;
}
.search-result .private-badge {
  color: #f59e0b;
  font-weight: 500;
}
.no-results {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}
.no-results svg { width: 64px; height: 64px; margin-bottom: 1rem; opacity: 0.5; }

/* ==========================================
   Utilities
   ========================================== */
.hidden { display: none !important; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
