/* Jarvis HUD 控制台样式（第 3 单 · 三栏与 1000/1240 手机分页断点）。 */

@property --state { syntax: '<color>'; inherits: true; initial-value: #5fd4ff; }

:root {
  --bg: #060a11;
  --panel: rgba(13, 20, 32, 0.74);
  --panel-2: rgba(22, 32, 50, 0.55);
  --line: rgba(132, 178, 255, 0.14);
  --line-2: rgba(132, 178, 255, 0.28);
  --border: var(--line);
  --text: #d9e6f7;
  --muted: #8094ad;
  --faint: #52647c;
  --accent: #5fd4ff;
  --accent-2: #8fb7ff;
  --amber: #ffb454;
  --green: #6ee7b7;
  --yellow: #fbbf24;
  --red: #ff5d6c;
  --violet: #a08cff;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", "SF Mono", Consolas, Menlo, "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans CJK SC", monospace;
  --sans: "Inter", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, -apple-system, sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  transition: --state 0.8s var(--ease);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }

body {
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: color-mix(in srgb, var(--state) 35%, transparent); }

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(1100px 640px at 14% -12%, rgba(58, 110, 255, 0.17), transparent 62%),
    radial-gradient(900px 620px at 104% 112%, color-mix(in srgb, var(--state) 13%, transparent), transparent 60%),
    radial-gradient(rgba(140, 180, 255, 0.085) 1px, transparent 1.3px) 0 0 / 22px 22px;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 60%, rgba(0, 0, 0, 0.42));
}

#bg { position: fixed; inset: 0; z-index: 0; width: 100%; height: 100%; pointer-events: none; }
#flash {
  position: fixed;
  inset: 0;
  z-index: 7;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(255, 70, 90, 0.34));
}
#flash.go { animation: hudFlash 1.1s ease-out; }
@keyframes hudFlash { 0% { opacity: 0; } 12% { opacity: 1; } 100% { opacity: 0; } }

body.reloading .app { filter: saturate(0.58) brightness(0.84); transition: filter 0.45s; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: rgba(132, 178, 255, 0.18); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(132, 178, 255, 0.36); }
:focus-visible { outline: 1px solid var(--state); outline-offset: 2px; }
.i { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* === 主网格骨架：桌面三栏（>1240 标准 / 1001-1240 紧凑） === */
.pages { display: contents; }
.mnav { display: none; }
.app {
  position: relative;
  z-index: 1;
  height: 100vh;
  height: var(--app-height, 100dvh);
  display: grid;
  grid-template-columns: 316px minmax(0, 1fr) 372px;
  grid-template-rows: auto minmax(0, 1fr) 26px;
  gap: 10px;
  padding: 0 12px 6px;
}

.col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.col::-webkit-scrollbar { display: none; }

.center,
.chat-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

/* === 顶栏 === */
header.top {
  grid-column: 1 / -1;
  position: relative;
  min-height: 52px;
  padding: 8px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
header.top::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  pointer-events: none;
  background:
    linear-gradient(90deg, var(--line), var(--line)),
    linear-gradient(90deg, transparent, var(--state), transparent) 0 0 / 26% 100% no-repeat;
  animation: hudSweep 7s linear infinite;
}
@keyframes hudSweep {
  from { background-position: 0 0, -30% 0; }
  to { background-position: 0 0, 130% 0; }
}
.brand { display: flex; align-items: center; gap: 10px; flex: none; min-width: 0; }
.mark { width: 28px; height: 28px; flex: none; }
.mark circle { fill: none; stroke: var(--state); stroke-width: 1.4; transform-origin: 16px 16px; }
.mark .m1 { stroke-dasharray: 22 8 6 8; animation: spin 9s linear infinite; opacity: 0.85; }
.mark .m2 { stroke-dasharray: 3 5; animation: spin 6s linear infinite reverse; opacity: 0.6; }
.mark .m3 { fill: var(--state); stroke: none; filter: drop-shadow(0 0 4px var(--state)); }
@keyframes spin { to { transform: rotate(360deg); } }

header h1 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  white-space: nowrap;
  text-shadow: 0 0 18px color-mix(in srgb, var(--state) 42%, transparent);
}
.top-controls {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
}

.pill {
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(13, 20, 32, 0.72);
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.pill.ok {
  color: var(--state);
  border-color: color-mix(in srgb, var(--state) 42%, transparent);
  background: color-mix(in srgb, var(--state) 10%, transparent);
}
.pill.warn { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 45%, transparent); }

/* === 对话区与气泡 === */
.sess {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 2px 8px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.sess b { color: var(--text); font-weight: 500; }
.sess .sp { flex: 1; }

.turn {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  margin-bottom: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.turn[hidden] { display: none; }
.turn::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 1.5px;
  width: calc(var(--p, 0) * 100%);
  background: var(--state);
  box-shadow: 0 0 8px var(--state);
  transition: width 0.35s var(--ease);
}
.turn b { color: var(--text); font-weight: 600; }
.turn .tools {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 6px;
  overflow: hidden;
}
.turn .tools b {
  font-weight: 400;
  color: var(--state);
  background: color-mix(in srgb, var(--state) 10%, transparent);
  padding: 1px 6px;
  border-radius: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 11px; flex: none; }
.eq i { width: 2px; background: var(--state); border-radius: 1px; animation: eq 0.9s infinite ease-in-out; }
.eq i:nth-child(2) { animation-delay: 0.15s; }
.eq i:nth-child(3) { animation-delay: 0.3s; }
.eq i:nth-child(4) { animation-delay: 0.45s; }
@keyframes eq { 0%, 100% { height: 22%; } 50% { height: 100%; } }
.caret {
  display: inline-block;
  width: 6px;
  height: 12px;
  background: var(--state);
  margin-left: 3px;
  vertical-align: -2px;
  animation: blink 0.9s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 10px 14px 4px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 6px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  font-size: 13.5px;
}
.msg.user {
  align-self: flex-end;
  background: color-mix(in srgb, var(--accent) 11%, rgba(13, 20, 32, 0.86));
  border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
  border-radius: 10px 10px 2px 10px;
}
.msg.assistant {
  align-self: flex-start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 2px solid color-mix(in srgb, var(--state) 68%, transparent);
  backdrop-filter: blur(8px);
  white-space: normal;
}

.msg.assistant > .msg-body { position: relative; }
.msg.assistant.msg-folded > .msg-body { max-height: 22em; overflow: hidden; }
.msg.assistant.msg-folded > .msg-body::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2.4em;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(13, 20, 32, 0), rgba(13, 20, 32, 0.96));
}
.msg-fold-btn {
  display: block;
  margin: 6px 0 0 0;
  padding: 2px 10px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.8;
  color: var(--state);
  background: color-mix(in srgb, var(--state) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--state) 35%, transparent);
  border-radius: 3px;
  cursor: pointer;
}
.msg-fold-btn:hover {
  border-color: color-mix(in srgb, var(--state) 65%, transparent);
  background: color-mix(in srgb, var(--state) 16%, transparent);
}

.msg.assistant p { margin: 0 0 8px 0; }
.msg.assistant p:last-child { margin-bottom: 0; }
.msg.assistant h1, .msg.assistant h2, .msg.assistant h3, .msg.assistant h4 {
  margin: 10px 0 6px 0;
  font-size: 13.5px;
  letter-spacing: 0.04em;
  color: var(--accent-2);
}
.msg.assistant ul, .msg.assistant ol { margin: 4px 0 8px 0; padding-left: 20px; }
.msg.assistant li { margin: 3px 0; }
.msg.assistant code {
  font-family: var(--mono);
  font-size: 12px;
  background: rgba(140, 180, 255, 0.1);
  color: #cfe3ff;
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--line);
}
.msg.assistant pre {
  background: rgba(4, 8, 14, 0.72);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px 12px;
  overflow-x: auto;
  margin: 6px 0 10px 0;
}
.msg.assistant pre code { background: transparent; border: none; padding: 0; font-size: 11.5px; }
.msg.assistant table { width: 100%; border-collapse: collapse; margin: 8px 0 10px 0; font-size: 12.5px; }
.msg.assistant th, .msg.assistant td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.msg.assistant th { background: var(--panel-2); color: var(--muted); font-weight: 600; }

.msg.assistant details {
  margin: 8px 0;
  padding: 6px 10px;
  background: rgba(140, 180, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.msg.assistant details > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--muted);
  padding: 2px 0;
  user-select: none;
}
.msg.assistant details > summary:hover { color: var(--state); }
.msg.assistant details > summary::marker { color: var(--state); }
.msg.assistant details[open] > summary { color: var(--text); margin-bottom: 6px; }
.msg.assistant details > *:last-child { margin-bottom: 0; }

.msg.system-note {
  align-self: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-top: 1px dashed var(--line-2);
  border-bottom: 1px dashed var(--line-2);
  border-radius: 0;
  padding: 5px 14px;
}

.event-tag {
  display: inline-block;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 2px;
  background: rgba(140, 180, 255, 0.06);
  color: var(--state);
  border: 1px solid color-mix(in srgb, var(--state) 35%, transparent);
}
.msg-time { color: var(--muted); border-color: var(--line); margin-right: 6px; }
body.no-msg-time .msg-time { display: none; }

/* === 活动面板 === */
.activity-card {
  flex: 0 0 auto;
  margin: 0 0 6px 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  padding: 6px 10px;
  max-height: 28vh;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
}
.activity-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
}
.activity-card.collapsed .activity-panel { display: none; }
.activity-panel {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-height: calc(28vh - 34px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.activity-group { border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; background: var(--panel-2); }
.activity-group-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 600; color: var(--text); }
.activity-group-head .activity-total { color: var(--muted); font-weight: 400; font-size: 11px; font-family: var(--mono); }
.activity-summary {
  margin: 4px 0;
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 3px;
  border: 1px dashed color-mix(in srgb, var(--state) 45%, transparent);
  color: var(--state);
  cursor: pointer;
  user-select: none;
}
.activity-summary:hover { background: color-mix(in srgb, var(--state) 12%, transparent); }
.activity-omitted { margin: 4px 0 0 0; font-size: 11px; color: var(--red); }
.activity-omitted[hidden] { display: none; }
.activity-rows { display: flex; flex-direction: column; gap: 2px; }
.activity-row { font-family: var(--mono); font-size: 11px; color: var(--muted); padding: 2px 0; word-break: break-all; }
.activity-row .activity-row-dot { margin-right: 5px; }
.activity-row.folded-hidden { display: none; }

/* === 输入区 === */
.composer {
  flex: 0 0 auto;
  padding: 9px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  display: flex;
  gap: 8px;
  align-items: center;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.composer:focus-within {
  border-color: color-mix(in srgb, var(--state) 55%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--state) 16%, transparent), 0 0 36px color-mix(in srgb, var(--state) 9%, transparent);
}
.prompt {
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1;
  color: var(--state);
  user-select: none;
  flex: none;
}
.ctools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}
.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 3px;
  overflow: hidden;
  background: rgba(6, 10, 17, 0.55);
}
.seg button {
  all: unset;
  padding: 4px 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.seg button + button { border-left: 1px solid var(--line); }
.seg button:hover { color: var(--text); }
.seg button[aria-checked="true"] {
  background: color-mix(in srgb, var(--state) 18%, transparent);
  color: var(--state);
}
.hints {
  flex: 0 0 auto;
  display: flex;
  gap: 14px;
  padding: 5px 2px 0;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
}
.msg-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip.fallback-chip {
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--amber) 12%, transparent);
  color: var(--amber);
  border: 1px solid color-mix(in srgb, var(--amber) 38%, transparent);
}
textarea {
  flex: 1;
  min-width: 0;
  resize: none;
  height: 44px;
  padding: 10px 12px;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: rgba(4, 8, 14, 0.72);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
}
textarea:focus { border-color: color-mix(in srgb, var(--state) 65%, transparent); }

button {
  position: relative;
  padding: 0 14px;
  height: 32px;
  border: 1px solid color-mix(in srgb, var(--state) 55%, transparent);
  border-radius: 3px;
  background: color-mix(in srgb, var(--state) 14%, transparent);
  color: var(--state);
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.2s, background 0.2s, color 0.2s, transform 0.1s;
}
button:hover { border-color: color-mix(in srgb, var(--state) 85%, transparent); background: color-mix(in srgb, var(--state) 22%, transparent); }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.ghost {
  height: auto;
  background: rgba(120, 170, 255, 0.04);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 4px 9px;
  font-size: 11.5px;
  font-weight: 500;
}
button.ghost:hover { border-color: color-mix(in srgb, var(--state) 58%, transparent); background: color-mix(in srgb, var(--state) 10%, transparent); color: var(--state); }

/* === 左右栏卡片 === */
.card {
  position: relative;
  flex: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 11px 13px;
  backdrop-filter: blur(10px) saturate(125%);
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s;
  background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--state) 11%, transparent), transparent 62%);
}
.card:hover::before { opacity: 1; }
.card::after {
  content: "";
  position: absolute;
  inset: -1px;
  pointer-events: none;
  opacity: 0.52;
  transition: opacity 0.3s, background-size 0.35s var(--ease);
  --c: linear-gradient(var(--state), var(--state));
  --s: 9px;
  background:
    var(--c) 0 0 / var(--s) 1px, var(--c) 0 0 / 1px var(--s),
    var(--c) 100% 0 / var(--s) 1px, var(--c) 100% 0 / 1px var(--s),
    var(--c) 0 100% / var(--s) 1px, var(--c) 0 100% / 1px var(--s),
    var(--c) 100% 100% / var(--s) 1px, var(--c) 100% 100% / 1px var(--s);
  background-repeat: no-repeat;
}
.card:hover::after { opacity: 1; --s: 20px; }

.code {
  font: 600 9.5px/1 var(--mono);
  letter-spacing: 0.14em;
  color: var(--state);
  padding: 2px 5px;
  border-radius: 2px;
  margin-right: 6px;
  border: 1px solid color-mix(in srgb, var(--state) 38%, transparent);
}
.card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.05em;
  margin-bottom: 9px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}
.item { font-size: 12.5px; padding: 7px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: none; padding-top: 0; }
.card.collapsed .item,
.card.collapsed > div:not(.card-title) { display: none; }

.item-head { display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; min-width: 0; }
.item-head:hover { color: var(--state); }
.item-caret { font-size: 10px; color: var(--muted); width: 10px; flex: none; }
.item-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.clampable { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.clampable.clamp-open { display: block; -webkit-line-clamp: unset; }
.clamp-click { cursor: pointer; }
.clamp-hint { font-size: 11px; color: var(--state); margin-top: 2px; cursor: pointer; user-select: none; }
.board-more { text-align: center; font-family: var(--mono); font-size: 11px; color: var(--muted); padding: 6px 0 2px; cursor: pointer; user-select: none; }
.board-more:hover { color: var(--state); }
.item-body { margin-top: 4px; padding-left: 14px; color: var(--muted); font-size: 12px; line-height: 1.45; word-break: break-word; }

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 6px;
  background: var(--green);
  box-shadow: 0 0 8px color-mix(in srgb, var(--green) 60%, transparent);
}
.dot.warn { background: var(--amber); box-shadow: 0 0 8px color-mix(in srgb, var(--amber) 60%, transparent); }
.dot.pain { background: var(--red); box-shadow: 0 0 8px color-mix(in srgb, var(--red) 60%, transparent); }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.tab { font-family: var(--mono); font-size: 11px; padding: 3px 8px; border-radius: 3px; background: rgba(4, 8, 14, 0.55); border: 1px solid var(--line); color: var(--muted); cursor: pointer; }
.tab.active { color: var(--state); border-color: var(--state); background: color-mix(in srgb, var(--state) 10%, transparent); }
.nb-editor { width: 100%; min-height: 150px; font-family: var(--mono); font-size: 12px; line-height: 1.5; }

/* === 底栏与核心遥测（第 4 单） === */
.ph-r { font: 500 10.5px var(--mono); color: var(--muted); display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.card-tight { padding: 0; overflow: hidden; }
.card-tight .card-title { margin-bottom: 0; height: 34px; padding: 0 12px; border-bottom: 1px solid var(--line); }
.empty { padding: 12px; color: var(--faint); font: 500 11px var(--mono); }
.core { position: relative; display: grid; place-items: center; height: 210px; }
.core canvas { width: 206px; height: 206px; display: block; }
.core-c { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.core-mode { font-size: 14px; font-weight: 600; letter-spacing: 0.22em; text-indent: 0.22em; color: var(--state); text-shadow: 0 0 16px color-mix(in srgb, var(--state) 70%, transparent); }
.core-sub { font: 500 10px/1.5 var(--mono); color: var(--muted); margin-top: 4px; max-width: 108px; justify-self: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.kpi { padding: 8px 11px 7px; border-right: 1px solid var(--line); }
.kpi:last-child { border-right: 0; }
.kpi label { display: block; font-size: 10.5px; color: var(--muted); letter-spacing: 0.06em; }
.kpi b { font: 600 15px/1.35 var(--mono); font-variant-numeric: tabular-nums; }
.kpi b small { font-size: 10.5px; color: var(--muted); font-weight: 500; }

.vitals { display: grid; grid-template-columns: repeat(3, 1fr); }
.vital { padding: 8px 11px 7px; border-right: 1px solid var(--line); font: 500 10.5px var(--mono); color: var(--muted); }
.vital:last-child { border-right: 0; }
.vital div { display: flex; justify-content: space-between; align-items: baseline; }
.vital svg { display: block; width: 100%; height: 20px; margin-top: 5px; overflow: visible; }
.vital .l { fill: none; stroke: var(--c); stroke-width: 1.3; vector-effect: non-scaling-stroke; }
.vital .a { fill: color-mix(in srgb, var(--c) 13%, transparent); }
.vital b { color: var(--text); font-weight: 600; font-size: 12px; font-variant-numeric: tabular-nums; }

.sig { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: start; padding: 8px 12px; border-top: 1px solid var(--line); }
.sig p { margin: 0; font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.sig small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.lv { font: 600 9px/1 var(--mono); padding: 3px 4px; border-radius: 2px; letter-spacing: 0.06em; margin-top: 2px; }
.lv.PAIN { color: #fff; background: color-mix(in srgb, var(--red) 82%, transparent); }
.lv.DISCOMFORT { color: var(--amber); border: 1px solid color-mix(in srgb, var(--amber) 50%, transparent); }

.devs { display: grid; grid-template-columns: 1fr 1fr; }
.dev { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 9px; align-items: center; padding: 9px 11px 8px; }
.dev:nth-child(even) { border-left: 1px solid var(--line); }
.dev:nth-child(n+3) { border-top: 1px solid var(--line); }
.dev-ico { width: 28px; height: 28px; border: 1px solid var(--line-2); border-radius: 3px; display: grid; place-items: center; color: var(--green); }
.dev b { display: block; font: 600 12px/1.3 var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev small { display: block; color: var(--muted); font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; font: 500 10.5px var(--mono); color: var(--muted); }
.ecg { display: block; width: 46px; height: 14px; }
.ecg path { fill: none; stroke: var(--green); stroke-width: 1.3; stroke-dasharray: 60; animation: ecg 1.8s linear infinite; }
@keyframes ecg { from { stroke-dashoffset: 60; } to { stroke-dashoffset: -60; } }

.pv { padding: 8px 12px 7px; }
.pv + .pv { border-top: 1px solid var(--line); }
.pv.disabled { opacity: 0.5; }
.pv-h { display: flex; align-items: center; gap: 6px; }
.pv-h b { font-size: 12.5px; }
.tag { font: 600 9.5px/1 var(--mono); padding: 2px 5px; border-radius: 2px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.route { margin-left: auto; font: 600 10px var(--mono); color: var(--state); letter-spacing: 0.06em; animation: blinkr 1.6s ease-in-out infinite; }
@keyframes blinkr { 50% { opacity: 0.45; } }
.quota { position: relative; height: 5px; margin: 6px 0 4px; background: rgba(140, 180, 255, 0.08); border-radius: 3px; overflow: hidden; }
.quota i { position: absolute; inset: 0 auto 0 0; width: var(--p, 40%); border-radius: 3px; transition: width 0.8s var(--ease); background: linear-gradient(90deg, color-mix(in srgb, var(--c) 45%, transparent), var(--c)); }
.pv-f { display: flex; justify-content: space-between; gap: 8px; font: 500 10.5px var(--mono); color: var(--muted); }
.pv-f > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* === 施工引擎面板（FORGE 流水线 / 锁状态 / 末3步轨迹） === */
.forge-active {
  margin: 0 0 10px 0;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--state) 42%, transparent);
  border-radius: 4px;
  background: color-mix(in srgb, var(--state) 6%, rgba(8, 13, 22, 0.88));
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.forge-active[hidden] { display: none; }
.forge-head { display: flex; align-items: baseline; gap: 7px; font-size: 12px; min-width: 0; }
.forge-id { font-family: var(--mono); font-size: 10.5px; color: var(--state); flex: none; }
.forge-title { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.forge-lock {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
}
.forge-pct { color: var(--state); font-weight: 600; }
.forge-bar { height: 4px; border-radius: 2px; background: rgba(140, 180, 255, 0.12); overflow: hidden; }
.forge-bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, color-mix(in srgb, var(--state) 65%, transparent), var(--state));
  box-shadow: 0 0 8px var(--state);
  transition: width 0.4s var(--ease);
}
.pipe {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
}
.pipe .st {
  position: relative;
  text-align: center;
  font-family: var(--mono);
  font-size: 10px;
  padding: 4px 2px;
  border-radius: 2px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(6, 10, 17, 0.55);
  overflow: hidden;
}
.pipe .st.done {
  color: var(--green);
  border-color: color-mix(in srgb, var(--green) 42%, transparent);
  background: color-mix(in srgb, var(--green) 10%, transparent);
}
.pipe .st.act {
  color: var(--state);
  border-color: color-mix(in srgb, var(--state) 65%, transparent);
  background: color-mix(in srgb, var(--state) 16%, transparent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--state) 26%, transparent);
}
.pipe .st.act::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--state) 28%, transparent), transparent);
  transform: translateX(-100%);
  animation: pipeFlow 1.8s infinite linear;
}
@keyframes pipeFlow { to { transform: translateX(100%); } }
.trace-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px 8px;
  border-radius: 3px;
  background: rgba(4, 8, 14, 0.65);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 10.5px;
}
.trace-empty { color: var(--muted); }
.trace-row { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 6px; align-items: center; color: var(--text); }
.trace-row.err { color: var(--red); }
.trace-step { color: var(--muted); }
.trace-tool { color: var(--state); }
.trace-arg { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trace-ok { font-weight: 700; }
.forge-actions { display: flex; gap: 6px; justify-content: flex-end; }
button.ghost.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, transparent); }

/* === 里程碑 / 台账队列 / 浏览器与子代理 === */
.ms-bar { height: 3px; margin: 5px 0 4px; border-radius: 2px; background: rgba(140, 180, 255, 0.12); overflow: hidden; }
.ms-bar > i { display: block; height: 100%; background: var(--state); box-shadow: 0 0 6px var(--state); transition: width 0.35s var(--ease); }
.ms-step { font-size: 12px; margin-top: 2px; word-break: break-word; overflow-wrap: anywhere; }
.ledger-panel { display: flex; flex-direction: column; gap: 5px; }
.lg-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  padding: 4px 7px;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: rgba(6, 10, 17, 0.55);
  font-family: var(--mono);
  font-size: 11px;
}
.lg-row.next { border-color: color-mix(in srgb, var(--state) 45%, transparent); background: color-mix(in srgb, var(--state) 8%, rgba(6, 10, 17, 0.65)); }
.lg-row.skip { border-color: color-mix(in srgb, var(--amber) 35%, transparent); }
.lg-row.warn { border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.lg-row.dim { opacity: 0.72; }
.lg-tag { font-size: 9.5px; padding: 1px 5px; border-radius: 2px; background: rgba(140, 180, 255, 0.12); color: var(--state); }
.lg-row.skip .lg-tag { color: var(--amber); background: color-mix(in srgb, var(--amber) 14%, transparent); }
.lg-row.warn .lg-tag { color: var(--red); background: color-mix(in srgb, var(--red) 14%, transparent); }
.lg-title { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-meta { color: var(--muted); font-size: 10px; white-space: nowrap; }
.sw-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; }
.sw-meta { color: var(--muted); font-size: 11px; font-family: var(--mono); }
.sw-url { color: var(--muted); font-size: 11px; word-break: break-all; margin-top: 2px; font-family: var(--mono); }
.sw-err { color: var(--red); font-size: 11px; margin-top: 2px; }
.sw-shot { margin-top: 6px; }
.sw-shot img { max-width: 100%; max-height: 110px; border-radius: 4px; border: 1px solid var(--line); }
.sw-row { padding: 5px 0; border-top: 1px solid var(--line); }
.sw-summary { color: var(--muted); font-size: 11px; margin-top: 2px; word-break: break-word; overflow-wrap: anywhere; }

/* === 底栏 === */
footer.status {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 4px;
  font: 500 10.5px var(--mono);
  color: var(--muted);
  white-space: nowrap;
}
.status-sp { flex: 1; }

/* === 弹窗与登录闸门 === */
.modal-backdrop { position: fixed; inset: 0; background: rgba(3, 6, 12, 0.78); backdrop-filter: blur(6px); display: none; align-items: center; justify-content: center; z-index: 100; }
.modal-backdrop.open { display: flex; }
.modal { width: 680px; max-width: 94vw; max-height: 90vh; overflow-y: auto; background: rgba(9, 14, 23, 0.96); border: 1px solid var(--line-2); border-radius: 6px; padding: 20px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.72); }
.pv-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; padding: 12px; margin-bottom: 12px; }
.pv-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 8px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chk-row { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.chk-row label { display: inline-flex; align-items: center; gap: 4px; margin: 0; color: var(--text); cursor: pointer; }
.chk-row input[type=checkbox] { width: auto; }
.effort-select { padding: 4px 8px; font-family: var(--mono); font-size: 11.5px; border-radius: 3px; background: rgba(13, 20, 32, 0.8); color: var(--text); border: 1px solid var(--line); }
.img-preview-bar { display: none; flex: 0 0 auto; gap: 8px; padding: 6px 4px; flex-wrap: wrap; }
.img-preview-bar.has-items { display: flex; }
.img-thumb { position: relative; width: 64px; height: 64px; border-radius: 4px; overflow: hidden; border: 1px solid var(--line); }
.img-thumb img { width: 100%; height: 100%; object-fit: cover; }
.img-thumb button { position: absolute; top: 2px; right: 2px; padding: 0 5px; height: auto; font-size: 11px; border-radius: 999px; background: rgba(0, 0, 0, 0.75); color: #fff; border: 0; }
.msg-imgs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.msg-imgs img { max-width: 180px; max-height: 140px; border-radius: 4px; border: 1px solid var(--line-2); }
.modal h2 { margin: 0 0 6px 0; font-size: 16px; letter-spacing: 0.06em; }
.modal p.sub { margin: 0 0 14px 0; font-size: 12px; color: var(--muted); }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.field input, .field select { width: 100%; padding: 9px 11px; border-radius: 4px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; font-size: 13px; outline: none; }
.field input:focus, .field select:focus { border-color: var(--state); }
.inline-row { display: flex; gap: 8px; align-items: center; }
.inline-row input, .inline-row select { flex: 1; }
.hint { font-size: 11px; color: var(--muted); margin-top: 4px; min-height: 14px; }
.hint.err { color: var(--red); }
.hint.ok { color: var(--green); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.preset-row { display: flex; gap: 6px; margin-bottom: 12px; }

.login-gate {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 6, 12, 0.92);
  backdrop-filter: blur(8px);
  z-index: 300;
}
.login-gate[hidden] { display: none; }
.login-card { display: flex; flex-direction: column; gap: 10px; width: 360px; max-width: 90vw; }
.login-card h2 { margin: 0; font-size: 17px; }
.login-card label { font-size: 12px; color: var(--muted); margin-bottom: -4px; }
.login-card input[type=text], .login-card input[type=password] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  outline: none;
}
.login-card input[type=text]:focus, .login-card input[type=password]:focus { border-color: var(--state); }
.login-card .chk-row input[type=checkbox] { width: auto; }

/* === 第 8 单浮层：平滑重载横幅 / 侧滑笔记抽屉 / ⌘K 指令面板 / Toast 栈 / Boot 开机画面 === */
.banner {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 220;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 4px;
  border: 1px solid color-mix(in srgb, var(--state) 60%, transparent);
  background: rgba(8, 13, 22, 0.96);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text);
}
.banner[hidden] { display: none; }
.banner-stage {
  padding: 1px 6px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--state) 18%, transparent);
  color: var(--state);
  font-weight: 600;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(560px, 92vw);
  z-index: 160;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px calc(14px + env(safe-area-inset-bottom, 0px));
  background: rgba(8, 13, 22, 0.97);
  border-left: 1px solid var(--line-2);
  box-shadow: -18px 0 48px rgba(0, 0, 0, 0.72);
  transform: translateX(100%);
  transition: transform 0.24s var(--ease);
}
.drawer[hidden] { display: none; }
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.dirty-tag {
  font-family: var(--mono);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--amber) 16%, transparent);
  color: var(--amber);
  border: 1px solid color-mix(in srgb, var(--amber) 45%, transparent);
}
.dirty-tag[hidden] { display: none; }
.dirty-bar {
  padding: 8px 10px;
  border-radius: 4px;
  border: 1px solid color-mix(in srgb, var(--amber) 50%, transparent);
  background: color-mix(in srgb, var(--amber) 10%, rgba(10, 15, 24, 0.9));
  font-size: 12px;
  color: var(--text);
}
.dirty-bar[hidden] { display: none; }
.drawer .nb-editor, .nb-preview {
  flex: 1 1 auto;
  min-height: 220px;
  overflow-y: auto;
  padding: 10px 12px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: rgba(4, 8, 14, 0.78);
  color: var(--text);
}
.drawer .nb-editor { resize: none; font-family: var(--mono); font-size: 12.5px; line-height: 1.55; }
.nb-preview[hidden], .nb-editor[hidden] { display: none; }

.palette {
  position: fixed;
  inset: 0;
  z-index: 240;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  background: rgba(3, 6, 12, 0.72);
  backdrop-filter: blur(6px);
}
.palette[hidden] { display: none; }
.pal-box {
  width: min(520px, 92vw);
  background: rgba(9, 14, 23, 0.98);
  border: 1px solid var(--line-2);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.75);
}
.pal-box input {
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
}
.pal-list { max-height: 54vh; overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 3px; }
.pal-item {
  all: unset;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.pal-item:hover, .pal-item.sel { background: color-mix(in srgb, var(--state) 16%, transparent); color: var(--state); }
.pal-hint { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.pal-empty { padding: 14px; text-align: center; color: var(--muted); font-size: 12px; }

.toasts {
  position: fixed;
  right: 16px;
  bottom: 42px;
  z-index: 230;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(340px, 88vw);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 11px;
  border-radius: 4px;
  background: rgba(9, 14, 23, 0.95);
  border: 1px solid var(--line-2);
  border-left: 2px solid var(--state);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
  font-size: 12px;
}
.toast.ok { border-left-color: var(--green); }
.toast.warn { border-left-color: var(--amber); }
.toast.pain { border-left-color: var(--red); }
.toast-body { flex: 1; min-width: 0; }
.toast-t { font-weight: 600; color: var(--text); }
.toast-d { font-family: var(--mono); font-size: 10.5px; color: var(--muted); margin-top: 2px; word-break: break-word; }
.toast-x { all: unset; cursor: pointer; color: var(--muted); padding: 0 4px; font-size: 15px; line-height: 1; }

.boot {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  background: #060a11;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.boot[hidden] { display: none; }
.boot.out { opacity: 0; pointer-events: none; }
.boot-core { text-align: center; font-family: var(--mono); }
.boot-logo { font-size: 18px; letter-spacing: 0.22em; color: var(--state); margin-bottom: 8px; }
.boot-line { font-size: 11px; letter-spacing: 0.14em; color: var(--muted); }

/* === 响应式断点（必须晚于基础规则）：1001–1240 紧凑三栏；≤1000 三页左右滑动 === */
@media (max-width: 1240px) {
  .app { grid-template-columns: 288px minmax(0, 1fr) 332px; }
}

@media (max-width: 1000px) {
  html, body { overflow-x: hidden; }
  .app { display: flex; flex-direction: column; gap: 0; padding: 0; height: var(--app-h, var(--app-height, 100dvh)); }
  header.top {
    flex: none;
    min-height: 0;
    padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px;
    gap: 6px;
    border-bottom: 1px solid var(--line);
  }
  header.top::after { display: none; }
  header h1 { font-size: 13.5px; }
  .top-controls { width: 100%; min-width: 0; gap: 5px; }
  .top-controls .pill,
  .top-controls button,
  .top-controls .effort-select {
    font-size: 11px;
    padding: 3px 7px;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  footer.status { display: none; }

  .pages {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .pages::-webkit-scrollbar { display: none; }
  .pages > * {
    flex: 0 0 100%;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    padding: 8px 12px 6px;
    transform: scale(calc(1 - var(--d, 0) * 0.05));
    opacity: calc(1 - var(--d, 0) * 0.6);
    will-change: transform, opacity;
  }
  .card { backdrop-filter: none; background: rgba(11, 17, 28, 0.92); }
  .messages { padding: 8px 2px 12px; gap: 10px; }
  .msg { max-width: 94%; padding: 9px 11px; }
  .msg.assistant pre { max-width: 100%; }
  .activity-card { max-height: 24vh; }
  .activity-card-head { flex-wrap: wrap; gap: 4px; }
  .activity-panel { max-height: calc(24vh - 34px); }
  .activity-row { word-break: break-word; overflow-wrap: anywhere; }
  .composer { padding: 8px 10px; gap: 6px; flex-wrap: wrap; }
  .composer > textarea { flex: 1 1 140px; min-width: 0; font-size: 16px; height: 40px; }
  .ctools { margin-left: auto; max-width: 100%; }
  .ctools button { height: 30px; padding: 0 10px; font-size: 12px; }
  .seg button { padding: 4px 6px; font-size: 10px; }
  .hints { display: none; }
  .modal { width: 100%; max-width: 94vw; padding: 14px; }
  .drawer { width: 100vw; }
  .palette { align-items: flex-end; padding-top: 0; }
  .pal-box { width: 100%; max-width: 100%; border-radius: 12px 12px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .toasts { right: 12px; left: 12px; bottom: 64px; max-width: none; }
  .grid-2 { grid-template-columns: 1fr; }
  .login-card { max-width: 92vw; }

  .mnav {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    position: relative;
    flex: none;
    height: calc(52px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    border-top: 1px solid var(--line);
    background: rgba(6, 10, 17, 0.92);
    backdrop-filter: blur(12px);
  }
  .mnav button {
    all: unset;
    position: relative;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 3px;
    font-size: 10.5px;
    letter-spacing: 0.16em;
    color: var(--muted);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.25s;
  }
  .mnav button[aria-current="true"] { color: var(--state); }
  .mnav .i { width: 18px; height: 18px; }
  .mnav .ind {
    position: absolute;
    top: -1px;
    left: 0;
    width: 33.333%;
    height: 2px;
    pointer-events: none;
    transform: translateX(calc(var(--pos, 1) * 100%));
  }
  .mnav .ind::before {
    content: "";
    position: absolute;
    inset: 0 30%;
    border-radius: 1px;
    background: var(--state);
    box-shadow: 0 0 12px var(--state);
  }
  .mnav .bd {
    position: absolute;
    top: 8px;
    left: calc(50% + 11px);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    opacity: 0;
    transform: scale(0.3);
    background: var(--c, var(--state));
    box-shadow: 0 0 8px var(--c, var(--state));
    transition: opacity 0.25s, transform 0.25s;
  }
  .mnav button.badge .bd { opacity: 1; transform: none; }
  body.kb .mnav { display: none; }
}

.pages.nudge { animation: nudge 0.85s var(--ease); }
@keyframes nudge { 30% { transform: translateX(-30px); } 62% { transform: translateX(10px); } }

@media (min-width: 601px) and (max-width: 1000px) {
  .pages > .col { padding-inline: max(12px, calc(50% - 300px)); }
  .pages > .center { padding-inline: max(12px, calc(50% - 380px)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
