:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --ink: #18202f;
  --muted: #647084;
  --line: #d8e0eb;
  --panel: #ffffff;
  --panel-soft: #eef3f8;
  --accent: #1477ff;
  --accent-2: #00a676;
  --danger: #d64b4b;
  --shadow: 0 22px 60px rgba(40, 58, 88, .14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    linear-gradient(135deg, rgba(20,119,255,.08), transparent 34%),
    linear-gradient(315deg, rgba(0,166,118,.10), transparent 36%),
    var(--bg);
  color: var(--ink);
}

button, textarea, input, select {
  font: inherit;
}

.app {
  width: min(1180px, calc(100vw - 32px));
  min-height: calc(100vh - 32px);
  margin: 16px auto;
  display: grid;
  grid-template-columns: 390px 1fr;
  gap: 16px;
}

.control, .conversation {
  background: rgba(255,255,255,.88);
  border: 1px solid rgba(216,224,235,.9);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.control {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
}

.mark {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 12px 28px rgba(20,119,255,.22);
}

.mark span {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 0 0 8px rgba(255,255,255,.24);
}

h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: 0;
}

p {
  margin: 0;
  line-height: 1.65;
}

.brand p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.statusRow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.statusRow span {
  height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 12px;
}

.orb {
  position: relative;
  min-height: 230px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: radial-gradient(circle, rgba(20,119,255,.10), transparent 54%);
  overflow: hidden;
}

.ring {
  position: absolute;
  width: 174px;
  height: 174px;
  border-radius: 50%;
  border: 1px solid rgba(20,119,255,.20);
  animation: pulse 2.8s ease-in-out infinite;
}

.orb.listening .ring {
  border-color: rgba(0,166,118,.48);
  animation-duration: 1.1s;
}

.micButton {
  position: relative;
  z-index: 1;
  width: 148px;
  height: 148px;
  border-radius: 50%;
  border: 0;
  color: white;
  background: linear-gradient(145deg, var(--accent), #0e57c9);
  box-shadow: 0 20px 42px rgba(20,119,255,.26);
  cursor: pointer;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
}

.orb.listening .micButton {
  background: linear-gradient(145deg, var(--accent-2), #087a59);
}

.micButton span {
  font-size: 24px;
  line-height: 1;
}

.micButton strong {
  font-size: 16px;
}

.modePanel, .apiPanel, .languagePanel, .transcriptBox {
  display: grid;
  gap: 8px;
}

label {
  color: var(--muted);
  font-size: 13px;
}

select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  color: var(--ink);
  background: white;
  line-height: 1.55;
  outline: none;
}

select {
  min-height: 44px;
  cursor: pointer;
}

textarea {
  min-height: 118px;
  resize: vertical;
}

select:focus, textarea:focus {
  border-color: rgba(20,119,255,.72);
  box-shadow: 0 0 0 4px rgba(20,119,255,.10);
}

.modePanel, .apiPanel {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}

.modePanel p, .apiPanel p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.modeButtons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.modeButtons button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  color: var(--ink);
  background: white;
  font-weight: 800;
}

.modeButtons button.active {
  color: white;
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 10px 24px rgba(20,119,255,.18);
}

.modeButtons button:disabled {
  cursor: wait;
  opacity: .68;
}

.apiKeyRow {
  display: grid;
  grid-template-columns: 1fr 76px;
  gap: 8px;
}

.apiKeyRow input {
  min-width: 0;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  background: white;
  color: var(--ink);
  outline: none;
}

.apiKeyRow input:focus {
  border-color: rgba(20,119,255,.72);
  box-shadow: 0 0 0 4px rgba(20,119,255,.10);
}

.apiKeyRow button {
  height: 42px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  color: white;
  background: var(--accent);
  font-weight: 800;
}

.apiKeyRow button:disabled {
  cursor: wait;
  opacity: .62;
}

.interim {
  min-height: 24px;
  color: var(--accent);
  font-size: 13px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 96px;
  gap: 10px;
}

.actions button, .tips button {
  height: 42px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  color: white;
  background: var(--accent);
  font-weight: 700;
}

.actions .ghost {
  color: var(--ink);
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.uploadBox {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}

.uploadBox p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.uploadBox input[type="file"] {
  width: 100%;
  padding: 10px;
  border: 1px dashed #b9c5d6;
  border-radius: 10px;
  background: white;
  color: var(--muted);
}

.uploadBox button {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  color: var(--ink);
  background: white;
  font-weight: 700;
}

.uploadBox button:disabled {
  cursor: wait;
  opacity: .62;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 13px;
}

.toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.tips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 4px;
}

.tips span {
  width: 100%;
  color: var(--muted);
  font-size: 13px;
}

.tips button {
  height: 34px;
  padding: 0 10px;
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
  font-weight: 600;
}

.conversation {
  min-height: calc(100vh - 32px);
  padding: 18px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 16px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.metrics div {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.metrics strong {
  font-size: 20px;
  line-height: 1.1;
}

.chat {
  overflow: auto;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  max-width: 82%;
  border-radius: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: white;
}

.message.user {
  align-self: flex-end;
  border-color: rgba(20,119,255,.28);
  background: #eef5ff;
}

.message.assistant {
  align-self: flex-start;
}

.role {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 4px;
  letter-spacing: .04em;
}

.message p {
  white-space: pre-wrap;
}

@keyframes pulse {
  0%, 100% { transform: scale(.92); opacity: .42; }
  50% { transform: scale(1.08); opacity: .9; }
}

@media (max-width: 880px) {
  .app {
    grid-template-columns: 1fr;
    width: min(100vw - 18px, 620px);
    margin: 9px auto;
  }

  .conversation {
    min-height: 620px;
  }

  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .message {
    max-width: 96%;
  }
}

/* MoonToTop Lab skin */
:root {
  color-scheme: dark;
  --bg: #020609;
  --ink: #f6fbff;
  --muted: #9aa7b4;
  --line: rgba(99, 237, 255, .18);
  --panel: rgba(7, 17, 23, .84);
  --panel-soft: rgba(255,255,255,.055);
  --accent: #63edff;
  --accent-2: #86ffbf;
  --danger: #ff6d6d;
  --shadow: 0 30px 90px rgba(0,0,0,.46);
}

html {
  background: #020609;
}

body {
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 68% 20%, rgba(99,237,255,.13), transparent 27%),
    radial-gradient(circle at 28% 78%, rgba(134,255,191,.08), transparent 26%),
    linear-gradient(180deg, rgba(7,17,23,.94), #020609 44%, #000);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .32;
  background-image:
    radial-gradient(circle, rgba(255,255,255,.62) 0 1px, transparent 1.5px),
    radial-gradient(circle, rgba(99,237,255,.34) 0 1px, transparent 1.4px);
  background-size: 140px 140px, 220px 220px;
  background-position: 28px 42px, 98px 118px;
}

.labShell {
  position: relative;
  z-index: 1;
  width: min(1240px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.labHeader {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.labBrand,
.labNav {
  display: flex;
  align-items: center;
}

.labBrand {
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
}

.labBrand b,
.eyebrow {
  color: var(--accent);
}

.labMark {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.48);
  box-shadow: inset 0 0 0 7px rgba(255,255,255,.04), 0 0 24px rgba(99,237,255,.12);
  position: relative;
}

.labMark::before,
.labMark::after {
  content: "";
  position: absolute;
  inset: 11px;
  border: 1px solid rgba(99,237,255,.72);
  border-radius: 50%;
}

.labMark::after {
  inset: 18px 8px;
  border-radius: 999px;
}

.labNav {
  gap: 10px;
}

.labNav a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  color: rgba(246,251,255,.78);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 999px;
}

.labNav a:hover {
  color: var(--ink);
  border-color: var(--line);
  background: rgba(99,237,255,.08);
}

.app {
  width: 100%;
  min-height: calc(100vh - 116px);
  margin: 0;
  grid-template-columns: minmax(340px, 390px) minmax(0, 1fr);
  gap: 18px;
}

.control,
.conversation,
.metrics div,
.modePanel,
.apiPanel,
.uploadBox,
.message {
  border-color: var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.control,
.conversation {
  border-radius: 18px;
}

.conversation {
  background:
    linear-gradient(145deg, rgba(99,237,255,.08), transparent 30%),
    var(--panel);
}

.brand {
  align-items: flex-start;
}

.mark {
  flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(99,237,255,.08);
  border: 1px solid var(--line);
  box-shadow: 0 0 28px rgba(99,237,255,.12);
}

.mark span {
  background: var(--accent);
  box-shadow: 0 0 0 8px rgba(99,237,255,.14);
}

.eyebrow {
  margin: 0 0 5px;
  text-transform: uppercase;
  letter-spacing: .16em;
  font-size: 11px;
  font-weight: 900;
}

h1,
.metrics strong,
.message p,
.actions .ghost,
.tips button,
.uploadBox button {
  color: var(--ink);
}

.brand p,
label,
.statusRow span,
.metrics span,
.tips span,
.role,
.uploadBox p {
  color: var(--muted);
}

.statusRow span,
select,
textarea,
.apiKeyRow input,
.modeButtons button,
.tips button,
.uploadBox input[type="file"],
.uploadBox button,
.actions .ghost {
  border-color: var(--line);
  background: rgba(255,255,255,.055);
}

select,
textarea,
.apiKeyRow input {
  color: var(--ink);
}

textarea::placeholder,
.apiKeyRow input::placeholder {
  color: rgba(154,167,180,.72);
}

select:focus,
textarea:focus,
.apiKeyRow input:focus {
  border-color: rgba(99,237,255,.78);
  box-shadow: 0 0 0 4px rgba(99,237,255,.10);
}

.modePanel p,
.apiPanel p,
.interim {
  color: var(--accent);
}

.modeButtons button {
  color: var(--muted);
}

.modeButtons button.active,
.apiKeyRow button,
.actions button {
  color: #001014;
  border-color: rgba(99,237,255,.82);
  background: linear-gradient(135deg, #63edff, #86ffbf);
  box-shadow: 0 12px 28px rgba(99,237,255,.16);
}

.orb {
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 50% 48%, rgba(99,237,255,.24), transparent 34%),
    radial-gradient(circle at 50% 50%, rgba(134,255,191,.12), transparent 58%);
}

.ring {
  border-color: rgba(99,237,255,.32);
  box-shadow: 0 0 48px rgba(99,237,255,.12);
}

.micButton {
  color: #001014;
  background: linear-gradient(145deg, #63edff, #1978a1);
  box-shadow: 0 22px 55px rgba(99,237,255,.22);
}

.orb.listening .micButton {
  background: linear-gradient(145deg, #86ffbf, #0c8d66);
}

.message.user {
  border-color: rgba(99,237,255,.30);
  background: rgba(99,237,255,.10);
}

.message.assistant {
  background: rgba(255,255,255,.065);
}

@media (max-width: 880px) {
  .labShell {
    width: min(100vw - 18px, 660px);
    padding: 12px 0;
  }

  .labHeader {
    align-items: flex-start;
    flex-direction: column;
  }

  .app {
    width: 100%;
    grid-template-columns: 1fr;
  }
}
