/* ===========================================================
   北极星提示词工厂 — 极客深空风 + 北极星隐喻
   近黑深蓝底 / 星辉青 / 暖白 / 等宽呈现提示词 / 衬线权威标题
   =========================================================== */

:root {
  --bg:        #0b1020;
  --bg-2:      #0e1426;
  --panel:     #121a30;
  --panel-2:   #0f1729;
  --line:      #1e2a47;
  --line-soft: #18233d;

  --ink:       #e8edf7;   /* 暖白主文字 */
  --ink-dim:   #9fb0cc;   /* 次级 */
  --ink-faint: #7085a9;   /* 弱（WCAG AA ≥4.5:1） */

  --star:      #7fd6e8;   /* 星辉青 */
  --star-soft: rgba(127,214,232,.16);
  --star-glow: rgba(127,214,232,.45);
  --amber:     #e8c98a;   /* 暖点缀 */
  --danger:    #e87f8a;

  --mono: 'JetBrains Mono','IBM Plex Mono',ui-monospace,SFMono-Regular,Menlo,monospace;
  --serif: 'Noto Serif SC',Georgia,serif;
  --sans: 'Noto Sans SC',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;

  --radius: 14px;
  --shadow: 0 18px 50px -20px rgba(0,0,0,.7);
  --tap-min: 32px;   /* 窄屏触控目标最小边长 */
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 700px at 80% -10%, #14223f 0%, transparent 55%),
    radial-gradient(900px 600px at 0% 100%, #101a33 0%, transparent 50%),
    var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  position: relative;
  overflow-x: hidden;
}

/* ---------- starfield ---------- */
.starfield {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
}
.starfield .star {
  position: absolute;
  width: 2px; height: 2px;
  background: #cfe3ee;
  border-radius: 50%;
  opacity: .5;
  animation: twinkle 4s ease-in-out infinite;
}
@keyframes twinkle { 0%,100%{opacity:.18} 50%{opacity:.7} }

/* ---------- topbar ---------- */
.topbar {
  position: relative; z-index: 2;
  display: flex; flex-wrap: wrap; gap: 18px;
  align-items: center; justify-content: space-between;
  padding: 22px clamp(18px, 5vw, 48px);
  border-bottom: 1px solid var(--line-soft);
  backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: 14px; }
.polaris {
  font-size: 26px; color: var(--star);
  text-shadow: 0 0 14px var(--star-glow), 0 0 30px var(--star-soft);
  animation: pulse 3.2s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{transform:scale(1);opacity:.9} 50%{transform:scale(1.12);opacity:1} }
.brand-text h1 {
  font-family: var(--serif); font-weight: 900;
  font-size: clamp(18px, 2.4vw, 23px);
  margin: 0; letter-spacing: .5px;
}
.tagline { margin: 3px 0 0; font-size: 12.5px; color: var(--ink-faint); font-family: var(--mono); }

.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-btn {
  font-family: var(--mono); font-size: 13px;
  color: var(--ink-dim); background: transparent;
  border: 1px solid transparent; border-radius: 9px;
  padding: 8px 13px; cursor: pointer;
  transition: all .18s ease;
}
.nav-btn:hover { color: var(--ink); background: var(--star-soft); }
.nav-btn.active {
  color: var(--bg); background: var(--star);
  box-shadow: 0 0 18px -4px var(--star-glow);
  font-weight: 700;
}

/* ---------- stage / views ---------- */
.stage {
  position: relative; z-index: 1;
  max-width: 1180px; margin: 0 auto;
  padding: clamp(20px, 4vw, 40px) clamp(16px, 5vw, 48px) 70px;
}
.view { display: none; animation: fade .35s ease; }
.view.active { display: block; }
@keyframes fade { from{opacity:0; transform: translateY(8px)} to{opacity:1; transform:none} }

/* ---------- panels ---------- */
.panel {
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(18px, 3vw, 28px);
  box-shadow: var(--shadow);
}
.panel.narrow { max-width: 720px; margin: 0 auto; }
.panel-title {
  font-family: var(--serif); font-weight: 700;
  font-size: 19px; margin: 0 0 4px;
}
.panel-head-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.sub { color: var(--ink-dim); font-size: 13.5px; line-height: 1.7; margin: 6px 0 18px; }

/* ---------- forge grid ---------- */
.forge-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 22px;
  align-items: start;
}
@media (max-width: 880px) { .forge-grid { grid-template-columns: 1fr; } }

.form-panel { display: flex; flex-direction: column; }
.field { margin-bottom: 18px; }
.field-label {
  display: block; font-size: 12.5px; font-weight: 600;
  color: var(--ink-dim); margin-bottom: 8px;
  letter-spacing: .3px;
}

/* segmented control */
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.seg-btn {
  font-family: var(--mono); font-size: 12.5px;
  color: var(--ink-dim); background: transparent;
  border: none; border-radius: 7px; padding: 7px 13px; cursor: pointer;
  transition: all .15s ease;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.active {
  background: var(--star); color: var(--bg); font-weight: 700;
  box-shadow: 0 0 14px -4px var(--star-glow);
}

/* inputs */
.text-input {
  width: 100%; font-family: var(--sans); font-size: 14px;
  color: var(--ink); background: var(--bg-2);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 13px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.text-input::placeholder { color: var(--ink-faint); }
.text-input:focus { border-color: var(--star); box-shadow: 0 0 0 3px var(--star-soft); }
.text-input.area { resize: vertical; line-height: 1.6; min-height: 56px; }

/* principles */
.principles { display: flex; flex-direction: column; gap: 9px; }
.principle {
  display: flex; gap: 11px; align-items: flex-start;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 11px; padding: 12px 14px; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.principle:hover { border-color: var(--star); }
.principle input { margin-top: 3px; accent-color: var(--star); width: 16px; height: 16px; cursor: pointer; flex-shrink: 0; }
.principle-body { display: flex; flex-direction: column; gap: 2px; }
.principle-name { font-weight: 700; font-size: 14px; }
.principle-anti { font-size: 12px; color: var(--ink-faint); line-height: 1.5; }

/* mode card */
.mode-card { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.mode-head { display: flex; align-items: center; gap: 8px; margin-bottom: 11px; }
.mode-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--star); box-shadow: 0 0 10px var(--star-glow); }
.mode-title { font-size: 13px; font-weight: 600; color: var(--ink); }
.mode-switch { display: inline-flex; gap: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 3px; margin-bottom: 10px; }
.mode-opt {
  font-family: var(--mono); font-size: 12px; color: var(--ink-dim);
  background: transparent; border: none; border-radius: 6px;
  padding: 6px 12px; cursor: pointer; transition: all .15s;
}
.mode-opt.active { background: var(--amber); color: #2a2210; font-weight: 700; }
.mode-hint { font-size: 12.5px; color: var(--ink-dim); line-height: 1.65; margin: 0; }

/* ---------- console / preview ---------- */
.preview-panel { position: sticky; top: 18px; }
@media (max-width: 880px) { .preview-panel { position: static; } }
.console {
  background: #070b16;
  border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden;
  box-shadow: inset 0 0 40px -20px var(--star-soft);
}
.console-bar {
  display: flex; align-items: center; gap: 7px;
  padding: 10px 14px; background: #0b1120;
  border-bottom: 1px solid var(--line-soft);
}
.dot { width: 11px; height: 11px; border-radius: 50%; }
.dot.red{background:#ff5f57} .dot.yellow{background:#febc2e} .dot.green{background:#28c840}
.console-name { margin-left: 8px; font-family: var(--mono); font-size: 12px; color: var(--ink-faint); }
.console-body {
  margin: 0; padding: 18px 18px 20px;
  font-family: var(--mono); font-size: 13px; line-height: 1.78;
  color: #cfe0ec; white-space: pre-wrap; word-break: break-word;
  max-height: 460px; overflow-y: auto;
}
.console-body::-webkit-scrollbar { width: 8px; }
.console-body::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

/* meta row */
.meta-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 16px; flex-wrap: wrap; }
.token-box { display: flex; align-items: baseline; gap: 7px; font-family: var(--mono); }
.token-num { font-size: 28px; font-weight: 700; color: var(--star); text-shadow: 0 0 18px var(--star-soft); }
.token-unit { font-size: 12px; color: var(--ink-dim); }
.token-chars { font-size: 11px; color: var(--ink-faint); }

.actions { display: flex; gap: 8px; }
.btn {
  font-family: var(--mono); font-size: 13px; font-weight: 600;
  border-radius: 9px; padding: 9px 16px; cursor: pointer;
  border: 1px solid var(--line); transition: all .15s ease;
}
.btn.primary { background: var(--star); color: var(--bg); border-color: var(--star); }
.btn.primary:hover { box-shadow: 0 0 22px -6px var(--star-glow); transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--ink-dim); }
.btn.ghost:hover { color: var(--ink); border-color: var(--star); }
.btn.wide { width: 100%; padding: 13px; font-size: 14px; margin-top: 8px; }
.btn.danger { color: var(--danger); border-color: transparent; padding: 6px 10px; }
.btn.danger:hover { border-color: var(--danger); }
.btn.mini { padding: 6px 11px; font-size: 12px; }

.hint { font-size: 12px; color: var(--ink-faint); margin: 10px 0 0; min-height: 16px; }
.hint.ok { color: var(--star); }

/* ---------- library ---------- */
.counter { font-family: var(--mono); font-size: 13px; color: var(--ink-faint); }
.fork-list { display: flex; flex-direction: column; gap: 12px; }
.fork {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 15px 17px;
  transition: border-color .15s;
}
.fork:hover { border-color: var(--line); }
.fork-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.fork-name {
  font-family: var(--serif); font-weight: 700; font-size: 16px;
  background: transparent; border: none; color: var(--ink);
  outline: none; border-bottom: 1px dashed transparent; padding: 2px 0;
}
.fork-name:focus { border-bottom-color: var(--star); }
.fork-tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 10px; }
.tag {
  font-family: var(--mono); font-size: 11px; color: var(--star);
  background: var(--star-soft); border: 1px solid var(--line);
  border-radius: 6px; padding: 3px 8px;
}
.fork-prompt {
  font-family: var(--mono); font-size: 11.5px; line-height: 1.6;
  color: var(--ink-dim); background: #070b16;
  border: 1px solid var(--line-soft); border-radius: 9px;
  padding: 11px 13px; max-height: 110px; overflow: hidden;
  position: relative; white-space: pre-wrap; word-break: break-word;
}
.fork-prompt::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 34px;
  background: linear-gradient(transparent, #070b16);
}
.fork-actions { display: flex; gap: 7px; margin-top: 11px; flex-wrap: wrap; }

.empty {
  text-align: center; color: var(--ink-faint);
  font-size: 13.5px; line-height: 1.7;
  padding: 34px 20px; border: 1px dashed var(--line);
  border-radius: 12px; margin-top: 14px; display: none;
}
.empty.show { display: block; }

/* ---------- selfcheck ---------- */
.q { margin-bottom: 22px; }
.q-label { display: block; font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 11px; line-height: 1.5; }
.scale { display: flex; gap: 7px; }
.scale .pip {
  flex: 1; height: 40px; border-radius: 9px;
  background: var(--bg-2); border: 1px solid var(--line);
  color: var(--ink-dim); font-family: var(--mono); font-size: 14px;
  cursor: pointer; transition: all .15s ease;
}
.scale .pip:hover { border-color: var(--star); color: var(--ink); }
.scale .pip.on {
  background: var(--star); color: var(--bg); border-color: var(--star);
  font-weight: 700; box-shadow: 0 0 16px -4px var(--star-glow);
}
.scale-ends { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-faint); margin-top: 6px; }

.score-readout {
  font-family: var(--mono); font-size: 13px; color: var(--ink-dim);
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 11px; padding: 14px 16px; margin: 8px 0 16px;
  line-height: 1.7; min-height: 52px;
}
.score-readout b { color: var(--star); }
.score-readout .verdict { color: var(--amber); font-weight: 700; }

/* ---------- trend ---------- */
.legend { font-family: var(--mono); font-size: 12px; padding: 1px 7px; border-radius: 5px; }
.legend.think { color: var(--star); border: 1px solid var(--star); }
.legend.eval { color: var(--amber); border: 1px solid var(--amber); }
.chart-wrap { margin: 18px 0 16px; }
.chart-wrap svg { width: 100%; height: auto; display: block; }
.trend-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 12px; }
.stat {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 11px; padding: 14px 16px;
}
.stat .v { font-family: var(--mono); font-size: 22px; font-weight: 700; color: var(--star); }
.stat .l { font-size: 12px; color: var(--ink-dim); margin-top: 3px; }
.stat .delta.up { color: var(--star); } .stat .delta.down { color: var(--danger); }

/* ---------- principles prose ---------- */
.prose { line-height: 1.85; }
.prose .lead { font-size: 15px; color: var(--ink); margin: 8px 0 22px; }
.prose strong { color: var(--star); font-weight: 700; }
.prose em { color: var(--amber); font-style: normal; font-weight: 600; }
.sec { font-family: var(--serif); font-weight: 700; font-size: 16px; color: var(--ink); margin: 26px 0 12px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.principle-doc { display: flex; flex-direction: column; gap: 12px; }
.pd { background: var(--bg-2); border: 1px solid var(--line); border-radius: 11px; padding: 14px 16px; }
.pd-name { display: inline-block; font-family: var(--mono); font-weight: 700; color: var(--star); margin-bottom: 5px; }
.pd p { margin: 0; font-size: 13.5px; color: var(--ink-dim); }
.mode-list { padding-left: 20px; color: var(--ink-dim); font-size: 14px; }
.mode-list li { margin-bottom: 8px; }
.mode-list b { color: var(--ink); }
.closing { margin-top: 20px; padding: 14px 16px; background: var(--star-soft); border-left: 3px solid var(--star); border-radius: 0 9px 9px 0; font-size: 14px; color: var(--ink); }

/* ---------- footer ---------- */
.footer {
  position: relative; z-index: 1;
  text-align: center; font-family: var(--mono); font-size: 11.5px;
  color: var(--ink-faint); padding: 26px 20px 40px; line-height: 1.9;
}
.footer .sep { margin: 0 8px; opacity: .5; }
@media (max-width: 600px) {
  .footer .sep { display: none; } .footer span { display: block; }
  /* 触控目标：窄屏下分段按钮、模式按钮与原则复选框至少 --tap-min */
  .seg-btn, .mode-opt { min-height: var(--tap-min); }
  .principle input { width: var(--tap-min); height: var(--tap-min); }
}

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--star); color: var(--bg);
  font-family: var(--mono); font-size: 13px; font-weight: 700;
  padding: 11px 20px; border-radius: 10px;
  box-shadow: 0 12px 30px -8px var(--star-glow);
  opacity: 0; pointer-events: none; transition: all .3s ease; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 无障碍：尊重「减少动态效果」系统偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* 键盘聚焦可见性（鼠标点击不显，Tab 导航显） */
:focus-visible {
  outline: 2px solid var(--star);
  outline-offset: 2px;
}

/* W7 手机端输入框至少 16px（2026-10-24）：iPhone 的 Safari 在字号小于 16px 的输入框获得焦点时会放大整页。
   本产品没有大于 16px 的输入框，所以统一抬到 16px。:not(#_) 只用来把优先级提到 ID 级，压过按 #id 或 .类 写的小字号 */
@media (max-width: 760px) {
  :is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"]), select, textarea):not(#_) { font-size: 16px; }
}
