/* ============================================================
   中科OPC算力网 · H5 赛博风格设计系统  V202611162200
   cyberpunk / 霓虹赛博 · 移动端优先 · 零外部依赖 · 离线可开
   ============================================================ */

:root {
  --cy-bg: #05060f;
  --cy-bg-2: #0a0d1f;
  --cy-panel: rgba(13, 18, 38, 0.86);
  --cy-panel-2: rgba(18, 24, 50, 0.92);
  --cy-line: rgba(0, 240, 255, 0.22);
  --cy-line-dim: rgba(0, 240, 255, 0.10);
  --cy-cyan: #00f0ff;
  --cy-cyan-dim: rgba(0, 240, 255, 0.12);
  --cy-magenta: #ff2a6d;
  --cy-magenta-dim: rgba(255, 42, 109, 0.14);
  --cy-yellow: #fcea0a;
  --cy-yellow-dim: rgba(252, 234, 10, 0.10);
  --cy-green: #05ffa1;
  --cy-green-dim: rgba(5, 255, 161, 0.10);
  --cy-text: #e8f6ff;
  --cy-sub: #8ba3c7;
  --cy-faint: #55688f;
  --cy-font: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  --cy-mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--cy-bg);
  color: var(--cy-text);
  font: 400 14px/1.7 var(--cy-font);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img, svg { display: block; max-width: 100%; }
.mono { font-family: var(--cy-mono); }

/* ---------- 全局氛围：网格 + 扫描线 + 辉光 ---------- */
.cy-fx {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(120vw 60vw at 80% -10%, rgba(255, 42, 109, 0.08), transparent 60%),
    radial-gradient(120vw 60vw at 10% 110%, rgba(0, 240, 255, 0.10), transparent 60%),
    linear-gradient(rgba(0, 240, 255, 0.030) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.030) 1px, transparent 1px);
  background-size: auto, auto, 34px 34px, 34px 34px;
}
.cy-scan {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.16) 0 1px, transparent 1px 3px);
  opacity: 0.55;
}
/* 顶部霓虹扫描光带 */
.cy-sweep {
  position: fixed; left: 0; right: 0; top: 0; height: 3px; z-index: 60; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--cy-cyan), var(--cy-magenta), transparent);
  background-size: 200% 100%;
  animation: sweep 6s linear infinite;
  opacity: 0.85;
}
@keyframes sweep { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- 应用框架 ---------- */
#cy-app {
  max-width: 480px; margin: 0 auto; min-height: 100vh;
  padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  position: relative;
}

/* 顶栏 */
.cy-top {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: rgba(5, 6, 15, 0.88);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--cy-line);
}
.cy-logo { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.cy-logo svg { width: 26px; height: 26px; flex: none; }
.cy-logo b { font-size: 16px; font-weight: 800; letter-spacing: 0.02em; white-space: nowrap; }
.cy-logo b em { font-style: normal; color: var(--cy-cyan); text-shadow: 0 0 12px rgba(0, 240, 255, 0.65); }
.cy-logo small {
  display: block; font-family: var(--cy-mono); font-size: 8px;
  letter-spacing: 0.2em; color: var(--cy-faint);
}
.cy-icon-btn {
  width: 36px; height: 36px; flex: none; display: flex; align-items: center; justify-content: center;
  background: var(--cy-cyan-dim); border: 1px solid var(--cy-line); border-radius: 8px;
  color: var(--cy-cyan); transition: all 0.2s;
}
.cy-icon-btn:active { transform: scale(0.92); }

/* 底部导航 */
.cy-tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; z-index: 50;
  width: 100%; max-width: 480px;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(5, 6, 15, 0.92);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--cy-line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.cy-tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 0 7px; color: var(--cy-faint); font-size: 10.5px;
  transition: color 0.2s; position: relative;
}
.cy-tab svg { width: 21px; height: 21px; }
.cy-tab.on { color: var(--cy-cyan); text-shadow: 0 0 10px rgba(0, 240, 255, 0.6); }
.cy-tab.on::before {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 26px; height: 2px; background: var(--cy-cyan);
  box-shadow: 0 0 8px var(--cy-cyan);
}

/* ---------- 通用组件 ---------- */
.cy-main { padding: 16px 16px calc(84px + env(safe-area-inset-bottom, 0px)); }
/* 带固定对话框的页面（AI助理）：为固定输入栏留出空间 */
body.has-inputbar .cy-main { padding-bottom: calc(210px + env(safe-area-inset-bottom, 0px)); }

/* HUD 分节标题 */
.cy-sec {
  display: flex; align-items: center; gap: 10px; margin: 22px 0 12px;
  font-family: var(--cy-mono); font-size: 11px; letter-spacing: 0.22em;
  color: var(--cy-cyan); text-transform: uppercase;
}
.cy-sec::before { content: "▚"; color: var(--cy-magenta); }
.cy-sec::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--cy-line), transparent); }

/* 面板（切角） */
.cy-panel {
  position: relative;
  background: var(--cy-panel);
  border: 1px solid var(--cy-line);
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
  padding: 16px;
}
.cy-panel.glow { box-shadow: 0 0 24px rgba(0, 240, 255, 0.10), inset 0 0 24px rgba(0, 240, 255, 0.03); }
.cy-panel.mag { border-color: rgba(255, 42, 109, 0.35); background: var(--cy-magenta-dim); }

/* 标签 */
.cy-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 600; letter-spacing: 0.06em;
  padding: 2px 8px; border-radius: 3px; white-space: nowrap;
  border: 1px solid var(--cy-line); color: var(--cy-cyan); background: var(--cy-cyan-dim);
  font-family: var(--cy-mono);
}
.cy-tag.mag { border-color: rgba(255, 42, 109, 0.45); color: var(--cy-magenta); background: var(--cy-magenta-dim); }
.cy-tag.yel { border-color: rgba(252, 234, 10, 0.40); color: var(--cy-yellow); background: var(--cy-yellow-dim); }
.cy-tag.grn { border-color: rgba(5, 255, 161, 0.40); color: var(--cy-green); background: var(--cy-green-dim); }
.cy-tag.dim { border-color: rgba(139, 163, 199, 0.25); color: var(--cy-sub); background: rgba(139, 163, 199, 0.07); }

/* 按钮 */
.cy-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 20px; font-size: 13.5px; font-weight: 700; letter-spacing: 0.04em;
  border: 1px solid var(--cy-cyan); color: #04121a;
  background: linear-gradient(180deg, #4df7ff, var(--cy-cyan));
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  box-shadow: 0 0 18px rgba(0, 240, 255, 0.35);
  transition: all 0.2s;
}
.cy-btn:active { transform: scale(0.96); }
.cy-btn.mag {
  border-color: var(--cy-magenta); color: #fff;
  background: linear-gradient(180deg, #ff5c8d, var(--cy-magenta));
  box-shadow: 0 0 18px rgba(255, 42, 109, 0.35);
}
.cy-btn.ghost {
  background: transparent; color: var(--cy-cyan); font-weight: 600;
  box-shadow: none;
  background: var(--cy-cyan-dim);
}
.cy-btn.sm { padding: 7px 14px; font-size: 12px; }
.cy-btn.block { width: 100%; }

/* 数字 / 单位 */
.cy-num { font-family: var(--cy-mono); font-weight: 700; color: var(--cy-cyan); text-shadow: 0 0 10px rgba(0, 240, 255, 0.45); }
.cy-num.mag { color: var(--cy-magenta); text-shadow: 0 0 10px rgba(255, 42, 109, 0.45); }
.cy-num.yel { color: var(--cy-yellow); text-shadow: 0 0 10px rgba(252, 234, 10, 0.35); }
.cy-unit { font-size: 10px; color: var(--cy-faint); font-family: var(--cy-mono); }

/* glitch 标题 */
.cy-glitch {
  position: relative; display: inline-block; font-weight: 800; letter-spacing: 0.03em;
  animation: glitch-flicker 4.6s infinite;
}
@keyframes glitch-flicker {
  0%, 91%, 94%, 100% { opacity: 1; text-shadow: 0 0 14px rgba(0, 240, 255, 0.5); }
  92% { opacity: 0.6; text-shadow: 2px 0 var(--cy-magenta), -2px 0 var(--cy-cyan); }
  93% { opacity: 0.9; text-shadow: -2px 0 var(--cy-magenta), 2px 0 var(--cy-cyan); }
}

/* 列表行 */
.cy-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; margin-top: 10px;
  background: var(--cy-panel); border: 1px solid var(--cy-line-dim);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}
.cy-row b { font-size: 13.5px; }
.cy-row .cy-row-sub { font-size: 11px; color: var(--cy-sub); margin-top: 2px; }
.cy-row.tap { cursor: pointer; transition: border-color 0.2s; }
.cy-row.tap:active { border-color: var(--cy-cyan); }

/* 模态框 */
.cy-mask {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(2, 4, 10, 0.78);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: none; align-items: flex-end; justify-content: center;
}
.cy-mask.show { display: flex; }
.cy-modal {
  width: 100%; max-width: 480px; max-height: 82vh; overflow: auto;
  background: var(--cy-bg-2); border-top: 1px solid var(--cy-cyan);
  box-shadow: 0 -12px 40px rgba(0, 240, 255, 0.15);
  padding: 18px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  animation: modalUp 0.28s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}
@keyframes modalUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.cy-modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding-bottom: 12px; margin-bottom: 14px;
  border-bottom: 1px dashed var(--cy-line);
}
.cy-modal-head b { font-size: 16px; }
.cy-modal-head .cy-x {
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--cy-line); border-radius: 6px; color: var(--cy-cyan);
  background: var(--cy-cyan-dim); font-size: 15px;
}

/* toast */
.cy-toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 300;
  transform: translateX(-50%) translateY(10px);
  max-width: 86%; padding: 10px 16px;
  background: var(--cy-panel-2); border: 1px solid var(--cy-cyan);
  color: var(--cy-text); font-size: 12.5px; text-align: center;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.25);
  opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s;
}
.cy-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 倒计时 */
.cy-count {
  display: flex; gap: 6px; align-items: center; justify-content: center;
  font-family: var(--cy-mono);
}
.cy-count i {
  font-style: normal; font-size: 16px; font-weight: 700; color: var(--cy-yellow);
  background: rgba(252, 234, 10, 0.08); border: 1px solid rgba(252, 234, 10, 0.35);
  padding: 3px 7px; border-radius: 4px; min-width: 34px; text-align: center;
  text-shadow: 0 0 8px rgba(252, 234, 10, 0.4);
}
.cy-count em { font-style: normal; color: var(--cy-faint); font-size: 11px; }

/* 表格（活动档位） */
.cy-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.cy-table th {
  font-family: var(--cy-mono); font-size: 10px; letter-spacing: 0.06em;
  color: var(--cy-cyan); text-align: right; padding: 8px 6px;
  border-bottom: 1px solid var(--cy-line); white-space: nowrap;
}
.cy-table th:first-child { text-align: left; }
.cy-table td {
  padding: 9px 6px; text-align: right; font-family: var(--cy-mono);
  border-bottom: 1px dashed var(--cy-line-dim); white-space: nowrap;
}
.cy-table td:first-child { text-align: left; color: var(--cy-sub); }
.cy-table tr:last-child td { border-bottom: none; }

/* 进度条 */
.cy-bar { height: 8px; background: rgba(0, 240, 255, 0.08); border: 1px solid var(--cy-line-dim); overflow: hidden; }
.cy-bar i {
  display: block; height: 100%;
  background: repeating-linear-gradient(45deg, var(--cy-cyan) 0 6px, rgba(0, 240, 255, 0.55) 6px 12px);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

/* 聊天（AI助理页） */
.cy-chat { display: flex; flex-direction: column; gap: 12px; }
.cy-msg { display: flex; gap: 8px; max-width: 92%; }
.cy-msg .cy-ava {
  width: 30px; height: 30px; flex: none; display: flex; align-items: center; justify-content: center;
  font-family: var(--cy-mono); font-size: 9px; font-weight: 700;
  border: 1px solid var(--cy-line); color: var(--cy-cyan); background: var(--cy-cyan-dim);
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}
.cy-msg .cy-bubble {
  padding: 10px 13px; font-size: 13px; line-height: 1.75;
  background: var(--cy-panel); border: 1px solid var(--cy-line-dim);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  white-space: pre-wrap; word-break: break-word;
}
.cy-msg.me { align-self: flex-end; flex-direction: row-reverse; }
.cy-msg.me .cy-ava { color: var(--cy-magenta); border-color: rgba(255, 42, 109, 0.4); background: var(--cy-magenta-dim); }
.cy-msg.me .cy-bubble { border-color: rgba(255, 42, 109, 0.3); background: var(--cy-magenta-dim); }
.cy-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.cy-chip {
  font-family: var(--cy-mono); font-size: 11.5px; padding: 7px 12px;
  border: 1px solid var(--cy-line); color: var(--cy-cyan); background: var(--cy-cyan-dim);
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
  transition: all 0.2s;
}
.cy-chip:active { transform: scale(0.94); background: rgba(0, 240, 255, 0.25); }
/* 对话框固定在底部（tabbar 之上，全宽居中 480px） */
.cy-inputbar {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 40;
  bottom: calc(60px + env(safe-area-inset-bottom, 0px));
  width: 100%; max-width: 480px; box-sizing: border-box;
  display: flex; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px) / 2);
  background: rgba(5, 6, 15, 0.94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--cy-line-dim);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.45);
}
.cy-inputbar .cy-chips { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
.cy-inputbar .cy-chips::-webkit-scrollbar { display: none; }
.cy-inputbar .cy-chip { flex: none; }
.cy-input {
  flex: 1; padding: 11px 13px; font: 500 13.5px var(--cy-font); outline: none;
  background: var(--cy-bg-2); border: 1px solid var(--cy-line); color: var(--cy-text);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}
.cy-input:focus { border-color: var(--cy-cyan); box-shadow: 0 0 12px rgba(0, 240, 255, 0.2); }

/* 页脚 */
.cy-foot {
  text-align: center; padding: 26px 16px 18px;
  font-family: var(--cy-mono); font-size: 9.5px; letter-spacing: 0.16em; color: var(--cy-faint);
}

/* 动画入场 */
.rise { opacity: 0; transform: translateY(14px); animation: rise 0.55s cubic-bezier(0.2, 0.8, 0.3, 1) forwards; }
.rise-d1 { animation-delay: 0.08s; }
.rise-d2 { animation-delay: 0.16s; }
.rise-d3 { animation-delay: 0.24s; }
@keyframes rise { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .rise { animation: none; opacity: 1; transform: none; } }
