:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172c23;
  background: #f5f8f5;
  --brand: #0a5238;
  --muted: #4e665a;
  --line: #d8e4dc;
  --surface: #fff;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 0; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.4rem;
  padding: max(.65rem, env(safe-area-inset-top)) max(4vw, 1rem, env(safe-area-inset-right))
    .65rem max(4vw, 1rem, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  min-height: 44px;
  color: var(--brand);
  font-size: 1.2rem;
  font-weight: 750;
  letter-spacing: -.025em;
  text-decoration: none;
}
.brand img { flex: none; object-fit: contain; }
main {
  max-width: 1240px;
  margin-inline: auto;
  padding: clamp(1rem, 4vw, 3rem) max(3vw, 1rem, env(safe-area-inset-right))
    max(2rem, env(safe-area-inset-bottom)) max(3vw, 1rem, env(safe-area-inset-left));
}
.workspace { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 1rem; align-items: start; }
.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: clamp(1rem, 2.4vw, 1.6rem);
  box-shadow: 0 2px 9px #17382908;
}
.auth { max-width: 27rem; margin: clamp(0rem, 6vh, 4rem) auto 0; }
h1, h2 { margin: 0 0 1.15rem; font-size: 1.35rem; line-height: 1.2; letter-spacing: -.025em; }
.auth h1 { font-size: 1.75rem; }
p, small { color: var(--muted); line-height: 1.5; }
form, label { display: grid; gap: .4rem; min-width: 0; }
form { gap: 1rem; }
label { font-size: .9rem; font-weight: 640; }
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea, fieldset {
  width: 100%;
  min-width: 0;
  border: 1px solid #becfc3;
  border-radius: .6rem;
  background: var(--surface);
  padding: .65rem .7rem;
}
input, select, textarea { font-size: 1rem; }
input, select, button { min-height: 44px; }
textarea { resize: vertical; line-height: 1.5; }
button {
  width: fit-content;
  max-width: 100%;
  padding: .55rem .9rem;
  border: 1px solid #becfc3;
  border-radius: .6rem;
  background: var(--surface);
  font-weight: 650;
  cursor: pointer;
  touch-action: manipulation;
}
button:hover:not(:disabled) { border-color: var(--brand); }
.primary { width: 100%; background: var(--brand); border-color: var(--brand); color: #fff; }
.primary:hover:not(:disabled) { background: #083c2a; }
.text-button { padding-inline: 0; border-color: transparent; color: var(--brand); }
.text-button:hover:not(:disabled) { border-color: transparent; text-decoration: underline; }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 3px solid #288a62; outline-offset: 2px; }
.check { display: flex; align-items: center; min-height: 44px; }
.check input { width: 1.15rem; height: 1.15rem; min-height: 0; accent-color: var(--brand); flex: none; }
fieldset { margin: 0; }
fieldset > label + label, fieldset > label + div { margin-top: .65rem; }
fieldset p, details p, .language-note { font-size: .85rem; margin: .4rem 0 0; }
legend { padding-inline: .3rem; font-weight: 640; }
details { border: 1px solid var(--line); border-radius: .6rem; padding: 0 .7rem; }
details[open] { padding-bottom: .7rem; }
summary { display: list-item; min-height: 44px; padding-block: .65rem; cursor: pointer; font-weight: 650; }
.speech-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; margin-top: .5rem; }
details > label { margin-top: .65rem; }
#musicSettings, #cloneControls, #languageSettings { display: grid; gap: .6rem; }
#passwordHelp { margin-top: -.65rem; }
.notice { color: #8c3327; margin: .65rem 0 0; }
.notice:empty { display: none; }
.resultsHead { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .85rem; }
.resultsHead h2 { margin: 0; }
#empty { margin: 0; }
#results { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15.75rem), 1fr)); gap: .75rem; }
article {
  display: grid;
  align-content: start;
  gap: .5rem;
  padding: .85rem;
  border: 1px solid var(--line);
  border-radius: .7rem;
  background: #f5f9f6;
  overflow-wrap: anywhere;
}
article h3, article p { margin: 0; }
article p { font-size: .875rem; }
.result-language {
  width: fit-content;
  padding: .2rem .55rem;
  border-radius: 1rem;
  background: #e1efe6;
  color: var(--brand);
  font-weight: 650;
}
audio, video { width: 100%; min-width: 0; }
a { color: var(--brand); }
article a { display: flex; align-items: center; min-height: 44px; width: fit-content; }

@media (max-width: 760px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 370px) {
  .speech-grid { grid-template-columns: minmax(0, 1fr); }
}
