/* style.css — 决策迷宫控制台: 深空墨蓝 + 磷光青 + 起司黄任务控制美学 */

:root {
  --ink: #0b0f1a;
  --ink-2: #101828;
  --panel: #111a2c;
  --line: #1e293b;
  --line-2: #2b3a52;
  --text: #dbe7ff;
  --dim: #64748b;
  --cyan: #5eead4;
  --cyan-2: #38bdf8;
  --blue: #60a5fa;
  --cheese: #fde047;
  --amber: #facc15;
  --cherry: #f87171;
  --pink: #f472b6;
  --green: #4ade80;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Consolas,
          "Noto Sans Mono CJK SC", "WenQuanYi Micro Hei Mono", monospace;
}

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

html, body { height: 100%; }

body {
  font-family: var(--mono);
  background: var(--ink);
  color: var(--text);
  overflow-x: hidden;
  /* 网格底纹 + 顶部辉光 */
  background-image:
    radial-gradient(ellipse 80% 40% at 50% -10%, rgba(56, 189, 248, 0.08), transparent),
    linear-gradient(rgba(30, 41, 59, 0.25) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 41, 59, 0.25) 1px, transparent 1px);
  background-size: 100% 100%, 34px 34px, 34px 34px;
}

/* ---------- 顶栏 ---------- */
header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 15, 26, 0.85);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 1px;
}

.logo .glyph {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(94, 234, 212, 0.12), rgba(56, 189, 248, 0.08));
  font-size: 18px;
}

.logo .sub {
  font-size: 10px;
  font-weight: 400;
  color: var(--dim);
  letter-spacing: 2px;
  display: block;
  margin-top: 2px;
}

.hdr-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 11px;
  color: var(--dim);
}

.led {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--ink-2);
}
.led::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--dim);
  box-shadow: 0 0 6px var(--dim);
}
.led.ok::before { background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse 2s infinite; }
.led.err::before { background: var(--cherry); box-shadow: 0 0 8px var(--cherry); }
.led.busy::before { background: var(--amber); box-shadow: 0 0 8px var(--amber); animation: pulse 0.8s infinite; }

@keyframes pulse { 50% { opacity: 0.4; } }

/* ---------- 主布局 ---------- */
main {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 18px;
  padding: 18px 22px 30px;
  max-width: 1600px;
  margin: 0 auto;
}

@media (max-width: 1000px) { main { grid-template-columns: 1fr; } }

/* ---------- 画布区 ---------- */
.stage {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--ink-2);
  padding: 14px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(148, 163, 184, 0.06);
}

.stage::after { /* 扫描线氛围 */
  content: "";
  position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,0.015) 0 1px, transparent 1px 3px);
  pointer-events: none;
  border-radius: 14px;
}

.stage-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.floor-tabs { display: flex; gap: 6px; }

.floor-tab {
  font-family: inherit;
  font-size: 11px;
  padding: 5px 12px;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  transition: all 0.15s;
}
.floor-tab:hover { color: var(--text); border-color: var(--cyan-2); }
.floor-tab.active {
  color: var(--ink);
  background: var(--cyan);
  border-color: var(--cyan);
  font-weight: 700;
}
.floor-tab.has-mouse { box-shadow: 0 0 0 1px var(--cheese), 0 0 12px rgba(253, 224, 71, 0.35); }

.stage-title {
  font-size: 11px;
  color: var(--dim);
  letter-spacing: 1px;
  margin-left: auto;
}

#mazeCanvas {
  display: block;
  margin: 0 auto;
  image-rendering: pixelated;
  border-radius: 8px;
}

/* 楼梯连接提示 */
.stair-note {
  font-size: 10px;
  color: var(--dim);
  margin-top: 10px;
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}
.stair-note b { font-weight: 400; }
.stair-note .up { color: var(--amber); }
.stair-note .down { color: var(--pink); }

/* ---------- 右栏 ---------- */
aside { display: flex; flex-direction: column; gap: 14px; }

.panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  padding: 14px 16px;
}

.panel h2 {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--dim);
  text-transform: uppercase;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel h2::before {
  content: "";
  width: 8px; height: 8px;
  background: var(--cyan);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

/* 表单 */
.field { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.field:last-child { margin-bottom: 0; }
.field label { font-size: 11px; color: var(--dim); width: 64px; flex: none; }
.field select, .field input[type="range"] { flex: 1; }

select {
  font-family: inherit;
  font-size: 12px;
  color: var(--text);
  background: var(--ink);
  border: 1px solid var(--line-2);
  border-radius: 7px;
  padding: 6px 8px;
  outline: none;
  cursor: pointer;
}
select:focus { border-color: var(--cyan-2); }

input[type="range"] {
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: var(--line-2);
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px rgba(94, 234, 212, 0.6);
}

/* 按钮 */
.btn-row { display: flex; gap: 8px; margin-top: 12px; }

button.primary, button.ghost {
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  border-radius: 8px;
  padding: 9px 14px;
  cursor: pointer;
  transition: all 0.15s;
  flex: 1;
}
button.primary {
  border: 1px solid var(--cyan);
  background: linear-gradient(180deg, rgba(94,234,212,0.2), rgba(94,234,212,0.08));
  color: var(--cyan);
}
button.primary:hover { background: var(--cyan); color: var(--ink); box-shadow: 0 0 18px rgba(94,234,212,0.4); }
button.primary:disabled { opacity: 0.35; cursor: not-allowed; box-shadow: none; }
button.ghost {
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--dim);
  font-weight: 400;
}
button.ghost:hover { color: var(--text); border-color: var(--cyan-2); }

/* 统计条 */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.stat {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--ink);
  padding: 8px 10px;
}
.stat .v { font-size: 17px; font-weight: 700; color: var(--cyan); }
.stat .v.warm { color: var(--cheese); }
.stat .v.bad { color: var(--cherry); }
.stat .k { font-size: 10px; color: var(--dim); margin-top: 2px; }

/* 决策可视化 */
.dir-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.dir {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--ink);
  padding: 8px 10px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s;
}
.dir .name { font-size: 13px; font-weight: 700; }
.dir .prob { font-size: 11px; color: var(--dim); margin-top: 1px; }
.dir .bar {
  position: absolute; left: 0; bottom: 0;
  height: 3px;
  background: var(--cyan);
  width: 0%;
  transition: width 0.3s ease;
}
.dir.chosen { border-color: var(--cyan); }
.dir.chosen .name { color: var(--cyan); text-shadow: 0 0 10px rgba(94,234,212,0.6); }
.dir.blocked { opacity: 0.35; }
.dir.chosen .bar { background: var(--cheese); box-shadow: 0 0 8px var(--cheese); }

.decision-meta {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--dim);
  margin-top: 10px;
}
.decision-meta b { color: var(--text); font-weight: 400; }

/* 日志终端 */
#log {
  height: 210px;
  overflow-y: auto;
  font-size: 10.5px;
  line-height: 1.75;
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}
#log .line { white-space: nowrap; }
#log .t { color: #3b4a63; }
#log .ok { color: var(--cyan); }
#log .warn { color: var(--amber); }
#log .err { color: var(--cherry); }
#log .dim { color: var(--dim); }

/* ---------- 覆盖层 ---------- */
.overlay {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: rgba(7, 10, 18, 0.82);
  backdrop-filter: blur(4px);
  z-index: 20;
  opacity: 0; pointer-events: none;
  transition: opacity 0.4s;
}
.overlay.show { opacity: 1; pointer-events: auto; }

.overlay .card {
  text-align: center;
  border: 1px solid var(--line-2);
  background: var(--panel);
  border-radius: 16px;
  padding: 36px 48px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  animation: rise 0.5s ease both;
}
@keyframes rise { from { transform: translateY(16px); opacity: 0; } }

.overlay .big { font-size: 52px; margin-bottom: 8px; }
.overlay h3 { font-size: 20px; letter-spacing: 2px; margin-bottom: 8px; }
.overlay h3.win { color: var(--cheese); text-shadow: 0 0 20px rgba(253,224,71,0.5); }
.overlay h3.stuck { color: var(--cherry); }
.overlay p { font-size: 12px; color: var(--dim); line-height: 1.9; }
.overlay p b { color: var(--text); font-weight: 400; }

/* 消息条 */
#toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  font-size: 12px;
  padding: 10px 18px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--panel);
  transition: transform 0.3s;
  z-index: 50;
}
#toast.show { transform: translateX(-50%) translateY(0); }

/* LLM 主题横幅 */
#themeBanner {
  display: none;
  margin-top: 10px;
  font-size: 11px;
  color: var(--dim);
  border-left: 2px solid var(--pink);
  padding: 4px 10px;
  line-height: 1.7;
}
#themeBanner.show { display: block; }
#themeBanner b { color: var(--pink); font-weight: 400; }
