:root {
  --green: #3d9b45;
  --green-d: #1f6b32;
  --blue: #1e7ad6;
  --gold: #c4a35a;
  --ink: #2c3338;
  --bg: #0b1110;
  --card: #141c19;
  --line: #24302b;
  --text: #e8efe8;
  --muted: #8aa090;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: "Microsoft YaHei", "PingFang SC", sans-serif; }
a { color: var(--green); cursor: pointer; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }
.hidden { display: none !important; }

.topbar {
  min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 14px; background: #0e1613; border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; min-width: 0; flex: 1; }
.brand img { height: 36px; background: #fff; border-radius: 6px; padding: 2px 6px; flex: 0 0 auto; }
.brand-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: flex; gap: 14px; align-items: center; color: var(--muted); font-size: 14px; }
.nav span { cursor: pointer; }
.nav span.on, .nav span:hover { color: var(--green); }
.nav-user { position: relative; flex: 0 0 auto; }
.nav-name { color: var(--gold); font-size: 14px; white-space: nowrap; cursor: pointer; }
.nav-menu {
  position: absolute; right: 0; top: 32px; z-index: 40;
  min-width: 148px; padding: 6px 0;
  background: #141c19; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 12px 28px #0008;
}
.nav-menu span { display: block; padding: 10px 16px; color: var(--muted); cursor: pointer; font-size: 14px; }
.nav-menu span.on, .nav-menu span:hover { color: var(--green); background: #101815; }

.wrap { max-width: 980px; margin: 0 auto; padding: 20px 16px 80px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.hero { display: grid; grid-template-columns: 1.2fr .8fr; gap: 20px; align-items: center; }
.hero h1 { font-size: 32px; margin: 8px 0; }
.muted { color: var(--muted); font-size: 13px; line-height: 1.6; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.feat { background: #101815; border-radius: 10px; padding: 12px; }
.feat b { color: var(--gold); display: block; margin-bottom: 6px; }
.dl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.dl-item { border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: #101815; }
.dl-item .btn, .dl-item a.btn { display: inline-block; margin-top: 10px; text-decoration: none; }
.ver-box { margin: 12px 0; padding: 12px; background: #101815; border: 1px solid var(--line); border-radius: 10px; }
.ver-box p { margin: 0 0 8px; font-size: 14px; line-height: 1.6; }
.ver-box .ver-new { color: var(--gold); font-weight: 700; }
.ver-box .btn { margin-top: 4px; }

.btn { border: 0; border-radius: 8px; padding: 10px 16px; color: #fff; background: var(--green); }
.btn.blue { background: var(--blue); }
.btn.red { background: #c23b3b; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.login-page { min-height: 100vh; background: #f4f7f4; color: var(--ink); display: flex; flex-direction: column; }
.login-page .topbar { background: #fff; border-color: #e4ebe4; }
.login-box { width: 420px; max-width: 92vw; margin: 48px auto; background: #fff; border-radius: 16px; padding: 28px; box-shadow: 0 10px 40px #0001; text-align: center; }
.login-box img.logo { width: 220px; max-width: 100%; }
.login-box h2 { margin: 8px 0 18px; }
.field { display: flex; align-items: center; background: #eef5f0; border-radius: 10px; margin: 10px 0; padding: 0 12px; }
.field input { flex: 1; border: 0; background: transparent; padding: 12px 8px; outline: none; color: var(--ink); }
.login-box .btn { width: 100%; margin-top: 8px; padding: 12px; }
.links { margin-top: 14px; color: #c27a2a; font-size: 13px; display: flex; justify-content: space-around; }
.links span { cursor: pointer; }

.stat { display: flex; gap: 24px; }
.stat b { font-size: 22px; color: var(--green); }
.slot { display: flex; justify-content: space-between; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-top: 10px; }
.card.dead, .slot.dead { opacity: .55; }
.card.slot-new { border-style: dashed; background: #101512; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 20px; }
.tag.on { background: #1f6b32; }
.tag.off { background: #444; }
.edit-mini {
  margin-left: 6px; padding: 1px 6px; font-size: 11px; line-height: 1.4;
  border: 1px solid var(--line); border-radius: 4px; background: transparent;
  color: var(--muted); vertical-align: middle;
}
.edit-mini:hover { color: var(--text); border-color: #3a4a42; }
.qa-item { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-top: 12px; background: #101815; }
.qa-item textarea { min-height: 64px; }
.log-qa { margin-top: 8px; }
.log-qa .lab { margin: 0 0 4px; }
.log-qa p { margin: 0; white-space: pre-wrap; line-height: 1.6; color: var(--text); }

label.lab { display: block; margin: 10px 0 6px; color: var(--gold); font-size: 13px; }
textarea, input[type=text], input[type=password], select {
  width: 100%; background: #0f1613; color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px; outline: none;
}
textarea { min-height: 120px; resize: vertical; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.check { display: flex; gap: 12px; flex-wrap: wrap; }
.modes { display: flex; flex-wrap: wrap; gap: 8px; }
.modes label { background: #101815; padding: 6px 10px; border-radius: 20px; font-size: 13px; }

.engine-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 4px 0 8px; }
.engine-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  text-align: left; padding: 14px 14px 12px; border-radius: 12px;
  border: 2px solid #2a3a34; background: #101815; color: var(--text);
}
.engine-card b { font-size: 16px; color: #e8efe8; }
.engine-card span { font-size: 12px; color: var(--muted); line-height: 1.45; }
.engine-card i { font-style: normal; font-size: 12px; color: #8aa090; }
.engine-card.on { border-color: var(--green); background: #122018; box-shadow: 0 0 0 1px #3d9b4555; }
.engine-card.on b { color: #7dcb7d; }
.engine-card.dialect.on { border-color: var(--gold); background: #1a1810; box-shadow: 0 0 0 1px #c4a35a55; }
.engine-card.dialect.on b { color: var(--gold); }
.engine-card:disabled { opacity: .55; cursor: not-allowed; }
@media (max-width: 800px) { .engine-pick { grid-template-columns: 1fr; } }

.work-mask {
  position: sticky; top: 8px; z-index: 7; display: flex; gap: 16px; align-items: center;
  background: #122018; border: 1px solid #3d9b45; color: #e8efe8;
  border-radius: 14px; padding: 18px 20px; margin-bottom: 12px; box-shadow: 0 10px 28px #0006;
}
.work-mask b { display: block; color: #7dcb7d; margin-bottom: 6px; font-size: 16px; }
.spin {
  width: 32px; height: 32px; border: 3px solid #24302b; border-top-color: #3d9b45;
  border-radius: 50%; animation: spin .8s linear infinite; flex: 0 0 32px;
}
.spin-sm { width: 14px; height: 14px; border-width: 2px; flex: 0 0 14px; display: inline-block; vertical-align: -2px; margin-right: 6px; }
.ask-wait { display: flex; align-items: center; color: #8aa090; margin-top: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }
.ask-box {
  position: sticky; top: 8px; z-index: 6; background: #c4a35a; color: #2c1a08;
  border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; box-shadow: 0 8px 24px #0005;
}
.ask-box b { display: block; margin-bottom: 6px; }
.ask-line { font-size: 20px; font-weight: 700; line-height: 1.5; }
.ans-line { margin-top: 10px; font-size: 16px; line-height: 1.6; background: #fff6e0; border-radius: 8px; padding: 8px 10px; }
.popup {
  position: sticky; top: 8px; z-index: 5; background: #dfe8e2; color: #163; border-radius: 12px;
  padding: 12px 14px; margin-bottom: 12px; box-shadow: 0 8px 24px #0004;
}
.popup .bar { height: 6px; background: #bcd; border-radius: 6px; overflow: hidden; margin-top: 8px; }
.popup .bar i { display: block; height: 100%; background: var(--green); width: 0; }

.modal { position: fixed; inset: 0; background: #0008; display: flex; align-items: center; justify-content: center; z-index: 20; }
.modal .box { width: 620px; max-width: 94vw; max-height: 86vh; overflow: auto; background: var(--card); border-radius: 12px; padding: 16px; }
.set-block {
  background: #101815; border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 14px 12px; margin: 0 0 14px;
}
.set-block h4 { margin: 0 0 8px; color: var(--gold); font-size: 15px; font-weight: 700; }
.set-block .hint { color: var(--muted); font-size: 12px; margin: 0 0 8px; line-height: 1.5; }
.set-block textarea { min-height: 88px; margin-bottom: 8px; }
.set-block .freq { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.set-block .freq span { white-space: nowrap; color: var(--muted); font-size: 13px; }
.set-block .freq input { max-width: 160px; }
.voice-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.voice-col { background: #0c1210; border: 1px solid var(--line); border-radius: 8px; padding: 8px; max-height: 180px; overflow: auto; }
.voice-col h5 { margin: 0 0 8px; font-size: 13px; color: var(--text); }
.voice-col label { display: block; font-size: 13px; padding: 3px 0; }

.range-box { padding: 8px 4px 4px; }
.range-scale { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-bottom: 18px; }
.dual-range { position: relative; height: 28px; }
.dual-range .bar {
  position: absolute; left: 0; right: 0; top: 11px; height: 6px;
  background: #2a3a34; border-radius: 6px;
}
.dual-range .bar i {
  position: absolute; top: 0; height: 100%; background: var(--blue); border-radius: 6px;
}
.dual-range input[type=range] {
  position: absolute; left: 0; width: 100%; margin: 0; top: 4px; height: 20px;
  background: none; pointer-events: none; -webkit-appearance: none; appearance: none;
}
.dual-range input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; pointer-events: auto;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  border: 2px solid var(--blue); box-shadow: 0 1px 4px #0008; cursor: pointer;
}
.dual-range input[type=range]::-moz-range-thumb {
  pointer-events: auto; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: 2px solid var(--blue); cursor: pointer;
}
.dual-range input[type=range]::-moz-range-track { background: transparent; border: 0; }
.range-now { display: flex; justify-content: space-between; margin-top: 8px; color: var(--text); font-size: 13px; }
.range-now b { color: var(--blue); }

@media (max-width: 800px) {
  .hero, .grid4, .voice-cols, .dl-grid { grid-template-columns: 1fr; }
  .stat { flex-direction: column; gap: 8px; }
}
