/* 安全区：默认 0，由 JS 探针写入像素值（iOS 上 env 放进 var 常会变成 0） */
:root {
  --safe-t: 0px;
  --safe-b: 0px;
  --safe-l: 0px;
  --safe-r: 0px;
}

/* 默认 = 废土末日；主题挂在 html / #phone 的 data-theme */
:root,
:root[data-theme="wasteland"],
#phone[data-theme="wasteland"] {
  --sys-panel: rgba(15, 10, 10, 0.85);
  --sys-text: #d4d4d4;
  --sys-gray: #555555;
  --sys-red: #e60000;
  --sys-white: #ffffff;
  --sys-yellow: #e6c300;
  --sys-green: #4dff4d;
  --theme-bg: linear-gradient(160deg, #1a0505 0%, #0a0a0c 45%, #1a0a10 100%);
  --theme-body: #000000;
  --chrome-bg: rgba(0, 0, 0, 0.55);
  --dock-bg: rgba(5, 5, 5, 0.72);
  --chrome-line: rgba(255, 255, 255, 0.1);
  --font-mono: "Courier New", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-heavy: Impact, "Arial Black", "PingFang SC", "Microsoft YaHei", sans-serif;
  --chat-msg: #888888;
  --chat-msg-user: #e0e0e0;
  --chat-sender: #ffffff;
  --chat-rail: rgba(255, 255, 255, 0.45);
  --chat-rail-user: rgba(230, 0, 0, 0.55);
  --spirit-well: #050505;
  --spirit-ring: rgba(255, 255, 255, 0.22);
  --spirit-ring-hot: #ffffff;
  --input-focus-border: #e60000;
  --input-focus-glow: rgba(230, 0, 0, 0.28);
}

/* 古风 / 修仙：千山暮雪 · 碎冰蓝 + 雪中红梅（顶栏底栏只换色，中间另做雪境卡片） */
:root[data-theme="xianxia"],
#phone[data-theme="xianxia"] {
  --sys-panel: rgba(255, 255, 255, 0.78);
  --sys-text: #1e293b;
  --sys-gray: #64748b;
  --sys-red: #7baac1;
  --sys-white: #1e293b;
  --sys-yellow: #c62f2f;
  --sys-green: #5a9e86;
  --theme-bg: linear-gradient(180deg, #eef4f7 0%, #f5f8fa 55%, #e8eef2 100%);
  --theme-body: #dce4e8;
  --chrome-bg: rgba(255, 255, 255, 0.72);
  --dock-bg: rgba(255, 255, 255, 0.7);
  --chrome-line: rgba(123, 170, 193, 0.35);
  --font-mono: "STSong", "SimSun", "Songti SC", "PingFang SC", serif;
  --font-heavy: "STKaiti", "KaiTi", "Kaiti SC", "PingFang SC", serif;
  --snow-accent: #7baac1;
  --snow-plum: #c62f2f;
  --snow-silver: rgba(123, 170, 193, 0.3);
  --chat-msg: #64748b;
  --chat-msg-user: #1e293b;
  --chat-sender: #7baac1;
  --chat-rail: rgba(123, 170, 193, 0.55);
  --chat-rail-user: rgba(198, 47, 47, 0.55);
  --spirit-well: linear-gradient(180deg, #e8eef2 0%, #dce6ec 100%);
  --spirit-ring: rgba(123, 170, 193, 0.35);
  --spirit-ring-hot: #7baac1;
  --input-focus-border: #7baac1;
  --input-focus-glow: rgba(123, 170, 193, 0.4);
}

/* 现代都市：Nexus 极简灰 · 日间纸感 + 星盘线稿 */
:root[data-theme="modern"],
#phone[data-theme="modern"] {
  --sys-panel: rgba(255, 255, 255, 0.62);
  --sys-text: #111111;
  --sys-gray: #666666;
  --sys-red: #111111;
  --sys-white: #111111;
  --sys-yellow: #111111;
  --sys-green: #333333;
  --theme-bg: #e5e5e5;
  --theme-body: #1a1a1a;
  --chrome-bg: rgba(255, 255, 255, 0.55);
  --dock-bg: rgba(245, 245, 245, 0.62);
  --chrome-line: rgba(0, 0, 0, 0.25);
  --font-mono: Consolas, "Courier New", "Space Mono", "PingFang SC", "Microsoft YaHei", monospace;
  --font-heavy: Georgia, "Times New Roman", "Playfair Display", "PingFang SC", serif;
  --nexus-line: rgba(0, 0, 0, 0.25);
  --nexus-glass: rgba(255, 255, 255, 0.6);
  --nexus-glass-border: rgba(255, 255, 255, 0.9);
  --nexus-sub: #666666;
  --chat-msg: #666666;
  --chat-msg-user: #111111;
  --chat-sender: #111111;
  --chat-rail: rgba(0, 0, 0, 0.35);
  --chat-rail-user: rgba(0, 0, 0, 0.55);
  --spirit-well: linear-gradient(180deg, #ececec 0%, #e0e0e0 100%);
  --spirit-ring: rgba(0, 0, 0, 0.2);
  --spirit-ring-hot: #111111;
  --input-focus-border: #111111;
  --input-focus-glow: rgba(0, 0, 0, 0.22);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

input,
textarea {
  user-select: text;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/*
  全屏铺满（对齐 QiuQ / 第四张目标）：
  - 外壳 100vh，主题背景绝对铺满，无上下黑/白边
  - 顶栏底栏：背景延伸进安全区；只有文字/图标用 safe 内边距避开
*/
html,
body {
  width: 100%;
  height: 100vh;
  margin: 0;
  overflow: hidden;
}

body {
  background: var(--theme-body, #000);
  font-family: var(--font-mono);
  overscroll-behavior: none;
  -webkit-touch-callout: none;
  transition: background 0.35s ease;
}

.phone {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: auto;
  height: auto;
  margin: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  color: var(--sys-text);
  /* 手机上必须铺满；桌面再居中成画幅 */
  max-width: none;
}

@media (min-width: 480px) {
  body {
    display: flex;
    justify-content: center;
    align-items: stretch;
  }

  .phone {
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    width: 100%;
    max-width: 414px;
    height: 100vh;
    margin: 0 auto;
  }
}

.bg-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: opacity 0.5s ease, filter 0.5s ease;
}

.default-bg {
  background-image: var(--theme-bg);
  filter: contrast(120%) brightness(0.85);
  transition: background-image 0.35s ease, filter 0.35s ease;
}

#phone[data-theme="xianxia"] .default-bg {
  filter: none;
}

#phone[data-theme="modern"] .default-bg {
  filter: none;
  background-color: #e5e5e5;
  background-image: none;
}

#phone[data-theme="modern"] .custom-bg.is-on {
  opacity: 0.32;
  /* 强制去色偏，避免水面/风景底图发绿发青 */
  filter: grayscale(1) contrast(1.15) brightness(1.05) !important;
}

#phone[data-theme="xianxia"] .app-title,
#phone[data-theme="xianxia"] .time-text {
  font-style: normal;
  letter-spacing: 0.14em;
  transform: none;
}

#phone[data-theme="xianxia"] .cyber-lines,
#phone[data-theme="xianxia"] .noise,
#phone[data-theme="xianxia"] .mask-layer,
#phone[data-theme="modern"] .cyber-lines,
#phone[data-theme="modern"] .noise,
#phone[data-theme="modern"] .mask-layer {
  opacity: 0;
  visibility: hidden;
}

#phone[data-theme="modern"] .app-title {
  font-style: italic;
  letter-spacing: 0.08em;
  font-weight: 400;
}

.theme-chip .chip-swatch {
  width: 10px;
  height: 10px;
  border-radius: 1px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.theme-chip[data-theme-id="wasteland"] .chip-swatch {
  background: #e60000;
}

.theme-chip[data-theme-id="xianxia"] .chip-swatch {
  background: linear-gradient(135deg, #7baac1, #c62f2f);
}

/* —— 古风雪境：装饰层（仅中间氛围，不改顶栏/底栏结构） —— */
.theme-deco {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

#phone[data-theme="xianxia"] .theme-deco-snow {
  display: block;
}

#phone[data-theme="modern"] .theme-deco-nexus {
  display: block;
}

.astrolabe-container {
  position: absolute;
  top: 48%;
  left: -22%;
  width: 145%;
  height: 620px;
  transform: translateY(-50%);
  pointer-events: none;
  animation: nexus-slow-rotate 120s linear infinite;
  opacity: 0.9;
}

.astrolabe-container svg {
  width: 100%;
  height: 100%;
  stroke: var(--nexus-line, rgba(0, 0, 0, 0.25));
  fill: none;
}

.astrolabe-container .astro-roman {
  fill: var(--sys-text);
  stroke: none;
  font-family: var(--font-heavy);
  font-size: 28px;
  text-anchor: middle;
}

.astrolabe-container .astro-hand {
  stroke: var(--sys-text);
}

@keyframes nexus-slow-rotate {
  from {
    transform: translateY(-50%) rotate(0deg);
  }
  to {
    transform: translateY(-50%) rotate(360deg);
  }
}

.bg-mountains {
  position: absolute;
  bottom: 64px;
  left: 0;
  width: 100%;
  height: 42%;
  opacity: 0.4;
  background: linear-gradient(to top, #f5f8fa 0%, transparent 42%),
    radial-gradient(ellipse 85% 55% at 22% 100%, #6b7280 0%, transparent 58%),
    radial-gradient(ellipse 75% 48% at 78% 108%, #4b5563 0%, transparent 52%),
    radial-gradient(ellipse 95% 40% at 50% 120%, #9ca3af 0%, transparent 48%);
  filter: grayscale(0.25) contrast(1.05);
}

.theme-chip[data-theme-id="modern"] .chip-swatch {
  background: linear-gradient(135deg, #e5e5e5, #111);
  border-color: rgba(0, 0, 0, 0.35);
}

.custom-bg {
  opacity: 0;
}

/* 观测端不再单独压暗；勿写 filter:none，否则会清掉现代主题自定义背景的灰度 */

.mask-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.9) 0%,
    rgba(0, 0, 0, 0.4) 40%,
    rgba(0, 0, 0, 0.9) 100%
  );
}

.cyber-lines {
  position: absolute;
  inset: 0;
  z-index: 3;
  opacity: 0.15;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    var(--sys-red) 2px,
    var(--sys-red) 3px
  );
}

.noise {
  position: absolute;
  inset: 0;
  z-index: 900;
  pointer-events: none;
  opacity: 0.1;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

.ui-layer {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.top-bar {
  /* 顶栏贴齐屏顶：背景铺进刘海区，仅内容下移 */
  flex: none;
  padding: 10px 20px 12px;
  padding-top: calc(10px + constant(safe-area-inset-top));
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 2px solid var(--sys-red);
  background: var(--chrome-bg, rgba(0, 0, 0, 0.5));
  position: relative;
  overflow: hidden;
  z-index: 20;
  /* 顶栏字形固定，主题只换色 */
  --chrome-font-heavy: Impact, "Arial Black", "PingFang SC", "Microsoft YaHei", sans-serif;
  --chrome-font-mono: "Courier New", "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* 观测端顶栏边色与宿主端一致 */
.sys-mode .top-bar {
  border-bottom-color: var(--sys-red);
}

.top-bar::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--sys-red);
  box-shadow: 0 0 10px var(--sys-red);
  animation: pulse-border 2s infinite alternate;
}

@keyframes pulse-border {
  0% {
    opacity: 0.3;
  }
  100% {
    opacity: 1;
  }
}

.sys-title {
  font-family: var(--chrome-font-heavy, var(--font-heavy));
  font-size: 20px;
  color: var(--sys-white);
  letter-spacing: 2px;
  font-style: italic;
  transform: skewX(-10deg);
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sys-sub {
  font-family: var(--chrome-font-mono, var(--font-mono));
  font-size: 9px;
  color: var(--sys-red);
  margin-top: 5px;
  font-weight: bold;
}

.sys-status {
  font-family: var(--chrome-font-mono, var(--font-mono));
  text-align: right;
  font-size: 10px;
  font-weight: bold;
  line-height: 1.4;
  color: var(--sys-gray);
}

.save-tip {
  flex-shrink: 0;
  padding: 2px 20px 4px;
  font-size: 9px;
  color: #666;
  font-weight: bold;
  letter-spacing: 0.5px;
}

.save-tip.ok {
  color: #6a9a6a;
}

.main-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: none;
  padding: 16px 20px 12px;
}

.main-content::-webkit-scrollbar {
  display: none;
}

.page {
  display: none;
}

.page.active {
  display: block;
  animation: page-slide-in 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes page-slide-in {
  0% {
    opacity: 0;
    transform: translateX(20px);
    filter: blur(4px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
    filter: blur(0);
  }
}

.time-block {
  margin-bottom: 20px;
}

.time-text {
  font-family: var(--font-heavy);
  font-size: 56px;
  line-height: 0.85;
  color: var(--sys-white);
  letter-spacing: -1px;
  position: relative;
  display: inline-block;
  text-shadow: 2px 0 0 rgba(230, 0, 0, 0.8);
}

.time-text::before {
  content: attr(data-text);
  position: absolute;
  left: 2px;
  top: 0;
  color: var(--sys-red);
  z-index: -1;
  opacity: 0.8;
}

.time-info {
  margin-top: 8px;
  font-size: 11px;
  font-weight: bold;
  color: var(--sys-white);
  border-left: 3px solid var(--sys-red);
  padding-left: 8px;
  line-height: 1.5;
}

.time-info .muted {
  color: var(--sys-gray);
  font-weight: normal;
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 15px;
}

.sys-card {
  background: var(--sys-panel);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 15px;
  position: relative;
  cursor: pointer;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 15px), calc(100% - 15px) 100%, 0 100%);
  transition: all 0.2s cubic-bezier(0.1, 0.9, 0.2, 1);
  overflow: hidden;
}

.sys-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--sys-red);
  transition: all 0.2s ease;
}

.sys-card:active {
  background: rgba(230, 0, 0, 0.15);
  border-color: var(--sys-red);
  transform: scale(0.97);
  box-shadow: 0 0 15px rgba(230, 0, 0, 0.4) inset;
}

.sys-card:active::before {
  width: 100%;
  opacity: 0.1;
}

.sys-card.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.sys-card.quest-card .card-title {
  color: var(--sys-yellow);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}

.card-title {
  font-family: var(--font-heavy);
  font-size: 20px;
  color: var(--sys-white);
  font-style: italic;
  transition: color 0.2s;
}

.sys-card:active .card-title {
  color: var(--sys-red);
  text-shadow: 0 0 5px var(--sys-red);
}

.card-code {
  font-size: 10px;
  font-weight: bold;
  color: var(--sys-gray);
}

.card-body {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  position: relative;
  z-index: 1;
  gap: 8px;
}

.card-desc {
  font-size: 12px;
  color: var(--sys-text);
  line-height: 1.5;
  width: 75%;
}

.card-status {
  font-size: 13px;
  font-family: var(--font-heavy);
  color: var(--sys-red);
  animation: blink-text 2s infinite;
  white-space: nowrap;
}

@keyframes blink-text {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.obs-file {
  background: #0a0a0c;
  border: 1px solid #333;
  padding: 20px 15px;
  position: relative;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.9), 0 10px 20px rgba(0, 0, 0, 0.8);
  background-image: linear-gradient(rgba(230, 0, 0, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px);
  background-size: 20px 20px;
}

.obs-seal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: repeating-linear-gradient(
    90deg,
    var(--sys-red),
    var(--sys-red) 20px,
    transparent 20px,
    transparent 40px
  );
  opacity: 0.8;
}

.stamp-obs {
  position: absolute;
  top: 25px;
  right: 15px;
  border: 2px solid var(--sys-red);
  color: var(--sys-red);
  font-family: var(--font-heavy);
  font-size: 18px;
  padding: 4px 8px;
  transform: rotate(-10deg);
  letter-spacing: 2px;
  opacity: 0.7;
  pointer-events: none;
  mix-blend-mode: screen;
  animation: stamp-pulse 3s infinite;
  z-index: 2;
}

@keyframes stamp-pulse {
  0%,
  100% {
    opacity: 0.7;
    transform: rotate(-10deg) scale(1);
  }
  50% {
    opacity: 0.4;
    transform: rotate(-10deg) scale(1.05);
  }
}

.cctv-frame {
  width: 110px;
  height: 140px;
  position: absolute;
  top: 50px;
  left: 15px;
  background: #000;
  border: 1px solid #222;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 1), 0 0 15px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

.cctv-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, transparent 30%, rgba(0, 0, 0, 0.8) 100%);
  z-index: 2;
  pointer-events: none;
}

.cctv-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(255, 255, 255, 0.08) 2px,
    rgba(255, 255, 255, 0.08) 3px
  );
  z-index: 3;
  pointer-events: none;
}

.cctv-target {
  font-family: var(--font-heavy);
  font-size: 50px;
  color: #555;
  filter: blur(1px) drop-shadow(0 0 5px rgba(255, 255, 255, 0.2));
  animation: target-breathe 3s infinite ease-in-out;
  z-index: 1;
}

@keyframes target-breathe {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
    opacity: 0.8;
  }
  50% {
    transform: translate(1px, -1px) scale(1.03);
    opacity: 1;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
  }
}

.crosshair-line {
  position: absolute;
  background: rgba(230, 0, 0, 0.6);
  z-index: 4;
}

.crosshair-h {
  top: 50%;
  left: 0;
  width: 100%;
  height: 1px;
  animation: cross-h 0.4s cubic-bezier(0.1, 0.9, 0.2, 1);
}

.crosshair-v {
  top: 0;
  left: 50%;
  width: 1px;
  height: 100%;
  animation: cross-v 0.4s cubic-bezier(0.1, 0.9, 0.2, 1);
}

@keyframes cross-h {
  0% {
    transform: scaleX(0);
    opacity: 0;
  }
  100% {
    transform: scaleX(1);
    opacity: 1;
  }
}

@keyframes cross-v {
  0% {
    transform: scaleY(0);
    opacity: 0;
  }
  100% {
    transform: scaleY(1);
    opacity: 1;
  }
}

.crosshair-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 30px;
  height: 30px;
  border: 1px solid rgba(230, 0, 0, 0.4);
  border-radius: 50%;
  z-index: 4;
  animation: center-pop 0.4s 0.2s backwards;
}

@keyframes center-pop {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
  }
  80% {
    transform: translate(-50%, -50%) scale(1.1);
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

.lock-corners {
  position: absolute;
  inset: 15px;
  z-index: 4;
  pointer-events: none;
  animation: lock-pulse 2s infinite alternate;
}

@keyframes lock-pulse {
  0% {
    transform: scale(0.95);
    opacity: 0.6;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.lock-corners div {
  position: absolute;
  width: 10px;
  height: 10px;
  border: 1px solid var(--sys-red);
}

.lock-tl {
  top: 0;
  left: 0;
  border-right: none;
  border-bottom: none;
}

.lock-tr {
  top: 0;
  right: 0;
  border-left: none;
  border-bottom: none;
}

.lock-bl {
  bottom: 0;
  left: 0;
  border-right: none;
  border-top: none;
}

.lock-br {
  bottom: 0;
  right: 0;
  border-left: none;
  border-top: none;
}

.cctv-frame .lock-text {
  position: absolute;
  bottom: 5px;
  left: 0;
  width: 100%;
  text-align: center;
  color: var(--sys-red);
  font-size: 9px;
  font-weight: bold;
  letter-spacing: 1px;
  z-index: 5;
  animation: lock-blink 1s infinite alternate;
  /* 防止被地图封条样式污染 */
  font-family: var(--font-mono);
  background: none;
  border: none;
  padding: 0;
  transform: none;
  opacity: 1;
  text-shadow: none;
}

@keyframes lock-blink {
  0% {
    opacity: 1;
    text-shadow: 0 0 5px var(--sys-red);
  }
  100% {
    opacity: 0.2;
    text-shadow: none;
  }
}

.rec-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 4px;
}

.rec-dot span {
  width: 5px;
  height: 5px;
  background: var(--sys-red);
  border-radius: 50%;
  animation: blink 1s infinite;
}

.rec-dot p {
  color: var(--sys-red);
  font-size: 8px;
  font-family: var(--font-mono);
  font-weight: bold;
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

.obs-info {
  margin-left: 0;
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.8;
  color: #aaa;
}

.obs-info-compact {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed #2a2a2a;
}

.obs-info .obs-edit {
  appearance: none;
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  color: #ddd;
  font-family: var(--font-mono);
  font-weight: bold;
  font-size: 12px;
  text-align: right;
  width: 58%;
  min-width: 0;
  padding: 0 0 1px;
  outline: none;
}

.obs-info .obs-edit:focus {
  border-bottom-color: rgba(230, 0, 0, 0.55);
  color: #fff;
}

.obs-info .obs-edit.red {
  color: var(--sys-red);
}

.obs-info .obs-edit::placeholder {
  color: #555;
  font-weight: normal;
}

.obs-edit-tip {
  margin-top: 8px;
  font-size: 10px;
  color: #666;
  line-height: 1.45;
}

.avatar-duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
  position: relative;
  z-index: 1;
}

.avatar-card {
  --avatar-w: 108px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.avatar-frame {
  position: relative;
  width: var(--avatar-w);
  flex-shrink: 0;
  aspect-ratio: 3 / 4;
  background: #000;
  border: 1px solid #333;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.9);
}

.avatar-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: contrast(1.05) saturate(0.85);
  z-index: 1;
}

.avatar-letter {
  position: relative;
  z-index: 1;
  font-family: var(--font-heavy);
  font-size: 22px;
  color: #666;
  letter-spacing: 0.08em;
  text-align: center;
  padding: 0 6px;
  line-height: 1.15;
}

.avatar-scan {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(255, 255, 255, 0.06) 2px,
    rgba(255, 255, 255, 0.06) 3px
  );
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.65);
}

.avatar-meta {
  width: var(--avatar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: center;
}

.avatar-role {
  font-size: 9px;
  color: var(--sys-red);
  letter-spacing: 0.12em;
  font-weight: bold;
  text-align: center;
}

.avatar-name {
  font-size: 12px;
  color: #ddd;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 3px 0 6px;
  text-align: center;
}

.gender-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin: 0 0 6px;
  font-size: 10px;
  color: var(--sys-gray);
  font-weight: bold;
}

.gender-select {
  flex: 1;
  min-width: 0;
  appearance: none;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid #333;
  color: var(--sys-text);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: bold;
  padding: 4px 6px;
  text-align: center;
  outline: none;
  cursor: pointer;
}

.gender-select:focus {
  border-color: var(--sys-red);
}

#phone[data-theme="xianxia"] .gender-select {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(123, 170, 193, 0.45);
  color: var(--sys-text);
}

.avatar-acts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  width: 100%;
}

.avatar-acts .persona-import-btn {
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
  padding: 4px 0;
  font-size: 9px;
}

.persona-import-btn.ghost {
  color: #888;
  border-color: #444;
  background: transparent;
  font-family: var(--font-mono);
  cursor: pointer;
}

.fold-panel {
  margin-top: 10px;
  border: 1px solid #2a2a2a;
  background: rgba(0, 0, 0, 0.45);
}

.fold-panel > summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: bold;
  color: #ccc;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  user-select: none;
}

.fold-panel > summary::-webkit-details-marker {
  display: none;
}

.fold-panel > summary::after {
  content: "+";
  color: var(--sys-red);
  font-size: 14px;
  flex-shrink: 0;
}

.fold-panel[open] > summary::after {
  content: "−";
}

.fold-panel[open] > summary {
  border-bottom: 1px solid #222;
}

.fold-hint {
  margin-left: auto;
  font-weight: normal;
  color: #666;
  font-size: 10px;
  max-width: 42%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fold-body {
  padding: 8px 10px 10px;
}

.persona-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 6px;
}

.obs-info .row {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed #333;
  padding: 2px 0;
  gap: 8px;
}

.obs-info .key {
  font-weight: bold;
  color: #666;
  font-size: 11px;
  flex-shrink: 0;
}

.obs-info .val {
  color: #ddd;
  font-family: var(--font-mono);
  font-weight: bold;
  text-align: right;
  max-width: 58%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#profile-world {
  max-width: 9em;
}

.obs-info .val.red {
  color: var(--sys-red);
}

.data-glitch {
  animation: glitch-num 4s infinite steps(1);
}

@keyframes glitch-num {
  0%,
  90%,
  100% {
    transform: none;
  }
  92% {
    transform: translateX(2px) skewX(10deg);
    color: var(--sys-white);
  }
  94% {
    transform: translateX(-2px);
  }
  96% {
    transform: translateY(1px);
  }
}

.persona-import-btn {
  font-size: 10px;
  color: var(--sys-red);
  border: 1px solid rgba(230, 0, 0, 0.45);
  padding: 3px 8px;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
}

.persona-ta {
  min-height: 72px;
  max-height: 140px;
  resize: vertical;
  border: 1px solid #222 !important;
  border-radius: 0;
  font-size: 11px;
  line-height: 1.55;
}

.persona-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.persona-actions.compact {
  margin-top: 10px;
  gap: 6px;
}

.persona-actions.compact .action-btn {
  padding: 10px;
  font-size: 12px;
}

.persona-hint {
  margin-top: 6px;
  font-size: 10px;
  color: #666;
  line-height: 1.45;
}

.dossier-derived {
  border-left-color: #666 !important;
}

.dossier-derived .der-title {
  color: var(--sys-red);
  font-weight: bold;
  margin-top: 10px;
  margin-bottom: 4px;
}

.dossier-derived .der-tag {
  display: inline-block;
  margin: 2px 4px 2px 0;
  padding: 1px 6px;
  border: 1px solid #444;
  color: #bbb;
  font-size: 10px;
}

.dossier-derived .muted {
  color: #666;
}

.obs-notes {
  margin-top: 0;
  border-top: none;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #888;
  line-height: 1.7;
  background: rgba(0, 0, 0, 0.5);
  padding: 12px;
  border-left: 3px solid var(--sys-red);
}

.fold-body .obs-notes {
  margin: 0;
}

.obs-notes p {
  margin-bottom: 8px;
}

.obs-notes .warning {
  color: var(--sys-red);
  font-weight: bold;
  animation: glitch-text 2s infinite;
}

@keyframes glitch-text {
  0%,
  100% {
    opacity: 1;
    transform: translateX(0);
  }
  33% {
    opacity: 0.7;
    transform: translateX(1px);
  }
  66% {
    opacity: 0.9;
    transform: translateX(-1px);
  }
}

.redacted {
  background: #000;
  color: transparent;
  padding: 0 5px;
  position: relative;
  border: 1px solid #333;
}

.redacted::after {
  content: "███";
  color: #555;
  font-size: 10px;
}

.bottom-dock {
  /* 底栏贴齐屏底：背景铺进 Home 区，图标在安全区上方 */
  flex: none;
  display: flex;
  align-items: stretch;
  margin: 0;
  min-height: 0;
  padding-top: 0;
  padding-left: 0;
  padding-right: 0;
  padding-bottom: constant(safe-area-inset-bottom);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  border-top: 1px solid var(--chrome-line, rgba(255, 255, 255, 0.1));
  background: var(--dock-bg, rgba(5, 5, 5, 0.98));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 100;
  position: relative;
  /* 底栏字形固定，主题只换色 */
  --chrome-font-heavy: Impact, "Arial Black", "PingFang SC", "Microsoft YaHei", sans-serif;
  --chrome-font-mono: "Courier New", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.dock-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 64px;
  font-family: var(--chrome-font-mono, var(--font-mono));
  font-size: 10px;
  font-weight: bold;
  color: var(--sys-gray);
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
}

.dock-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 0;
  height: 3px;
  background: var(--sys-red);
  transition: all 0.3s cubic-bezier(0.1, 0.9, 0.2, 1);
}

.dock-item.active {
  color: var(--sys-white);
}

.dock-item.active::before {
  width: 100%;
  left: 0;
  box-shadow: 0 0 10px var(--sys-red);
}

.dock-icon {
  font-family: var(--chrome-font-heavy, var(--font-heavy));
  font-size: 18px;
  margin-bottom: 4px;
  font-style: italic;
  transition: transform 0.2s, color 0.2s;
}

.dock-item.active .dock-icon {
  transform: translateY(-2px) scale(1.1);
  color: var(--sys-red);
}

/* 观测端底栏激活态与宿主端同色 */
.sys-mode .dock-item.active .dock-icon {
  color: var(--sys-red);
}

.sys-mode .dock-item.active::before {
  background: var(--sys-red);
  box-shadow: 0 0 10px var(--sys-red);
}

.dock-item:active .dock-icon {
  animation: dock-glitch 0.2s steps(2, end) forwards;
}

@keyframes dock-glitch {
  0% {
    transform: translateY(0) scale(1);
  }
  25% {
    transform: translateY(-2px) translateX(2px) scale(1.1);
    opacity: 0.5;
  }
  50% {
    transform: translateY(-2px) translateX(-2px) scale(1.1);
    opacity: 1;
  }
  100% {
    transform: translateY(-2px) scale(1.1);
  }
}

.app-window {
  position: absolute;
  inset: 0;
  z-index: 200;
  background: rgba(5, 5, 5, 0.95);
  backdrop-filter: blur(15px);
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.1, 0.9, 0.2, 1);
  border-top: 3px solid transparent;
}

.app-window.active {
  transform: translateY(0);
  border-top-color: var(--sys-red);
  box-shadow: 0 -5px 20px rgba(230, 0, 0, 0.2);
}

.app-header {
  flex: none;
  padding: 14px 20px;
  padding-top: calc(10px + constant(safe-area-inset-top));
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  display: flex;
  align-items: center;
  border-bottom: 2px solid var(--sys-red);
  background: rgba(230, 0, 0, 0.05);
}

.back-btn {
  background: transparent;
  border: none;
  color: var(--sys-white);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  margin-right: 20px;
  transition: 0.2s;
}

.back-btn:active {
  color: var(--sys-red);
  transform: translateX(-3px);
}

.app-title {
  font-family: var(--font-heavy);
  font-size: 22px;
  color: var(--sys-white);
  font-style: italic;
}

#app-host-chat .app-header .app-title {
  flex: 1;
  min-width: 0;
}

.chat-clear-btn {
  flex: none;
  margin-left: 8px;
  background: transparent;
  border: 1px solid var(--chrome-line, rgba(255, 255, 255, 0.2));
  color: var(--sys-gray);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  padding: 6px 10px;
  cursor: pointer;
  transition: 0.2s;
}

.chat-clear-btn:active {
  border-color: var(--sys-red);
  color: var(--sys-white);
}

#phone[data-theme="xianxia"] .chat-clear-btn,
#phone[data-theme="modern"] .chat-clear-btn {
  border-color: var(--chrome-line);
  color: var(--sys-gray);
}

.app-content {
  padding: 20px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.term-msg {
  font-size: 14px;
  line-height: 1.85;
  padding: 15px;
  border-left: 2px solid var(--sys-gray);
  background: rgba(255, 255, 255, 0.05);
  animation: page-slide-in 0.3s backwards;
  user-select: text;
  color: #d8d8d8;
  font-weight: normal;
}

/* 系统/勘测长文：红边提示来源，正文用易读浅灰 */
.term-msg.sys {
  border-left-color: var(--sys-red);
  color: #d2d2d2;
  font-weight: normal;
}

/* 短警告才用红字 */
.term-msg.alert {
  border-left-color: var(--sys-red);
  color: #ff6b6b;
  font-weight: bold;
  font-size: 13px;
}

.term-msg.npc {
  border-left-color: var(--sys-yellow);
  color: #e8d48a;
}

.term-msg strong {
  color: var(--sys-white);
  font-family: var(--font-heavy);
  font-size: 15px;
  font-style: italic;
  display: block;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.action-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid #333;
  color: var(--sys-text);
  padding: 15px;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  transition: 0.2s;
  width: 100%;
}

.action-btn:active {
  background: var(--sys-red);
  color: #fff;
  transform: scale(0.98);
}

.action-btn.danger {
  color: var(--sys-red);
  border-color: var(--sys-red);
}

.action-btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

.choice-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.story-layout {
  gap: 12px;
  min-height: 0;
  padding-top: 12px;
}

.story-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.story-act-bar {
  flex: none;
  display: flex;
  gap: 8px;
  align-items: stretch;
  padding-top: 4px;
  border-top: 1px solid var(--chrome-line, #222);
}

.story-act-input {
  flex: 1;
  min-width: 0;
  min-height: 52px;
  resize: none;
  font-size: 12px;
  line-height: 1.45;
}

.story-act-send {
  flex: none;
  width: auto;
  padding: 10px 14px;
  align-self: stretch;
}

#phone[data-theme="xianxia"] .story-act-bar,
#phone[data-theme="modern"] .story-act-bar {
  border-top-color: var(--chrome-line);
}

/* —— 剧情页紧凑战术状态栏 —— */
.compact-widget {
  flex-shrink: 0;
  width: 100%;
  height: 158px;
  background: #0a0a0a;
  clip-path: polygon(
    0 10px,
    10px 0,
    100% 0,
    100% calc(100% - 10px),
    calc(100% - 10px) 100%,
    15px 100%,
    0 calc(100% - 15px)
  );
  border-top: 1px solid #333;
  border-right: 1px solid #222;
  border-bottom: 1px solid #111;
  box-shadow: -5px 5px 15px rgba(0, 0, 0, 0.8);
  display: flex;
  position: relative;
  overflow: hidden;
}

.compact-widget .widget-bg {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.15;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E"),
    repeating-linear-gradient(0deg, transparent, transparent 2px, #000 2px, #000 4px);
}

.compact-widget .alert-line {
  position: absolute;
  top: 0;
  left: 0;
  width: 30%;
  height: 2px;
  z-index: 6;
  background: var(--sys-red);
  box-shadow: 0 0 8px var(--sys-red);
  animation: story-status-scan 3s infinite linear;
}

@keyframes story-status-scan {
  0% {
    left: -30%;
  }
  100% {
    left: 100%;
  }
}

.compact-widget .left-deco {
  width: 52px;
  flex-shrink: 0;
  border-right: 1px dashed #333;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  z-index: 2;
  background: #000;
}

.compact-widget .left-deco::before {
  content: "+";
  position: absolute;
  color: var(--sys-red);
  font-size: 20px;
  font-weight: bold;
  opacity: 0.5;
  z-index: 2;
  animation: story-status-pulse 2s infinite alternate;
}

.compact-widget .left-deco::after {
  content: "";
  position: absolute;
  inset: 10px;
  background-image: radial-gradient(circle, #444 1px, transparent 1.5px);
  background-size: 6px 6px;
  opacity: 0.5;
}

@keyframes story-status-pulse {
  0% {
    opacity: 0.2;
    transform: scale(0.8);
  }
  100% {
    opacity: 0.8;
    transform: scale(1.2);
  }
}

.compact-widget .main-content {
  flex: 1;
  min-width: 0;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  z-index: 5;
}

.compact-widget .header-tag {
  font-size: 9px;
  color: var(--sys-red);
  font-weight: bold;
  letter-spacing: 1px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compact-widget .header-tag::before {
  content: "■";
  font-size: 8px;
  flex-shrink: 0;
}

.compact-widget .main-title {
  font-family: var(--font-heavy);
  font-size: 18px;
  color: var(--sys-text);
  line-height: 1.1;
  letter-spacing: 1px;
  margin-bottom: 6px;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compact-widget .data-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.compact-widget .data-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #aaa;
  border-bottom: 1px dotted #222;
  padding-bottom: 2px;
}

.compact-widget .data-row:last-child {
  border-bottom: none;
}

.compact-widget .data-row .name {
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.compact-widget .data-row .val {
  font-family: var(--font-heavy);
  font-size: 12px;
  color: var(--sys-red);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 58%;
}

.compact-widget .redact {
  background: var(--sys-red);
  color: transparent;
  display: inline-block;
  width: 28px;
  height: 10px;
  vertical-align: middle;
  margin: 0 2px;
}

.compact-widget .nav-side {
  width: 46px;
  flex-shrink: 0;
  border-left: 1px solid #222;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 8px 4px;
  background: rgba(0, 0, 0, 0.5);
  z-index: 5;
}

.compact-widget .nav-item {
  appearance: none;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: bold;
  color: var(--sys-gray);
  text-align: center;
  cursor: pointer;
  padding: 5px 0;
  transition: 0.2s;
  border: 1px solid transparent;
  letter-spacing: 1px;
  position: relative;
  line-height: 1;
}

.compact-widget .nav-item.active {
  color: var(--sys-text);
  border-color: var(--sys-red);
  background: rgba(230, 0, 0, 0.1);
}

.compact-widget .nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 2px;
  height: 100%;
  background: var(--sys-red);
}

.story-choices {
  flex-shrink: 0;
  padding-top: 8px;
  padding-bottom: constant(safe-area-inset-bottom);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  border-top: 1px solid rgba(230, 0, 0, 0.35);
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.55));
}

.story-choices .choice-hint {
  font-size: 11px;
  color: var(--sys-gray);
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.choice-btn .risk {
  float: right;
  font-size: 10px;
  color: var(--sys-red);
}

.sys-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid #333;
  color: var(--sys-white);
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  outline: none;
  transition: border 0.3s, box-shadow 0.3s;
}

.sys-input:focus {
  border-color: var(--input-focus-border);
  box-shadow: 0 0 10px var(--input-focus-glow);
}

#app-host-chat .chat-input:focus {
  border-color: var(--input-focus-border);
  box-shadow: 0 0 12px var(--input-focus-glow);
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  font-size: 11px;
  color: var(--sys-red);
  font-weight: bold;
  margin-bottom: 5px;
}

textarea.sys-input {
  resize: none;
  height: 80px;
}

.upload-btn-wrapper {
  position: relative;
  overflow: hidden;
  display: inline-block;
  width: 100%;
}

.upload-btn-wrapper input[type="file"] {
  font-size: 100px;
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-display {
  border: 1px dashed var(--sys-red);
  color: var(--sys-red);
  padding: 15px;
  text-align: center;
  font-size: 12px;
  font-weight: bold;
  background: rgba(230, 0, 0, 0.1);
  transition: 0.2s;
}

.upload-display:active {
  background: rgba(230, 0, 0, 0.3);
  transform: scale(0.98);
}

.template-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.template-chip {
  border: 1px solid #444;
  background: rgba(255, 255, 255, 0.04);
  color: var(--sys-text);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: bold;
  padding: 8px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}

.template-chip .chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 7.5em;
}

.template-chip .chip-x {
  border: none;
  background: transparent;
  color: #777;
  font-size: 12px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
}

.template-chip .chip-x:hover {
  color: var(--sys-red);
}

.template-chip:active,
.template-chip.active {
  border-color: var(--sys-red);
  color: var(--sys-white);
  background: rgba(230, 0, 0, 0.2);
}

.template-chip.custom-chip:not(.active) {
  border-style: dashed;
}

.chat-composer {
  flex: none;
  padding: 15px 20px;
  padding-bottom: calc(15px + constant(safe-area-inset-bottom));
  padding-bottom: calc(15px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #222;
  display: flex;
  gap: 10px;
  background: rgba(0, 0, 0, 0.8);
  z-index: 20;
}

#phone[data-theme="xianxia"] .chat-composer,
#phone[data-theme="modern"] .chat-composer {
  border-top-color: var(--chrome-line);
  background: var(--chrome-bg);
}

.chat-composer .chat-input {
  flex: 1;
  min-width: 0;
}

.chat-composer .chat-send {
  flex: none;
  width: auto;
  padding: 10px 18px;
}

/* —— 通讯：灵体区 + 左右气泡 —— */
.spirit-zone {
  position: relative;
  flex: none;
  width: 100%;
  height: min(38vw, 200px);
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--spirit-well);
  border-bottom: 1px solid var(--chrome-line);
  overflow: hidden;
}

.pulse-ring {
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 1.5px solid var(--spirit-ring);
  opacity: 0;
  pointer-events: none;
}

.pulse-ring.auto {
  animation: spirit-auto-pulse 3.5s cubic-bezier(0.1, 0.8, 0.3, 1) infinite;
}

.pulse-ring.auto:nth-child(2) {
  animation-delay: 1.1s;
}

.pulse-ring.auto:nth-child(3) {
  animation-delay: 2.2s;
}

.pulse-ring.active {
  animation: spirit-strong-pulse 1.5s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes spirit-auto-pulse {
  0% {
    transform: scale(1);
    opacity: 0.55;
  }
  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

@keyframes spirit-strong-pulse {
  0% {
    transform: scale(0.9);
    opacity: 1;
    border-width: 3px;
    border-color: var(--spirit-ring-hot);
  }
  100% {
    transform: scale(2.8);
    opacity: 0;
    border-width: 0;
  }
}

#spirit-canvas {
  width: 160px;
  height: 160px;
  z-index: 2;
  filter: drop-shadow(0 0 12px var(--spirit-ring));
}

#app-host-chat .chat-feed {
  flex: 1;
  min-height: 0;
  padding: 18px 20px 12px;
  gap: 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#app-host-chat .chat-feed .chat-msg.stacked {
  margin-top: -6px;
  gap: 0;
}

#app-host-chat .chat-feed .chat-msg.stacked::before {
  top: 0;
}

#app-host-chat .chat-feed::-webkit-scrollbar {
  display: none;
}

.chat-msg {
  position: relative;
  max-width: 88%;
  padding-left: 14px;
  animation: chat-msg-in 0.55s ease;
  user-select: text;
}

.chat-msg.rerollable {
  cursor: context-menu;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  user-select: none;
}

.chat-msg.rerollable .chat-msg-text,
.chat-msg.rerollable .chat-msg-sender {
  user-select: none;
}

.chat-msg.rerollable.pressing {
  opacity: 0.55;
  transform: scale(0.98);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.chat-msg::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  bottom: 3px;
  width: 1px;
  background: linear-gradient(to bottom, var(--chat-rail), transparent);
}

.chat-msg-sender {
  font-size: 14px;
  font-weight: bold;
  font-style: italic;
  font-family: var(--font-heavy);
  margin-bottom: 6px;
  color: var(--chat-sender);
  letter-spacing: 0.5px;
}

.chat-msg-text {
  font-size: 14px;
  line-height: 1.75;
  color: var(--chat-msg);
  font-weight: normal;
}

.chat-msg-text strong {
  color: var(--sys-white);
  font-weight: bold;
}

.chat-msg.user {
  align-self: flex-end;
  padding-left: 0;
  padding-right: 14px;
  text-align: right;
}

.chat-msg.user::before {
  left: auto;
  right: 0;
  background: linear-gradient(to bottom, transparent, var(--chat-rail-user));
}

.chat-msg.user .chat-msg-text {
  color: var(--chat-msg-user);
}

.chat-msg.sys-line {
  align-self: center;
  max-width: 94%;
  text-align: center;
  padding: 0;
  color: var(--sys-gray);
  font-size: 12px;
  font-style: italic;
}

.chat-msg.sys-line::before {
  display: none;
}

.chat-msg.idle {
  max-width: 100%;
  align-self: stretch;
}

@keyframes chat-msg-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pulse-ring.auto,
  .pulse-ring.active {
    animation: none;
    opacity: 0.25;
  }
  .chat-msg {
    animation: none;
  }
}

.toast {
  position: absolute;
  left: 50%;
  bottom: calc(90px + constant(safe-area-inset-bottom));
  bottom: calc(90px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(20px);
  z-index: 500;
  background: rgba(0, 0, 0, 0.92);
  border: 1px solid var(--sys-red);
  color: var(--sys-white);
  padding: 12px 16px;
  font-size: 12px;
  font-weight: bold;
  max-width: 85%;
  opacity: 0;
  pointer-events: none;
  transition: 0.25s;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.hr {
  border: none;
  border-top: 1px solid #333;
  margin: 15px 0;
}

.api-acts {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.api-act {
  flex: 1;
  padding: 12px 10px;
  text-align: center;
  font-size: 12px;
}

.api-hint {
  font-size: 10px;
  color: #666;
  line-height: 1.5;
  margin-bottom: 12px;
}

.api-hint.ok {
  color: var(--sys-green);
}

.api-hint.err {
  color: var(--sys-red);
}

.model-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
  margin-bottom: 15px;
  border: 1px solid #333;
  background: rgba(0, 0, 0, 0.45);
  padding: 8px;
}

.model-list[hidden] {
  display: none;
}

.model-item {
  border: 1px solid #333;
  background: rgba(255, 255, 255, 0.03);
  color: var(--sys-text);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: bold;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  width: 100%;
}

.model-item:active,
.model-item.active {
  border-color: var(--sys-red);
  color: var(--sys-white);
  background: rgba(230, 0, 0, 0.18);
}

/* ===== 战术沙盘地图 ===== */
#app-map {
  display: flex;
  flex-direction: column;
}

#app-map .map-app-header {
  flex-shrink: 0;
  z-index: 30;
}

#app-map .map-shell {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #08080a;
}

.map-bg {
  position: absolute;
  inset: 0;
  z-index: 1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    radial-gradient(circle at center, transparent 30%, rgba(255, 255, 255, 0.02) 31%, transparent 32%);
  background-size: 40px 40px, 40px 40px, 100% 100%;
}

.radar-sweep {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 200vw;
  height: 200vw;
  transform-origin: 0 0;
  z-index: 2;
  pointer-events: none;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(230, 0, 0, 0.02) 45deg,
    rgba(230, 0, 0, 0.08) 90deg,
    transparent 90deg
  );
  animation: radar-rotate 7s linear infinite;
  border-radius: 50%;
}

@keyframes radar-rotate {
  100% {
    transform: rotate(360deg);
  }
}

.map-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
}

.contour {
  stroke: rgba(255, 255, 255, 0.08);
  fill: none;
  stroke-width: 1;
}

.water {
  stroke: rgba(100, 150, 255, 0.15);
  fill: none;
  stroke-width: 15;
  filter: blur(2px);
}

.road-base {
  stroke: rgba(255, 255, 255, 0.15);
  stroke-width: 6;
  fill: none;
  stroke-linejoin: round;
}

.road-center {
  stroke: rgba(0, 0, 0, 0.8);
  stroke-width: 1.5;
  fill: none;
  stroke-dasharray: 4 4;
}

.street {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 2;
  fill: none;
}

.block-fill {
  fill: rgba(255, 255, 255, 0.03);
  stroke: rgba(255, 255, 255, 0.2);
  stroke-width: 0.8;
}

.block-detail {
  fill: none;
  stroke: rgba(255, 255, 255, 0.15);
  stroke-width: 0.5;
}

.red-thread {
  stroke: var(--sys-red);
  stroke-width: 1.5;
  fill: none;
  stroke-dasharray: 5 5;
  animation: dash-move 1s linear infinite;
  filter: drop-shadow(0 0 4px rgba(230, 0, 0, 0.8));
}

@keyframes dash-move {
  to {
    stroke-dashoffset: -10;
  }
}

.hud-top {
  position: absolute;
  top: 10px;
  left: 15px;
  right: 15px;
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  font-weight: bold;
  color: #888;
  border-bottom: 1px solid #333;
  padding-bottom: 5px;
  z-index: 5;
}

.hud-top span {
  color: var(--sys-red);
}

.poi-layer {
  position: absolute;
  inset: 0;
  z-index: 10;
}

.poi {
  position: absolute;
  z-index: 10;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  transform: translate(-50%, -50%);
}

.poi.locked {
  opacity: 0.35;
  cursor: not-allowed;
  filter: grayscale(1);
}

.poi-scan {
  position: absolute;
  inset: -10px;
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  animation: poi-spin 10s linear infinite;
}

.poi-lock {
  position: absolute;
  inset: 0;
  border: 1.5px solid rgba(230, 0, 0, 0.5);
  border-radius: 50%;
  border-top-color: transparent;
  border-bottom-color: transparent;
  animation: poi-spin 3s linear infinite;
}

.poi-lock-reverse {
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-left-color: transparent;
  border-right-color: transparent;
  animation: poi-spin-rev 2s linear infinite;
}

@keyframes poi-spin {
  100% {
    transform: rotate(360deg);
  }
}

@keyframes poi-spin-rev {
  100% {
    transform: rotate(-360deg);
  }
}

.poi-core {
  width: 6px;
  height: 6px;
  background: var(--sys-red);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--sys-red);
  animation: core-flash 1s infinite alternate;
}

.poi.yellow {
  z-index: 20;
  width: 52px;
  height: 52px;
}

.poi.yellow .poi-core {
  width: 10px;
  height: 10px;
  background: var(--sys-yellow);
  box-shadow: 0 0 14px var(--sys-yellow), 0 0 28px rgba(230, 195, 0, 0.45);
  animation: core-flash 0.7s infinite alternate;
}

.poi.yellow .poi-lock {
  border-color: var(--sys-yellow);
  border-top-color: transparent;
  border-bottom-color: transparent;
  box-shadow: 0 0 12px rgba(230, 195, 0, 0.35);
  animation-duration: 1.6s;
}

.poi.yellow .poi-pulse {
  border-color: var(--sys-yellow);
  animation-duration: 1.4s;
}

.poi.yellow .poi-beacon {
  display: block;
}

.poi-beacon {
  display: none;
  position: absolute;
  inset: -18px;
  border: 1px dashed rgba(230, 195, 0, 0.55);
  border-radius: 50%;
  animation: poi-spin 6s linear infinite;
  pointer-events: none;
}

.poi.locked .poi-core {
  background: #555;
  box-shadow: none;
  animation: none;
}

@keyframes core-flash {
  0% {
    opacity: 0.4;
    transform: scale(0.8);
  }
  100% {
    opacity: 1;
    transform: scale(1.2);
  }
}

.poi-pulse {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 1px solid var(--sys-red);
  border-radius: 50%;
  animation: pulse-ring 2s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
  opacity: 0;
}

@keyframes pulse-ring {
  0% {
    transform: scale(0.2);
    opacity: 1;
  }
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

.poi-label {
  position: absolute;
  top: 34px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: #fff;
  font-weight: bold;
  font-family: var(--font-mono);
  text-shadow: 0 0 5px #000, 0 0 5px #000, 0 0 8px #000;
  white-space: nowrap;
  letter-spacing: 1px;
}

.poi.yellow .poi-label {
  color: var(--sys-yellow);
  font-size: 12px;
  letter-spacing: 1.5px;
  text-shadow: 0 0 6px #000, 0 0 10px rgba(230, 195, 0, 0.8);
}

.poi.locked .poi-label {
  color: #666;
}

.poi-badge {
  display: inline-block;
  margin-right: 4px;
  padding: 0 5px;
  font-size: 10px;
  letter-spacing: 1px;
  vertical-align: middle;
}

.scan-target {
  color: var(--sys-yellow);
  font-weight: bold;
  letter-spacing: 1px;
}

.poi.active .poi-lock {
  border-color: var(--sys-white);
  animation-duration: 0.5s;
  box-shadow: 0 0 15px var(--sys-red);
}

.tactical-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 20;
  background: rgba(8, 8, 10, 0.98);
  border-top: 2px solid #333;
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transform: translateY(100%);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.1, 0.9, 0.2, 1);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.9);
}

.tactical-panel.active {
  transform: translateY(0);
  opacity: 1;
  border-top-color: var(--sys-red);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 1px dashed #444;
  padding-bottom: 10px;
  gap: 10px;
}

.panel-title {
  font-family: var(--font-heavy);
  font-size: 22px;
  color: var(--sys-white);
  font-style: italic;
  letter-spacing: 1px;
}

.panel-code {
  font-size: 10px;
  color: var(--sys-red);
  font-weight: bold;
  flex-shrink: 0;
}

.panel-body {
  font-size: 12px;
  line-height: 1.6;
  color: #ccc;
}

.data-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 5px;
}

.data-cell {
  border: 1px solid #444;
  padding: 10px;
  background: rgba(0, 0, 0, 0.6);
  position: relative;
  overflow: hidden;
}

.data-cell::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
  animation: scan-glow 3s infinite;
}

@keyframes scan-glow {
  100% {
    left: 200%;
  }
}

.data-label {
  font-size: 9px;
  color: #777;
  display: block;
  margin-bottom: 4px;
}

.data-value {
  font-size: 15px;
  color: var(--sys-white);
  font-family: var(--font-mono);
  font-weight: bold;
}

.action-group {
  display: flex;
  gap: 10px;
  margin-top: 5px;
}

.map-breach-btn {
  flex: 1;
  background: rgba(230, 0, 0, 0.15);
  border: 1px solid var(--sys-red);
  color: var(--sys-red);
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: bold;
  text-align: center;
  cursor: pointer;
  transition: 0.2s;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

.map-breach-btn:active {
  background: var(--sys-red);
  color: var(--sys-white);
  box-shadow: 0 0 15px var(--sys-red);
}

.map-breach-btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

.map-cancel-btn {
  width: 60px;
  background: transparent;
  border: 1px solid #444;
  color: #888;
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
}

.warning-overlay {
  position: absolute;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.95);
  display: none;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.warning-overlay.active {
  display: flex;
}

.tape {
  position: absolute;
  width: 150vw;
  height: 60px;
  background: #facc15;
  display: flex;
  align-items: center;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.8), inset 0 0 10px rgba(0, 0, 0, 0.2);
  border-top: 2px solid rgba(0, 0, 0, 0.1);
  border-bottom: 2px solid rgba(0, 0, 0, 0.1);
  opacity: 0;
  transform: scale(2) rotate(var(--rot));
  animation: none;
}

.warning-overlay.active .tape {
  animation: tape-slam 0.3s cubic-bezier(0.1, 0.9, 0.2, 1) forwards;
}

.tape-text {
  font-family: var(--font-heavy);
  font-size: 40px;
  color: #000;
  white-space: nowrap;
  display: flex;
  gap: 20px;
  letter-spacing: 2px;
  animation: scroll-text 3s linear infinite;
}

.tape:nth-child(1) {
  top: 10%;
  left: -20%;
  --rot: 15deg;
  animation-delay: 0.1s;
}

.tape:nth-child(2) {
  top: 30%;
  right: -20%;
  --rot: -20deg;
  animation-delay: 0.2s;
}

.tape:nth-child(3) {
  top: 50%;
  left: -10%;
  --rot: 5deg;
  animation-delay: 0.3s;
  height: 80px;
  z-index: 2;
}

.tape:nth-child(4) {
  top: 70%;
  right: -10%;
  --rot: -10deg;
  animation-delay: 0.15s;
}

.tape:nth-child(5) {
  top: 85%;
  left: -30%;
  --rot: 25deg;
  animation-delay: 0.35s;
}

@keyframes tape-slam {
  0% {
    opacity: 0;
    transform: scale(2) rotate(var(--rot));
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(var(--rot));
  }
}

@keyframes scroll-text {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

.breach-lock-text {
  position: relative;
  z-index: 10;
  color: var(--sys-red);
  font-family: var(--font-heavy);
  font-size: 24px;
  letter-spacing: 4px;
  text-shadow: 0 0 10px var(--sys-red);
  opacity: 0;
  background: #000;
  padding: 15px 24px;
  border: 2px solid var(--sys-red);
  transform: skewX(-10deg);
}

.warning-overlay.active .breach-lock-text {
  animation: fade-in-lock 0.5s 0.8s forwards;
}

@keyframes fade-in-lock {
  0% {
    opacity: 0;
    transform: skewX(-10deg) scale(0.8);
  }
  100% {
    opacity: 1;
    transform: skewX(-10deg) scale(1);
  }
}

.map-scanlines {
  position: absolute;
  inset: 0;
  z-index: 15;
  pointer-events: none;
  opacity: 0.25;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.55) 2px,
    rgba(0, 0, 0, 0.55) 4px
  );
}

.chat-clue-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  border-top: 1px solid #222;
  background: rgba(20, 0, 0, 0.6);
}

.chat-clue-bar[hidden] {
  display: none !important;
}

.clue-chip {
  border: 1px solid #555;
  background: rgba(255, 255, 255, 0.04);
  color: #ccc;
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 6px 8px;
  cursor: pointer;
}

.clue-chip:active {
  border-color: var(--sys-red);
  color: #fff;
}

.clue-list .term-msg {
  font-size: 12px;
}

/* ================= 古风雪境：仅中间内容区（卡片/文案/输入），顶栏底栏结构不变 ================= */
#phone[data-theme="xianxia"] {
  color: var(--sys-text);
}

#phone[data-theme="xianxia"] .main-content {
  padding-bottom: 20px;
}

/* 顶栏文案只换色，字形/动效与默认壳一致 */
#phone[data-theme="xianxia"] .sys-title {
  color: var(--sys-white);
}

#phone[data-theme="xianxia"] .sys-sub {
  color: var(--sys-red);
}

#phone[data-theme="xianxia"] .sys-status {
  color: var(--sys-gray);
}

#phone[data-theme="xianxia"] .sys-status span {
  color: var(--sys-red) !important;
}

#phone[data-theme="xianxia"] .time-text {
  color: var(--sys-text);
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.9);
  letter-spacing: 0.16em;
}

#phone[data-theme="xianxia"] .time-text::before {
  color: var(--snow-accent);
  opacity: 0.28;
  left: 1px;
}

#phone[data-theme="xianxia"] .time-info {
  color: var(--sys-gray);
  font-family: var(--font-heavy);
  letter-spacing: 0.06em;
  border-left-color: var(--snow-accent);
}

#phone[data-theme="xianxia"] .time-info .muted {
  color: var(--snow-accent);
}

#phone[data-theme="xianxia"] .sys-card {
  clip-path: none;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.95);
  background: var(--sys-panel);
  box-shadow: 0 8px 25px rgba(123, 170, 193, 0.12), inset 0 0 15px rgba(255, 255, 255, 0.75);
  padding: 18px 16px;
}

#phone[data-theme="xianxia"] .sys-card::before {
  width: 3px;
  background: linear-gradient(to bottom, var(--snow-accent), rgba(123, 170, 193, 0.12));
}

#phone[data-theme="xianxia"] .sys-card::after {
  content: "寒";
  position: absolute;
  top: 10px;
  right: 10px;
  width: 22px;
  height: 22px;
  border: 1px solid var(--snow-silver);
  color: var(--snow-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heavy);
  font-size: 12px;
  border-radius: 4px;
  opacity: 0.55;
  transform: rotate(10deg);
  pointer-events: none;
  z-index: 2;
}

#phone[data-theme="xianxia"] .sys-card.disabled::after {
  content: "封";
  border-color: #cbd5e1;
  color: #94a3b8;
}

#phone[data-theme="xianxia"] .sys-card:active {
  background: #fff;
  border-color: rgba(123, 170, 193, 0.45);
  box-shadow: 0 4px 12px rgba(123, 170, 193, 0.18);
  transform: scale(0.98);
}

#phone[data-theme="xianxia"] .sys-card:active::before {
  width: 3px;
  opacity: 1;
}

#phone[data-theme="xianxia"] .card-title {
  font-style: normal;
  letter-spacing: 0.12em;
  color: var(--sys-text);
}

#phone[data-theme="xianxia"] .sys-card:active .card-title {
  color: var(--snow-plum);
  text-shadow: none;
}

#phone[data-theme="xianxia"] .sys-card.quest-card .card-title {
  color: var(--snow-plum);
}

#phone[data-theme="xianxia"] .card-code {
  color: var(--snow-accent);
}

#phone[data-theme="xianxia"] .card-desc {
  font-family: var(--font-heavy);
  color: var(--sys-gray);
  letter-spacing: 0.04em;
  line-height: 1.75;
}

#phone[data-theme="xianxia"] .card-status {
  font-family: var(--font-heavy);
}

#phone[data-theme="xianxia"] .term-msg {
  background: rgba(255, 255, 255, 0.72);
  border-left: 3px solid var(--snow-accent);
  color: var(--sys-text);
  box-shadow: 0 4px 14px rgba(123, 170, 193, 0.08);
}

#phone[data-theme="xianxia"] .term-msg.sys {
  border-left-color: var(--snow-plum);
  color: var(--sys-gray);
}

#phone[data-theme="xianxia"] .term-msg.alert {
  border-left-color: var(--snow-plum);
  color: var(--snow-plum);
}

#phone[data-theme="xianxia"] .obs-file {
  background: rgba(255, 255, 255, 0.72);
  background-image: linear-gradient(rgba(123, 170, 193, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(123, 170, 193, 0.03) 1px, transparent 1px);
  background-size: 20px 20px;
  border-color: rgba(123, 170, 193, 0.35);
  box-shadow: 0 8px 24px rgba(123, 170, 193, 0.1);
}

#phone[data-theme="xianxia"] .fold-panel {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(123, 170, 193, 0.3);
}

#phone[data-theme="xianxia"] .fold-panel > summary {
  color: var(--sys-text);
}

#phone[data-theme="xianxia"] .fold-panel > summary::after {
  color: var(--snow-accent);
}

#phone[data-theme="xianxia"] .action-btn {
  background: rgba(255, 255, 255, 0.85);
  border-color: var(--snow-accent);
  color: var(--sys-text);
  font-family: var(--font-heavy);
  letter-spacing: 0.08em;
}

#phone[data-theme="xianxia"] .action-btn:active {
  background: #fff;
  border-color: var(--snow-plum);
  color: var(--snow-plum);
}

#phone[data-theme="xianxia"] .sys-input {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(123, 170, 193, 0.4);
  color: var(--sys-text);
}

#phone[data-theme="xianxia"] .sys-input:focus {
  border-color: var(--input-focus-border);
  box-shadow: 0 0 10px var(--input-focus-glow);
}

#phone[data-theme="xianxia"] .compact-widget {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(123, 170, 193, 0.35);
  box-shadow: 0 8px 20px rgba(123, 170, 193, 0.12);
}

#phone[data-theme="xianxia"] .compact-widget .alert-line {
  background: var(--snow-accent);
  box-shadow: 0 0 8px rgba(123, 170, 193, 0.55);
}

#phone[data-theme="xianxia"] .compact-widget .left-deco::before {
  color: var(--snow-accent);
}

#phone[data-theme="xianxia"] .compact-widget .header-tag {
  color: var(--snow-accent);
}

#phone[data-theme="xianxia"] .compact-widget .data-row .val {
  color: var(--snow-plum);
}

#phone[data-theme="xianxia"] .compact-widget .redact {
  background: var(--snow-plum);
}

#phone[data-theme="xianxia"] .compact-widget .main-title {
  color: var(--sys-text);
  font-style: normal;
}

#phone[data-theme="xianxia"] .compact-widget .nav-item.active {
  color: var(--sys-text);
  border-color: var(--snow-accent);
  background: rgba(123, 170, 193, 0.12);
}

#phone[data-theme="xianxia"] .app-window {
  background: rgba(245, 248, 250, 0.96);
}

#phone[data-theme="xianxia"] .app-header {
  background: rgba(255, 255, 255, 0.7);
  border-bottom-color: var(--snow-accent);
}

#phone[data-theme="xianxia"] .app-title {
  color: var(--sys-text);
}

#phone[data-theme="xianxia"] .back-btn {
  color: var(--sys-text);
}

#phone[data-theme="xianxia"] .form-group label {
  color: var(--snow-plum);
}

#phone[data-theme="xianxia"] .upload-display {
  border-color: rgba(123, 170, 193, 0.55);
  color: var(--snow-accent);
  background: rgba(123, 170, 193, 0.08);
}

#phone[data-theme="xianxia"] .upload-display:active {
  background: rgba(123, 170, 193, 0.18);
}

#phone[data-theme="xianxia"] .persona-import-btn {
  color: var(--snow-plum);
  border-color: rgba(198, 47, 47, 0.5);
  background: rgba(255, 255, 255, 0.65);
}

#phone[data-theme="xianxia"] .persona-import-btn.ghost {
  color: var(--sys-gray);
  border-color: rgba(100, 116, 139, 0.45);
}

#phone[data-theme="xianxia"] .api-hint,
#phone[data-theme="xianxia"] .save-tip,
#phone[data-theme="xianxia"] .fold-hint,
#phone[data-theme="xianxia"] .obs-edit-tip,
#phone[data-theme="xianxia"] .persona-hint {
  color: var(--sys-gray) !important;
}

#phone[data-theme="xianxia"] .hr {
  border: none;
  border-top: 1px solid var(--snow-silver);
  opacity: 1;
  background: none;
  height: 0;
}

#phone[data-theme="xianxia"] .template-chip {
  background: rgba(255, 255, 255, 0.75);
  border-color: rgba(123, 170, 193, 0.4);
  color: var(--sys-text);
}

#phone[data-theme="xianxia"] .template-chip.active {
  border-color: var(--snow-accent);
  background: rgba(123, 170, 193, 0.18);
  color: var(--sys-text);
  box-shadow: none;
}

#phone[data-theme="xianxia"] .avatar-frame {
  border-color: rgba(123, 170, 193, 0.45);
  background: linear-gradient(160deg, #dbe4ea, #c5d0d8);
}

#phone[data-theme="xianxia"] .avatar-letter {
  color: #7a8794;
}

#phone[data-theme="xianxia"] .avatar-role {
  color: var(--snow-accent);
}

#phone[data-theme="xianxia"] .avatar-name {
  color: var(--sys-text);
}

#phone[data-theme="xianxia"] .obs-info .key {
  color: var(--sys-text);
}

#phone[data-theme="xianxia"] .obs-info .val,
#phone[data-theme="xianxia"] .obs-info .obs-edit {
  color: var(--snow-accent);
}

#phone[data-theme="xianxia"] .obs-info .obs-edit.red {
  color: var(--snow-plum);
}

#phone[data-theme="xianxia"] .obs-info .obs-edit:focus {
  border-bottom-color: var(--snow-accent);
}

#phone[data-theme="xianxia"] .obs-info .row {
  border-bottom-color: rgba(123, 170, 193, 0.28);
}

#phone[data-theme="xianxia"] .obs-seal {
  background: repeating-linear-gradient(
    90deg,
    var(--snow-accent),
    var(--snow-accent) 20px,
    transparent 20px,
    transparent 40px
  );
  opacity: 0.55;
}

#phone[data-theme="xianxia"] .stamp-obs {
  border-color: var(--snow-plum);
  color: var(--snow-plum);
}

#phone[data-theme="xianxia"] .dossier-derived .der-title {
  color: var(--snow-plum);
}

#phone[data-theme="xianxia"] .dossier-derived .der-tag {
  border-color: rgba(123, 170, 193, 0.45);
  color: var(--sys-gray);
}

#phone[data-theme="xianxia"] .obs-notes {
  background: rgba(255, 255, 255, 0.65);
  border-left-color: var(--snow-accent);
  color: var(--sys-gray);
}

#phone[data-theme="xianxia"] .obs-notes .warning {
  color: var(--snow-plum);
}

#phone[data-theme="xianxia"] .story-choices {
  border-top-color: rgba(123, 170, 193, 0.35);
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.75));
}

#phone[data-theme="xianxia"] .choice-btn .risk {
  color: var(--snow-plum);
}

#phone[data-theme="xianxia"] .toast {
  background: rgba(255, 255, 255, 0.95);
  border-color: var(--snow-accent);
  color: var(--sys-text);
}

#phone[data-theme="xianxia"] .avatar-scan {
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(123, 170, 193, 0.06) 2px,
    rgba(123, 170, 193, 0.06) 3px
  );
  box-shadow: inset 0 0 24px rgba(123, 170, 193, 0.18);
}

/* ================= 古风：天机阵图 · 勘测飞剑敕令 ================= */
#phone[data-theme="xianxia"] #app-map .map-shell {
  background: #fcfbf9;
}

#phone[data-theme="xianxia"] .map-bg {
  background-image:
    url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.06'/%3E%3C/svg%3E"),
    radial-gradient(circle at 80% 10%, rgba(26, 26, 26, 0.04) 0%, transparent 50%),
    radial-gradient(circle at 10% 90%, rgba(26, 26, 26, 0.04) 0%, transparent 50%);
  background-size: auto, 100% 100%, 100% 100%;
}

#phone[data-theme="xianxia"] .radar-sweep,
#phone[data-theme="xianxia"] .map-scanlines {
  display: none;
}

#phone[data-theme="xianxia"] .map-svg .contour,
#phone[data-theme="xianxia"] .map-svg .street,
#phone[data-theme="xianxia"] .map-svg .block-fill,
#phone[data-theme="xianxia"] .map-svg .block-detail,
#phone[data-theme="xianxia"] .map-svg .road-base,
#phone[data-theme="xianxia"] .map-svg .road-center,
#phone[data-theme="xianxia"] .map-svg .water {
  stroke: rgba(26, 26, 26, 0.12);
  fill: none;
  filter: none;
}

#phone[data-theme="xianxia"] .map-svg .block-fill {
  fill: rgba(26, 26, 26, 0.03);
}

#phone[data-theme="xianxia"] .map-svg .red-thread {
  stroke: #1a1a1a;
  stroke-width: 1;
  stroke-dasharray: 2 6;
  filter: none;
  opacity: 0.4;
  animation: dash-move 3s linear infinite;
}

#phone[data-theme="xianxia"] .hud-top {
  top: 28px;
  left: 22px;
  right: 22px;
  font-size: 11px;
  letter-spacing: 2px;
  color: #666;
  border-bottom: none;
  font-family: var(--font-mono);
}

#phone[data-theme="xianxia"] .hud-top span {
  color: #1a1a1a;
  font-weight: bold;
}

#phone[data-theme="xianxia"] .poi {
  width: 72px;
  height: 72px;
}

#phone[data-theme="xianxia"] .poi-scan {
  inset: 8px;
  border: 1px solid rgba(26, 26, 26, 0.2);
  border-top-color: rgba(26, 26, 26, 0.8);
  border-bottom-color: rgba(26, 26, 26, 0.8);
  border-style: solid;
  animation: poi-spin 12s linear infinite;
}

#phone[data-theme="xianxia"] .poi-scan::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px dashed rgba(26, 26, 26, 0.3);
  border-radius: 50%;
}

#phone[data-theme="xianxia"] .poi:not(.yellow) .poi-lock,
#phone[data-theme="xianxia"] .poi:not(.yellow) .poi-lock-reverse,
#phone[data-theme="xianxia"] .poi:not(.yellow) .poi-pulse,
#phone[data-theme="xianxia"] .poi:not(.yellow) .poi-beacon {
  display: none;
}

#phone[data-theme="xianxia"] .poi:not(.yellow):not(.locked) {
  opacity: 0.72;
}

#phone[data-theme="xianxia"] .poi-core {
  width: 10px;
  height: 10px;
  background: #c0392b;
  box-shadow: 0 0 12px rgba(192, 57, 43, 0.55);
  animation: none;
  position: relative;
}

#phone[data-theme="xianxia"] .poi-core::after {
  content: "";
  position: absolute;
  inset: -4px;
  border: 1px solid rgba(192, 57, 43, 0.4);
  border-radius: 50%;
  animation: pulse-ring 2s infinite;
}

#phone[data-theme="xianxia"] .poi.yellow {
  width: 88px;
  height: 88px;
  opacity: 1;
  z-index: 24;
}

#phone[data-theme="xianxia"] .poi.yellow .poi-scan {
  inset: 4px;
  border-color: rgba(192, 57, 43, 0.35);
  border-top-color: #c0392b;
  border-bottom-color: #c0392b;
  animation-duration: 5s;
}

#phone[data-theme="xianxia"] .poi.yellow .poi-lock {
  display: block;
  inset: 10px;
  border: 1.5px solid #b8860b;
  border-top-color: transparent;
  border-bottom-color: transparent;
  box-shadow: 0 0 10px rgba(184, 134, 11, 0.35);
  animation: poi-spin 2.2s linear infinite;
}

#phone[data-theme="xianxia"] .poi.yellow .poi-lock-reverse {
  display: block;
  inset: 18px;
  border: 1px solid rgba(192, 57, 43, 0.55);
  border-left-color: transparent;
  border-right-color: transparent;
  animation: poi-spin-rev 1.8s linear infinite;
}

#phone[data-theme="xianxia"] .poi.yellow .poi-pulse {
  display: block;
  border-color: #c0392b;
  animation-duration: 1.5s;
}

#phone[data-theme="xianxia"] .poi.yellow .poi-beacon {
  display: block;
  inset: -22px;
  border-color: rgba(184, 134, 11, 0.55);
  border-style: dashed;
}

#phone[data-theme="xianxia"] .poi.yellow .poi-core {
  width: 14px;
  height: 14px;
  background: #c0392b;
  box-shadow: 0 0 0 3px #fcfbf9, 0 0 0 5px #b8860b, 0 0 18px rgba(192, 57, 43, 0.75);
  animation: core-flash 0.85s infinite alternate;
}

#phone[data-theme="xianxia"] .poi.yellow .poi-core::after {
  inset: -8px;
  border-color: rgba(184, 134, 11, 0.65);
  animation-duration: 1.4s;
}

#phone[data-theme="xianxia"] .poi.locked .poi-core {
  background: #999;
  box-shadow: none;
}

#phone[data-theme="xianxia"] .poi.locked .poi-core::after {
  display: none;
}

#phone[data-theme="xianxia"] .poi-label {
  top: auto;
  bottom: -26px;
  font-size: 13px;
  color: #1a1a1a;
  letter-spacing: 2px;
  text-shadow: none;
  background: #fcfbf9;
  padding: 0 8px;
  border-bottom: 1px solid #1a1a1a;
  font-family: var(--font-heavy);
}

#phone[data-theme="xianxia"] .poi.yellow .poi-label {
  bottom: -34px;
  color: #c0392b;
  font-size: 15px;
  padding: 2px 10px;
  border-bottom: 2px solid #c0392b;
  box-shadow: 0 2px 0 rgba(184, 134, 11, 0.35);
}

#phone[data-theme="xianxia"] .poi.yellow .poi-label .poi-tag {
  color: #b8860b;
}

#phone[data-theme="xianxia"] .poi.yellow .poi-badge {
  background: #c0392b;
  color: #fcfbf9;
  border: 1px solid #b8860b;
  margin-right: 6px;
  padding: 1px 6px;
  font-size: 11px;
}

#phone[data-theme="xianxia"] .poi.locked .poi-label {
  color: #888;
  border-bottom-color: #aaa;
}

#phone[data-theme="xianxia"] .poi-label .poi-tag {
  color: #c0392b;
  font-size: 11px;
  margin-right: 4px;
}

#phone[data-theme="xianxia"] .scan-target {
  color: var(--snow-plum);
  border-bottom: 1px solid rgba(198, 47, 47, 0.45);
}

#phone[data-theme="xianxia"] .tactical-panel {
  background: #fcfbf9;
  border-top: none;
  clip-path: polygon(
    0 2%,
    2% 1%,
    5% 2%,
    8% 0.5%,
    12% 2%,
    15% 1%,
    18% 2.5%,
    22% 1%,
    26% 2%,
    30% 0.5%,
    35% 2%,
    40% 1%,
    45% 2.5%,
    50% 1%,
    55% 2%,
    60% 0.5%,
    65% 2%,
    70% 1%,
    75% 2.5%,
    80% 1%,
    85% 2%,
    90% 0.5%,
    95% 2%,
    98% 1%,
    100% 2%,
    100% 100%,
    0 100%
  );
  box-shadow: 0 -15px 40px rgba(0, 0, 0, 0.12);
  padding: 36px 22px 28px;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
}

#phone[data-theme="xianxia"] .tactical-panel .panel-header {
  position: relative;
  border-bottom: none;
  margin-bottom: 8px;
}

#phone[data-theme="xianxia"] .tactical-panel .panel-header::after {
  content: "勘";
  position: absolute;
  top: -4px;
  right: 36px;
  width: 36px;
  height: 36px;
  border: 2px solid #b8860b;
  color: #b8860b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-family: var(--font-mono);
  font-weight: bold;
  border-radius: 2px;
  transform: rotate(15deg);
  box-shadow: inset 0 0 5px rgba(184, 134, 11, 0.3);
  opacity: 0;
}

#phone[data-theme="xianxia"] .tactical-panel.active .panel-header::after {
  animation: stamp-slam 0.3s 0.45s forwards;
}

@keyframes stamp-slam {
  0% {
    transform: scale(3) rotate(45deg);
    opacity: 0;
  }
  100% {
    transform: scale(1) rotate(15deg);
    opacity: 1;
  }
}

#phone[data-theme="xianxia"] .tactical-panel .panel-title {
  font-size: 28px;
  font-family: var(--font-mono);
  color: #1a1a1a;
  letter-spacing: 2px;
}

#phone[data-theme="xianxia"] .tactical-panel .panel-code {
  color: #888;
  font-size: 10px;
  letter-spacing: 2px;
  margin-top: 2px;
}

#phone[data-theme="xianxia"] .tactical-panel .panel-body {
  color: #666;
  font-size: 13px;
  line-height: 1.8;
  padding-left: 14px;
  border-left: 2px solid #c0392b;
  margin: 16px 0 20px;
}

#phone[data-theme="xianxia"] .tactical-panel .data-label {
  color: #888;
  letter-spacing: 2px;
}

#phone[data-theme="xianxia"] .tactical-panel .data-value {
  font-family: var(--font-mono);
  color: #1a1a1a;
  font-size: 18px;
}

#phone[data-theme="xianxia"] .tactical-panel .data-cell {
  border-color: rgba(26, 26, 26, 0.12);
}

#phone[data-theme="xianxia"] .map-breach-btn {
  background: #1a1a1a;
  color: #fcfbf9;
  border: none;
  font-family: var(--font-heavy);
  letter-spacing: 6px;
  clip-path: polygon(2% 0, 98% 0, 100% 20%, 100% 100%, 0 100%, 0 20%);
}

#phone[data-theme="xianxia"] .map-breach-btn:active:not(:disabled) {
  background: #c0392b;
}

#phone[data-theme="xianxia"] .map-cancel-btn {
  border-color: #aaa;
  color: #888;
}

/* 飞剑敕令 overlay */
.sword-breach-overlay {
  position: absolute;
  inset: 0;
  z-index: 210;
  pointer-events: none;
  display: none;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
}

.sword-breach-overlay.active {
  display: flex;
  opacity: 1;
  visibility: visible;
}

.sword-breach-overlay .ink-mask {
  position: absolute;
  inset: 0;
  background: rgba(252, 251, 249, 0.95);
  opacity: 0;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.sword-breach-overlay.active .ink-mask {
  animation: ink-mask-in 2.2s forwards;
}

@keyframes ink-mask-in {
  0% {
    opacity: 0;
  }
  15% {
    opacity: 1;
  }
  85% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.sword-breach-overlay .ink-burst {
  position: absolute;
  width: 20px;
  height: 20px;
  background: #1a1a1a;
  border-radius: 50%;
  filter: blur(8px);
  opacity: 0;
}

.sword-breach-overlay.active .ink-burst {
  animation: ink-burst-out 1s ease-out forwards;
}

@keyframes ink-burst-out {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }
  100% {
    transform: scale(60);
    opacity: 0;
  }
}

.sword-breach-overlay .swords-layer {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.sword-breach-overlay .sword-wrapper {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
}

.sword-breach-overlay .sword-svg {
  width: 22px;
  height: 140px;
  position: absolute;
  top: -170px;
  filter: drop-shadow(0 8px 8px rgba(0, 0, 0, 0.28));
}

.sword-breach-overlay .sword-trail {
  position: absolute;
  top: -260px;
  width: 2px;
  height: 90px;
  background: linear-gradient(to top, rgba(26, 26, 26, 0.75), transparent);
  opacity: 0;
}

.sword-breach-overlay.active .sword-wrapper {
  animation: swords-in 1.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes swords-in {
  0% {
    transform: rotate(var(--angle)) translateY(-400px) scale(0.5);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  60% {
    transform: rotate(calc(var(--angle) + 180deg)) translateY(-120px) scale(1);
    opacity: 1;
  }
  90% {
    transform: rotate(calc(var(--angle) + 360deg)) translateY(-100px) scale(1);
    opacity: 1;
  }
  100% {
    transform: rotate(calc(var(--angle) + 360deg)) translateY(-50px) scale(0.8);
    opacity: 0;
  }
}

.sword-breach-overlay .compass-layer {
  position: absolute;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transform: scale(0.8);
}

.sword-breach-overlay.active .compass-layer {
  animation: compass-show 0.8s 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes compass-show {
  0% {
    transform: scale(0.8) rotate(-90deg);
    opacity: 0;
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

.sword-breach-overlay .compass-inner {
  transform-origin: 140px 140px;
  animation: poi-spin 20s linear infinite;
}

.sword-breach-overlay .compass-text {
  position: absolute;
  font-size: 44px;
  font-weight: bold;
  color: #c0392b;
  font-family: "STSong", "SimSun", "Songti SC", serif;
  opacity: 0;
  transform: scale(3);
}

.sword-breach-overlay.active .compass-text {
  animation: text-slam 0.4s 1.4s cubic-bezier(0.1, 0.9, 0.2, 1) forwards;
}

@keyframes text-slam {
  0% {
    opacity: 0;
    transform: scale(3) rotate(-20deg);
  }
  80% {
    transform: scale(0.9) rotate(5deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

/* ================= 现代都市：Nexus 极简（参考星盘 / 灰纸 / 衬线大日期） ================= */
#phone[data-theme="modern"] {
  color: var(--sys-text);
}

/* 顶栏/底栏：结构固定，仅吃主题色变量 */
#phone[data-theme="modern"] .sys-title {
  color: var(--sys-white);
}

#phone[data-theme="modern"] .sys-sub {
  color: var(--sys-red);
}

#phone[data-theme="modern"] .sys-status {
  color: var(--sys-gray);
}

#phone[data-theme="modern"] .sys-status span {
  color: var(--sys-red) !important;
}

#phone[data-theme="modern"] .time-block {
  margin-bottom: 28px;
  position: relative;
  z-index: 2;
}

#phone[data-theme="modern"] .time-text {
  font-family: var(--font-heavy);
  font-style: normal;
  transform: none;
  letter-spacing: -0.04em;
  line-height: 0.85;
  color: var(--sys-text);
  text-shadow: none;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

#phone[data-theme="modern"] .time-text::before {
  display: none;
}

#phone[data-theme="modern"] .nexus-day {
  font-size: 72px;
  font-weight: 400;
  letter-spacing: -3px;
  line-height: 0.8;
}

#phone[data-theme="modern"] .nexus-month {
  font-size: 24px;
  font-style: italic;
  font-weight: 400;
}

#phone[data-theme="modern"] .nexus-clock {
  flex-basis: 100%;
  display: block;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--nexus-sub);
  letter-spacing: 0.16em;
  border-bottom: 1px solid var(--nexus-line);
  padding-bottom: 4px;
  width: fit-content;
}

#phone[data-theme="modern"] .time-info {
  margin-top: 14px;
  color: var(--nexus-sub);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  border-left: 1px solid var(--nexus-line);
  padding-left: 10px;
  line-height: 1.6;
}

#phone[data-theme="modern"] .time-info .muted {
  color: var(--nexus-sub);
  opacity: 0.85;
}

#phone[data-theme="modern"] .sys-card {
  clip-path: none;
  border-radius: 0;
  border: 1px solid var(--nexus-glass-border);
  background: var(--nexus-glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: none;
  padding: 18px 16px;
}

#phone[data-theme="modern"] .sys-card::before {
  width: 1px;
  background: var(--sys-text);
  opacity: 0.35;
}

#phone[data-theme="modern"] .sys-card::after {
  content: none;
}

#phone[data-theme="modern"] .sys-card:active {
  background: rgba(255, 255, 255, 0.82);
  transform: none;
}

#phone[data-theme="modern"] .sys-card.disabled {
  opacity: 0.42;
  filter: grayscale(0.4);
}

#phone[data-theme="modern"] .card-title {
  font-family: var(--font-heavy);
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--sys-text);
  font-size: 20px;
}

#phone[data-theme="modern"] .sys-card.quest-card .card-title {
  color: var(--sys-text);
}

#phone[data-theme="modern"] .card-code {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--nexus-sub);
  opacity: 0.7;
}

#phone[data-theme="modern"] .card-desc {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--nexus-sub);
  letter-spacing: 0.02em;
  line-height: 1.55;
}

#phone[data-theme="modern"] .card-status {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--nexus-sub);
}

#phone[data-theme="modern"] .term-msg {
  border-left: 1px solid var(--sys-text);
  background: transparent;
  color: var(--sys-text);
  font-family: var(--font-mono);
  font-size: 12px;
}

#phone[data-theme="modern"] .term-msg.sys {
  border-left-color: var(--nexus-sub);
  color: var(--nexus-sub);
}

#phone[data-theme="modern"] .term-msg.alert {
  border-left-color: var(--sys-text);
  color: var(--sys-text);
  font-weight: 700;
}

#phone[data-theme="modern"] .action-btn {
  background: transparent;
  border: 1px solid var(--sys-text);
  color: var(--sys-text);
  font-family: var(--font-mono);
  letter-spacing: 0.14em;
  border-radius: 0;
  clip-path: none;
}

#phone[data-theme="modern"] .action-btn:active {
  background: var(--sys-text);
  color: #e5e5e5;
}

#phone[data-theme="modern"] .action-btn.danger {
  border-color: #444;
  color: #333;
}

#phone[data-theme="modern"] .sys-input {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--nexus-line);
  color: var(--sys-text);
  font-family: var(--font-mono);
  border-radius: 0;
}

#phone[data-theme="modern"] .sys-input:focus {
  border-color: var(--input-focus-border);
  box-shadow: 0 0 10px var(--input-focus-glow);
  outline: none;
}

#phone[data-theme="modern"] .app-window {
  background: rgba(229, 229, 229, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top-color: var(--sys-text);
}

#phone[data-theme="modern"] .app-header {
  background: var(--nexus-glass);
  border-bottom: 1px solid var(--nexus-line);
}

#phone[data-theme="modern"] .app-title {
  color: var(--sys-text);
  font-family: var(--font-heavy);
}

#phone[data-theme="modern"] .back-btn {
  color: var(--nexus-sub);
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
}

#phone[data-theme="modern"] .back-btn:active {
  color: var(--sys-text);
}

#phone[data-theme="modern"] .obs-file {
  background: var(--nexus-glass);
  border: 1px solid var(--nexus-line);
  box-shadow: none;
  background-image: none;
}

#phone[data-theme="modern"] .fold-panel {
  background: var(--nexus-glass);
  border: 1px solid var(--nexus-line);
}

#phone[data-theme="modern"] .fold-panel > summary {
  color: var(--sys-text);
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
}

#phone[data-theme="modern"] .avatar-frame {
  background: #ddd;
  border: 1px solid var(--nexus-line);
  box-shadow: none;
}

#phone[data-theme="modern"] .avatar-letter {
  color: #888;
  font-family: var(--font-heavy);
  font-style: italic;
}

#phone[data-theme="modern"] .avatar-name {
  color: var(--sys-text);
  font-family: var(--font-mono);
}

#phone[data-theme="modern"] .avatar-role {
  color: var(--nexus-sub);
}

#phone[data-theme="modern"] .obs-info .key {
  color: var(--nexus-sub);
}

#phone[data-theme="modern"] .obs-info .val,
#phone[data-theme="modern"] .obs-info .obs-edit {
  color: var(--sys-text);
  background: transparent;
  border-color: var(--nexus-line);
}

#phone[data-theme="modern"] .stamp-obs {
  border-color: var(--sys-text);
  color: var(--sys-text);
  mix-blend-mode: normal;
  opacity: 0.35;
  font-family: var(--font-mono);
}

#phone[data-theme="modern"] .gender-select {
  background: rgba(255, 255, 255, 0.7);
  border-color: var(--nexus-line);
  color: var(--sys-text);
}

#phone[data-theme="modern"] .template-chip {
  border-color: var(--nexus-line);
  color: var(--nexus-sub);
  background: transparent;
  font-family: var(--font-mono);
}

#phone[data-theme="modern"] .template-chip.active {
  border-color: var(--sys-text);
  color: var(--sys-text);
  background: rgba(255, 255, 255, 0.7);
}

#phone[data-theme="modern"] .toast {
  background: rgba(17, 17, 17, 0.9);
  color: #e5e5e5;
  border: none;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
}

#phone[data-theme="modern"] .compact-widget {
  background: #f0f0f0;
  border-color: var(--nexus-line);
  box-shadow: none;
  clip-path: none;
}

#phone[data-theme="modern"] .compact-widget .left-deco {
  background: #e8e8e8;
  border-right-color: var(--nexus-line);
}

#phone[data-theme="modern"] .compact-widget .left-deco::before {
  color: var(--sys-text);
}

#phone[data-theme="modern"] .compact-widget .alert-line {
  background: var(--sys-text);
  box-shadow: none;
}

#phone[data-theme="modern"] .compact-widget .header-tag,
#phone[data-theme="modern"] .compact-widget .main-title,
#phone[data-theme="modern"] .compact-widget .data-row .val {
  color: var(--sys-text);
}

#phone[data-theme="modern"] .compact-widget .nav-item.active {
  color: var(--sys-text);
  border-color: var(--sys-text);
  background: rgba(0, 0, 0, 0.04);
}

#phone[data-theme="modern"] #app-map .map-shell {
  background: #e8e8e8;
}

#phone[data-theme="modern"] .map-bg {
  opacity: 0.5;
  filter: grayscale(1) contrast(1.15);
}

#phone[data-theme="modern"] .radar-sweep {
  opacity: 0.35;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(0, 0, 0, 0.03) 45deg,
    rgba(0, 0, 0, 0.08) 90deg,
    transparent 90deg
  );
}

#phone[data-theme="modern"] .hud-top {
  color: var(--nexus-sub);
  border-bottom-color: var(--nexus-line);
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
}

#phone[data-theme="modern"] .hud-top span {
  color: var(--sys-text);
}

#phone[data-theme="modern"] .poi-label {
  color: var(--sys-text);
  text-shadow: none;
  font-family: var(--font-mono);
}

#phone[data-theme="modern"] .poi.yellow .poi-label {
  color: var(--sys-text);
  font-weight: 700;
  border-bottom: 1px solid var(--sys-text);
}

#phone[data-theme="modern"] .poi.yellow .poi-core {
  background: var(--sys-text);
  box-shadow: 0 0 12px rgba(17, 17, 17, 0.35);
}

#phone[data-theme="modern"] .tactical-panel {
  background: rgba(245, 245, 245, 0.95);
  border-top: 1px solid var(--nexus-line);
  box-shadow: 0 -12px 30px rgba(0, 0, 0, 0.08);
}

#phone[data-theme="modern"] .map-breach-btn {
  background: var(--sys-text);
  color: #e5e5e5;
  border: none;
  font-family: var(--font-mono);
  letter-spacing: 0.16em;
}

#phone[data-theme="modern"] .warning-overlay {
  background: rgba(229, 229, 229, 0.96);
}

#phone[data-theme="modern"] .tape {
  background: #111;
}

#phone[data-theme="modern"] .tape-text {
  color: #e5e5e5;
}

#phone[data-theme="modern"] .breach-lock-text {
  color: var(--sys-text);
  background: #e5e5e5;
  border-color: var(--sys-text);
  text-shadow: none;
  transform: none;
  font-family: var(--font-heavy);
  font-style: italic;
}

#phone[data-theme="modern"] .warning-overlay.active .breach-lock-text {
  transform: none;
}

#phone[data-theme="modern"] .scan-target {
  color: var(--sys-text);
  border-bottom: 1px solid rgba(17, 17, 17, 0.45);
}

#phone[data-theme="modern"] .story-choices .choice-btn,
#phone[data-theme="modern"] .choice-btn {
  border-color: var(--nexus-line);
  background: var(--nexus-glass);
  color: var(--sys-text);
  font-family: var(--font-mono);
}

#phone[data-theme="modern"] .hr {
  border-color: var(--nexus-line);
}

#phone[data-theme="modern"] .api-hint,
#phone[data-theme="modern"] .save-tip,
#phone[data-theme="modern"] .fold-hint,
#phone[data-theme="modern"] .persona-hint {
  color: var(--nexus-sub);
}
