:root {
  --canvas: #f3f4ef;
  --surface: #fffefa;
  --surface-soft: #f8f8f3;
  --ink: #123f38;
  --ink-strong: #082f2a;
  --muted: #607b76;
  --line: #d8e5e1;
  --line-strong: #bed3cd;
  --teal: #0b5147;
  --teal-bright: #168572;
  --teal-soft: #e5f2ef;
  --amber: #e88716;
  --amber-dark: #8b4a05;
  --amber-soft: #fff2dc;
  --danger: #b64b1c;
  --shadow-sm: 0 1px 2px rgba(8, 47, 42, .05), 0 5px 16px rgba(8, 47, 42, .05);
  --shadow-lg: 0 18px 50px rgba(8, 47, 42, .16);
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  overflow: hidden;
  background: var(--canvas);
  color: var(--ink);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button { color: inherit; }
button, select, input { outline: none; }
button:focus-visible, select:focus-visible, input:focus-visible, summary:focus-visible {
  box-shadow: 0 0 0 3px rgba(232, 135, 22, .28);
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.hidden { display: none !important; }

.app-header {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 10px 24px;
  background: rgba(255, 254, 250, .96);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  position: relative;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 12px 12px 12px 4px;
  background: var(--teal);
  box-shadow: 0 5px 14px rgba(11, 81, 71, .18);
}
.brand-mark::before {
  content: "";
  position: absolute;
  inset: 10px 9px 12px;
  border: 2px solid #fff;
  border-radius: 6px 6px 6px 2px;
}
.brand-mark::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  top: -3px;
  right: -3px;
  border-radius: 50%;
  background: var(--amber);
  border: 3px solid var(--surface);
}
.brand-copy { display: flex; align-items: baseline; gap: 14px; min-width: 0; }
.brand h1 { margin: 0; color: var(--ink-strong); font-size: 1.45rem; line-height: 1; letter-spacing: -.025em; }
.tagline { color: var(--muted); font-size: .94rem; white-space: nowrap; }
.beta-note {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: .76rem;
  font-weight: 650;
  letter-spacing: .02em;
  white-space: nowrap;
}
.beta-note span { color: var(--amber); font-size: .58rem; }

.main-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.72fr) minmax(360px, .88fr);
}
.left-panel, .right-panel { min-width: 0; min-height: 0; }
.left-panel {
  display: flex;
  flex-direction: column;
  padding: 20px 24px 0;
  background:
    radial-gradient(circle at 15% 12%, rgba(229, 242, 239, .8), transparent 24%),
    var(--canvas);
  border-right: 1px solid var(--line-strong);
}
.conversation-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 2px 15px;
  border-bottom: 1px solid var(--line);
}
.eyebrow {
  display: block;
  margin-bottom: 2px;
  color: var(--teal-bright);
  font-size: .68rem;
  line-height: 1.2;
  font-weight: 750;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.conversation-heading h2 { margin: 0; color: var(--ink-strong); font-size: 1.25rem; line-height: 1.25; letter-spacing: -.015em; }
.status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 160px;
  justify-content: flex-end;
  color: var(--teal);
  font-size: .75rem;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.status-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--teal-bright); box-shadow: 0 0 0 4px rgba(22, 133, 114, .11); }
.waveform { height: 18px; display: flex; align-items: center; gap: 2px; margin-left: 5px; }
.waveform i { width: 2px; height: 5px; border-radius: 2px; background: var(--teal-bright); opacity: .35; }
.waveform.active i { animation: level .85s ease-in-out infinite alternate; opacity: .75; }
.waveform.active i:nth-child(2), .waveform.active i:nth-child(4) { animation-delay: -.3s; }
.waveform.active i:nth-child(3) { animation-delay: -.55s; }
@keyframes level { from { height: 4px; } to { height: 16px; } }

.conversation {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding: 18px 5px 26px 2px;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}
.empty-state {
  width: min(430px, 90%);
  margin: auto;
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 34px;
  text-align: center;
  color: var(--muted);
}
.empty-state strong { color: var(--ink-strong); font-size: 1.25rem; letter-spacing: -.015em; }
.empty-state span:last-child { max-width: 360px; font-size: .92rem; }
.empty-state-mark { position: relative; width: 56px; height: 46px; margin-bottom: 9px; }
.empty-state-mark::before, .empty-state-mark::after { content: ""; position: absolute; width: 35px; height: 27px; border: 2px solid var(--line-strong); border-radius: 10px 10px 10px 3px; }
.empty-state-mark::before { left: 0; top: 0; background: var(--surface); }
.empty-state-mark::after { right: 0; bottom: 0; background: var(--teal-soft); border-color: #a9cbc3; transform: scaleX(-1); }
.message {
  width: fit-content;
  max-width: min(76%, 760px);
  padding: 14px 16px 15px;
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}
.message.landlord { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.message.tenant { align-self: flex-end; background: var(--teal); border: 1px solid var(--teal); border-bottom-right-radius: 5px; box-shadow: 0 8px 24px rgba(11, 81, 71, .14); }
.message.landlord:has(.inline-flags:not(:empty)) { border-left: 3px solid var(--amber); }
.message .speaker { margin-bottom: 5px; color: var(--muted); font-size: .67rem; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
.message .original { margin-bottom: 5px; color: var(--muted); font-size: .9rem; line-height: 1.4; }
.message .translation { color: var(--ink-strong); font-size: 1.08rem; line-height: 1.45; font-weight: 680; }
.message.tenant .speaker, .message.tenant .original { color: rgba(255,255,255,.7); }
.message.tenant .translation { color: #fff; }
.inline-flags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px !important; padding-top: 9px; border-top: 1px solid var(--line); }
.message.tenant .inline-flags { border-color: rgba(255,255,255,.2); }

.right-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 20px 22px 18px;
  background: var(--surface);
}
.rail-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 0 2px 14px; }
.rail-heading > div { min-width: 0; }
.rail-heading p, .view-heading p { margin: 5px 0 0; color: var(--muted); font-size: .84rem; line-height: 1.45; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-bottom: 16px; padding: 4px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 12px; }
.tab { min-width: 0; padding: 8px 6px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; font-size: .82rem; font-weight: 700; }
.tab:hover { color: var(--ink); background: rgba(255,255,255,.75); }
.tab.active { color: var(--ink-strong); background: var(--surface); box-shadow: 0 1px 4px rgba(8,47,42,.09); }
.tab-content { display: none; min-height: 0; flex: 1; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.tab-content.active { display: block; }
.insight-block { padding: 15px 0 17px; border-bottom: 1px solid var(--line); }
.insight-block:first-child { padding-top: 5px; }
.section-title { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.section-title h3, .view-heading h3 { margin: 0; color: var(--ink-strong); font-size: .75rem; font-weight: 760; letter-spacing: .1em; text-transform: uppercase; }
.section-icon { position: relative; width: 24px; height: 24px; flex: none; border-radius: 8px; background: var(--teal-soft); }
.promise-icon::before { content: ""; position: absolute; left: 7px; top: 6px; width: 9px; height: 5px; border-left: 2px solid var(--teal); border-bottom: 2px solid var(--teal); transform: rotate(-45deg); }
.flag-icon { background: var(--amber-soft); }
.flag-icon::before { content: ""; position: absolute; left: 8px; top: 5px; width: 2px; height: 9px; border-radius: 2px; background: var(--amber-dark); box-shadow: 0 12px 0 -1px var(--amber-dark); }
.promises-list ul { list-style: none; padding: 0; margin: 0; }
.promises-list li { position: relative; margin: 7px 0; padding: 10px 12px 10px 34px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-soft); color: var(--ink); font-size: .9rem; line-height: 1.42; }
.promises-list li::before { content: "✓"; position: absolute; left: 11px; top: 10px; color: var(--teal-bright); font-weight: 800; }
#promises-ul:empty::after, #flags-container:empty::after { display: block; padding: 13px 14px; border: 1px dashed var(--line-strong); border-radius: 11px; color: var(--muted); background: var(--surface-soft); font-size: .84rem; line-height: 1.4; }
#promises-ul:empty::after { content: "Specific commitments will appear here as the conversation develops."; }
#flags-container:empty::after { content: "Money terms, rules, penalties and vague commitments will appear here for review."; }
.flags-container { display: flex; flex-wrap: wrap; gap: 7px; }
.flag-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border: 1px solid #efd19f; border-radius: 8px; background: var(--amber-soft); color: var(--amber-dark); font-size: .78rem; line-height: 1; font-weight: 720; }
.flag-chip[data-count]:not([data-count="1"])::after { content: "×" attr(data-count); padding-left: 6px; border-left: 1px solid #e2bd7d; font-size: .68rem; opacity: .82; }
.inline-flags .flag-chip { border-radius: 999px; padding: 4px 9px; }
.soft-no-note { flex-basis: 100%; margin-top: 0; color: var(--danger); font-size: .82rem; font-style: normal; }
.rail-note { margin: 16px 2px 0; color: var(--muted); font-size: .75rem; }
.view-heading { padding: 5px 2px 10px; }
.simulator-item { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; margin: 8px 0; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.simulator-item p { margin: 0; color: var(--ink); font-size: .84rem; line-height: 1.42; }
.simulator-item button, #close-summary, #retry-btn { padding: 7px 11px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--teal); cursor: pointer; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.simulator-item button:hover, #close-summary:hover, #retry-btn:hover { border-color: var(--teal); }
.simulator-item button:disabled { opacity: .55; cursor: wait; }
#score-output { overflow: auto; margin: 7px 0; color: var(--ink); font-size: .84rem; }
.score-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.score-metric { min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-soft); }
.score-label, .score-value, .score-note { display: block; }
.score-label { color: var(--muted); font-size: .68rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.score-value { margin: 3px 0 0; color: var(--ink-strong); font-size: 1.48rem; line-height: 1.1; letter-spacing: -.035em; }
.score-note { color: var(--muted); font-size: .68rem; line-height: 1.35; }
.score-context { margin: 9px 0 12px; padding: 9px 11px; border-left: 3px solid var(--teal-bright); border-radius: 0 10px 10px 0; background: var(--teal-soft); }
.score-context strong { color: var(--ink-strong); font-size: .78rem; }
.score-context p { margin: 3px 0 0; color: var(--muted); font-size: .75rem; line-height: 1.45; }
.score-section-title { display: flex; align-items: center; justify-content: space-between; margin: 0 1px 6px; }
.score-section-title h4 { margin: 0; color: var(--ink-strong); font-size: .78rem; }
.score-section-title span { color: var(--muted); font-size: .68rem; }
.score-table { width: 100%; border-spacing: 0; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; background: var(--surface); font-size: .75rem; }
.score-table th, .score-table td { padding: 8px 9px; border-bottom: 1px solid var(--line); text-align: left; }
.score-table thead th { background: var(--surface-soft); color: var(--muted); font-size: .64rem; letter-spacing: .05em; text-transform: uppercase; }
.score-table tbody th { color: var(--ink); font-weight: 650; }
.score-table tr:last-child th, .score-table tr:last-child td { border-bottom: 0; }
.score-number { color: var(--teal); font-variant-numeric: tabular-nums; font-weight: 750; }
.score-caveat { display: flex; align-items: center; gap: 8px; margin: 9px 0 0; padding: 8px 10px; border: 1px solid #efd19f; border-radius: 9px; background: var(--amber-soft); color: var(--muted); font-size: .68rem; line-height: 1.35; }
.score-caveat strong { color: var(--amber-dark); white-space: nowrap; }
.score-caveat span { min-width: 0; }
.about-hero { position: relative; padding: 7px 0 16px 52px; border-bottom: 1px solid var(--line); }
.about-mark { position: absolute; left: 2px; top: 8px; width: 38px; height: 38px; border-radius: 12px 12px 12px 4px; background: var(--teal); }
.about-mark::before { content: ""; position: absolute; inset: 10px 9px 12px; border: 2px solid #fff; border-radius: 6px 6px 6px 2px; }
.about-mark::after { content: ""; position: absolute; width: 8px; height: 8px; right: -3px; top: -3px; border: 3px solid var(--surface); border-radius: 50%; background: var(--amber); }
.about-hero h3 { margin: 5px 0 5px; color: var(--ink-strong); font-size: 1rem; letter-spacing: -.015em; }
.about-hero p { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.about-steps { list-style: none; display: grid; gap: 0; margin: 13px 0; padding: 0; }
.about-steps li { display: grid; grid-template-columns: 27px 1fr; gap: 9px; padding: 8px 2px; }
.about-steps li > span { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; background: var(--teal-soft); color: var(--teal); font-size: .7rem; font-weight: 800; }
.about-steps strong { display: block; color: var(--ink-strong); font-size: .78rem; }
.about-steps p { margin: 1px 0 0; color: var(--muted); font-size: .72rem; line-height: 1.4; }
.about-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.about-facts article { padding: 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-soft); }
.about-facts strong { display: block; color: var(--ink-strong); font-size: .72rem; }
.about-facts p { margin: 3px 0 0; color: var(--muted); font-size: .68rem; line-height: 1.4; }
.about-note { margin: 12px 2px 0; color: var(--muted); font-size: .68rem; }

.bottom-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.72fr) minmax(360px, .88fr);
  background: var(--surface);
  border-top: 1px solid var(--line-strong);
  box-shadow: 0 -8px 24px rgba(8, 47, 42, .035);
}
.controls-left { display: grid; grid-template-columns: auto minmax(240px, 1fr); gap: 10px 14px; align-items: center; padding: 13px 24px; border-right: 1px solid var(--line-strong); }
.controls-left-top { display: flex; align-items: center; gap: 9px; }
.select-wrap { position: relative; }
#tenant-lang { height: 42px; padding: 0 34px 0 11px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--ink); cursor: pointer; font-size: .86rem; }
.mic-btn { height: 42px; display: inline-flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--teal); border-radius: 10px; background: var(--teal); color: #fff; cursor: pointer; font-size: .84rem; font-weight: 720; box-shadow: 0 4px 12px rgba(11,81,71,.12); white-space: nowrap; }
.mic-btn:hover { background: #0e6356; }
.mic-btn.active { background: var(--amber-dark); border-color: var(--amber-dark); transform: translateY(1px); }
.mic-icon { position: relative; width: 11px; height: 15px; border: 2px solid currentColor; border-radius: 6px; }
.mic-icon::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 7px; height: 4px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateX(-50%); }
kbd { display: inline-flex; align-items: center; min-height: 21px; padding: 1px 6px; border: 1px solid rgba(255,255,255,.25); border-bottom-width: 2px; border-radius: 5px; color: rgba(255,255,255,.78); font: 600 .64rem/1 var(--font); }
.mute-label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); cursor: pointer; font-size: .78rem; white-space: nowrap; }
.mute-label input { width: 15px; height: 15px; accent-color: var(--teal); }
.text-input-wrap { position: relative; min-width: 0; }
#tenant-text-input { width: 100%; height: 42px; padding: 0 58px 0 13px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface-soft); color: var(--ink-strong); font-size: .88rem; }
#tenant-text-input::placeholder { color: #7f938f; }
.text-input-wrap > kbd { position: absolute; right: 9px; top: 9px; border-color: var(--line-strong); color: var(--muted); background: var(--surface); }
.controls-right { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 22px; }
.approval-copy { min-width: 0; }
.approval-copy strong, .approval-copy span { display: block; }
.approval-copy strong { color: var(--ink-strong); font-size: .8rem; }
.approval-copy span { color: var(--muted); font-size: .7rem; white-space: nowrap; }
#approve-btn { min-height: 44px; padding: 0 14px; border: 1px solid var(--amber); border-radius: 10px; background: var(--amber); color: #2c1a02; cursor: pointer; font-size: .82rem; font-weight: 780; white-space: nowrap; box-shadow: 0 5px 14px rgba(232,135,22,.18); }
#approve-btn:hover:not(:disabled) { background: #f09a32; }
#approve-btn:disabled { border-color: var(--line); background: var(--surface-soft); color: #879b96; cursor: not-allowed; box-shadow: none; }
footer { padding: 5px 16px 6px; background: var(--surface); color: var(--muted); text-align: center; font-size: .68rem; }
footer p { margin: 0; } footer span { padding: 0 6px; color: var(--line-strong); }

#connection-overlay { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 20px; background: rgba(8, 47, 42, .55); backdrop-filter: blur(7px); }
.overlay-content { width: min(400px, 100%); padding: 28px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-lg); text-align: center; }
.overlay-icon { display: grid; place-items: center; width: 38px; height: 38px; margin: 0 auto 12px; border-radius: 50%; background: var(--amber-soft); color: var(--amber-dark); font-weight: 850; }
.overlay-content h2 { margin: 0; color: var(--ink-strong); font-size: 1.2rem; }
.overlay-content p { margin: 8px 0 17px; color: var(--muted); font-size: .88rem; }
dialog { width: min(680px, calc(100% - 32px)); max-height: calc(100% - 40px); overflow: auto; padding: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(8, 47, 42, .52); backdrop-filter: blur(6px); }
.dialog-content { padding: 28px; }
.dialog-content h2 { margin: 3px 0 16px; color: var(--ink-strong); letter-spacing: -.02em; }
#summary-content { margin-bottom: 20px; }
#summary-content table { font-size: .86rem; }

@media (max-width: 1100px) {
  .main-layout, .bottom-panel { grid-template-columns: minmax(0, 1.45fr) minmax(330px, .9fr); }
  .controls-left { grid-template-columns: 1fr; }
  .approval-copy { display: none; }
  .controls-right { justify-content: flex-end; }
  .message { max-width: 86%; }
  .mic-btn kbd { display: none; }
}
@media (max-width: 780px) {
  body { display: flex; flex-direction: column; width: 100%; overflow: auto; min-height: 100%; height: auto; }
  .app-header { min-height: 60px; padding: 9px 14px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-copy { display: block; }
  .tagline { display: none; }
  .beta-note { margin-left: auto; }
  .main-layout { display: flex; flex-direction: column; overflow: visible; }
  .left-panel { min-height: 60vh; padding: 16px 14px 0; border-right: 0; }
  .right-panel { min-height: 420px; padding: 18px 14px; border-top: 1px solid var(--line-strong); }
  .conversation-heading { align-items: flex-end; }
  .message { max-width: 94%; }
  .bottom-panel { display: flex; flex-direction: column; position: static; z-index: 5; }
  .controls-left { width: 100%; padding: 11px 14px; border-right: 0; }
  .controls-left-top { flex-wrap: wrap; }
  .text-input-wrap { width: 100%; }
  .controls-right { width: 100%; padding: 0 14px 12px; }
  #approve-btn { width: 100%; }
  footer { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

/* ---- Microphone feedback (added with the hold-to-speak rewrite) ---- */
.mic-btn { touch-action: none; user-select: none; -webkit-user-select: none; position: relative; --level: 0; }
.mic-btn.active { box-shadow: 0 0 0 calc(3px + var(--level) * 12px) rgba(214, 132, 20, .22), 0 4px 12px rgba(11,81,71,.12); }
.mic-btn.active::after { content: "Recording"; margin-left: 6px; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; opacity: .9; }
.mic-hint { margin: 2px 0 0; min-height: 1.2em; font-size: .82rem; line-height: 1.3; color: #5e7a74; }
.mic-hint[data-kind="error"] { color: #a8431a; font-weight: 600; }
.mic-hint[data-kind="live"] { color: #0b5147; font-weight: 600; }
.mic-hint:empty { visibility: hidden; }
/* While recording, the bars follow the real input level instead of a canned animation. */
body[data-state="recording"] .waveform i { animation: none; opacity: .95; height: 16px; transform-origin: center; transition: transform .08s linear; background: #d68414; }
@media (prefers-reduced-motion: reduce) { body[data-state="recording"] .waveform i { transition: none; } }

/* Who is speaking */
.speaker-choice { display: inline-flex; border: 1px solid #cfe0db; border-radius: 10px; overflow: hidden; background: #fff; height: 42px; }
.speaker-choice button { border: 0; background: none; padding: 0 11px; font: inherit; font-size: .8rem; font-weight: 650; color: #5e7a74; cursor: pointer; }
.speaker-choice button + button { border-left: 1px solid #e3ece9; }
.speaker-choice button[aria-checked="true"] { background: #e6f2ef; color: #0b5147; }
.speaker-choice button:focus-visible { outline: 2px solid #d68414; outline-offset: -2px; }

/* Prerecorded voice-message fallback */
.audio-upload-btn { height: 42px; display: inline-flex; align-items: center; gap: 7px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--teal); cursor: pointer; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.audio-upload-btn:hover:not(:disabled) { border-color: var(--teal); background: var(--teal-soft); }
.audio-upload-btn:disabled { opacity: .55; cursor: wait; }
.upload-icon { display: grid; place-items: center; width: 18px; height: 18px; border: 1px solid var(--line-strong); border-radius: 6px; font-size: .78rem; line-height: 1; }

.about-help { width: 30px; height: 30px; flex: none; display: grid; place-items: center; padding: 0; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--surface-soft); color: var(--teal); cursor: pointer; font-size: .86rem; font-weight: 800; }
.about-help:hover { border-color: var(--teal); background: var(--teal-soft); }
.about-dialog { width: min(520px, calc(100% - 32px)); }
.about-dialog .dialog-content { padding: 24px; }
.about-dialog .about-hero { padding-bottom: 18px; }
.about-dialog .about-hero h2 { margin: 5px 0; color: var(--ink-strong); font-size: 1.12rem; letter-spacing: -.02em; }
.about-close { width: 100%; margin-top: 16px; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); color: var(--teal); cursor: pointer; font-weight: 700; }
.about-close:hover { border-color: var(--teal); background: var(--teal-soft); }

/* Structured bilingual conversation summary */
#summary-dialog { width: min(860px, calc(100% - 32px)); }
.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.summary-grid-single { grid-template-columns: 1fr; }
.summary-language { min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-soft); }
.summary-language-label { display: block; margin: 0 0 10px; color: var(--teal-bright); font-size: .67rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.summary-section { padding: 10px 0; border-top: 1px solid var(--line); }
.summary-section:first-of-type { border-top: 0; padding-top: 0; }
.summary-section:last-child { padding-bottom: 0; }
.summary-section h3 { margin: 0 0 6px; color: var(--ink-strong); font-size: .78rem; line-height: 1.35; letter-spacing: .04em; text-transform: none; }
.summary-section ul { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.summary-section li { position: relative; padding: 8px 9px 8px 25px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); font-size: .78rem; line-height: 1.42; }
.summary-section li::before { content: ""; position: absolute; left: 10px; top: 13px; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); }
.summary-empty { margin: 0; padding: 8px 9px; border: 1px dashed var(--line-strong); border-radius: 9px; color: var(--muted); font-size: .75rem; font-style: italic; }
#copy-summary-btn { padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); color: var(--teal); cursor: pointer; font-weight: 700; }
#copy-summary-btn:hover { border-color: var(--teal); background: var(--teal-soft); }
@media (max-width: 680px) { .summary-grid { grid-template-columns: 1fr; } }

.summary-section:first-of-type li { padding-left: 10px; border-color: #b9d8d1; background: var(--teal-soft); font-weight: 620; }
.summary-section:first-of-type li::before { display: none; }

/* The controls row grew (upload button, speaker switch), so let the text box wrap to its own
   line instead of spilling into the right-hand panel. */
.controls-left { display: flex; flex-wrap: wrap; min-width: 0; }
.controls-left-top { flex: 0 1 auto; flex-wrap: wrap; min-width: 0; }
.text-input-wrap { flex: 1 1 280px; min-width: 0; }
.mic-hint { flex: 1 0 100%; }

/* Shown only on the static, key-free copy of the page. */
.demo-banner { background: #fff4dc; color: #6b4705; border-bottom: 1px solid #f0d9a4; padding: 7px 24px; font-size: .84rem; text-align: center; }
.demo-banner a { color: #0b5147; font-weight: 650; }
