:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #132238;
  background: #eef2f7;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 10% 0%, rgba(74, 111, 165, 0.12), transparent 32rem),
    #eef2f7;
}

button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }

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

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.76rem;
  letter-spacing: 0.13em;
  font-weight: 800;
  color: #42618f;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(2rem, 5vw, 3.6rem); line-height: 1; }
h2 { margin-bottom: 6px; font-size: 1.05rem; }
.lead { margin-bottom: 0; max-width: 720px; color: #506078; }

.panel {
  border: 1px solid rgba(82, 101, 130, 0.18);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 16px 40px rgba(37, 56, 82, 0.07);
  border-radius: 18px;
}

.notice {
  margin-bottom: 18px;
  padding: 13px 16px;
  border-left: 4px solid #ad711b;
  background: #fff8e7;
  color: #5e451f;
  border-radius: 10px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 13px;
  border: 1px solid rgba(82, 101, 130, 0.18);
  border-radius: 999px;
  background: rgba(255,255,255,0.8);
  white-space: nowrap;
  font-weight: 700;
  font-size: 0.9rem;
}

.status-dot { width: 10px; height: 10px; border-radius: 50%; background: #718096; }
.status-live .status-dot { background: #1e9d5a; box-shadow: 0 0 0 6px rgba(30,157,90,0.13); }
.status-error .status-dot { background: #cf3f3f; }
.status-connecting .status-dot { background: #d69320; animation: pulse 1s infinite alternate; }
@keyframes pulse { to { opacity: 0.35; } }

.settings {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) minmax(220px, 1fr) auto;
  align-items: end;
  gap: 16px;
  padding: 18px;
  margin-bottom: 18px;
}

.field { display: grid; gap: 7px; }
label { color: #43526a; font-size: 0.84rem; font-weight: 800; }
input, select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #cbd4e0;
  border-radius: 11px;
  padding: 9px 12px;
  background: #fff;
  color: #14233a;
}
input:focus, select:focus { outline: 3px solid rgba(55, 105, 177, 0.18); border-color: #4e75ac; }

.switch-row {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 8px;
}
.switch-row input { width: 19px; min-height: auto; height: 19px; }

.participants {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}
.participant { padding: 20px; }
.participant-header { display: flex; align-items: center; gap: 13px; margin-bottom: 16px; }
.participant-header p { margin: 0; color: #6a788d; font-size: 0.86rem; }
.badge {
  width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: 12px; background: #213d68; color: white; font-weight: 900;
}
.swap { color: #6580a8; font-size: 1.6rem; font-weight: 800; }

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  padding: 14px;
  margin-bottom: 18px;
}

.controls button {
  min-height: 62px;
  border-radius: 13px;
  border: 0;
  padding: 10px 16px;
  font-weight: 800;
}
.primary { background: #254d86; color: #fff; }
.primary.secondary { background: #476b9d; }
.danger { background: #9f2f3a; color: #fff; min-width: 120px; }
.button-main, .button-sub { display: block; }
.button-sub { margin-top: 4px; font-size: 0.76rem; opacity: 0.76; font-weight: 600; }

.live-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}
.transcript { min-height: 260px; padding: 20px; }
.panel-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.pill { padding: 5px 9px; border-radius: 999px; background: #e7edf6; color: #39577f; font-size: 0.76rem; font-weight: 800; }
.transcript-content {
  margin-top: 18px;
  min-height: 150px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #55637a;
  font-size: 1.08rem;
  line-height: 1.6;
}
.transcript-content.emphasized { color: #142c50; font-weight: 650; font-size: 1.2rem; }

.history { padding: 20px; margin-bottom: 18px; }
.history-title p { margin: 0; color: #718096; font-size: 0.82rem; }
.history-actions { display: flex; gap: 8px; }
.ghost { border: 1px solid #c6d0de; background: #fff; color: #2f486c; border-radius: 9px; padding: 8px 11px; font-weight: 750; }
.history-list { margin-top: 18px; display: grid; gap: 12px; }
.empty-history { color: #78869a; margin: 0; }
.history-entry { padding: 14px; border: 1px solid #e0e6ee; border-radius: 12px; background: #f9fbfd; }
.history-meta { display: flex; justify-content: space-between; gap: 12px; color: #5d6b7f; font-size: 0.77rem; font-weight: 750; }
.history-original { margin: 10px 0 6px; color: #45556d; }
.history-translation { margin: 0; color: #17345f; font-weight: 750; }

.diagnostics { padding: 16px 20px; }
.diagnostics summary { cursor: pointer; font-weight: 800; }
.diagnostics pre { white-space: pre-wrap; overflow-wrap: anywhere; color: #394961; font-size: 0.78rem; }

@media (max-width: 820px) {
  .hero { flex-direction: column; }
  .settings { grid-template-columns: 1fr; }
  .participants { grid-template-columns: 1fr; }
  .swap { transform: rotate(90deg); justify-self: center; }
  .controls { grid-template-columns: 1fr; }
  .live-grid { grid-template-columns: 1fr; }
  .history-title { align-items: flex-start; flex-direction: column; }
}

@media (prefers-color-scheme: dark) {
  :root { color: #edf3fb; background: #101826; }
  body { background: radial-gradient(circle at 10% 0%, rgba(74,111,165,0.2), transparent 30rem), #101826; }
  .panel, .status { background: rgba(22, 33, 50, 0.95); border-color: #2b3d59; box-shadow: none; }
  .lead, .participant-header p, .history-title p, .empty-history { color: #9eabc0; }
  label { color: #bdc9da; }
  input, select { background: #0e1725; color: #edf3fb; border-color: #40516a; }
  .notice { background: #332917; color: #f1d9a8; }
  .transcript-content { color: #aebbd0; }
  .transcript-content.emphasized { color: #e9f1fc; }
  .pill { background: #263a58; color: #c9daf3; }
  .ghost { background: #162235; border-color: #40516a; color: #dce8f8; }
  .history-entry { background: #121d2c; border-color: #2d3c53; }
  .history-original { color: #aebbd0; }
  .history-translation { color: #e2edfc; }
}
