/* 基础层：重置、背景、顶栏、容器 */
*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--neon-cyan); text-decoration: none; }
a:hover { text-shadow: var(--glow-cyan); }

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: 0.02em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }

::selection { background: rgba(57, 255, 20, 0.28); }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #0c0c14; }
::-webkit-scrollbar-thumb {
  background: rgba(57, 255, 20, 0.22);
  border-radius: 10px;
  border: 2px solid #0c0c14;
}
::-webkit-scrollbar-thumb:hover { background: rgba(57, 255, 20, 0.4); }

/* 背景：网格 + 光晕 + 扫描线 */
.bg-grid { display: none; }

.bg-glow { display: none; }

.scanlines { display: none; }

/* 顶栏 */
.topbar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: 222px;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 32px 20px 20px;
  background: #151619;
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  user-select: none;
}
.brand__symbol { display: grid; place-content: center; position: relative; width: 42px; height: 42px; flex-shrink: 0; border-radius: 12px; background: var(--neon-green); color: #19220c; font-size: 26px; font-weight: 900; line-height: 1; }
.brand__symbol span { position: absolute; right: 6px; bottom: 7px; font-size: 18px; }
.brand__name { display: flex; flex-direction: column; gap: 3px; }
.brand__mark {
  font-family: var(--font-ui);
  font-size: 21px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.1em;
}
.brand__sub {
  font-size: 8px;
  color: var(--text-dim);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sidebar-label { color: #666c76; font-size: 11px; margin: 48px 10px 8px; letter-spacing: 0.08em; }
.nav { display: flex; flex-direction: column; gap: 6px; }
.nav__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 12px;
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-dim);
  border: 1px solid transparent;
  cursor: pointer;
  background: none;
  transition: all 0.18s var(--ease);
}
.nav__item:hover { color: var(--text); border-color: var(--line-strong); }
.nav__item.is-active {
  color: var(--neon-green);
  background: rgba(204, 255, 115, 0.08);
  border-color: rgba(204, 255, 115, 0.1);
  font-weight: 600;
}
.nav__item svg, .sidebar-settings svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.nav__arrow { margin-left: auto; opacity: 0; }
.is-active .nav__arrow { opacity: 1; }
.sidebar-note { margin-bottom: 20px; padding: 16px 14px; background: #1c1e21; border: 1px solid var(--line); border-radius: 12px; font-size: 11px; color: var(--text-2); }
.sidebar-note__dot { display: inline-block; width: 5px; height: 5px; background: var(--neon-green); border-radius: 50%; margin-right: 6px; }
.sidebar-note p { color: var(--text-dim); font-size: 11px; line-height: 1.9; margin-top: 10px; }
.sidebar-settings { display: flex; align-items: center; gap: 10px; border: 0; background: none; color: var(--text-2); padding: 12px; text-align: left; cursor: pointer; font-size: 13px; border-radius: 10px; }
.sidebar-settings:hover { background: var(--panel-hi); color: var(--text); }
.sidebar-local { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 8px; color: #717782; font-size: 10px; display: flex; gap: 6px; align-items: center; }
.sidebar-local__tag { margin-left: auto; font-family: var(--font-mono); font-size: 9px; }

.topbar__spacer { flex: 1; }

/* 主容器 */
.view {
  width: calc(100% - 222px);
  max-width: var(--max-w);
  margin: 0 0 0 222px;
  padding: 36px 44px 60px;
  outline: none;
  animation: viewIn 0.32s var(--ease);
}

@keyframes viewIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.page-head { margin-bottom: 24px; }
.page-head h2 { font-size: 28px; letter-spacing: -0.03em; }
.page-head .hint { color: var(--text-dim); font-size: 13px; margin-top: 7px; max-width: 62ch; line-height: 1.6; }

.section-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-shadow: none;
  margin-bottom: 10px;
  opacity: 0.9;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* 键盘焦点可见性（仅键盘导航时出现） */
:focus-visible {
  outline: 2px solid var(--neon-green);
  outline-offset: 2px;
  border-radius: 4px;
}
.input:focus-visible,
.textarea:focus-visible,
.select:focus-visible { outline: none; }

/* 尊重系统「减少动态效果」偏好 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* 窄屏：紧凑顶栏，保留可用导航 */
@media (max-width: 1100px) {
  .topbar { width: 192px; padding: 26px 14px 18px; }
  .view { width: calc(100% - 192px); margin-left: 192px; padding: 30px 28px 50px; }
}
@media (max-width: 760px) {
  .topbar { position: sticky; inset: auto; top: 0; width: 100%; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; padding: 14px 20px 10px; gap: 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand__symbol { width: 32px; height: 32px; font-size: 21px; border-radius: 9px; }
  .brand__mark { font-size: 17px; }
  .brand__sub { font-size: 7px; }
  .nav { order: 3; width: 100%; flex-direction: row; gap: 8px; }
  .nav__item { padding: 9px 12px; font-size: 12px; flex: 1; }
  .nav__arrow { display: none; }
  .sidebar-label, .sidebar-note, .sidebar-local { display: none; }
  .sidebar-settings { padding: 8px; font-size: 12px; }
  .view { width: 100%; margin-left: 0; padding: 26px 20px 48px; }
}
