:root {
  font-family: 'DM Sans', 'Segoe UI', sans-serif;
  color: #182f28;
  background: #f6f5ec;
  font-size: 16px;
  line-height: 1.5;
  --ink: #182f28;
  --muted: #4e6257;
  --line: #d4ddd4;
  --green: #204d3f;
  --paper: #fffef9;
  --error: #9a2a24;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button, select, summary { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
a { color: var(--green); text-underline-offset: .2em; }
:focus-visible { outline: 3px solid #976526; outline-offset: 3px; }
h1, h2, p { margin: 0; }
.wrap { width: min(1120px, calc(100% - 48px)); margin-inline: auto; }
.top { background: var(--paper); border-block-end: 1px solid #e1e6db; }
.top-inner { min-height: 75px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { color: var(--ink); display: inline-flex; align-items: center; gap: 11px; font-size: 1.23rem; font-weight: 750; text-decoration: none; }
.brand-light { font-weight: 550; }
.mark { display: block; width: 37px; height: 37px; flex: none; }
.locale { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .875rem; }
.locale select { width: auto; min-width: 110px; }

.hero { margin-block: 30px 22px; padding: clamp(27px, 4.5vw, 56px); border-radius: 23px; position: relative; isolation: isolate; overflow: hidden; background: #1e4236; color: #fff8e6; min-height: 230px; display: flex; align-items: center; }
.hero::after { content: ''; position: absolute; z-index: -1; inset: 0; background: radial-gradient(ellipse at 90% 20%, #3c6851 0, transparent 66%); }
.hero h1 { font-family: 'Instrument Serif', Georgia, serif; font-weight: 400; font-size: clamp(2.6rem, 6vw, 5.5rem); line-height: 1.04; letter-spacing: -.045em; margin-block-end: 12px; }
.hero p { max-width: 57ch; font-size: 1.04rem; color: #e4eddf; }
.wave { position: absolute; inset-inline-end: 5%; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: clamp(4px, .65vw, 8px); height: 148px; z-index: -1; opacity: .64; direction: ltr; }
.wave i { display: block; width: 4px; height: 12%; background: #e6cd83; border-radius: 20px; }
.wave i:nth-child(2n) { background: #b5ceab; }
.wave i:nth-child(2), .wave i:nth-child(13) { height: 22%; }
.wave i:nth-child(3), .wave i:nth-child(11) { height: 35%; }
.wave i:nth-child(4), .wave i:nth-child(10) { height: 56%; }
.wave i:nth-child(5), .wave i:nth-child(9) { height: 82%; }
.wave i:nth-child(6) { height: 64%; }
.wave i:nth-child(7) { height: 100%; }
.wave i:nth-child(8) { height: 49%; }
.wave i:nth-child(12) { height: 40%; }
.wave i:nth-child(14) { height: 28%; }

.workspace { display: grid; grid-template-columns: 1.42fr 1fr; align-items: start; gap: 20px; }
.card { min-width: 0; padding: clamp(20px, 3vw, 29px); border: 1px solid var(--line); border-radius: 18px; background: var(--paper); box-shadow: 0 3px 6px #22322307; }
.card-header { margin-block-end: 19px; }
.card-header h2 { font-size: 1.35rem; line-height: 1.2; letter-spacing: -.018em; }
.card-header p { margin-block-start: 7px; color: var(--muted); font-size: .95rem; }
.fields { display: grid; gap: 12px; min-width: 0; }
.source-fields { grid-template-columns: 1fr 1fr; }
.fields label, details label { display: grid; align-content: start; gap: 5px; min-width: 0; font-weight: 650; font-size: .92rem; }
select, input, textarea { width: 100%; min-width: 0; min-height: 44px; border-radius: 8px; border: 1px solid #adbdb1; background: #fff; padding: 8px 10px; font-weight: 450; }
textarea { resize: vertical; line-height: 1.45; }
.fields .check-label { display: flex; align-items: center; gap: 9px; min-height: 44px; cursor: pointer; }
.check-label input { width: 18px; min-height: 18px; margin: 0; accent-color: var(--green); }
.audio-setting small, .setting-hint { display: block; color: var(--muted); font-size: .83rem; }
.setting-hint { margin-block-start: 5px; }
.retranslate { margin-block-start: 10px; }
.detected-languages { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 14px 0 0; color: var(--muted); font-size: .9rem; }
.detected-languages dd { margin: 0; color: var(--ink); font-weight: 650; }
#key, #model { direction: ltr; text-align: start; }
.key-meta { margin-block-start: -6px; display: flex; gap: 4px 10px; flex-wrap: wrap; justify-content: space-between; color: var(--muted); font-size: .83rem; }
.key-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.key-actions button { font-size: .85rem; }
details { font-size: .9rem; }
details label { margin-block-start: 6px; }
.model-reset { margin-block-start: 8px; }
summary { width: fit-content; min-height: 44px; align-content: center; color: var(--green); font-weight: 650; }
.privacy, .result-note { color: var(--muted); font-size: .87rem; margin-block-start: 12px; }
.primary, .secondary, .remove, .time { min-height: 44px; border-radius: 8px; padding: 8px 14px; font-weight: 680; border: 1px solid transparent; }
.primary { background: var(--green); color: #fff; }
.primary:hover:enabled { background: #153a2e; }
.secondary, .time { background: #fff; color: var(--green); border-color: #a5b8a9; }
.secondary:hover:enabled, .time:hover:enabled { background: #e9f0e7; }
.account-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-block-start: 8px; }

.inbox-message { color: var(--muted); font-size: .9rem; }
.inbox-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-block-end: 12px; }
.inbox-message.error { color: var(--error); }
.inbox-list { list-style: none; margin: 0; padding: 0; max-height: 430px; overflow-y: auto; }
.inbox-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px; border-block-end: 1px solid #e4e9e0; }
.inbox-list label { display: flex; gap: 10px; align-items: center; min-height: 44px; min-width: 0; cursor: pointer; }
.inbox-list input { flex: none; width: 18px; min-height: 18px; margin: 0; accent-color: var(--green); }
.inbox-list bdi { display: block; overflow-wrap: anywhere; font-weight: 650; }
.inbox-list small { display: block; color: var(--muted); font-size: .82rem; }
.inbox-list .inbox-sender { color: var(--ink); }
.inbox-sender bdi { display: inline; }
.inbox-list .secondary { padding-inline: 9px; font-size: .85rem; }
.inbox-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.inbox-actions a { display: inline-flex; align-items: center; text-decoration: none; }
.inbox-run { width: 100%; margin-block-start: 12px; }
.manual-upload { margin-block-start: 12px; }
.sender-help { margin-block-start: 8px; }
.sender-help p { color: var(--muted); }

.dropzone { display: grid; justify-items: center; gap: 6px; border: 1px dashed #7e9987; border-radius: 13px; background: #eef3e9; margin-block-start: 15px; padding: 22px 12px; text-align: center; }
.dropzone.dragging { background: #dce8d8; border-color: #315d46; }
.upload-icon { display: grid; place-items: center; width: 39px; height: 39px; margin-block-end: 3px; border-radius: 11px; background: #dbe9d9; color: #25553e; font-size: 1.5rem; font-weight: 600; line-height: 1; }
.drop-hint { font-size: .9rem; color: var(--muted); }
.dropzone small { color: var(--muted); }
.queue { list-style: none; padding: 0; margin: 12px 0 0; }
.queue:empty { display: none; }
.queue li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-block: 9px; border-block-end: 1px solid #e4e9e0; }
.queue li:last-child { border-block-end: 0; padding-block-end: 0; }
.queue small, .file-status { display: block; color: var(--muted); font-size: .84rem; }
.queue .file-name { display: block; overflow-wrap: anywhere; font-weight: 650; }
.error, .file-status.error { color: var(--error); font-size: .9rem; }
#upload-error { margin-block-start: 8px; }
.remove { flex: none; width: 44px; background: transparent; color: var(--muted); font-size: 1.35rem; }
.remove:hover:enabled { color: var(--error); background: #faeeeb; }

.results { margin-block: 20px 34px; }
.results .card-header:has(#empty:not([hidden])) { margin-block-end: 0; }
.result-controls { grid-template-columns: minmax(0, 1fr) minmax(0, 180px) auto; align-items: end; }
.downloads { display: flex; gap: 6px; flex-wrap: wrap; }
.media-preview:not(:empty) { margin-block-start: 12px; }
.media-preview video { display: block; width: 100%; max-height: 340px; border-radius: 12px; background: #14251e; }
.media-preview audio { display: block; width: 100%; }
.cues { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.cues li { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 8px; }
.time { font-variant-numeric: tabular-nums; font-size: .85rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 900px) {
  .wave { opacity: .23; }
}
@media (max-width: 710px) {
  .wrap { width: calc(100% - 30px); }
  .workspace { grid-template-columns: 1fr; gap: 14px; }
  .hero { margin-block: 17px 14px; min-height: 180px; }
  .result-controls { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .downloads { grid-column: 1 / -1; }
}
@media (max-width: 450px) {
  .locale span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .locale select { min-width: 0; max-width: 115px; }
  .brand { font-size: 1rem; gap: 7px; }
  .mark { width: 32px; height: 32px; }
  .source-fields { grid-template-columns: 1fr; }
  .cues li { grid-template-columns: 1fr; }
  .time { justify-self: start; }
}

.missing-language {
  margin: 0.5rem 0 0;
  padding: 0.5rem 0.75rem;
  border-inline-start: 3px solid #b7791f;
  background: #fffaf0;
  color: #7b5307;
  font-size: 0.95rem;
}
