*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg-main: #060507;
  --bg-sidebar: #050306;
  --accent: #ff4b3a;
  --accent-soft: #ff8b54;
  --accent-neon: #ff6b5b;
  --text-main: #f4f0ee;
  --text-soft: #b9b1ad;
  --border: #2d2024;
  --card-bg: #151217;
  --card-border: #33242a;
  --font-main: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco,
    Consolas, "Liberation Mono", "Courier New", monospace;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  letter-spacing: 0.03em;
  cursor: none;
}

/* CRT */

body.crt-on {
  position: relative;
}

body.crt-on::before {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  background-image: linear-gradient(
    rgba(0, 0, 0, 0.25) 1px,
    transparent 1px
  );
  background-size: 100% 2px;
  mix-blend-mode: multiply;
  opacity: 0.6;
  z-index: 999;
}

body.crt-on::after {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 50% 0, rgba(255, 132, 78, 0.28), transparent 60%),
    radial-gradient(circle at 85% 80%, rgba(255, 70, 72, 0.24), transparent 60%);
  opacity: 0.55;
  mix-blend-mode: screen;
  z-index: 998;
}

/* 加载动画 */

#loading-screen {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top, #ffb38b 0, #7a2b28 45%, #050307 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  color: #130c0b;
}

#loading-screen.hidden {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
}

.loading-inner {
  border: 2px solid #130c0b;
  background: rgba(14, 9, 11, 0.96);
  padding: 22px 28px;
  max-width: 520px;
  width: 90%;
  position: relative;
  box-shadow: 0 0 0 3px #130c0b, 0 0 40px rgba(0, 0, 0, 0.9);
  overflow: hidden;
  color: #f5e8df;
}

.loading-inner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0.08),
    rgba(255, 255, 255, 0.08) 1px,
    transparent 1px,
    transparent 5px
  );
  mix-blend-mode: soft-light;
  opacity: 0.35;
  pointer-events: none;
}

.loading-logo {
  font-family: var(--font-mono);
  font-size: 22px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-bottom: 6px;
}

.loading-sub {
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 18px;
}

.loading-bar {
  width: 100%;
  height: 10px;
  border: 2px solid #130c0b;
  background: #2b1514;
  overflow: hidden;
  margin-bottom: 10px;
  position: relative;
}

.loading-bar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    transparent 0%,
    rgba(255, 255, 255, 0.55) 40%,
    transparent 80%
  );
  animation: loading-scan 1.1s linear infinite;
}

.loading-bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #ff4b3a, #ffbe6b);
  animation: loading-fill 2.1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.loading-meta {
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.loading-step {
  opacity: 0.35;
  animation: loading-step 1.6s ease-in-out infinite alternate;
}

.loading-step:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-step:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes loading-fill {
  0% {
    width: 0;
  }
  100% {
    width: 100%;
  }
}

@keyframes loading-scan {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

@keyframes loading-step {
  0% {
    opacity: 0.25;
  }
  100% {
    opacity: 0.9;
  }
}

/* 自定义鼠标 */

#cursor-ring,
#cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 2100;
  transform: translate3d(-50%, -50%, 0);
  mix-blend-mode: exclusion;
}

#cursor-ring {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.7);
  transition: transform 0.12s ease-out, border-color 0.1s, box-shadow 0.1s,
    background-color 0.1s;
}

#cursor-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
  transition: transform 0.06s ease-out, opacity 0.1s;
}

#cursor-ring.cursor-hover {
  border-color: var(--accent-neon);
  box-shadow: 0 0 14px rgba(255, 120, 112, 0.95);
  background-color: rgba(255, 120, 112, 0.1);
}

#cursor-ring.cursor-click {
  transform: translate3d(-50%, -50%, 0) scale(0.75);
}

#cursor-dot.cursor-click {
  transform: translate3d(-50%, -50%, 0) scale(0.5);
}

@media (pointer: coarse) {
  body {
    cursor: default;
  }

  #cursor-ring,
  #cursor-dot {
    display: none;
  }
}

/* 布局 */

.app-frame {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

body.app-ready .app-frame {
  opacity: 1;
  transform: translateY(0);
}

/* 侧边栏 */

.sidebar {
  background-color: var(--bg-sidebar);
  color: #f1dde0;
  border-right: 3px solid #000;
  padding: 20px 16px 16px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.25;
  pointer-events: none;
}

.logo-block {
  border: 2px solid #e3c1c5;
  padding: 12px;
  margin-bottom: 18px;
  background: radial-gradient(circle at 0% 0%, #ff7050 0, #1a090b 55%);
  position: relative;
}

.logo-block::after {
  content: "WORLD NODE";
  position: absolute;
  right: 9px;
  bottom: -10px;
  font-size: 9px;
  font-family: var(--font-mono);
  letter-spacing: 0.18em;
  padding: 1px 4px;
  background: #f1dde0;
  color: #1a090b;
}

.logo-title {
  font-family: var(--font-mono);
  font-size: 18px;
  line-height: 1.1;
  text-transform: uppercase;
}

.logo-sub {
  margin-top: 4px;
  font-size: 11px;
  opacity: 0.85;
}

.nav {
  margin-bottom: 24px;
  position: relative;
  z-index: 1;
}

.nav-group-title {
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 8px;
  opacity: 0.72;
}

.nav-item {
  width: 100%;
  text-align: left;
  border: 1px solid #362127;
  background: #10090b;
  color: #f1dde0;
  font-size: 13px;
  padding: 8px 10px;
  margin-bottom: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: background 0.15s, transform 0.08s ease-out, box-shadow 0.15s,
    border-color 0.15s;
}

.nav-item::after {
  content: "";
  position: absolute;
  left: -40%;
  bottom: 0;
  width: 40%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transform: translateX(0);
  transition: opacity 0.16s linear, transform 0.18s ease-out;
}

.nav-item:hover {
  background: #1d0c0f;
  box-shadow: 0 0 0 1px var(--accent-soft);
  transform: translateY(-1px);
  border-color: var(--accent-soft);
}

.nav-item:hover::after {
  opacity: 1;
  transform: translateX(120%);
}

.nav-item.active {
  background: linear-gradient(90deg, #ff4b3a, #ff8b54);
  color: #180507;
  border-color: #000;
  box-shadow: 0 0 0 1px #000, 0 0 16px rgba(255, 88, 72, 0.9);
}

.system-config {
  margin-top: auto;
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}

.system-config-title {
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 6px;
  opacity: 0.7;
}

.sys-btn {
  width: 100%;
  border: 1px solid #342126;
  margin-bottom: 6px;
  padding: 8px 10px;
  font-size: 12px;
  background: #0e0709;
  color: #f1dde0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, transform 0.08s,
    border-color 0.15s;
}

.sys-btn .label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
}

.sys-btn .value {
  font-family: var(--font-mono);
}

.sys-btn:hover {
  background: #1a0a0d;
  box-shadow: 0 0 0 1px var(--accent-soft);
  transform: translateY(-1px);
}

.sys-btn.active {
  background: linear-gradient(90deg, #ff4b3a, #ff8b54);
  color: #180507;
  border-color: #000;
}

.system-note {
  font-size: 11px;
  margin-top: 8px;
  opacity: 0.85;
}

.status-bar {
  font-size: 11px;
  font-family: var(--font-mono);
  border-top: 1px solid #2d1d21;
  padding-top: 8px;
  margin-top: 4px;
  position: relative;
  z-index: 1;
}

.status-line + .status-line {
  margin-top: 2px;
}

.status-online {
  color: #88ff8a;
}

/* 主内容 */

.main {
  background:
    radial-gradient(circle at 0 0, rgba(255, 120, 72, 0.22), transparent 55%),
    radial-gradient(circle at 100% 100%, rgba(154, 39, 38, 0.4), #050307 60%),
    repeating-linear-gradient(
      to right,
      rgba(255, 255, 255, 0.06) 0,
      rgba(255, 255, 255, 0.06) 1px,
      transparent 1px,
      transparent 22px
    );
  padding: 18px 26px 26px;
  overflow: auto;
}

/* 顶部 header */

.top-header {
  border-bottom: 3px solid #ff4b3a;
  padding-bottom: 10px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.top-left {
  max-width: 70%;
}

.top-label {
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 6px;
  color: #f4b9a5;
}

.top-title {
  font-size: 28px;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.glitch-text {
  position: relative;
  display: inline-block;
}

.glitch-text::before,
.glitch-text::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  overflow: hidden;
  clip-path: inset(0 0 50% 0);
  opacity: 0.6;
  pointer-events: none;
}

.glitch-text::before {
  transform: translate(-1px, -1px);
  color: #ff4b3a;
}

.glitch-text::after {
  transform: translate(1px, 1px);
  color: #2ed7ff;
}

.top-meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-soft);
}

.top-meta span {
  font-family: var(--font-mono);
  color: #ffb98f;
}

.top-right {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #f4b9a5;
}

.rec-label {
  letter-spacing: 0.18em;
  margin-bottom: 2px;
}

.rec-value {
  border: 1px solid #ff4b3a;
  display: inline-block;
  padding: 4px 8px;
  background: rgba(10, 5, 6, 0.85);
  color: #ffd8bd;
}

/* section / card */

.section {
  display: none;
  margin-bottom: 24px;
  animation: section-enter 0.35s ease-out;
}

.section.active {
  display: block;
}

@keyframes section-enter {
  0% {
    opacity: 0;
    transform: translateY(6px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.section-title {
  font-size: 18px;
  margin: 10px 0 12px;
  padding-bottom: 4px;
  position: relative;
}

.section-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 110px;
  background: linear-gradient(90deg, #ff4b3a, #ffbe6b, transparent);
}

.card-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.card {
  background-color: var(--card-bg);
  border: 2px solid var(--card-border);
  padding: 12px 14px;
  flex: 1 1 220px;
  position: relative;
  box-shadow: 0 3px 0 #000;
  transition: transform 0.15s ease-out, box-shadow 0.15s ease-out,
    border-color 0.15s;
  color: var(--text-soft);
}

.card-wide {
  flex-basis: 100%;
}

.card-quote {
  max-width: 280px;
  background: radial-gradient(circle at 0 0, #ff8c57 0, #381016 60%);
  color: #fcefe5;
}

.card:hover {
  transform: translate(-2px, -3px);
  box-shadow: 3px 6px 0 #000;
  border-color: #ff7550;
}

.card-title {
  margin: 0 0 6px;
  font-size: 16px;
  color: #f6ebe6;
}

.card-text {
  font-size: 13px;
  margin: 0;
}

.card-text + .card-text {
  margin-top: 6px;
}

.card-text.small {
  font-size: 12px;
}

.card-tag {
  position: absolute;
  top: -10px;
  right: 12px;
  padding: 2px 6px;
  font-size: 10px;
  font-family: var(--font-mono);
  background: #ff4b3a;
  color: #140407;
}

.card-label {
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 6px;
  display: inline-block;
  padding: 2px 4px;
  border: 1px solid #ff7550;
  background: rgba(10, 5, 7, 0.9);
  color: #ffb98f;
}

.card-quote-text {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 6px;
}

/* chips */

.card-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chip {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid #ff7550;
  background-color: rgba(255, 139, 84, 0.08);
  color: #ffb98f;
}

/* meta list */

.meta-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--text-soft);
}

.meta-list li + li {
  margin-top: 4px;
}

.meta-list span {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  color: #ffb98f;
}

/* 时间线 */

.timeline {
  border-left: 2px solid #ff4b3a;
  padding-left: 16px;
  margin-top: 8px;
}

.timeline-item {
  position: relative;
  margin-bottom: 16px;
  padding-left: 2px;
}

.timeline-dot {
  position: absolute;
  left: -11px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #000;
  background: radial-gradient(circle, #ffbf6b, #ff4b3a);
  box-shadow: 0 0 10px rgba(255, 122, 78, 0.9);
}

.timeline-content {
  padding-left: 4px;
}

.timeline-date {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  margin-bottom: 4px;
  color: #ffb98f;
}

.timeline-title {
  margin: 0 0 4px;
  font-size: 15px;
  color: #f8ebe4;
}

.timeline-text {
  font-size: 13px;
  color: var(--text-soft);
  margin: 0;
}

/* 章节列表 */

.chapter-list {
  margin-top: 8px;
}

.chapter-item {
  display: flex;
  border: 2px solid var(--card-border);
  background: var(--card-bg);
  margin-bottom: 8px;
  box-shadow: 0 3px 0 #000;
  transition: transform 0.15s ease-out, box-shadow 0.15s ease-out;
}

.chapter-item:hover {
  transform: translate(-2px, -3px);
  box-shadow: 3px 6px 0 #000;
}

.chapter-index {
  width: 52px;
  border-right: 2px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 16px;
  background: radial-gradient(circle at 0 0, #ff8b54 0, #280c10 60%);
  color: #1a0506;
}

.chapter-body {
  padding: 8px 12px;
}

.chapter-title {
  margin: 0 0 4px;
  font-size: 15px;
  color: #f6ebe6;
}

.chapter-text {
  margin: 0;
  font-size: 13px;
  color: var(--text-soft);
}

/* 响应式 */

@media (max-width: 900px) {
  .app-frame {
    grid-template-columns: 1fr;
  }

  .sidebar {
    flex-direction: row;
    align-items: flex-start;
    padding-bottom: 10px;
    overflow-x: auto;
  }

  .logo-block {
    margin-bottom: 0;
    margin-right: 12px;
    min-width: 140px;
  }

  .nav {
    flex: 1;
    margin: 0 12px 0 0;
  }

  .system-config,
  .status-bar {
    display: none;
  }

  .main {
    padding: 14px 16px 20px;
  }

  .top-left {
    max-width: 100%;
  }
}
