/* ============ MiMo TTS Console ============ */
:root {
  --bg: #0d1117;
  --bg-soft: #121826;
  --card: #161d2b;
  --card-2: #1c2434;
  --border: #263043;
  --text: #e8edf6;
  --text-2: #9aa7bd;
  --text-3: #64748b;
  --accent: #ff6900;
  --accent-2: #ffa04d;
  --accent-soft: rgba(255, 105, 0, 0.14);
  --green: #22c55e;
  --red: #ef4444;
  --blue: #38bdf8;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  font-size: 15px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(255, 105, 0, 0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(56, 189, 248, 0.08), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
}

/* ---------------- topbar ---------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(13, 17, 23, 0.7);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 50;
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center;
  font-weight: 800; font-size: 22px; color: #fff;
  box-shadow: 0 6px 18px rgba(255, 105, 0, 0.35);
}
.brand h1 { margin: 0; font-size: 19px; letter-spacing: 0.3px; }
.brand p { margin: 2px 0 0; color: var(--text-3); font-size: 12.5px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 999px;
  background: var(--card-2); border: 1px solid var(--border);
  font-size: 12.5px; color: var(--text-2);
}
.pill .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-3);
  box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.18);
}
.pill.ok .dot { background: var(--green); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18); }
.pill.bad .dot { background: var(--red); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18); }

/* ---------------- layout ---------------- */
.layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 22px;
  padding: 24px 28px 40px;
  max-width: 1500px;
  margin: 0 auto;
}
@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; }
}
.col { display: flex; flex-direction: column; gap: 22px; min-width: 0; }

/* ---------------- cards ---------------- */
.card {
  background: linear-gradient(180deg, var(--card), var(--bg-soft));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}
.card-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 700;
  margin-bottom: 16px;
}
.card-title .num {
  width: 22px; height: 22px; border-radius: 7px;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 800;
}

/* ---------------- form ---------------- */
.field { display: block; margin-bottom: 14px; }
.label {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  font-size: 13px; color: var(--text-2); margin-bottom: 7px;
}
.label em { color: var(--accent); font-style: normal; }
.label small { color: var(--text-3); font-size: 11.5px; }

input[type="text"], input[type="password"], textarea, select {
  width: 100%;
  background: #0e1420;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 11px 13px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color .18s, box-shadow .18s;
  outline: none;
  resize: vertical;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { line-height: 1.65; }
select { cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239aa7bd' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.input-row { display: flex; gap: 8px; }
.input-row input { flex: 1; }

.check {
  display: flex; align-items: center; gap: 9px;
  font-size: 12.5px; color: var(--text-2);
  cursor: pointer; margin: 10px 0 4px;
}
.check small { color: var(--text-3); font-size: 11px; display: block; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; }

.options-row { display: flex; gap: 20px; align-items: flex-end; margin-top: 16px; flex-wrap: wrap; }
.opt { display: flex; flex-direction: column; gap: 7px; }
.opt .label { margin: 0; }
.opt select { min-width: 190px; }

/* switch */
.switch { position: relative; display: inline-block; width: 46px; height: 25px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; cursor: pointer;
  background: var(--card-2); border: 1px solid var(--border);
  border-radius: 999px; transition: .22s;
}
.slider::before {
  content: ""; position: absolute;
  width: 17px; height: 17px; left: 3px; top: 3px;
  background: var(--text-2); border-radius: 50%; transition: .22s;
}
.switch input:checked + .slider { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(21px); background: #fff; }

/* ---------------- tabs ---------------- */
.tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  flex: 1; min-width: 100px;
  padding: 10px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text-2);
  font-size: 13px; font-family: inherit;
  cursor: pointer;
  transition: all .18s;
}
.tab:hover { border-color: var(--accent); color: var(--text); }
.tab.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-2);
  font-weight: 700;
}
.mode-panel { animation: fade .25s ease; }
.hidden { display: none !important; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------------- voice grid ---------------- */
.voice-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}
@media (max-width: 520px) { .voice-grid { grid-template-columns: repeat(2, 1fr); } }
.voice-item {
  border: 1px solid var(--border);
  background: var(--card-2);
  border-radius: 10px;
  padding: 10px 8px;
  text-align: center;
  cursor: pointer;
  transition: all .16s;
}
.voice-item:hover { border-color: var(--accent); transform: translateY(-2px); }
.voice-item.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 6px 16px rgba(255, 105, 0, 0.18);
}
.voice-item .v-name { font-size: 13.5px; font-weight: 700; }
.voice-item .v-tag { font-size: 11px; color: var(--text-3); margin-top: 3px; }

/* ---------------- dropzone ---------------- */
.dropzone {
  display: block;
  border: 1.5px dashed var(--border);
  border-radius: 12px;
  padding: 22px;
  text-align: center;
  cursor: pointer;
  transition: all .18s;
  background: rgba(255, 255, 255, 0.015);
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); }
.dz-icon { font-size: 26px; margin-bottom: 8px; }
#dzText { color: var(--text-2); font-size: 13px; }
.audio-preview { margin-top: 12px; width: 100%; }

/* ---------------- tags ---------------- */
.tag-box {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.015);
  margin-top: 6px;
}
.tag-group + .tag-group { margin-top: 12px; }
.tag-label { font-size: 11.5px; color: var(--text-3); margin-bottom: 7px; letter-spacing: .4px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text-2);
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
  user-select: none;
}
.chip:hover { border-color: var(--accent); color: var(--accent-2); background: var(--accent-soft); }

/* ---------------- buttons ---------------- */
.action-row { display: flex; align-items: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.spacer { flex: 1; }

.primary-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; border: none;
  padding: 12px 26px;
  border-radius: 11px;
  font-size: 14.5px; font-weight: 700; font-family: inherit;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(255, 105, 0, 0.32);
  transition: all .18s;
}
.primary-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(255, 105, 0, 0.42); }
.primary-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }

.ghost-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 11px 18px;
  border-radius: 11px;
  font-size: 13px; font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: all .18s;
}
.ghost-btn:hover { border-color: var(--accent); color: var(--text); }
.ghost-btn:disabled { opacity: .45; cursor: not-allowed; }

.icon-btn {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  width: 38px; height: 38px;
  cursor: pointer;
  font-size: 15px;
  transition: all .16s;
  flex-shrink: 0;
}
.icon-btn:hover { border-color: var(--accent); }

.stat { font-size: 12px; color: var(--text-3); }
.stat strong { color: var(--accent-2); }

/* ---------------- result ---------------- */
.result-empty {
  text-align: center;
  padding: 34px 10px 26px;
  color: var(--text-3);
  font-size: 13px;
}
.wave-anim { display: flex; gap: 5px; justify-content: center; align-items: flex-end; height: 46px; margin-bottom: 12px; }
.wave-anim span {
  width: 5px; border-radius: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  animation: wave 1.15s ease-in-out infinite;
}
.wave-anim span:nth-child(1) { height: 30%; animation-delay: 0s; }
.wave-anim span:nth-child(2) { height: 62%; animation-delay: .12s; }
.wave-anim span:nth-child(3) { height: 88%; animation-delay: .24s; }
.wave-anim span:nth-child(4) { height: 48%; animation-delay: .36s; }
.wave-anim span:nth-child(5) { height: 74%; animation-delay: .48s; }
.wave-anim span:nth-child(6) { height: 38%; animation-delay: .6s; }
.wave-anim span:nth-child(7) { height: 58%; animation-delay: .72s; }
@keyframes wave {
  0%, 100% { transform: scaleY(0.45); opacity: .65; }
  50% { transform: scaleY(1); opacity: 1; }
}

.player { width: 100%; height: 44px; border-radius: 10px; margin-bottom: 6px; }

/* ---------------- log ---------------- */
.log-box { margin-top: 18px; }
.log-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--text-3); margin-bottom: 8px;
}
.log {
  background: #0a0f18;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  height: 190px;
  overflow-y: auto;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.75;
}
.log-line { color: var(--text-2); word-break: break-all; }
.log-line .ts { color: var(--text-3); margin-right: 8px; }
.log-line.info { color: var(--blue); }
.log-line.ok { color: var(--green); }
.log-line.error { color: var(--red); }
.log-line.muted { color: var(--text-3); }

.hint { font-size: 12px; color: var(--text-3); line-height: 1.7; margin: 6px 0 12px; }
.hint.tiny { font-size: 11.5px; margin-top: 12px; }

/* ---------------- footer ---------------- */
.footer {
  text-align: center;
  padding: 22px;
  color: var(--text-3);
  font-size: 12px;
  border-top: 1px solid var(--border);
}
.footer a { color: var(--accent-2); text-decoration: none; }
.footer a:hover { text-decoration: underline; }

/* scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }
