/* 像素只留在下方的世界里；界面是轻拟物：同色系表面 + 一亮一暗两道柔光营造凸起 */
:root {
  --px: 4px;
  --stage: 200px;
  --ground: 128px;
  --strip: 180px; /* 阅读时露出的世界高度，由 world.ts 按像素比例改写 */
  --sink: 110px;
  --tint: #cdebff;
  --radius: 22px;
  --font: 'Inter', 'PingFang SC', 'HarmonyOS Sans SC', 'Microsoft YaHei', system-ui, sans-serif;
  --mono: ui-monospace, 'SFMono-Regular', 'JetBrains Mono', Menlo, monospace;
}
:root, [data-theme='light'] {
  color-scheme: light;
  --bg: #eef1f5;
  --surface: #f2f4f8;
  --surface-hi: #f7f9fc;
  --surface-lo: #e9edf2;
  --sh-dark: rgb(163 177 198 / 0.55);
  --sh-light: rgb(255 255 255 / 0.95);
  --edge: rgb(255 255 255 / 0.7);
  --text: #2b313c;
  --muted: #7a8394;
  --accent: #3a9a30;
  --accent-soft: rgb(58 154 48 / 0.12);
  --world-filter: none;
}
[data-theme='dark'] {
  color-scheme: dark;
  --bg: #15181d;
  --surface: #1a1e24;
  --surface-hi: #1f242b;
  --surface-lo: #171a1f;
  --sh-dark: rgb(0 0 0 / 0.55);
  --sh-light: rgb(255 255 255 / 0.045);
  --edge: rgb(255 255 255 / 0.05);
  --text: #e3e7ee;
  --muted: #8b93a3;
  --accent: #7ccf5c;
  --accent-soft: rgb(124 207 92 / 0.12);
  --world-filter: none; /* 夜色由 world.ts 绘制 */
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  transition: background-color 0.3s;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---- 顶栏 ---- */
.topbar {
  position: absolute; z-index: 3; top: 0; left: 0; right: 0; /* 首页改为 fixed，见 home.css */
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 22px; pointer-events: none;
}
.topbar a, .topbar button { pointer-events: auto; }
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 18px; letter-spacing: 0.3px; text-decoration: none;
}
.brand-dot {
  width: 10px; height: 10px; background: var(--accent);
  box-shadow: 10px 0 0 color-mix(in srgb, var(--accent) 55%, transparent), 0 10px 0 color-mix(in srgb, var(--accent) 35%, transparent);
  margin-right: 10px;
}
.toplinks { display: flex; gap: 10px; align-items: center; }
.toplinks a, .theme-btn {
  font: inherit; font-size: 13px; color: var(--muted); text-decoration: none;
  padding: 7px 13px; border-radius: 12px; border: 0; cursor: pointer;
  background: var(--surface);
  box-shadow: 4px 4px 10px var(--sh-dark), -4px -4px 10px var(--sh-light);
  transition: box-shadow 0.15s, color 0.15s;
}
.toplinks a:hover, .theme-btn:hover { color: var(--accent); }
.toplinks a:active, .theme-btn:active { box-shadow: inset 3px 3px 7px var(--sh-dark), inset -3px -3px 7px var(--sh-light); }
.theme-btn { display: grid; place-items: center; padding: 7px 9px; }
.theme-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.theme-btn .i-moon { fill: currentColor; stroke: none; }
[data-theme='light'] .i-moon, [data-theme='dark'] .i-sun { display: none; }

/* ---- 凸起卡片 ---- */
.card {
  position: relative;
  max-height: 100%;
  overflow: auto;
  padding: 26px 28px 24px;
  border-radius: var(--radius);
  background: linear-gradient(145deg, var(--surface-hi), var(--surface-lo));
  box-shadow: 14px 14px 32px var(--sh-dark), -12px -12px 28px var(--sh-light), inset 1px 1px 0 var(--edge);
  scrollbar-width: thin;
}
.card-title { margin: 0 0 18px; display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 700; }
/* 唯一的像素元素：标题前的一颗方块 */
.title-dot { width: 8px; height: 8px; background: var(--accent); box-shadow: 8px 8px 0 color-mix(in srgb, var(--accent) 40%, transparent); margin-right: 8px; }
.biome-chip {
  margin-left: auto; font-size: 12px; font-weight: 500; color: var(--muted);
  padding: 4px 12px; border-radius: 999px;
  box-shadow: inset 2px 2px 5px var(--sh-dark), inset -2px -2px 5px var(--sh-light);
}

.btn {
  display: inline-block; text-decoration: none; padding: 9px 16px; margin: 0 10px 10px 0;
  border-radius: 12px; font-size: 14px; color: var(--text); background: var(--surface);
  box-shadow: 5px 5px 12px var(--sh-dark), -5px -5px 12px var(--sh-light);
  transition: box-shadow 0.15s, color 0.15s;
}
.btn:hover { color: var(--accent); }
.btn:active { box-shadow: inset 3px 3px 8px var(--sh-dark), inset -3px -3px 8px var(--sh-light); }


@media (max-width: 640px) {
  .topbar { padding: 12px 14px; }
  .toplinks { gap: 8px; }
  .toplinks a { font-size: 12px; padding: 6px 10px; }
  .brand { font-size: 16px; }
  .card { padding: 20px 18px 16px; border-radius: 18px; box-shadow: 8px 8px 20px var(--sh-dark), -8px -8px 18px var(--sh-light), inset 1px 1px 0 var(--edge); }
  .card-title { font-size: 18px; margin-bottom: 14px; }
}

/* ---- 打开面板的按钮：比普通按钮更显眼，带强调色和一个会前移的箭头 ---- */
.btn-open {
  display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--accent);
  background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 10%, var(--surface-hi)), color-mix(in srgb, var(--accent) 4%, var(--surface-lo)));
  box-shadow: 6px 6px 14px var(--sh-dark), -6px -6px 14px var(--sh-light), inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
}
.btn-open:hover {
  color: var(--accent);
  box-shadow: 8px 8px 18px var(--sh-dark), -8px -8px 18px var(--sh-light), inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent);
}
.btn-open:active { box-shadow: inset 3px 3px 8px var(--sh-dark), inset -3px -3px 8px var(--sh-light), inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent); }
.open-icon {
  width: 7px; height: 7px; flex: none; border-top: 2px solid currentColor; border-right: 2px solid currentColor;
  transform: rotate(45deg); margin-right: 2px; transition: transform 0.2s;
}
.btn-open:hover .open-icon { transform: translateX(3px) rotate(45deg); }
@media (prefers-reduced-motion: reduce) { .open-icon { transition: none; } }

/* ---- 滚动条：页面本身不显示（首页靠快捷栏指示位置），卡片内是自绘的细圆条 ---- */
html.js { scrollbar-width: none; }
html.js::-webkit-scrollbar { display: none; }
/* 默认看不见，滚动时（theme.ts 加 .is-scrolling）才浮现，停下约 0.9 秒后再隐去 */
* { scrollbar-width: thin; }
.js * { scrollbar-color: transparent transparent; }
.js .is-scrolling { scrollbar-color: color-mix(in srgb, var(--muted) 50%, transparent) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 8px; background-clip: padding-box; background-color: color-mix(in srgb, var(--muted) 45%, transparent); }
.js ::-webkit-scrollbar-thumb { background-color: transparent; }
.js .is-scrolling::-webkit-scrollbar-thumb { background-color: color-mix(in srgb, var(--muted) 45%, transparent); }
.js .is-scrolling::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--muted) 70%, transparent); }
