* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: radial-gradient(ellipse at top, #e3edf9, transparent 62%), #eff4f9; }
.top { background: var(--nav); color: white; }
.top-inner { width: min(100% - 32px, 860px); height: 66px; margin: auto; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 11px; font-size: 17px; font-weight: 800; letter-spacing: .075em; }
.brand-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: #ffffff16; }
svg { width: 20px; height: 20px; display: block; }
main { width: min(100% - 28px, 720px); margin: auto; }
.hero { text-align: center; padding: 32px 0 21px; }
.demo { display: inline-flex; gap: 8px; align-items: center; background: #fff2d8; color: #6c490d; font-weight: 700; font-size: .875rem; border: 1px solid #eeddb7; padding: 5px 11px; border-radius: 100px; }
i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
h1 { font-size: clamp(1.75rem, 6vw, 2.55rem); line-height: 1.12; letter-spacing: -.04em; margin: 12px 0 5px; }
p { color: var(--muted); }
.hero p { margin: 0; }
.hero p span { margin: 0 5px; }
.workspace { background: white; border: 1px solid var(--line); border-radius: 23px; padding: clamp(12px, 3vw, 24px); box-shadow: 0 12px 40px #1837530d; }
.controls { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.voice-head { color: var(--muted); font-size: .875rem; font-weight: 700; margin-bottom: 6px; }
.status { display: inline-flex; align-items: center; gap: 7px; color: #22623e; background: #e7f5ed; padding: 7px 11px; border-radius: 100px; font-size: .875rem; font-weight: 750; }
.status[data-mic="interrupted"] { color: #8a3131; background: #ffebeb; }
.status[data-mic="stopped"], .status[data-mic="starting"] { color: #475973; background: #eef2f7; }
.panel { margin-top: 10px; border-radius: var(--radius); padding: 2px 12px 10px; border: 1px solid; }
.original { background: #eff9f2; border-color: #d7ebde; color: #22583b; }
.translation { background: #eff5ff; border-color: #d9e6fa; color: #204e84; }
.panel-head, .panel-head label, .panel-actions { display: flex; align-items: center; }
.panel-head { justify-content: space-between; gap: 4px; }
.panel-head label { gap: 7px; font-weight: 750; min-width: 0; flex-wrap: wrap; }
.panel-actions { flex: none; }
#text-language { width: auto; max-width: 8rem; font-size: .8rem; }
.panel-head small { color: inherit; font-weight: 500; font-size: .8rem; }
textarea { display: block; width: 100%; min-height: 76px; resize: vertical; padding: 4px 0; border: 0; border-radius: 4px; background: transparent; font: inherit; font-size: clamp(1.08rem, 4.5vw, 1.25rem); line-height: 1.45; color: var(--ink); }
textarea::placeholder { color: #526980; }
button, select, input { font: inherit; }
button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: var(--touch); min-width: var(--touch); border-radius: 10px; border: 1px solid var(--line); background: white; color: var(--ink); padding: 0 12px; cursor: pointer; font-weight: 700; }
button:hover:not(:disabled) { filter: brightness(.94); }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 3px solid #4285da; outline-offset: 2px; }
.primary { color: white; background: var(--blue); border-color: var(--blue); }
.icon-button, .subtle { background: transparent; border-color: transparent; color: inherit; }
.icon-button { padding: 0; }
.icon-button.light { background: #ffffff16; color: white; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.actions button { font-size: .875rem; }
.actions svg { width: 17px; height: 17px; }
.voice { border-top: 1px solid var(--line); margin-top: 15px; padding-top: 6px; }
.voice-head { display: flex; justify-content: space-between; flex-wrap: wrap; align-items: center; gap: 0 10px; }
.toggle { display: inline-flex; align-items: center; gap: 7px; position: relative; min-height: var(--touch); cursor: pointer; }
.toggle input { position: absolute; opacity: 0; }
.toggle span { width: 34px; height: 20px; background: #708199; border-radius: 100px; padding: 3px; }
.toggle span::after { content: ""; display: block; width: 14px; height: 14px; border-radius: 50%; background: white; }
.toggle input:checked + span { background: var(--green); }
.toggle input:checked + span::after { transform: translateX(14px); }
.toggle input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.microphones { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mic { min-height: 112px; flex-direction: column; gap: 7px; border: 0; border-radius: var(--radius); color: white; white-space: nowrap; font-size: clamp(1rem, 4.8vw, 1.18rem); }
.bg { background: linear-gradient(150deg, #208957, #11643d); }
.de { background: linear-gradient(150deg, #286ec6, #154d9b); }
.mic.active { background: var(--red); }
.mic-symbol { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: #ffffff23; }
.mic-symbol svg { width: 25px; height: 25px; }
footer { display: flex; justify-content: center; align-items: center; gap: 6px; padding: 17px 0 23px; color: var(--muted); font-size: .875rem; text-align: center; }
footer svg { width: 16px; height: 16px; }
.warning { color: #87333a; overflow-wrap: anywhere; }
.warning:empty { display: none; }
h2 { margin: 0; font-size: 1.2rem; }
.login { max-width: 440px; margin: auto; }
form label { display: grid; gap: 5px; margin: 9px 0; font-weight: 650; }
form input, select { width: 100%; min-height: var(--touch); border: 1px solid #aab9c9; border-radius: 9px; padding: 5px 8px; background: white; color: var(--ink); }
.login button, dialog form button { margin-top: 6px; }
dialog { width: min(100% - 24px, 480px); max-height: 90dvh; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; color: var(--ink); }
dialog::backdrop { background: #132e5099; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; }
summary { cursor: pointer; min-height: var(--touch); padding-top: 10px; }

#speak { padding: 0 7px; }
.listen-label { font-size: .875rem; }
@media (max-width: 400px) {
  .listen-label { display: none; }
}

@media (max-width: 720px) {
  body.conversation {
    height: 100vh;
    height: 100dvh;
    height: var(--visible-height, 100dvh);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .conversation .top {
    flex: none;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
  }
  .conversation .top-inner { height: 48px; }
  .conversation .brand-icon { width: 29px; height: 29px; }
  .conversation main {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    width: 100%;
    padding: 0 max(8px, env(safe-area-inset-right)) max(5px, env(safe-area-inset-bottom))
      max(8px, env(safe-area-inset-left));
  }
  .conversation .hero { padding: 4px 0; }
  .conversation .hero h1, .conversation .hero p, .conversation footer { display: none; }
  .conversation .demo { font-size: .8rem; padding: 1px 9px; }
  #workspace {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 4px;
    min-height: 0;
    padding: 7px;
    border-radius: 16px;
  }
  #workspace:focus { outline: none; }
  .controls { margin: 0; gap: 4px; align-items: center; }
  .status { line-height: 1.2; padding: 4px 7px; }
  .text-panels {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-rows: repeat(2, minmax(75px, 1fr));
    gap: 4px;
    overflow-y: auto;
  }
  .panel { display: flex; flex-direction: column; margin: 0; padding: 0 8px 3px; }
  .panel-head { flex: none; }
  .panel-head label { font-size: .9rem; gap: 4px; }
  .panel-head label svg { width: 16px; height: 16px; }
  textarea { flex: 1; min-height: 0; resize: none; overflow-y: auto; padding: 0; }
  .actions { margin: 0; gap: 4px; }
  .actions button { padding: 0 6px; }
  .voice { flex: none; margin: 0; padding: 0; }
  .voice-head { margin: 0; }
  .voice-head > span { display: none; }
  .toggle { margin-left: auto; }
  .microphones { gap: 7px; }
  .mic { min-height: var(--compact-mic-height); gap: 2px; }
  .mic-symbol { width: 35px; height: 35px; }
  #notice { flex: none; margin: 0; font-size: .875rem; max-height: 3.6em; overflow-y: auto; }
  .keyboard-open #notice { max-height: 1.45em; }
  .keyboard-open .hero { display: none; }
  .keyboard-open #workspace { gap: 2px; padding-block: 4px; }
  .keyboard-open .mic { min-height: var(--keyboard-mic-height); flex-direction: row; gap: 5px; }
  .keyboard-open .mic-symbol { width: 27px; height: 27px; }
  .keyboard-open .mic-symbol svg { width: 18px; height: 18px; }
  .keyboard-open .text-panels:focus-within { grid-template-rows: minmax(65px, 1fr) 0; gap: 0; }
  .keyboard-open .text-panels:focus-within .panel:not(:focus-within) { visibility: hidden; grid-row: 2; }
  .keyboard-open .text-panels:focus-within .panel:focus-within { grid-row: 1; }
}

@media (max-width: 360px) {
  .actions svg, .panel-head label > span { display: none; }
}
