/* MoodScope · 心情检测系统 —— 样式表（零外部依赖，不引用任何 CDN 字体/图标） */

:root {
  --bg: #eef1f9;
  --bg-grad: radial-gradient(1200px 600px at 10% -10%, #dfe6ff 0%, transparent 60%),
             radial-gradient(900px 500px at 110% 0%, #ffe6f3 0%, transparent 55%),
             #eef1f9;
  --card: #ffffff;
  --card-soft: #f7f8fd;
  --line: #e5e8f2;
  --text: #1b2033;
  --text-soft: #5d6580;
  --text-mute: #8b93ab;
  --accent: #5b6cff;
  --accent-2: #a259ff;
  --accent-soft: #eef0ff;
  --ok: #1fae74;
  --warn: #e8a13a;
  --err: #e2564b;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(27, 32, 51, .04), 0 12px 32px -12px rgba(27, 32, 51, .16);
  --shadow-sm: 0 1px 2px rgba(27, 32, 51, .05), 0 6px 16px -10px rgba(27, 32, 51, .18);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

/* 作者样式里的 display 会覆盖 UA 的 [hidden]{display:none}，这里显式兜底 */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: .88em; background: var(--accent-soft); padding: 1px 5px; border-radius: 5px; }
.muted { color: var(--text-mute); }

/* ---------------- 顶栏 ---------------- */
.topbar {
  max-width: 1240px; margin: 0 auto; padding: 26px 22px 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo { display: grid; place-items: center; filter: drop-shadow(0 8px 18px rgba(91, 108, 255, .35)); }
.brand-text h1 { font-size: 21px; }
.brand-text h1 .dot { color: var(--text-mute); font-weight: 400; }
.brand-text p { color: var(--text-soft); font-size: 13px; margin-top: 2px; }
.status-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 14px; font-size: 12.5px; color: var(--text-soft); box-shadow: var(--shadow-sm);
}
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 3px rgba(232, 161, 58, .18); }
.status-pill.ok .pulse { background: var(--ok); box-shadow: 0 0 0 3px rgba(31, 174, 116, .18); }

/* ---------------- 布局 ---------------- */
.layout {
  max-width: 1240px; margin: 0 auto; padding: 12px 22px 40px;
  display: grid; grid-template-columns: minmax(0, 460px) minmax(0, 1fr); gap: 20px; align-items: start;
}
@media (max-width: 1020px) { .layout { grid-template-columns: minmax(0, 1fr); } }

.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.input-panel { position: sticky; top: 16px; }
@media (max-width: 1020px) { .input-panel { position: static; } }

.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head h2 { font-size: 16px; }
.hint { color: var(--text-mute); font-size: 12.5px; font-weight: 400; }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--card-soft); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 14px; margin-bottom: 14px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.tag { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.tag-text { background: #e9ecff; color: #4553d8; }
.tag-image { background: #f0e8ff; color: #7c3fd6; }
.counter { font-size: 12px; color: var(--text-mute); font-family: var(--mono); }

textarea {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 13px; font: inherit; font-size: 14.5px; resize: vertical;
  background: #fff; color: var(--text); outline: none; transition: border .15s, box-shadow .15s;
}
textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(91, 108, 255, .14); }

.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.chips.wrap { margin-top: 0; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--text-soft);
  border-radius: 999px; padding: 4px 11px; font-size: 12.5px; cursor: pointer; transition: all .15s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.chip.kw { font-family: var(--mono); font-size: 12px; cursor: default; }
.chip.kw.neg { border-color: #ffd6d2; background: #fff4f3; color: #c0392b; }
.chip.kw b { font-weight: 650; }

/* ---------------- 拖拽区 ---------------- */
.dropzone {
  border: 1.6px dashed #ccd3e6; border-radius: var(--radius-sm); background: #fff;
  min-height: 148px; display: grid; place-items: center; text-align: center;
  cursor: pointer; transition: all .18s; padding: 14px; overflow: hidden;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent); background: #fbfbff; outline: none; }
.dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); }
.dz-empty { display: grid; gap: 5px; justify-items: center; color: var(--text-mute); font-size: 12.5px; }
.dz-empty strong { color: var(--text-soft); font-size: 13.5px; }
.preview-wrap { position: relative; line-height: 0; max-width: 100%; }
.preview-wrap img { max-width: 100%; max-height: 320px; border-radius: 10px; display: block; }
#overlay-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#camera { width: 100%; border-radius: 10px; margin-top: 10px; }

/* ---------------- 按钮 ---------------- */
.btn {
  border: 1px solid transparent; border-radius: 11px; padding: 9px 16px; font: inherit;
  font-size: 13.5px; font-weight: 600; cursor: pointer; transition: all .16s;
  display: inline-flex; align-items: center; gap: 8px; background: #fff;
}
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
  box-shadow: 0 8px 20px -8px rgba(91, 108, 255, .8); padding: 11px 22px; font-size: 14.5px;
}
.btn.primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn.primary:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.btn.ghost { border-color: var(--line); color: var(--text-soft); background: #fff; }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn.danger:hover { border-color: var(--err); color: var(--err); }
.btn.mini { padding: 3px 10px; font-size: 12px; font-weight: 500; }

.row { display: flex; align-items: center; }
.row.gap { gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.switch { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-soft); cursor: pointer; user-select: none; }
.switch input { accent-color: var(--accent); width: 15px; height: 15px; }
.spinner {
  width: 14px; height: 14px; border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.error {
  margin-top: 10px; background: #fff4f3; border: 1px solid #ffd9d5; color: #b93b30;
  padding: 9px 12px; border-radius: 10px; font-size: 13px;
}

/* ---------------- 结果 ---------------- */
.result-panel { min-height: 460px; }
.empty-state { display: grid; place-items: center; gap: 6px; padding: 70px 10px; color: var(--text-mute); }
.empty-face { font-size: 46px; filter: grayscale(.35); }
.empty-state p { font-weight: 600; color: var(--text-soft); }
.empty-state span { font-size: 13px; }

.hero {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  background: linear-gradient(135deg, #f7f8ff, #fdf7ff);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 18px; margin-bottom: 14px;
}
.hero-emoji { font-size: 46px; line-height: 1; }
.hero-main { flex: 1 1 160px; }
.hero-label { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.hero-sub { font-size: 12.5px; color: var(--text-soft); margin-top: 2px; }
.hero-sub b { color: var(--text); font-family: var(--mono); }
.hero-dims { display: grid; gap: 8px; min-width: 190px; }
.dim { display: grid; grid-template-columns: 52px 1fr 42px; align-items: center; gap: 8px; font-size: 12px; color: var(--text-soft); }
.dim-bar { height: 7px; background: #e8ebf5; border-radius: 999px; overflow: hidden; position: relative; }
.dim-bar i { position: absolute; top: 0; bottom: 0; border-radius: 999px; transition: all .5s ease; }
.dim b { font-family: var(--mono); font-size: 11.5px; text-align: right; color: var(--text); }

.explain {
  font-size: 13.5px; color: var(--text-soft); background: var(--accent-soft);
  border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0; padding: 10px 13px; margin-bottom: 16px;
}

.charts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin-bottom: 14px; }
@media (max-width: 760px) { .charts { grid-template-columns: minmax(0, 1fr); } }
.chart-box { background: var(--card-soft); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; }
.chart-box h3 { font-size: 13.5px; margin-bottom: 12px; color: var(--text-soft); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chart-box h3.mt { margin-top: 16px; }
.chart-box canvas { width: 100%; height: auto; display: block; }

.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 58px 1fr 46px; align-items: center; gap: 9px; font-size: 12.5px; }
.bar-name { color: var(--text-soft); }
.bar-track { height: 9px; background: #e9ecf5; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; border-radius: 999px; transition: width .55s cubic-bezier(.2, .8, .2, 1); }
.bar-val { font-family: var(--mono); font-size: 11.5px; color: var(--text-mute); text-align: right; }
.bar-row.top .bar-name { color: var(--text); font-weight: 650; }

.modality { display: grid; gap: 9px; }
.mod-row { display: grid; grid-template-columns: 46px 1fr 44px; align-items: center; gap: 9px; font-size: 12.5px; color: var(--text-soft); }
.mod-track { height: 9px; background: #e9ecf5; border-radius: 999px; overflow: hidden; }
.mod-fill { height: 100%; border-radius: 999px; transition: width .55s ease; }
.mod-fill.text { background: linear-gradient(90deg, #5b6cff, #7a86ff); }
.mod-fill.image { background: linear-gradient(90deg, #a259ff, #c98bff); }
.mod-val { font-family: var(--mono); font-size: 11.5px; text-align: right; color: var(--text); }
.agreement { font-size: 12.5px; color: var(--text-soft); }
.agreement .ag-track { height: 8px; background: #e9ecf5; border-radius: 999px; margin-top: 7px; overflow: hidden; position: relative; }
.agreement .ag-fill { position: absolute; top: 0; bottom: 0; left: 50%; border-radius: 999px; transition: all .5s ease; }

.faces { display: flex; flex-wrap: wrap; gap: 12px; }
.face-item { text-align: center; font-size: 12px; color: var(--text-soft); }
.face-item img { width: 92px; height: 92px; border-radius: 10px; border: 1px solid var(--line); display: block; }
.face-item b { display: block; margin-top: 5px; color: var(--text); }

.history-box { margin-top: 4px; }
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; max-height: 224px; overflow-y: auto; }
.history li {
  display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--text-soft);
  background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px;
}
.history li .h-emoji { font-size: 17px; }
.history li .h-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history li .h-time { font-family: var(--mono); font-size: 11px; color: var(--text-mute); }
.history-empty { justify-content: center; color: var(--text-mute); border-style: dashed; }

.doc { margin-top: 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card-soft); padding: 12px 14px; }
.doc summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--text-soft); }
.doc ol { margin: 10px 0 6px; padding-left: 20px; font-size: 13px; color: var(--text-soft); }
.doc li { margin-bottom: 5px; }

/* ---------------- 页脚 ---------------- */
.footer {
  max-width: 1240px; margin: 0 auto; padding: 18px 22px 34px;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  color: var(--text-mute); font-size: 12.5px; border-top: 1px solid var(--line);
}
.footer-links { display: flex; gap: 14px; }
