@font-face {
    font-family: "DM Sans";
    src: url("assets/dm-sans-latin.woff2") format("woff2");
    font-style: normal;
    font-weight: 400 750;
    font-display: swap;
}

:root {
    color-scheme: light;
    --ink: #242131;
    --muted: #6d6b7c;
    --violet: #7042d6;
    --violet-dark: #5d31c0;
    --lavender: #f1ecfc;
    --border: #e3e2e9;
    --canvas: #f7f8fc;
    font-family: "DM Sans", "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input { font: inherit; }
button, a, input[type="range"] { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button, a { touch-action: manipulation; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #9879e6; outline-offset: 4px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
.symbols { position: absolute; width: 0; height: 0; pointer-events: none; }
.container { width: min(1120px, calc(100% - 80px)); margin-inline: auto; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.topbar { height: 74px; background: #fff; border-bottom: 1px solid var(--border); }
.topbar-inner, .topbar nav, .brand, .help-trigger, .nav-current { display: flex; align-items: center; }
.topbar-inner { height: 100%; justify-content: space-between; }
.brand { text-decoration: none; gap: 10px; font-size: 1.45rem; font-weight: 750; letter-spacing: -.065em; }
.brand-accent { color: #6840c4; }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: #fff; background: linear-gradient(140deg, #8b60e3, #6840c9); box-shadow: inset 0 0 0 1px #623ab832; }
.brand-mark svg { width: 30px; height: 30px; }
.topbar nav { gap: 26px; font-size: .88rem; font-weight: 600; }
.nav-current { color: var(--violet-dark); text-decoration: none; padding: 8px 16px; border-radius: 8px; background: #f2edfc; }
.help-trigger { gap: 7px; padding: 8px 0; background: transparent; color: #565461; border: 0; }
.help-trigger .icon { width: 17px; height: 17px; }
.help-trigger:hover { color: var(--violet-dark); }

.intro { display: flex; align-items: center; justify-content: space-between; gap: 22px; margin: 45px 0 29px; }
h1 { font-size: clamp(2.1rem, 3.8vw, 3rem); font-weight: 700; line-height: 1.11; letter-spacing: -.058em; }
h1 span { color: var(--violet); }
.intro p { margin-top: 10px; color: var(--muted); font-size: 1rem; line-height: 1.6; }
.local-badge { display: inline-flex; align-items: center; flex-shrink: 0; gap: 8px; color: #33735d; background: #eef7f2; border: 1px solid #d7eade; border-radius: 100px; padding: 6px 12px; font-size: .78rem; font-weight: 600; }
.local-badge > span { width: 7px; height: 7px; border-radius: 50%; background: #409a73; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.62fr) minmax(0, 1fr); gap: 22px; }
.panel { background: #fff; border: 1px solid var(--border); border-radius: 17px; box-shadow: 0 3px 9px -5px #26213712; min-width: 0; }
.upload-panel, .settings-panel { padding: 23px; }
.panel-title { display: flex; align-items: center; gap: 11px; }
.panel-title h2, .dialog-header h2 { font-size: 1.17rem; line-height: 1.3; font-weight: 700; letter-spacing: -.035em; }
.title-icon { display: inline-grid; place-items: center; width: 34px; height: 34px; color: var(--violet); border-radius: 9px; background: var(--lavender); flex: none; }
.title-icon .icon { width: 19px; height: 19px; }
.dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
    padding: 18px 12px 22px;
    min-height: 246px;
    position: relative;
    isolation: isolate;
    overflow: hidden;
    border: 1.5px dashed #b9a1e7;
    border-radius: 11px;
    background: #f8f5fe;
    text-align: center;
    cursor: pointer;
}
.dropzone::before { content: ""; position: absolute; inset: 0; z-index: -1; background-image: radial-gradient(#a08ac34a .8px, transparent .9px); background-size: 11px 11px; mask-image: linear-gradient(to right, #000, #0001 35%, #0001 65%, #000); }
.dropzone:hover { background-color: #f6f2fe; border-color: #9c7bd6; }
.dropzone.is-dragging { border: 2px solid var(--violet); background-color: #eee6ff; box-shadow: inset 0 0 0 3px #d8c6fd; }
.upload-art { display: block; width: 148px; height: auto; margin: -3px 0 10px; user-select: none; pointer-events: none; }
.dropzone h3 { font-size: 1.12rem; line-height: 1.35; letter-spacing: -.028em; font-weight: 700; }
.dropzone p { color: var(--muted); font-size: .88rem; margin: 4px 0 15px; }
.choose-button, .convert-button, .text-button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; }
.choose-button { padding: 9px 15px; min-height: 39px; border-radius: 8px; border: 1px solid #d7c9ed; color: var(--violet-dark); background: #fff; box-shadow: 0 2px 3px #40255f0a; font-size: .875rem; font-weight: 650; }
.choose-button .icon { width: 16px; height: 16px; stroke-width: 2; }
.choose-button:hover { border-color: #a787da; }
.upload-notes, .extensions, .multi-note { display: flex; align-items: center; }
.upload-notes { justify-content: space-between; margin-top: 15px; gap: 10px; }
.extensions { gap: 5px; }
.extensions span { padding: 2px 7px; border-radius: 5px; color: #696575; font-size: .7rem; line-height: 1.45; font-weight: 700; letter-spacing: .035em; background: #f5f5f8; border: 1px solid #e6e5eb; }
.multi-note { gap: 6px; font-size: .77rem; color: var(--muted); }
.multi-note .icon { width: 15px; height: 15px; }
.file-feedback:not(:empty) { margin-top: 12px; font-size: .875rem; color: #963f19; }
.settings-panel { display: flex; flex-direction: column; }
.format-setting { margin-top: 23px; }
.field-label { font-size: .885rem; font-weight: 650; line-height: 1.45; }
.format-option { display: flex; align-items: center; gap: 12px; padding: 12px; margin-top: 9px; border: 1px solid #ddd6ee; background: #fbfaff; border-radius: 9px; }
.format-icon { display: grid; place-items: center; width: 35px; height: 39px; border-radius: 5px; clip-path: polygon(0 0, 68% 0, 100% 28%, 100% 100%, 0 100%); color: #8050d0; background: linear-gradient(44deg, #ece2ff, #e2d4fa); font-size: 1.11rem; font-weight: 750; position: relative; padding-top: 4px; }
.format-icon::before { content: ""; position: absolute; top: 0; right: 0; width: 31%; height: 27%; background: #ccb4ec; border-radius: 0 0 0 2px; }
.format-name { display: grid; gap: 2px; }
.format-name strong { font-size: .95rem; font-weight: 700; }
.format-name > span { color: var(--muted); font-size: .77rem; }
.format-check { width: 17px; height: 17px; background: var(--violet); color: #fff; border-radius: 100%; display: grid; place-items: center; margin-left: auto; }
.format-check .icon { width: 11px; height: 11px; stroke-width: 2.6; }
.quality-setting { margin: 24px 0 22px; }
.quality-label, .quality-hints { display: flex; justify-content: space-between; align-items: center; }
#quality-value { color: var(--violet-dark); background: var(--lavender); padding: 3px 8px; border-radius: 6px; font-weight: 700; font-size: .8rem; font-variant-numeric: tabular-nums; }
#quality { --fill: 79.8%; width: 100%; display: block; cursor: pointer; accent-color: var(--violet); appearance: none; background: transparent; margin: 9px 0 4px; height: 20px; }
#quality::-webkit-slider-runnable-track { background: linear-gradient(to right, var(--violet) var(--fill), #e8e6ed var(--fill)); height: 5px; border-radius: 10px; }
#quality::-moz-range-track { background: #e8e6ed; height: 5px; border-radius: 10px; }
#quality::-moz-range-progress { background: var(--violet); height: 5px; border-radius: 10px; }
#quality::-webkit-slider-thumb { appearance: none; margin-top: -6px; background: #fff; border: 4px solid var(--violet); width: 17px; height: 17px; border-radius: 50%; box-shadow: 0 1px 3px #452b701c; }
#quality::-moz-range-thumb { background: #fff; border: 4px solid var(--violet); width: 9px; height: 9px; border-radius: 50%; }
.quality-hints { font-size: .75rem; color: var(--muted); }
.convert-action { margin-top: auto; border-top: 1px solid #eeedf1; padding-top: 18px; }
.convert-button { width: 100%; padding: 12px; min-height: 45px; border: 1px solid #6f44d0; border-radius: 9px; color: #fff; background: var(--violet); font-size: .935rem; font-weight: 650; box-shadow: 0 2px 3px #53329118; }
.convert-button .icon { width: 17px; height: 17px; stroke-width: 1.9; }
.convert-button:enabled:hover { background: var(--violet-dark); }
.convert-button:disabled { background: #7856ca; border-color: #7856ca; }
.convert-button[aria-busy="true"], #download-all[aria-busy="true"] { cursor: progress; }

.queue-panel { margin-top: 22px; overflow: hidden; }
.queue-header { padding: 17px 23px; border-bottom: 1px solid #eeedf2; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.queue-count { display: inline-grid; min-width: 23px; height: 22px; padding-inline: 5px; place-items: center; border-radius: 7px; background: #f3f1f8; color: #75678c; font-size: .75rem; font-weight: 700; }
.queue-toolbar { display: flex; gap: 12px; }
.text-button { color: #56515f; background: #fff; border: 1px solid var(--border); border-radius: 7px; padding: 6px 10px; font-size: .79rem; font-weight: 550; min-height: 31px; }
.text-button .icon { width: 14px; height: 14px; }
.text-button:disabled { color: #77727f; background: #fcfcfd; }
.text-button:enabled:hover { background: #f6f3fb; color: var(--violet-dark); }
.download-all:enabled { color: var(--violet-dark); background: var(--lavender); border-color: #d7c9ed; font-weight: 650; }
.download-all:enabled:hover { background: #e8defb; border-color: #b99cde; }
.queue-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 9px; padding: 20px; min-height: 142px; }
.empty-icon { display: grid; place-items: center; width: 41px; height: 41px; border-radius: 12px; background: #f3f2f7; color: #8e879f; }
.empty-icon .icon { width: 22px; height: 22px; }
.queue-empty h3 { font-size: .92rem; font-weight: 650; color: #4a4557; }
.queue-empty p { font-size: .82rem; color: var(--muted); margin-top: 3px; }
.queue-list { margin: 0; padding: 0 23px; list-style: none; }
.queue-item { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto auto; gap: 13px; align-items: center; padding: 13px 0; border-top: 1px solid #eeedf2; }
.queue-item:first-child { border: none; }
.queue-thumb { width: 42px; height: 42px; object-fit: contain; border: 1px solid var(--border); background: #f6f5fa; border-radius: 7px; }
.queue-details { display: grid; gap: 3px; min-width: 0; }
.queue-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.queue-meta { font-size: .78rem; color: var(--muted); overflow-wrap: anywhere; }
.queue-status { justify-self: start; padding: 4px 9px; border-radius: 6px; font-size: .76rem; font-weight: 600; background: #f2f1f5; color: #696473; }
.queue-status[data-state="working"] { color: var(--violet-dark); background: var(--lavender); }
.queue-status[data-state="done"] { color: #22684c; background: #eaf7ef; }
.queue-status[data-state="error"] { color: #953b35; background: #ffeded; }
.queue-actions { display: flex; align-items: center; gap: 6px; }
.queue-actions svg { width: 16px; height: 16px; }
.queue-actions a, .queue-actions button { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--border); border-radius: 7px; color: #706c7a; background: #fff; }
.queue-actions .queue-download { color: var(--violet-dark); background: #f6f2fe; border-color: #e1d7f5; }
.queue-actions a:hover, .queue-actions button:enabled:hover { border-color: #ab95d2; }

.footer { margin-top: 26px; padding: 0 2px 28px; display: flex; gap: 14px; align-items: center; justify-content: space-between; color: #777383; }
.footer-brand, .footer-privacy { display: inline-flex; align-items: center; gap: 6px; }
.footer-brand { font-weight: 650; font-size: .85rem; letter-spacing: -.035em; }
.footer-brand svg { width: 21px; height: 21px; }
.footer-privacy { font-size: .76rem; }
.footer-privacy .icon { width: 15px; height: 15px; }
dialog { width: min(440px, calc(100% - 32px)); padding: 24px; border: 1px solid var(--border); border-radius: 17px; color: var(--ink); box-shadow: 0 20px 90px #20103130; }
dialog::backdrop { background: #221a344f; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; }
.close-help { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 7px; background: #f3f1f7; color: var(--muted); }
.help-steps { padding-left: 22px; margin: 20px 0; }
.help-steps li { margin-bottom: 12px; padding-left: 3px; line-height: 1.55; font-size: .93rem; color: #514d5c; }
.help-steps li::marker { color: var(--violet-dark); font-weight: 700; }
.help-steps strong { color: var(--ink); font-weight: 650; }
.help-privacy { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--border); padding-top: 15px; color: var(--muted); font-size: .83rem; }
.help-privacy .icon { width: 16px; height: 16px; }

@media (max-width: 820px) {
    .container { width: calc(100% - 40px); }
    .workspace { grid-template-columns: minmax(0, 1.27fr) minmax(0, 1fr); gap: 16px; }
    .upload-panel, .settings-panel { padding: 18px; }
    .intro { margin-top: 32px; }
}
@media (max-width: 680px) {
    .container { width: calc(100% - 32px); }
    .topbar { height: 63px; }
    .brand { font-size: 1.25rem; gap: 7px; }
    .brand-mark { width: 32px; height: 32px; border-radius: 9px; }
    .brand-mark svg { width: 27px; height: 27px; }
    .topbar nav { gap: 0; font-size: .81rem; }
    .nav-current { display: none; }
    .intro { align-items: flex-start; flex-direction: column; gap: 12px; margin: 29px 0 21px; }
    .intro p { margin-top: 7px; line-height: 1.5; font-size: .95rem; }
    .local-badge { font-size: .74rem; padding: 4px 9px; }
    .workspace { grid-template-columns: 1fr; }
    .dropzone { margin-top: 16px; }
    .quality-setting { margin: 18px 0; }
    .queue-panel { margin-top: 16px; }
    .queue-header { padding: 15px; flex-wrap: wrap; }
    .queue-header .panel-title { gap: 7px; }
    .queue-toolbar { gap: 6px; margin-left: auto; }
    .queue-list { padding: 0 14px; }
    .queue-item { grid-template-columns: 36px minmax(0, 1fr) auto; gap: 3px 8px; }
    .queue-thumb { width: 36px; height: 36px; grid-row: 1 / 3; }
    .queue-status { grid-column: 2; grid-row: 2; padding: 2px 5px; }
    .queue-actions { grid-column: 3; grid-row: 1 / 3; }
    .footer { margin-top: 20px; align-items: flex-start; flex-wrap: wrap; gap: 7px 18px; }
}
@media (max-width: 480px) {
    .queue-toolbar { width: 100%; margin-left: 0; }
}
@media (max-width: 370px) {
    .queue-header .panel-title h2 { font-size: 1rem; }
    .text-button { gap: 4px; padding-inline: 6px; }
    .queue-toolbar { flex-wrap: wrap; }
}
