/* =========================================================================
   Base & Cyberpunk Theme Foundations
   Lo-Fi Stories // 全局变量、重置与基础视觉基石
   ========================================================================= */

:root {
  --bg-deep: #070b09;
  --bg-surface: rgba(11, 20, 16, 0.90);
  --bg-panel: rgba(7, 13, 10, 0.88);
  --emerald-dark: #064e3b;
  --emerald-primary: #10b981;
  --emerald-bright: #34d399;
  --emerald-glow: rgba(52, 211, 153, 0.35);
  --emerald-pale: #a7f3d0;
  --border-dim: rgba(52, 211, 153, 0.22);
  --border-bright: rgba(52, 211, 153, 0.65);
  --text-main: #f0fdf4;
  --text-muted: #6ee7b7;
  --text-dim: #059669;
  --font-mono: "Fira Code", "Cascadia Code", "Consolas", monospace;
  --scope-cursor: url('../404/cursor.svg') 16 16, crosshair;

  /* 动态栅格尺寸控制 */
  --left-dock-w: 290px;
  --sidebar-w: 340px;
  --bottom-h: 140px;
  --gap-x: 16px;
  --gap-y: 16px;
  --layout-padding: 16px;
}

html:not(.local-development) .chikage-debug,
html:not(.local-development) .voice-toolbar,
html:not(.local-development) .voice-editor { display: none !important; }

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

html, body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-mono);
  cursor: var(--scope-cursor);
}

/* CRT 微弱扫描线与暗角质感 (GPU 独立合成图层隔离，避免全屏重绘) */
.crt-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  background:
    radial-gradient(circle at 50% 50%, transparent 60%, rgba(3, 7, 5, 0.88) 100%),
    repeating-linear-gradient(0deg, rgba(0,0,0,0.12) 0px, rgba(0,0,0,0.12) 1px, transparent 1px, transparent 3px);
  opacity: 0.65;
  contain: strict;
  transform: translateZ(0);
}

/* 全局背景微弱星尘网格 (独立隔离图层) */
.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: 
    linear-gradient(rgba(52, 211, 153, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(52, 211, 153, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.75;
  contain: strict;
  transform: translateZ(0);
}

/* =========================================================================
   通用赛博线框容器与 HUD 刻度
   ========================================================================= */
.cyber-frame {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-dim);
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.55), inset 0 0 16px rgba(16, 185, 129, 0.03);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, opacity 0.3s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
}

.cyber-frame:hover {
  border-color: var(--border-bright);
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.8), 0 0 12px var(--emerald-glow), inset 0 0 20px rgba(16, 185, 129, 0.05);
}

/* 四角 HUD 十字准星装饰 */
.cyber-frame::before {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  width: 8px;
  height: 8px;
  border-top: 2px solid var(--emerald-bright);
  border-left: 2px solid var(--emerald-bright);
  pointer-events: none;
  z-index: 5;
}

.cyber-frame::after {
  content: "";
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 8px;
  height: 8px;
  border-bottom: 2px solid var(--emerald-bright);
  border-right: 2px solid var(--emerald-bright);
  pointer-events: none;
  z-index: 5;
}

/* 模块统一标题顶栏 */
.frame-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: rgba(5, 10, 8, 0.85);
  border-bottom: 1px solid rgba(52, 211, 153, 0.15);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--emerald-bright);
  text-transform: uppercase;
  white-space: nowrap;
}

.frame-tag-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--emerald-bright);
  box-shadow: 0 0 5px rgba(52, 211, 153, 0.45);
  animation: none;
  flex-shrink: 0;
}

.frame-tag-right {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 10px;
  flex-shrink: 0;
}

/* 顶栏控制按钮 */
.frame-btn-collapse {
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.28);
  color: var(--emerald-bright);
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 3px;
  cursor: var(--scope-cursor);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  outline: none;
}

.frame-btn-collapse:hover {
  background: rgba(52, 211, 153, 0.22);
  border-color: var(--emerald-bright);
  box-shadow: 0 0 8px var(--emerald-glow);
  color: #fff;
}

.frame-btn-collapse.active {
  background: rgba(16, 185, 129, 0.28);
  border-color: var(--emerald-bright);
  color: #fff;
  box-shadow: 0 0 10px var(--emerald-glow);
}

.frame-btn-collapse svg {
  width: 12px;
  height: 12px;
}

/* 顶栏纯图标控制按钮 (收起/折叠/设置) */
.frame-btn-icon-only {
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.28);
  color: var(--emerald-bright);
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: var(--scope-cursor);
  transition: all 0.2s ease;
  outline: none;
  flex-shrink: 0;
}

.frame-btn-icon-only:hover {
  background: rgba(52, 211, 153, 0.22);
  border-color: var(--emerald-bright);
  color: #fff;
  box-shadow: 0 0 10px var(--emerald-glow);
}

.frame-btn-icon-only svg {
  width: 13px;
  height: 13px;
}

/* 通用动画关键帧 */
@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.85); }
}

@keyframes sweepMove {
  0% { transform: translateY(0); opacity: 0; }
  15% { opacity: 0.6; }
  85% { opacity: 0.6; }
  100% { transform: translateY(400px); opacity: 0; }
}

@keyframes bounceUp {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
