/* ==========================================================================
   starecho 全站样式：黑底终端
   --------------------------------------------------------------------------
   取自「逐日笔记 · FUI 版式设计稿」的 A 方向：黑底、等宽字、荧光字的辉光、
   CRT 扫描线；一行表头，其余留白；选中的东西用一块反色滑块标出来。
   颜色和字体只在下面定义一次，全站引用。
   ========================================================================== */

@import url("fonts.css");

:root {
  --bg:    #050506;   /* 屏幕底色 */
  --ink:   #f1f2f3;   /* 荧光字 */
  --muted: #9a9da2;   /* 次要文字、空白项 */
  --bar:   #3a3c41;   /* 表头条、"已归档"标记 */
  --sel:   #1b1c1f;   /* 当前行的底 */
  --rule:  #26282c;   /* 细线 */
  --live:  #a9c8f0;   /* 活动状态：可写、已批准 */
  --live-ink: #0b0f14;

  /* 界面用系统自带的等宽字；手机上没有这几种时退到本站自带的 Courier Prime，中文始终是宋体 */
  --f-ui:   Consolas, "Cascadia Mono", "SF Mono", Menlo, "Courier Prime", "Noto Serif SC", "Songti SC", monospace;
  --f-text: "Courier Prime", "Noto Serif SC", "Songti SC", "SimSun", "Courier New", monospace;
  --glow: 0 0 2px rgba(255, 255, 255, .3), 0 0 8px rgba(255, 255, 255, .25);
  --snap: cubic-bezier(.16, 1, .3, 1);
}

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

html { background: var(--bg); color-scheme: dark; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  text-shadow: var(--glow);
  font-family: var(--f-ui);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--ink); text-underline-offset: 3px; }
a:hover { color: #fff; }
button, input, select, textarea { font: inherit; color: inherit; text-shadow: inherit; }
button { cursor: pointer; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
:focus-visible { outline: 1px solid var(--ink); outline-offset: 2px; }
[hidden] { display: none !important; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- 屏幕：三层盖在内容上面的效果，都不挡鼠标 ---------- */
/* 扫描线 */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 90; pointer-events: none;
  background: repeating-linear-gradient(to bottom,
    rgba(255, 255, 255, .012) 0px, rgba(255, 255, 255, .012) 4.5px,
    rgba(0, 0, 0, .075) 7px, rgba(0, 0, 0, .075) 7.4px, rgba(0, 0, 0, 0) 8px);
}
/* 四角压暗 */
body::after {
  content: "";
  position: fixed; inset: 0; z-index: 92; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 58%, rgba(0, 0, 0, .5) 100%);
}
/* 一条慢慢往下走的暗带（由 term.js 放进页面） */
.hum {
  position: fixed; left: 0; right: 0; top: -30%; height: 30%; z-index: 91; pointer-events: none;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, .38) 50%, rgba(0, 0, 0, 0) 100%);
  animation: hum 14s linear infinite;
}
@keyframes hum { from { top: -30%; } to { top: 100%; } }

/* ---------- 版面骨架 ---------- */
.screen {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 52px 64px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.column { width: 100%; max-width: 860px; display: flex; flex-direction: column; gap: 14px; flex: 1; }

/* 表头条：一页只有一条 */
.bar {
  padding: 5px 14px;
  background: var(--bar);
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline;
  gap: 2px 16px;
}
.bar h1, .bar .bar-title { margin: 0; font: inherit; }
.bar a { text-decoration: none; }
.bar a:hover { text-decoration: underline; }
.bar-path { display: flex; gap: 10px; align-items: baseline; min-width: 0; }

/* 状态栏：页面最底下一条 */
.status {
  margin-top: auto;
  min-height: 22px;
  padding: 8px 14px 0;
  border-top: 1px solid var(--rule);
  font-size: 13px; line-height: 1.6;
  color: var(--muted);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 20px;
}
.status a, .status button { color: var(--muted); }
.status a:hover, .status button:hover { color: var(--ink); }

/* 朴素的文字按钮 */
.link {
  background: none; border: 0; padding: 0;
  text-decoration: underline; text-underline-offset: 3px;
}
.link:disabled { opacity: .4; cursor: default; text-decoration: none; }

/* 状态标记：一小块实底 */
.chip {
  display: inline-block; box-sizing: content-box;
  height: .92em; padding: 1px 6px; line-height: .8;
  vertical-align: baseline; white-space: nowrap;
  font-family: "Noto Serif SC", "Songti SC", SimSun, serif;
  text-shadow: none;
  background: var(--bar); color: #fff;
}
.chip-live { background: var(--live); color: var(--live-ink); box-shadow: 0 0 10px rgba(169, 200, 240, .35); }
.chip-blank { background: none; color: var(--muted); box-shadow: inset 0 0 0 1px var(--bar); }
.pulse { animation: pulse 1.25s cubic-bezier(.37, 0, .63, 1) infinite alternate; }
@keyframes pulse { from { opacity: 1; } to { opacity: .3; } }

/* ---------- 列表行：日期/名称 + 说明 ---------- */
.rows { display: flex; flex-direction: column; position: relative; }
.row {
  display: grid; grid-template-columns: max-content minmax(0, 1fr) auto;
  align-items: baseline; gap: 10px;
  padding: 4px 10px 4px 7px;
  border-left: 3px solid transparent;
  text-decoration: none; color: var(--ink);
}
.row > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.is-blank { color: var(--muted); }
.row.is-current { border-left-color: var(--ink); background: var(--sel); }
.row-note { color: var(--muted); }

/* ---------- 反色滑块 ----------
   一块白色、用"差值"方式和底下内容混合的方块：盖到哪里，哪里就黑白颠倒。
   移动时前沿先到、后沿慢一拍跟上，像被拉了一下再弹回原长。 */
.hl-box { position: relative; }
.hl {
  position: absolute; left: 0; right: 0;
  background: var(--ink); mix-blend-mode: difference; pointer-events: none;
  box-shadow: 0 0 14px rgba(255, 255, 255, .4);
}
.hl.down { transition: bottom .084s var(--snap), right .084s var(--snap), top .108s var(--snap) .042s, left .108s var(--snap) .042s; }
.hl.up   { transition: top .084s var(--snap), left .084s var(--snap), bottom .108s var(--snap) .042s, right .108s var(--snap) .042s; }

/* 首页和目录页的大菜单：整行被滑块盖住。每项前面的数字是它的快捷键 */
.menu { display: flex; flex-direction: column; }
.menu-key { color: var(--muted); }
.menu-item {
  display: grid; grid-template-columns: 1.2em 7em minmax(0, 1fr) auto;
  align-items: baseline; gap: 16px;
  padding: 9px 14px;
  text-decoration: none; color: var(--ink);
  font-size: 16px; line-height: 30px;
  font-family: var(--f-text);
}
.menu-item .menu-note { color: var(--muted); }
.menu-item:focus-visible { outline: none; }

/* 读数行：表头条下面一行小字，放时间、状态这类随时在变的东西 */
.readout {
  margin: 0; padding: 6px 14px 0;
  font-family: var(--f-text); font-size: 14.5px; line-height: 1.7;
  color: var(--muted);
}
/* 分组名：这一组入口公不公开 */
.group-label {
  display: flex; align-items: baseline; gap: 10px;
  padding: 16px 14px 2px;
  color: var(--muted);
}
.menu > .group-label:first-child { padding-top: 8px; }
.group-label + .rows .row { padding-left: 11px; }   /* 和上面的分组名左边对齐 */

/* 开机：每次打开浏览器第一次进首页时，各行自上而下依次亮起，然后滑块落到第一项上 */
.booting [data-line] { animation: line-on .1s steps(2, end) backwards; animation-delay: calc(var(--i, 0) * 42ms); }
.booting .hl { opacity: 0; }
@keyframes line-on { from { opacity: 0; } to { opacity: 1; } }

/* ---------- 正文（博客文章） ---------- */
.prose {
  max-width: 820px;
  padding: 6px 14px 20px;
  font-family: var(--f-text);
  font-size: 16px; line-height: 30px;
}
.prose .meta { font-size: 14.5px; line-height: 1.7; color: var(--muted); margin: 0 0 14px; }
.prose p { margin: 0; }
.prose p + p, .prose p + ul, .prose p + ol, .prose ul + p, .prose ol + p, .prose pre + p, .prose blockquote + p { margin-top: 30px; }
.prose h2 { margin: 30px 0 0; font: inherit; font-weight: 700; }
.prose h2::before { content: "## "; color: var(--muted); font-weight: 400; }
.prose ul, .prose ol { margin: 30px 0 0; padding-left: 2em; }
.prose blockquote { margin: 30px 0 0; padding-left: 14px; border-left: 3px solid var(--ink); }
.prose code { font-family: var(--f-ui); font-size: 14px; background: var(--sel); padding: 2px 6px; }
.prose pre { margin: 30px 0 0; padding: 10px 14px; background: var(--sel); overflow-x: auto; line-height: 1.6; }
.prose pre code { background: none; padding: 0; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 30px 0; }

/* ---------- 登录页 ---------- */
.gate { max-width: 560px; padding: 6px 14px 20px; font-family: var(--f-text); font-size: 16px; line-height: 30px; }
.gate-field { display: grid; grid-template-columns: 4em minmax(0, 1fr); gap: 10px; align-items: baseline; }
.gate-field label, .gate-field dt { color: var(--muted); }
.gate-field dd { margin: 0; }
.gate dl { margin: 0; }
.gate input[type="password"] {
  width: 100%; padding: 0; border: 0; border-radius: 0;
  background: transparent; outline: 0;
  letter-spacing: .2em;
  caret-color: var(--ink); caret-shape: block;
}
.gate form { margin: 0; }
.gate-submit { margin-top: 30px; }
.gate-submit button {
  padding: 0 14px; border: 0; border-radius: 0;
  background: var(--ink); color: var(--bg); text-shadow: none;
  font-family: var(--f-ui); font-size: 14px; line-height: 31px;
  box-shadow: 0 0 14px rgba(255, 255, 255, .4);
}
.gate-submit button:disabled { background: var(--bar); color: var(--muted); box-shadow: none; cursor: default; }

.steps { list-style: none; margin: 30px 0 0; padding: 0; position: relative; }
.steps li { display: flex; gap: 10px; align-items: baseline; padding: 0 14px; margin: 0 -14px; color: var(--muted); }
.steps li::before { content: ">"; }
.steps li .dots { flex: 1; overflow: hidden; white-space: nowrap; color: var(--rule); text-shadow: none; }
.steps li[data-state="doing"], .steps li[data-state="done"], .steps li[data-state="failed"] { color: var(--ink); }
.steps li[data-state="doing"] .result { animation: pulse .5s cubic-bezier(.37, 0, .63, 1) infinite alternate; }
.verdict { min-height: 30px; margin: 30px 0 0; }

/* 口令不对：整块横向抖一下，像信号被干扰 */
.gate.is-refused { animation: jitter .32s steps(6, end); }
@keyframes jitter {
  0%, 100% { transform: translateX(0); }
  17% { transform: translateX(-7px); }
  34% { transform: translateX(5px); }
  51% { transform: translateX(-3px); }
  68% { transform: translateX(6px); }
  85% { transform: translateX(-2px); }
}
/* 放行：整屏反色闪一下再进门 */
.flash { position: fixed; inset: 0; z-index: 80; background: var(--ink); mix-blend-mode: difference; pointer-events: none; opacity: 0; }
.flash.go { animation: flash .42s var(--snap) forwards; }
@keyframes flash { 0% { opacity: 0; } 25% { opacity: 1; } 100% { opacity: 1; } }

/* ---------- 窄屏 ---------- */
@media (max-width: 760px) {
  .screen { padding: 20px 14px 24px; }
  .menu-item { grid-template-columns: 1.2em minmax(0, 1fr) auto; gap: 10px; }
  .menu-item .menu-note { grid-column: 2 / -1; grid-row: 2; line-height: 1.6; font-size: 14px; }
  .only-wide { display: none; }
}

/* ---------- 不想看动画的访客 ---------- */
@media (prefers-reduced-motion: reduce) {
  .hum, .pulse, .steps li[data-state="doing"] .result { animation: none; }
  .hum { display: none; }
  .hl { transition: none !important; }
  .gate.is-refused, .flash.go { animation-duration: .01ms; }
  .booting [data-line] { animation: none; }
  .booting .hl { opacity: 1; }
}
