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

:root {
  --bg: #f5f7fa; --card: #ffffff; --text: #1e2b3c; --text-soft: #4a5a6a;
  --border: #e6edf4; --border-hover: #c0d4e6; --link: #0b5e9e;
  --nav: #003366; --nav-hover: #0a4a7a; --accent: #2d8ac7;
  --download: #2ecc71; --download-hover: #27ae60;
  --logo-soft: #003366;
  --logo-soft-glow: none;
  --logo-pedia: #2d8ac7;
  --dl-bg: #2ecc71;
  --dl-bg-hover: #27ae60;
  --dl-text: #ffffff;
  --dl-border: transparent;
  --dl-shadow: 0 6px 18px rgba(46, 204, 113, 0.35);
  --dl-shadow-hover: 0 8px 24px rgba(46, 204, 113, 0.5);
}
body.dark {
  --bg: #0f1a24; --card: #16222e; --text: #e3ebf3; --text-soft: #9fb0c0;
  --border: #253544; --border-hover: #355066; --link: #4aa3e0;
  --nav: #0b1b29; --nav-hover: #142a3d; --accent: #4aa3e0;
  --download: #27ae60; --download-hover: #2ecc71;
  --logo-soft: #e6f4ff;
  --logo-soft-glow: 0 0 14px rgba(74, 163, 224, 0.55);
  --logo-pedia: #4aa3e0;
  --dl-bg: #0d2a1f;
  --dl-bg-hover: #123a2a;
  --dl-text: #6effb0;
  --dl-border: #2ecc71;
  --dl-shadow: 0 0 0 1px #2ecc71, 0 0 18px rgba(46, 204, 113, 0.45);
  --dl-shadow-hover: 0 0 0 1px #2ecc71, 0 0 26px rgba(46, 204, 113, 0.7);
}
body { font-family: 'Segoe UI', Tahoma, Arial, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; transition: background 0.3s, color 0.3s; }
a { text-decoration: none; color: var(--link); }
a:hover { text-decoration: underline; }
.container { max-width: 1440px; margin: 0 auto; padding: 0 28px; }

.top-bar { background: var(--card); border-bottom: 1px solid var(--border); font-size: 14px; color: var(--text-soft); padding: 8px 0; }
.top-bar .container { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; }
.top-left { display: flex; align-items: center; gap: 12px; }
.top-center { display: flex; justify-content: center; }
.top-right { display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
.theme-btn { background: none; border: 1px solid var(--border); border-radius: 30px; padding: 5px 14px; cursor: pointer; font-size: 14px; color: var(--text-soft); font-family: inherit; transition: all 0.2s; }
.theme-btn:hover { border-color: var(--accent); color: var(--accent); }

.nav-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 18px; border-radius: 30px;
  border: 1px solid var(--border); background: var(--bg);
  color: var(--text); font-weight: 600; font-size: 13.5px;
  transition: all 0.2s; white-space: nowrap;
}
.nav-pill:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.nav-pill.active { background: var(--link); color: #fff; border-color: var(--link); box-shadow: 0 4px 14px rgba(11, 94, 158, 0.25); }
body.dark .nav-pill.active { background: rgba(74, 163, 224, 0.18); color: #4aa3e0; border-color: #4aa3e0; box-shadow: 0 0 0 1px #4aa3e0, 0 0 16px rgba(74, 163, 224, 0.35); }
.nav-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.top-note { color: var(--text-soft); font-size: 13px; }

.main-header { background: var(--card); box-shadow: 0 2px 6px rgba(0,0,0,0.03); padding: 18px 0; }
.main-header .container { display: flex; align-items: center; flex-wrap: wrap; gap: 30px; }
.logo { font-size: 34px; font-weight: 700; letter-spacing: -0.5px; color: var(--logo-soft); display: flex; align-items: center; cursor: pointer; user-select: none; transition: color 0.3s, text-shadow 0.3s; text-shadow: var(--logo-soft-glow); }
.logo span { color: var(--logo-pedia); font-weight: 300; margin-left: 4px; }

.search-wrap { flex: 1; min-width: 260px; position: relative; }
.search-bar { display: flex; border: 1px solid var(--border); border-radius: 40px; overflow: hidden; background: var(--card); }
.search-bar.focused { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(45,138,199,0.15); }
.search-bar input { flex: 1; padding: 13px 22px; border: none; outline: none; font-size: 16px; background: transparent; color: var(--text); }
.search-bar button { background: var(--border); border: none; padding: 0 28px; cursor: pointer; font-size: 17px; color: var(--text-soft); }
.search-bar button:hover { background: var(--border-hover); }
.suggestions { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--card); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 8px 24px rgba(0,0,0,0.08); max-height: 320px; overflow-y: auto; display: none; z-index: 100; }
.suggestions.open { display: block; }
.suggestions .item { padding: 11px 18px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; }
.suggestions .item:hover, .suggestions .item.active { background: rgba(45,138,199,0.1); }
.suggestions .item .type { font-size: 12px; color: var(--text-soft); background: var(--bg); padding: 2px 10px; border-radius: 20px; white-space: nowrap; }
.suggestions .empty { padding: 14px 18px; color: var(--text-soft); font-size: 14px; }

.breadcrumb { font-size: 13px; padding: 16px 0 8px; color: var(--text-soft); }
.breadcrumb a { color: var(--link); }

.hero { background: linear-gradient(135deg, var(--nav) 0%, #0a4a7a 100%); color: #fff; border-radius: 18px; padding: 22px 28px; margin-bottom: 26px; }
.hero h1 { font-size: 24px; font-weight: 700; margin-bottom: 6px; color: #fff; }
.hero p { font-size: 14px; opacity: 0.9; max-width: 720px; }

.section-title { font-size: 24px; font-weight: 700; color: var(--text); margin-bottom: 20px; display: flex; justify-content: space-between; align-items: baseline; border-bottom: 2px solid var(--border); padding-bottom: 10px; flex-wrap: wrap; gap: 10px; }

.download-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; margin-bottom: 40px; }
.download-card { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 22px; display: flex; flex-direction: column; gap: 14px; transition: border 0.15s, box-shadow 0.15s, transform 0.15s; animation: fadeIn 0.35s ease both; }
.download-card:hover { border-color: var(--border-hover); box-shadow: 0 10px 28px rgba(0,0,0,0.08); transform: translateY(-4px); }
.dc-top { display: flex; align-items: center; gap: 16px; }
.dc-icon { width: 64px; height: 64px; border-radius: 16px; background: rgba(45,138,199,0.12); display: flex; align-items: center; justify-content: center; font-size: 30px; flex-shrink: 0; overflow: hidden; }
.dc-icon img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.dc-title { min-width: 0; }
.dc-title h3 { font-size: 18px; font-weight: 600; margin-bottom: 3px; }
.dc-title h3 a { color: var(--text); }
.dc-title h3 a:hover { color: var(--link); text-decoration: none; }
.dc-title .dc-version { font-size: 13px; color: var(--text-soft); }
.dc-desc { font-size: 14px; color: var(--text-soft); flex: 1; line-height: 1.55; }
.dc-meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-soft); border-top: 1px dashed var(--border); padding-top: 12px; }

.dc-btn, .btn-download, .modal-download {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--dl-bg); color: var(--dl-text);
  font-weight: 700; font-size: 15px;
  padding: 12px 20px; border-radius: 12px;
  border: 1px solid var(--dl-border);
  cursor: pointer; font-family: inherit;
  box-shadow: var(--dl-shadow);
  transition: background 0.15s, box-shadow 0.2s, transform 0.1s, color 0.15s;
}
.dc-btn:hover, .btn-download:hover, .modal-download:hover { background: var(--dl-bg-hover); box-shadow: var(--dl-shadow-hover); text-decoration: none; transform: translateY(-1px); }

.page-disclaimer { max-width: 1440px; margin: 0 auto 28px; padding: 0 28px; font-size: 11px; color: var(--text-soft); opacity: 0.75; line-height: 1.5; }
.disclaimer { font-size: 11px; color: var(--text-soft); padding: 12px 0 0; border-top: 1px dashed var(--border); margin-top: 16px; line-height: 1.4; opacity: 0.8; }

/* ===== APP PAGE ===== */
.app-page { margin-bottom: 40px; }
.app-header { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 28px; display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 22px; }
.app-icon { width: 96px; height: 96px; border-radius: 22px; background: rgba(45,138,199,0.12); display: flex; align-items: center; justify-content: center; font-size: 44px; flex-shrink: 0; overflow: hidden; }
.app-icon img { width: 100%; height: 100%; object-fit: contain; padding: 12px; }
.app-head-info { flex: 1; min-width: 260px; }
.app-head-info h1 { font-size: 28px; font-weight: 700; margin-bottom: 8px; color: var(--text); }
.app-version { font-size: 14px; color: var(--text-soft); margin-bottom: 12px; }
.app-stats { display: flex; gap: 22px; flex-wrap: wrap; font-size: 14px; color: var(--text-soft); margin-bottom: 18px; }
.app-stats strong { color: var(--text); font-weight: 600; }

.app-content { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 26px; margin-bottom: 22px; }
.app-content h2 { font-size: 20px; font-weight: 700; margin-bottom: 14px; color: var(--text); border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.app-content p { font-size: 15px; color: var(--text-soft); margin-bottom: 12px; line-height: 1.6; }
.app-content ul { list-style: none; }
.app-content ul li { font-size: 14px; color: var(--text-soft); padding: 8px 0 8px 24px; position: relative; border-bottom: 1px dashed var(--border); }
.app-content ul li:last-child { border-bottom: none; }
.app-content ul li::before { content: "✓"; position: absolute; left: 0; color: var(--download); font-weight: 700; }

.specs-table { width: 100%; border-collapse: collapse; margin-bottom: 6px; }
.specs-table tr { border-bottom: 1px dashed var(--border); }
.specs-table tr:last-child { border-bottom: none; }
.specs-table td { padding: 9px 0; font-size: 14px; }
.specs-table td:first-child { color: var(--text-soft); width: 45%; }
.specs-table td:last-child { color: var(--text); font-weight: 500; }

.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.related-card { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 14px; text-align: center; transition: border 0.15s, transform 0.15s; display: block; }
.related-card:hover { border-color: var(--border-hover); transform: translateY(-2px); text-decoration: none; }
.related-card img { width: 48px; height: 48px; object-fit: contain; margin-bottom: 8px; }
.related-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.related-version { font-size: 11px; color: var(--text-soft); }

.toast { position: fixed; bottom: 30px; right: 30px; background: var(--card); color: var(--text); border: 1px solid var(--border-hover); border-left: 4px solid var(--accent); padding: 14px 22px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.15); font-size: 14px; font-weight: 500; opacity: 0; transform: translateY(20px); transition: all 0.3s; pointer-events: none; z-index: 3000; max-width: 340px; }
.toast.show { opacity: 1; transform: translateY(0); }

.back-top { position: fixed; bottom: 30px; left: 30px; width: 48px; height: 48px; border-radius: 50%; background: var(--link); color: #fff; border: none; font-size: 20px; cursor: pointer; box-shadow: 0 6px 20px rgba(0,0,0,0.2); opacity: 0; transform: scale(0.6); transition: all 0.25s; z-index: 999; }
.back-top.show { opacity: 1; transform: scale(1); }
.back-top:hover { background: var(--accent); }

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

@media (max-width: 900px) {
  .top-bar .container { grid-template-columns: auto 1fr; }
  .top-center { grid-column: 1 / -1; order: 3; margin-top: 6px; }
  .top-right { grid-column: 1 / -1; justify-content: center; order: 4; display: none; }
}
@media (max-width: 640px) {
  .main-header .container { flex-direction: column; align-items: stretch; }
  .logo { font-size: 28px; }
  .hero { padding: 20px; }
  .hero h1 { font-size: 20px; }
  .back-top { left: 16px; bottom: 16px; }
  .toast { right: 16px; left: 16px; bottom: 80px; max-width: none; }
  .download-grid { grid-template-columns: 1fr; gap: 16px; }
  .container { padding: 0 16px; }
  .app-header { padding: 20px; }
  .app-head-info h1 { font-size: 22px; }
  .app-icon { width: 72px; height: 72px; font-size: 34px; }
}