:root {
  --bg: #f0f2f5;
  --ink: #1a2332;
  --muted: #5c6b7a;
  --card: #ffffff;
  --line: #e2e8ef;
  --accent: #0d7a5f;
  --accent-soft: #e6f5f0;
  --warn: #b42318;
  --shadow: 0 8px 24px rgba(26, 35, 50, 0.06);
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 0% -10%, #dceee8 0%, transparent 55%),
    radial-gradient(700px 360px at 100% 0%, #e8eef6 0%, transparent 50%),
    var(--bg);
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.85rem 1.25rem;
  padding: 1.15rem clamp(1rem, 4vw, 2.5rem) 0.35rem;
}
.brand h1 {
  margin: 0.15rem 0 0;
  font-size: clamp(1.35rem, 2.6vw, 1.75rem);
  font-weight: 700;
}
.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
}
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.nav a {
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.88rem;
  text-decoration: none;
  border: 1px solid transparent;
}
.nav a:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
}
.nav a.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: #b7ddd0;
  font-weight: 600;
}
.status {
  margin: 0;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}
.status.ok { color: var(--accent); border-color: #b7ddd0; background: var(--accent-soft); }
.status.err { color: var(--warn); border-color: #f0c2b0; }

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 1rem;
  padding: 0.75rem clamp(1rem, 4vw, 2.5rem) 2.5rem;
}
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.1rem 1.2rem 1.3rem;
  box-shadow: var(--shadow);
}
.panel.full { grid-column: 1 / -1; }
.panel h2 {
  margin: 0 0 0.75rem;
  font-size: 1.02rem;
}
.panel-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}
.panel-head h2 { margin: 0; }
.hint {
  margin: -0.35rem 0 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.hint.tiny {
  margin: -0.4rem 0 0.9rem;
  font-size: 0.78rem;
  line-height: 1.4;
}
.compare-layout {
  grid-template-columns: minmax(280px, 360px) 1fr;
}
.status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.stat-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  background: #fafbfc;
}
.stat-card.ok { border-color: #b7ddd0; background: var(--accent-soft); }
.stat-card.err { border-color: #f0c2b0; }
.stat-title {
  font-weight: 700;
  margin-bottom: 0.35rem;
}
.stat-body {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}
.preset-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}
.chip-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
  font-size: 0.8rem;
  cursor: pointer;
}
.chip.active, .chip:hover {
  border-color: #b7ddd0;
  background: var(--accent-soft);
  color: var(--accent);
}
.player-box {
  margin-top: 0.9rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}
.player-box audio { width: 100%; height: 36px; }

input[type="text"], input[type="password"], input[type="number"], input[type="search"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  background: #fff;
  color: var(--ink);
  font: inherit;
}
@media (max-width: 860px) {
  .status-grid { grid-template-columns: 1fr; }
  .compare-layout { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
}
.badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  vertical-align: middle;
}
select.voice-list {
  height: auto;
  min-height: 12rem;
  padding: 0.35rem;
}
select.voice-list option {
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
}

.field {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
  font-size: 0.9rem;
}
.field > span { color: var(--muted); font-size: 0.82rem; }
.field > span strong { color: var(--ink); font-weight: 600; }

.seg, select, textarea, button, input[type="range"] {
  font: inherit;
}
.seg, .primary, .ghost, .mini {
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  padding: 0.55rem 0.75rem;
}
select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  background: #fff;
  color: var(--ink);
}
textarea { resize: vertical; min-height: 5rem; }
input[type="range"] { width: 100%; }

.actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  flex: 1;
  min-width: 6rem;
}
.ghost { background: transparent; }
.primary:disabled, .mini:disabled, .ghost:disabled { opacity: 0.5; cursor: wait; }

.msg {
  margin: 0.75rem 0 0;
  color: var(--warn);
  font-size: 0.85rem;
  line-height: 1.4;
}
.msg.ok { color: var(--accent); }

.mini {
  padding: 0.4rem 0.65rem;
  font-size: 0.85rem;
}
.mini.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.sent-list {
  display: grid;
  gap: 0.55rem;
}
.sent {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafbfc;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
}
.sent:hover {
  border-color: #b7ddd0;
  background: var(--accent-soft);
  transform: translateY(-1px);
}
.sent p { margin: 0; }
.sent-text { font-size: 0.95rem; line-height: 1.45; }
.sent .meta { color: var(--muted); font-size: 0.8rem; margin-top: 0.3rem; }
.sent-phoneme .sent-text {
  font-family: "Segoe UI", "Noto Sans", Consolas, monospace;
  letter-spacing: 0.02em;
}
.sent-phoneme .meta { color: #0f766e; }
.sent-play {
  flex-shrink: 0;
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
}

.login-wrap {
  max-width: 380px;
  margin: 12vh auto;
  padding: 1.5rem;
}
.login-wrap h1 { font-size: 1.35rem; margin: 0 0 0.35rem; }
.login-wrap .err {
  color: var(--warn);
  font-size: 0.88rem;
  margin: 0.6rem 0;
}

table.route-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
table.route-table th, table.route-table td {
  border: 1px solid var(--line); padding: 0.35rem 0.5rem; text-align: left; vertical-align: middle;
}
table.route-table th { background: #f4f7fa; }
table.route-table td.route-text { max-width: 22rem; word-break: break-word; }
table.route-table td.route-play { width: 11rem; }
.route-audio {
  display: block;
  width: 10.5rem;
  height: 2rem;
}
.tag-gpu { color: #0a7; font-weight: 700; }
.tag-cpu { color: #c60; font-weight: 700; }
.stat-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 0.5rem 0 0.8rem; }
.stat-pill {
  border: 1px solid var(--line); border-radius: 10px; padding: 0.4rem 0.7rem;
  background: #fff; font-size: 0.85rem;
}

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .top { align-items: flex-start; }
}
