:root {
  color-scheme: dark;
  --bg: #121512;
  --panel: #1a1e19;
  --border: #33382e;
  --muted: #a0a79a;
  --text: #edf0e7;
  --accent: #d2f579;
  --mono: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  --display: 'Space Grotesk', Arial, sans-serif;
  --body: 'DM Sans', Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
}
button, a, input { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
[hidden] { display: none !important; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* Brand and page layout */
.header { width: 100%; max-width: 1192px; min-height: 91px; margin: 0 auto; padding: 20px 36px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid #2c3229; }
.brand { display: inline-flex; align-items: center; gap: 11px; font: 600 27px/1 var(--display); letter-spacing: -1.2px; white-space: nowrap; }
.brand-symbol { display: block; flex-shrink: 0; }
.brand-accent { color: var(--accent); }
.header-actions { display: flex; align-items: center; gap: 20px; flex-shrink: 0; }
.language-picker { display: inline-flex; align-items: center; gap: 7px; padding: 8px 9px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); color: var(--muted); }
.language-picker svg { width: 16px; height: 16px; }
.language-picker select { max-width: 110px; border: 0; padding: 0 3px; background: transparent; color: var(--text); font: 12px var(--body); cursor: pointer; }
.language-picker option { background: var(--panel); color: var(--text); }
.language-picker:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
.language-picker select:focus { outline: none; }
.back-link { font-size: 12px; color: var(--muted); }
.back-link:hover, .footer-link:hover { color: var(--accent); }
main { width: 100%; max-width: 1192px; margin: 0 auto; padding: 34px 36px 0; flex: 1; }
.intro { margin-bottom: 28px; }
.intro h1 { margin: 0 0 14px; font: 500 clamp(26px, 3.5vw, 38px)/1.2 var(--display); letter-spacing: -1.1px; text-wrap: balance; }
.intro h1 span { color: var(--accent); }
.intro p { max-width: 850px; margin: 0; color: var(--muted); font-size: 16px; line-height: 1.75; }
.converter { border: 1px solid var(--border); background: var(--panel); border-radius: 12px; overflow: hidden; box-shadow: 0 18px 70px #00000012; }
.workspace-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.input-side, .output-side { min-width: 0; padding: 25px 27px 26px; }
.input-side { border-right: 1px solid var(--border); }
.step-title { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.step-title h2 { font-size: 14px; font-weight: 550; margin: 0; }
.step-number { font: 10px var(--mono); color: #a4af95; border: 1px solid #424b38; padding: 3px 5px; border-radius: 4px; }

/* File selection */
.drop-zone { min-height: 276px; display: flex; justify-content: center; align-items: center; text-align: center; padding: 28px 20px; border: 1px dashed #66734c; border-radius: 7px; background: radial-gradient(ellipse at 50% 0%, #35422523, transparent 75%), #171c15; transition: background .15s, border-color .15s; }
.drop-zone.dragging { background: #2c3820; border: 1px solid var(--accent); }
.drop-zone[aria-disabled=true] { opacity: .7; }
.upload-icon { margin: 0 auto 16px; width: 48px; height: 48px; border: 1px solid #53623b; border-radius: 11px; display: grid; place-items: center; background: #293120; box-shadow: 0 0 0 5px #262e1f55; }
.upload-icon svg { width: 23px; height: 23px; color: var(--accent); }
.drop-zone h3 { font-size: 16px; font-weight: 500; margin: 0 0 5px; }
.drop-zone p { margin: 0; color: #9ba58e; font-size: 12px; }
.choose-button { margin: 21px 0 17px; padding: 10px 19px; display: inline-flex; align-items: center; gap: 8px; background: #303928; color: #edf3e4; border: 1px solid #566543; border-radius: 5px; font-size: 12px; font-weight: 500; }
.choose-button svg { width: 14px; height: 14px; }
.choose-button:hover { background: #3b482f; border-color: #849d5d; }
.choose-button:disabled { opacity: .5; }
.drop-zone .file-hint { font: 9px var(--mono); color: #859177; }
.file-hint > span:not([data-i18n]) { margin: 0 8px; }
.selected-icon { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; color: var(--accent); margin-bottom: 16px; }
.selected-icon svg { width: 37px; height: 37px; stroke-width: 1; }
.selected-icon span { font: 8px var(--mono); letter-spacing: 1px; }
#selected-file { min-width: 0; width: 100%; }
#file-name { overflow-wrap: anywhere; font-size: 15px; }
.selected-meta { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 8px; font: 10px var(--mono); color: #99a789; }
.valid-file { display: flex; justify-content: center; align-items: center; gap: 6px; font-size: 11px; color: #bcdb86; margin: 18px 0 13px; }
.valid-file svg { width: 13px; height: 13px; }
.replace-button { min-height: 32px; border: 0; background: transparent; color: #97a58a; font-size: 10px; display: inline-flex; align-items: center; gap: 5px; padding: 5px; }
.replace-button svg { width: 11px; height: 11px; }
.replace-button:hover { color: #e7efd9; }
.privacy-line { display: flex; justify-content: center; align-items: center; gap: 6px; color: #929e84; font-size: 11px; margin: 16px 0 23px; }
.privacy-line svg { width: 12px; height: 12px; }

/* Conversion and feedback */
.convert-button { border: 1px solid var(--accent); background: var(--accent); width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 15px 18px; border-radius: 5px; color: #17200e; font-size: 14px; font-weight: 650; transition: background .2s, opacity .2s; }
.convert-button:hover:not(:disabled) { background: #defc99; }
.convert-button:disabled { background: #9baf69; border-color: #9baf69; color: #263218; opacity: .55; }
.convert-button svg { width: 19px; height: 19px; }
.error { display: flex; align-items: flex-start; gap: 9px; padding: 13px; border: 1px solid #806543; background: #382e20; color: #f0d1a3; border-radius: 5px; margin: 15px 0; font-size: 12px; }
.error p { margin: 0; overflow-wrap: anywhere; }
.error svg { width: 16px; height: 16px; margin-top: 1px; }
.progress-panel { margin-top: 22px; padding-top: 17px; border-top: 1px solid var(--border); }
.progress-top { display: flex; justify-content: space-between; font-size: 11px; gap: 10px; }
.progress-top strong { font-weight: 500; }
.progress-top > span { font-family: var(--mono); color: var(--accent); }
progress { width: 100%; height: 5px; margin: 13px 0 9px; border: 0; border-radius: 3px; overflow: hidden; background: #313b26; appearance: none; }
progress::-webkit-progress-bar { background: #313b26; }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }
#progress-detail { font: 9px/1.7 var(--mono); color: #9ba98b; margin: 0; }
.cancel-button { min-height: 32px; margin: 13px 0 0; background: transparent; border: 1px solid #505b43; border-radius: 4px; font-size: 10px; color: #c3cfb5; padding: 5px 10px; }
.result-panel { margin-top: 20px; border: 1px solid #637d3d; background: #26341c; padding: 15px; border-radius: 7px; }
.success-line { display: flex; align-items: center; gap: 10px; }
.success-icon { display: grid; place-items: center; background: var(--accent); color: #1a2810; width: 27px; height: 27px; border-radius: 50%; flex-shrink: 0; }
.success-icon svg { width: 17px; height: 17px; }
.success-line > div { min-width: 0; }
.success-line h3 { font-size: 13px; margin: 0; }
.success-line p { font-size: 9px; color: #b3c49f; margin: 3px 0 0; overflow-wrap: anywhere; }
#result-size { margin-left: auto; color: #b3c49f; font: 9px var(--mono); white-space: nowrap; }
.download-button { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 15px; background: var(--accent); color: #17240d; padding: 10px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.download-button svg { width: 16px; height: 16px; }

/* Preview and options */
.preview-shell { border: 1px solid #3d4536; background: #151913; border-radius: 7px; overflow: hidden; }
.preview-top { display: flex; align-items: center; gap: 7px; padding: 10px 12px; color: #abb49d; font: 10px var(--mono); }
#preview-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-dot { width: 5px; height: 5px; background: #829e5b; border-radius: 50%; flex-shrink: 0; }
.screen { aspect-ratio: 16/9; position: relative; background: #33402d; }
.screen canvas, .screen video { width: 100%; height: 100%; display: block; object-fit: contain; }
.screen:fullscreen { background: #111619; width: 100vw; height: 100vh; aspect-ratio: auto; }
.preview-bottom { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; gap: 10px; font-size: 10px; color: #929e83; }
.preview-corners { border: 0; background: none; color: inherit; cursor: pointer; min-width: 28px; min-height: 26px; padding: 2px 5px; font-size: 17px; line-height: 1; }
.preview-corners:hover { color: var(--accent); }
.quality-picker { margin: 22px 0 18px; padding: 0; border: 0; min-width: 0; }
.quality-picker legend { font-size: 11px; font-weight: 500; color: #c4cfb8; margin-bottom: 11px; padding: 0; }
.quality-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.quality-options label { position: relative; cursor: pointer; min-width: 0; }
.quality-options input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.quality-choice { display: flex; flex-direction: column; border: 1px solid #414c35; border-radius: 6px; padding: 12px 13px; background: #171c14; color: #adba9b; transition: border-color .15s, background .15s; }
.quality-choice strong { font-size: 13px; font-weight: 550; color: #e4ebda; }
.quality-choice > span { font: 21px var(--display); margin: 6px 0 2px; color: #e4ebda; letter-spacing: -.8px; }
.quality-options input:checked + .quality-choice { border-color: var(--accent); background: #2b371d; }
.quality-options input:checked + .quality-choice strong, .quality-options input:checked + .quality-choice > span { color: var(--accent); }
.quality-options input:focus-visible + .quality-choice { outline: 2px solid var(--accent); outline-offset: 3px; }
.quality-options label:hover .quality-choice { border-color: #a1ba78; }
.quality-picker:disabled { opacity: .55; }
.quality-picker:disabled label { cursor: not-allowed; }
.export-options { display: grid; gap: 12px; }
.export-option { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 13px; cursor: pointer; color: var(--text); }
.export-option input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }
.export-option input:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.export-option:has(input:disabled) { opacity: .6; cursor: default; }

/* Footer and credits */
footer { width: 100%; max-width: 1192px; margin: 0 auto; padding: 28px 36px 30px; display: flex; align-items: center; justify-content: flex-end; }
.footer-link { color: #9ba78f; font-size: 12px; }
.footer-link span[aria-hidden] { margin-left: 5px; }
.noscript { position: fixed; bottom: 0; left: 0; right: 0; background: #5d2e20; color: white; text-align: center; padding: 20px; }
.credits-page { max-width: 832px; padding-top: 42px; }
.credits-page h1 { font: 500 clamp(30px, 5vw, 42px)/1.15 var(--display); letter-spacing: -1.5px; margin: 0 0 25px; }
.credits-page p, .credits-page li { font-size: 14px; line-height: 1.8; color: #b4bea8; }
.credits-page p { margin: 0 0 17px; }
.credits-page a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.credits-page h2 { font: 500 22px var(--display); margin: 32px 0 14px; }
.credits-page ul { padding-left: 20px; margin: 0 0 28px; }
.credits-page li { padding-left: 4px; margin: 0 0 13px; }
.credits-page .independent-note { font-size: 12px; color: var(--muted); }

@media (max-width: 900px) {
  .header { padding-left: 24px; padding-right: 24px; }
  main { padding: 28px 24px 0; }
  .input-side, .output-side { padding: 21px; }
  .intro p { font-size: 15px; }
  footer { padding-left: 24px; padding-right: 24px; }
}
@media (max-width: 690px) {
  .header { min-height: 76px; padding: 17px 20px; gap: 15px; }
  .brand { font-size: 25px; gap: 9px; }
  .header .brand-symbol { width: 32px; height: 32px; }
  main { padding: 25px 17px 0; }
  .intro { margin-bottom: 23px; }
  .intro p { font-size: 14px; line-height: 1.7; }
  .workspace-grid { grid-template-columns: minmax(0, 1fr); }
  .input-side { border-right: 0; border-bottom: 1px solid var(--border); }
  .input-side, .output-side { padding: 21px 20px; }
  .drop-zone { min-height: 255px; }
  .output-side .step-title { margin-bottom: 18px; }
  footer { padding: 24px 20px; }
  .footer-link { font-size: 11px; }
  .credits-page { padding-top: 30px; }
}
@media (max-width: 370px) {
  .header { padding-left: 14px; padding-right: 14px; gap: 10px; }
  .header .brand { font-size: 23px; gap: 7px; }
  .header .brand-symbol { width: 28px; height: 28px; }
  .quality-choice { padding: 10px; }
  .privacy-line { font-size: 10px; }
}
@media (max-width: 570px) {
  .header-actions { flex-direction: column-reverse; align-items: flex-end; gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
