/* ---------- 访问页：极简命令行风格 ----------
 * 配色全部走项目既有变量（--bg/--panel/--ink/--accent/--line…），
 * 与主站外观完全一致，不新增任何 hex。
 */

/* 终端字体栈：西文等宽（终端列要齐），中文跟用户设置的 --sans。
 * applyAppearance() 只改 --sans、不动 --mono，所以这里在等宽栈之后接 var(--sans)，
 * 用户换成思源 / 雅黑 / 宋体都跟着变。 */
:root {
  --lg-mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", var(--sans), monospace;
  --lg-ease: cubic-bezier(.22, .61, .36, 1);
  --lg-snap: cubic-bezier(.2, .8, .3, 1);
}

.lg-body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  /* 底色 + 纹理：与 core.css 的 body 一致，纹理浓淡烘在 SVG 的 fill-opacity 里，
     不叠半透明层，也不覆盖 applyAppearance() 的 --pattern-image */
  background-color: var(--bg);
  background-image: var(--pattern-image, none);
  background-size: var(--pattern-size, auto);
  background-repeat: repeat;
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--sans);
  font-size: calc(14px * var(--fs));
  -webkit-font-smoothing: antialiased;
}

/* margin:auto 而不是居中属性 —— 内容比视口高时不会把顶部裁掉。
   宽度按 ch 定：终端按字符列排，窗口宽度得跟着字号走，用户把字号调大不会折行。 */
.lg-stage {
  margin: auto;
  width: 100%;
  max-width: calc(58ch + 40px);
  padding: 0 20px;
}

/* ---------- 终端块 ---------- */
.lg-term {
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 22px 22px 18px;
  font-family: var(--lg-mono);
  font-size: calc(13.5px * var(--fs));
  line-height: 1.8;
  color: var(--ink);
  box-shadow: 0 14px 40px -30px rgba(20, 18, 14, .4);
  animation: lg-enter 300ms var(--lg-ease) both;
}
@keyframes lg-enter {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- 顶部命令行 ---------- */
/* 注意：这里不能用 pre-wrap —— 容器里有 <span> 子节点，
   HTML 源码中 span 之间的换行/缩进会被 pre-wrap 当成真实换行，把 $ 和命令拆成两行。 */
.lg-cmd {
  margin-bottom: 14px;
  white-space: normal;
  word-break: break-word;
  color: var(--ink);
}
.lg-sigil {
  color: var(--accent);
  font-weight: 600;
  margin-right: 2px;
  white-space: nowrap;
}

/* ---------- 输入行 ---------- */
.lg-form[hidden] { display: none; }
.lg-line { display: flex; align-items: baseline; gap: 8px; }
.lg-label { color: var(--accent); white-space: nowrap; }
.lg-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  color: var(--ink);
  caret-color: var(--accent);
  /* 聚焦时显出一道强调色下划线，既标出落点又不喧宾夺主。
     固定 2px 透明边框 → 聚焦只换颜色，不产生 1px 布局跳动。 */
  border-bottom: 2px solid transparent;
  transition: border-color .15s;
  padding-bottom: 1px;
}
.lg-input:focus { border-bottom-color: var(--accent); }
.lg-input:focus-visible { outline: none; }
@supports (caret-shape: block) { .lg-input { caret-shape: block; } }

/* 装饰块光标：输入框未聚焦时显示，聚焦后交给原生光标 */
.lg-caret {
  display: inline-block;
  width: .55ch;
  height: 1.05em;
  background: var(--accent);
  vertical-align: -.16em;
  margin-left: .1ch;
  animation: lg-blink 1.06s steps(1, end) infinite;
}
.lg-input:focus + .lg-caret { display: none; }
@keyframes lg-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

/* ---------- 错误行 ---------- */
/* 永远保持"已渲染"状态，只用 :empty 收掉间距：
   用 display:none 隐藏空的 live region 会让读屏器漏播后插入的错误文本。 */
.lg-err {
  margin: 6px 0 0;
  font-size: calc(12px * var(--fs));
  color: var(--warn);
}
.lg-err:empty { margin: 0; }
.lg-err.is-in { animation: lg-err-in 200ms var(--lg-snap) both; }
@keyframes lg-err-in {
  from { opacity: 0; transform: translateY(-2px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- 动作区 ---------- */
.lg-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
}
.lg-btn {
  font: inherit;
  cursor: pointer;
  padding: 3px 12px;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--ink-2);
  transition: background .12s, border-color .12s, color .12s;
}
.lg-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--panel-2); }
.lg-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lg-btn:disabled { opacity: .5; cursor: default; }

.lg-link {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  font: inherit;
  font-size: calc(12px * var(--fs));
  color: var(--ink-3);
  transition: color .12s;
}
.lg-link:hover { color: var(--accent); text-decoration: underline; }
.lg-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

/* ---------- 底部备注 ---------- */
.lg-note {
  margin-top: 18px;
  font-size: calc(12px * var(--fs));
  color: var(--ink-3);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------- 只给读屏 ---------- */
.lg-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- 登录成功后淡出 ---------- */
.lg-term.is-leaving { animation: lg-leave 220ms var(--lg-ease) both; }
@keyframes lg-leave {
  from { opacity: 1; }
  to   { opacity: .85; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 480px) {
  .lg-stage { padding: 0 12px; }
  .lg-term { padding: 16px 14px 14px; border-radius: 5px; }
  /* 窄屏上提示词和输入框换行，避免密码框被挤到看不见 */
  .lg-line { flex-wrap: wrap; }
  .lg-label { white-space: normal; }
}

/* ---------- 动效降级 ---------- */
@media (prefers-reduced-motion: reduce) {
  .lg-term, .lg-err.is-in, .lg-term.is-leaving { animation: none !important; }
  .lg-caret { animation: none !important; opacity: 1; }
  * { transition-duration: .001ms !important; }
}
