/* ============ J.A.R.V.I.S. 全息界面样式 ============ */
:root {
  --cyan: #00e5ff;
  --cyan-dim: rgba(0, 229, 255, 0.35);
  --cyan-faint: rgba(0, 229, 255, 0.12);
  --gold: #ffd166;
  --red: #ff4d5e;
  --bg: #04080f;
  --panel: rgba(6, 18, 34, 0.82);
  --text: #c8f4ff;
  --text-dim: #5e8f9e;
  --mono: 'Consolas', 'Courier New', monospace;
}

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

html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
  overflow: hidden;
}

/* ---------- 背景层 ---------- */
#particles { position: fixed; inset: 0; z-index: 0; }

.grid-overlay {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(rgba(0, 229, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 229, 255, 0.05) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
}

.scanline {
  position: fixed; left: 0; right: 0; height: 140px; z-index: 2; pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(0, 229, 255, 0.06), transparent);
  animation: scan 7s linear infinite;
}
@keyframes scan { from { top: -160px; } to { top: 110vh; } }

.vignette {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

.hidden { display: none !important; }

/* ---------- 开机动画 ---------- */
.boot {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, #061426 0%, #02050a 75%);
  cursor: pointer;
}
.boot-inner { text-align: center; }
.boot-logo { position: relative; width: 120px; height: 120px; margin: 0 auto 26px; filter: drop-shadow(0 0 18px var(--cyan-dim)); }
#bootRing { animation: ring 2.2s ease-out forwards; }
@keyframes ring { from { stroke-dashoffset: 339; } to { stroke-dashoffset: 0; } }
.boot-logo::after {
  content: ''; position: absolute; left: 10%; right: 10%; bottom: 4px; height: 22px;
  background: radial-gradient(ellipse, rgba(0,229,255,.35), transparent 70%);
  filter: blur(4px);
}
.boot-title {
  font-family: var(--mono); font-size: 44px; letter-spacing: 10px;
  color: var(--cyan); text-shadow: 0 0 14px var(--cyan-dim), 0 0 40px rgba(0,229,255,.25);
  margin-bottom: 12px;
}
.boot-sub { color: var(--text-dim); font-size: 13px; letter-spacing: 3px; margin-bottom: 22px; min-height: 18px; }
.boot-bar { width: 320px; height: 3px; margin: 0 auto; background: rgba(0,229,255,.15); overflow: hidden; }
.boot-bar-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), #7dfcff); box-shadow: 0 0 10px var(--cyan); }
.boot-hint { margin-top: 26px; color: rgba(94,143,158,.6); font-size: 12px; letter-spacing: 2px; animation: blink 1.6s infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* ---------- 主界面 ---------- */
.app {
  position: relative; z-index: 5; height: 100vh;
  display: flex; flex-direction: column; padding: 14px 20px 18px;
}
.app.fade-in { animation: appIn .8s ease; }
@keyframes appIn { from { opacity: 0; transform: translateY(12px); } }

/* 顶部栏 */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 14px; border: 1px solid var(--cyan-dim);
  background: linear-gradient(180deg, rgba(0,229,255,.07), rgba(0,229,255,.02));
  box-shadow: inset 0 0 24px rgba(0,229,255,.06), 0 0 18px rgba(0,229,255,.05);
  clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 22px 100%, 0 calc(100% - 22px));
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan); animation: pulse 2s infinite;
}
@keyframes pulse { 50% { opacity: .4; } }
.brand-name { font-family: var(--mono); font-size: 22px; letter-spacing: 4px; color: var(--cyan); text-shadow: 0 0 12px var(--cyan-dim); }
.brand-tag { font-size: 11px; color: var(--text-dim); letter-spacing: 2px; }
.top-right { display: flex; align-items: center; gap: 18px; }
.status-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11px; color: var(--text-dim); letter-spacing: 1px;
  padding: 4px 10px; border: 1px solid rgba(0,229,255,.2); background: rgba(0,229,255,.04);
}
.status-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-dim); }
.status-chip.on { color: var(--cyan); border-color: var(--cyan-dim); }
.status-chip.on i { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); animation: pulse 1.4s infinite; }
.status-chip.listening { color: var(--red); border-color: rgba(255,77,94,.5); }
.status-chip.listening i { background: var(--red); box-shadow: 0 0 8px var(--red); animation: pulse .6s infinite; }
.clock { text-align: right; line-height: 1.25; }
#clockTime { font-family: var(--mono); font-size: 19px; color: var(--cyan); text-shadow: 0 0 10px var(--cyan-dim); display: block; }
#clockDate { font-size: 11px; color: var(--text-dim); letter-spacing: 1px; }

/* 主内容 */
.main { flex: 1; display: flex; gap: 16px; margin-top: 14px; min-height: 0; }

/* 面板通用 */
.chat-panel, .sys-panel {
  background: var(--panel); border: 1px solid var(--cyan-dim);
  box-shadow: inset 0 0 40px rgba(0,229,255,.04), 0 0 24px rgba(0,229,255,.06);
  backdrop-filter: blur(6px);
  clip-path: polygon(0 0, calc(100% - 26px) 0, 100% 26px, 100% 100%, 26px 100%, 0 calc(100% - 26px));
  display: flex; flex-direction: column;
}
.chat-panel { flex: 1; padding: 14px 18px 12px; min-width: 0; }
.sys-panel { width: 300px; padding: 14px 18px 12px; overflow-y: auto; }

.panel-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; letter-spacing: 3px; color: var(--cyan);
  margin-bottom: 12px; white-space: nowrap;
}
.panel-title.small { margin-bottom: 8px; font-size: 11px; letter-spacing: 2px; }
.panel-title-line { flex: 1; height: 1px; background: linear-gradient(90deg, var(--cyan-dim), transparent); }
.panel-title-line:first-child { background: linear-gradient(90deg, transparent, var(--cyan-dim)); }
.panel-title-sub { color: var(--text-dim); font-size: 10px; letter-spacing: 2px; }

/* ---------- 对话区 ---------- */
.chat-log { flex: 1; overflow-y: auto; padding: 6px 4px 12px; scroll-behavior: smooth; }
.chat-log::-webkit-scrollbar { width: 5px; }
.chat-log::-webkit-scrollbar-thumb { background: var(--cyan-dim); }

.msg { display: flex; gap: 12px; margin-bottom: 18px; animation: msgIn .35s ease; }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } }
.msg-avatar {
  width: 34px; height: 34px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-weight: bold; font-size: 16px;
  border: 1px solid var(--cyan-dim); color: var(--cyan);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: rgba(0,229,255,.08);
}
.msg.user .msg-avatar { border-color: var(--gold); color: var(--gold); background: rgba(255,209,102,.08); }
.msg-body { flex: 1; min-width: 0; }
.msg-meta { font-size: 10px; color: var(--text-dim); letter-spacing: 2px; margin-bottom: 4px; display: flex; gap: 8px; align-items: center; }
.msg-meta span { font-size: 9px; color: rgba(94,143,158,.55); }
.msg.user .msg-meta { color: var(--gold); }
.msg-text {
  font-size: 14px; line-height: 1.75; color: var(--text);
  border-left: 2px solid var(--cyan-dim); padding-left: 12px;
  white-space: pre-wrap; word-break: break-word;
}
.msg.user .msg-text { border-left-color: rgba(255,209,102,.5); }
.msg-text .caret {
  display: inline-block; width: 8px; height: 15px; margin-left: 2px;
  background: var(--cyan); vertical-align: -2px; animation: blink .8s infinite;
}

/* 输入区 */
.input-area { display: flex; gap: 10px; align-items: center; border-top: 1px solid rgba(0,229,255,.12); padding-top: 12px; }
.input-area input {
  flex: 1; background: rgba(0,229,255,.05); border: 1px solid var(--cyan-dim);
  color: var(--text); font-size: 14px; padding: 11px 14px; outline: none;
  font-family: inherit; transition: box-shadow .2s;
}
.input-area input:focus { box-shadow: 0 0 14px rgba(0,229,255,.15), inset 0 0 8px rgba(0,229,255,.05); }
.input-area input::placeholder { color: rgba(94,143,158,.55); }
.mic-btn, .send-btn {
  width: 42px; height: 42px; flex-shrink: 0; cursor: pointer;
  background: rgba(0,229,255,.07); border: 1px solid var(--cyan-dim);
  color: var(--cyan); display: flex; align-items: center; justify-content: center;
  transition: all .2s;
}
.mic-btn:hover, .send-btn:hover { background: rgba(0,229,255,.2); box-shadow: 0 0 14px rgba(0,229,255,.25); }
.mic-btn.active { background: rgba(255,77,94,.18); border-color: var(--red); color: var(--red); box-shadow: 0 0 16px rgba(255,77,94,.4); animation: pulse 1s infinite; }

/* ---------- 系统面板 ---------- */
.gauge-wrap { display: flex; justify-content: center; margin: 4px 0 16px; }
.gauge { width: 150px; height: 150px; filter: drop-shadow(0 0 10px rgba(0,229,255,.2)); }
.gauge-bg { fill: none; stroke: rgba(0,229,255,.12); stroke-width: 7; }
.gauge-val {
  fill: none; stroke: var(--cyan); stroke-width: 7; stroke-linecap: round;
  stroke-dasharray: 314; stroke-dashoffset: 314;
  transition: stroke-dashoffset .6s ease; filter: drop-shadow(0 0 6px var(--cyan));
}
.gauge-num { fill: var(--cyan); font-size: 22px; font-family: var(--mono); text-shadow: 0 0 8px var(--cyan-dim); }
.gauge-label { fill: var(--text-dim); font-size: 11px; letter-spacing: 3px; }

.sys-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 12px; }
.sys-label { color: var(--text-dim); letter-spacing: 1px; width: 74px; flex-shrink: 0; }
.sys-bar { flex: 1; height: 5px; background: rgba(0,229,255,.1); overflow: hidden; }
.sys-bar-fill {
  height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), #7dfcff);
  box-shadow: 0 0 8px var(--cyan); transition: width .6s ease;
}
.sys-bar-fill.hot { background: linear-gradient(90deg, var(--gold), var(--red)); box-shadow: 0 0 8px var(--red); }
.sys-value { font-size: 12px; color: var(--text); text-align: right; white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 11px; }

.log-feed { margin-top: 16px; border-top: 1px solid rgba(0,229,255,.1); padding-top: 10px; }
.sys-log { max-height: 130px; overflow-y: auto; font-family: var(--mono); font-size: 11px; line-height: 1.9; color: var(--text-dim); }
.sys-log::-webkit-scrollbar { width: 4px; }
.sys-log::-webkit-scrollbar-thumb { background: var(--cyan-dim); }
.sys-log .log-line { animation: logIn .3s ease; }
.sys-log .log-time { color: rgba(94,143,158,.5); margin-right: 6px; }
.sys-log .log-ok { color: var(--cyan); }
.sys-log .log-warn { color: var(--gold); }
@keyframes logIn { from { opacity: 0; } }

@media (max-width: 900px) {
  .main { flex-direction: column; }
  .sys-panel { width: 100%; }
}
