* {
  box-sizing: border-box;
}

:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #eef2f6;
  --text: #15171a;
  --muted: #636b74;
  --line: #dce3ea;
  --accent: #0f8b8d;
  --accent-2: #e06b3c;
  --success: #21865a;
  --danger: #d04444;
  --shadow: 0 18px 48px rgba(26, 33, 42, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #09090b;
    --surface: #14161a;
    --surface-2: #1d2228;
    --text: #f2f5f7;
    --muted: #9ca6b2;
    --line: #2b333d;
    --accent: #38b6b9;
    --accent-2: #f18a5f;
    --success: #42b883;
    --danger: #ff6b6b;
    --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #09090b;
  --surface: #14161a;
  --surface-2: #1d2228;
  --text: #f2f5f7;
  --muted: #9ca6b2;
  --line: #2b333d;
  --accent: #38b6b9;
  --accent-2: #f18a5f;
  --success: #42b883;
  --danger: #ff6b6b;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

:root[data-theme="light"] {
  color-scheme: light;
}

[v-cloak] {
  display: none;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
select,
input {
  font: inherit;
}

button {
  color: inherit;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 0 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0 20px;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  font-size: 20px;
  font-weight: 780;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 740;
  letter-spacing: 0;
}

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

.topbar-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 10px;
}

.connection-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 94px;
  height: 38px;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.connection-pill.live {
  border-color: color-mix(in srgb, var(--success), transparent 60%);
  color: var(--success);
}

.connection-pill.connecting,
.connection-pill.closing {
  border-color: color-mix(in srgb, var(--accent), transparent 58%);
  color: var(--accent);
}

.connection-pill.error {
  border-color: color-mix(in srgb, var(--danger), transparent 58%);
  color: var(--danger);
}

.icon-button,
.text-button,
.swap-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 8px;
}

.icon-button:hover,
.text-button:hover,
.swap-button:hover {
  border-color: color-mix(in srgb, var(--accent), var(--line) 45%);
}

button:disabled,
select:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.workspace {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.control-panel,
.transcript-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.control-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.panel-section {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface), var(--surface-2) 32%);
}

.section-title,
.meter-label,
.block-heading,
.history-head,
.toggle-row {
  display: flex;
  align-items: center;
}

.section-title {
  gap: 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 720;
}

.field {
  display: grid;
  gap: 7px;
}

.field span,
.toggle-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 680;
}

select {
  width: 100%;
  min-height: 40px;
  padding: 0 36px 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}

select:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent), transparent 55%);
  outline-offset: 2px;
}

.swap-button {
  width: 40px;
  height: 34px;
  justify-self: center;
  border-radius: 8px;
}

.toggle-row {
  justify-content: space-between;
  min-height: 40px;
  padding: 0 2px;
}

.toggle-row input {
  width: 42px;
  height: 24px;
  margin: 0;
  accent-color: var(--accent);
}

.call-panel {
  display: grid;
  gap: 14px;
  padding: 2px 0 0;
}

.call-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 72px;
  gap: 12px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #217cba);
  color: #ffffff;
  cursor: pointer;
  font-size: 18px;
  font-weight: 760;
  letter-spacing: 0;
}

.call-button.active {
  background: linear-gradient(135deg, var(--danger), var(--accent-2));
}

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

.meter-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.meter-label {
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.meter {
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.meter span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--success));
  transition: width 90ms linear;
}

.meter.output span {
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
}

.transcript-panel {
  min-height: 650px;
  padding: 18px;
}

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

.live-block {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 190px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface), var(--surface-2) 28%);
}

.live-block.translated {
  border-color: color-mix(in srgb, var(--accent), var(--line) 70%);
}

.block-heading {
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.block-heading span {
  color: var(--text);
  font-size: 15px;
  font-weight: 760;
}

.block-heading small {
  font-size: 12px;
  font-weight: 700;
}

.live-block p {
  align-self: center;
  margin: 18px 0 0;
  color: var(--text);
  font-size: 24px;
  line-height: 1.42;
  overflow-wrap: anywhere;
}

.history-head {
  justify-content: space-between;
  gap: 12px;
  margin: 22px 0 12px;
}

.history-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 760;
}

.text-button {
  min-width: 84px;
  height: 36px;
  gap: 7px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.history-list {
  display: grid;
  gap: 10px;
  max-height: 350px;
  overflow: auto;
  padding-right: 4px;
}

.history-item {
  display: grid;
  gap: 7px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.history-item time {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.history-item p {
  margin: 0;
  overflow-wrap: anywhere;
  line-height: 1.48;
}

.source-text {
  color: var(--muted);
  font-size: 14px;
}

.target-text {
  color: var(--text);
  font-size: 16px;
  font-weight: 660;
}

.empty-state {
  display: grid;
  min-height: 210px;
  place-items: center;
  align-content: center;
  gap: 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 680;
}

@media (max-width: 860px) {
  .shell {
    width: min(100% - 24px, 720px);
    padding-top: 14px;
  }

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

  .workspace {
    grid-template-columns: 1fr;
  }

  .control-panel {
    order: 2;
  }

  .transcript-panel {
    order: 1;
    min-height: auto;
  }
}

@media (max-width: 620px) {
  .topbar {
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .connection-pill {
    flex: 1;
  }

  .live-grid,
  .meter-grid {
    grid-template-columns: 1fr;
  }

  .live-block {
    min-height: 150px;
  }

  .live-block p {
    font-size: 20px;
  }
}
