:root {
  color-scheme: dark;
  --bg: #07111f;
  --panel: rgba(20, 36, 58, 0.84);
  --panel-strong: #14243a;
  --ink: #f4efe3;
  --muted: #91a5bc;
  --line: rgba(145, 165, 188, 0.2);
  --green: #31c48d;
  --amber: #f2b84b;
  --red: #e65c5c;
  --blue: #4a90e2;
  --teal: #5eead4;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 2%, rgba(94, 234, 212, 0.13), transparent 30rem),
    radial-gradient(circle at 92% 12%, rgba(242, 184, 75, 0.09), transparent 28rem),
    var(--bg);
  font-family: "Microsoft YaHei UI", "PingFang SC", "Segoe UI", sans-serif;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 56px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 0 22px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.08em;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(94, 234, 212, 0.55);
  border-radius: 12px;
  color: var(--teal);
  font-weight: 800;
}

.brand strong, .brand small { display: block; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 10px; letter-spacing: 0.18em; }
.top-actions { display: flex; align-items: center; gap: 10px; }

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.status-dot::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  content: "";
}

.status-dot.online { color: var(--green); }
.status-dot.online::before { background: var(--green); box-shadow: 0 0 14px rgba(49, 196, 141, 0.8); }
.status-dot.offline { color: var(--red); }
.status-dot.offline::before { background: var(--red); }

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 34px;
  padding: 54px 0 40px;
}

.eyebrow { margin: 0 0 8px; color: var(--teal); font-size: 12px; font-weight: 800; letter-spacing: 0.2em; }
h1 { margin: 0; font-size: clamp(48px, 8vw, 88px); line-height: 0.94; letter-spacing: -0.055em; }
h2 { margin: 0; font-size: 28px; }
.hero > div > p:last-child { max-width: 620px; margin: 20px 0 0; color: var(--muted); line-height: 1.75; }

.summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(95px, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(20, 36, 58, 0.55);
}

.summary div { min-width: 105px; padding: 18px; border-left: 1px solid var(--line); }
.summary div:first-child { border-left: 0; }
.summary span, .summary small { display: block; }
.summary span { font-size: 30px; font-weight: 800; }
.summary small { margin-top: 4px; color: var(--muted); }

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 36px;
  padding: 20px;
  border: 1px solid rgba(242, 184, 75, 0.45);
  border-radius: 18px;
  background: rgba(242, 184, 75, 0.08);
}

.auth-panel p { margin: 6px 0 0; color: var(--muted); }
.auth-panel form { display: flex; gap: 10px; width: min(500px, 100%); }
.auth-panel input {
  flex: 1;
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink);
  background: rgba(7, 17, 31, 0.75);
  outline: none;
}
.auth-panel input:focus { border-color: var(--teal); }
code { color: var(--teal); }

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}
.muted { color: var(--muted); }

.recording-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.recording-card {
  overflow: hidden;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(160deg, rgba(20, 36, 58, 0.92), rgba(12, 25, 42, 0.9));
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.15);
}

.card-head, .card-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.record-id { margin: 0; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 14px; }
.record-device { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.record-status {
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--amber);
  background: rgba(242, 184, 75, 0.11);
  font-size: 12px;
  font-weight: 700;
}
.record-status.done { color: var(--green); background: rgba(49, 196, 141, 0.12); }
.record-status.audio_ready { color: var(--blue); background: rgba(74, 144, 226, 0.14); }
.record-status.failed { color: var(--red); background: rgba(230, 92, 92, 0.12); }

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin: 20px 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--line);
  overflow: hidden;
}
.metrics div { padding: 13px; background: rgba(7, 17, 31, 0.58); }
.metrics span, .metrics small { display: block; }
.metrics span { font-weight: 700; }
.metrics small { margin-top: 4px; color: var(--muted); font-size: 11px; }

.transcript-wrap {
  min-height: 96px;
  padding: 15px;
  border-radius: 14px;
  background: rgba(7, 17, 31, 0.45);
}
.transcript-label { margin: 0 0 8px; color: var(--muted); font-size: 11px; letter-spacing: 0.14em; }
.transcript { margin: 0; color: #dbe6f3; line-height: 1.65; white-space: pre-wrap; }
.card-actions { margin-top: 18px; justify-content: flex-start; flex-wrap: wrap; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 15px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: var(--ink);
  background: transparent;
  text-decoration: none;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: 0.55; transform: none; }
.button.primary { color: #06121a; background: var(--teal); }
.button.secondary { border-color: var(--line); background: rgba(20, 36, 58, 0.55); }
.button.danger { color: #ffd9d9; border-color: rgba(230, 92, 92, 0.32); }
.button.danger:hover { background: rgba(230, 92, 92, 0.12); }
.audio { width: 100%; margin-top: 8px; }

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: min(420px, calc(100vw - 48px));
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #13243a;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.35);
}
.toast.error { border-color: rgba(230, 92, 92, 0.5); }

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; padding-top: 38px; }
  .summary { width: 100%; }
  .recording-grid { grid-template-columns: 1fr; }
  .auth-panel { align-items: stretch; flex-direction: column; }
}

@media (max-width: 560px) {
  .shell { width: min(100% - 20px, 1180px); }
  .topbar, .section-head { align-items: flex-start; flex-direction: column; }
  .top-actions { width: 100%; flex-wrap: wrap; }
  .summary div { min-width: 0; padding: 13px; }
  .summary span { font-size: 24px; }
  .auth-panel form { flex-direction: column; }
}
