@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/IBMPlexSans-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/IBMPlexSans-Medium.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/IBMPlexSans-SemiBold.woff2") format("woff2");
}

:root {
  --bg: #0c1219;
  --bg-elevated: #121a24;
  --panel: #152033;
  --panel-2: #1b2a3d;
  --accent: #2f9e9e;
  --accent-soft: #3db8b0;
  --accent-dim: rgba(47, 158, 158, 0.16);
  --text: #e8eef4;
  --muted: #8a9bb0;
  --border: #243447;
  --highlight: #e8c547;
  --danger: #e07a5f;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  --radius: 10px;
  --sidebar-w: 380px;
  --font: "IBM Plex Sans", "Segoe UI", sans-serif;
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}

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

html,
body {
  height: 100%;
}

body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(47, 158, 158, 0.12), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(232, 197, 71, 0.06), transparent 50%),
    var(--bg);
  color: var(--text);
  display: flex;
  overflow: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--accent);
  color: #041016;
  padding: 8px 14px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 0 8px 0;
}
.skip-link:focus {
  left: 0;
}

/* Top bar (mobile) */
.topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  height: 56px;
  padding: 0 12px;
  align-items: center;
  gap: 10px;
  background: rgba(18, 26, 36, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-brand {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent-soft);
}

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(4, 10, 16, 0.55);
  z-index: 45;
}

/* Sidebar */
#sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg-elevated) 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}

.sidebar-header {
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

#sidebar h1 {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-soft);
  letter-spacing: 0.01em;
  margin-bottom: 4px;
}

.sub {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

.lang-switch {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--panel-2);
}

.lang-switch button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 10px;
  cursor: pointer;
  min-width: 40px;
}
.lang-switch button:hover {
  color: var(--text);
}
.lang-switch button.active {
  background: var(--accent-dim);
  color: var(--accent-soft);
}

#search-wrap {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

#search {
  width: 100%;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
#search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
#search::placeholder {
  color: var(--muted);
}

#menu {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0 32px;
  scrollbar-width: thin;
  scrollbar-color: #2a3f55 transparent;
}
#menu::-webkit-scrollbar {
  width: 8px;
}
#menu::-webkit-scrollbar-thumb {
  background: #2a3f55;
  border-radius: 4px;
}

.cat {
  border-bottom: 1px solid var(--border);
}

.cat-title {
  width: 100%;
  appearance: none;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 12px 18px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent-soft);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.cat-title:hover {
  background: var(--panel-2);
}
.cat-count {
  color: var(--muted);
  font-weight: 400;
}
.arrow {
  transition: transform 0.2s;
  font-size: 16px;
  color: var(--muted);
  line-height: 1;
}
.cat.open .arrow {
  transform: rotate(90deg);
}

.cat-questions {
  padding-bottom: 6px;
}

.q {
  width: 100%;
  appearance: none;
  border: 0;
  border-left: 3px solid transparent;
  background: transparent;
  text-align: left;
  padding: 9px 18px 9px 22px;
  font: inherit;
  font-size: 12.5px;
  color: var(--text);
  cursor: pointer;
  line-height: 1.4;
  display: flex;
  gap: 6px;
}
.q:hover {
  background: var(--panel-2);
}
.q.active {
  background: var(--panel-2);
  border-left-color: var(--accent);
  color: var(--accent-soft);
}
.q .num {
  color: var(--muted);
  font-size: 11px;
  flex-shrink: 0;
  margin-top: 1px;
}
.q mark,
.answer mark {
  background: var(--highlight);
  color: #1a1400;
  border-radius: 2px;
  padding: 0 2px;
}

.no-results {
  padding: 20px;
  color: var(--muted);
  font-size: 13px;
}

/* Main */
#main {
  flex: 1;
  overflow-y: auto;
  padding: 40px 56px 80px;
  scrollbar-width: thin;
  scrollbar-color: #2a3f55 transparent;
}
#main::-webkit-scrollbar {
  width: 10px;
}
#main::-webkit-scrollbar-thumb {
  background: #2a3f55;
  border-radius: 5px;
}

.welcome {
  max-width: 720px;
  margin: 48px auto;
  text-align: center;
  animation: fade 0.35s ease;
}
.welcome-brand {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 14px;
}
.welcome h2 {
  color: var(--text);
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 14px;
  letter-spacing: -0.02em;
}
.welcome p {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 10px;
}
.welcome-hint {
  opacity: 0.85;
}

.answer {
  max-width: 860px;
  margin: 0 auto;
  animation: fade 0.28s ease;
  outline: none;
}
@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.answer .meta {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}
.answer h2 {
  font-size: 22px;
  color: var(--accent-soft);
  margin-bottom: 20px;
  line-height: 1.35;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
  font-weight: 600;
}
.answer .body {
  font-size: 15px;
  line-height: 1.75;
  color: var(--text);
}
.answer .body p {
  margin-bottom: 12px;
}
.answer .body strong {
  color: var(--accent-soft);
  font-weight: 600;
}
.answer .body ul,
.answer .body ol {
  margin: 10px 0 14px 22px;
}
.answer .body li {
  margin-bottom: 8px;
}
.answer .body em {
  color: var(--highlight);
  font-style: normal;
  font-weight: 500;
}
.answer .body code {
  background: var(--panel-2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--accent-soft);
}

.sidebar-close {
  display: none;
}

@media (max-width: 900px) {
  body {
    flex-direction: column;
  }
  .topbar {
    display: flex;
  }
  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(92vw, 380px);
    transform: translateX(-105%);
    transition: transform 0.25s ease;
  }
  body.menu-open #sidebar {
    transform: translateX(0);
  }
  body.menu-open .overlay {
    display: block;
  }
  .sidebar-close {
    display: inline-flex;
  }
  #main {
    padding: 72px 20px 60px;
  }
  .welcome h2 {
    font-size: 22px;
  }
  .answer h2 {
    font-size: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
