/* MK Downloader on the web. Same tokens, fonts, mark and wording as the desktop window (src/style.css, DESIGN.md). */
:root{
  --bg:#f3f4f5;--surface:#fff;--soft:#f6f7f8;--ink:#1c1f24;--muted:#5c636e;--line:#dfe2e6;--edge:#8c939d;--tint:#eaf1ff;
  --blue:#205bd8;--blue-hover:#154bbd;--command:#205bd8;--command-hover:#154bbd;--on-command:#fff;
  --danger:#a42d39;--danger-tint:#fbeef0;--success:#226443;--amber:#8a5a00;--amber-tint:#fdf3df;
  --selection:#c9d9ff;--selection-ink:#14264b;--radius:12px;--control:8px;
  color-scheme:light;
}
@media(prefers-color-scheme:dark){:root:not([data-theme=light]){
  --bg:#111214;--surface:#191b1e;--soft:#141517;--ink:#eceef1;--muted:#a4a9b3;--line:#2c2f35;--edge:#6b717b;--tint:#1c2a47;
  --blue:#8db5ff;--blue-hover:#b0cbff;--command:#346de4;--command-hover:#2f62d2;--on-command:#fff;
  --danger:#ffa9ad;--danger-tint:#2e1c1f;--success:#8dd7ae;--amber:#f0c36a;--amber-tint:#2b2416;
  --selection:#35598b;--selection-ink:#fff;color-scheme:dark;
}}
:root[data-theme=dark]{
  --bg:#111214;--surface:#191b1e;--soft:#141517;--ink:#eceef1;--muted:#a4a9b3;--line:#2c2f35;--edge:#6b717b;--tint:#1c2a47;
  --blue:#8db5ff;--blue-hover:#b0cbff;--command:#346de4;--command-hover:#2f62d2;--on-command:#fff;
  --danger:#ffa9ad;--danger-tint:#2e1c1f;--success:#8dd7ae;--amber:#f0c36a;--amber-tint:#2b2416;
  --selection:#35598b;--selection-ink:#fff;color-scheme:dark;
}

@font-face{font-family:'Manrope';font-style:normal;font-display:swap;font-weight:700;src:url(/fonts/manrope-latin-700.woff2) format('woff2')}
@font-face{font-family:'Source Sans 3';font-style:normal;font-display:swap;font-weight:400;src:url(/fonts/source-sans-3-latin-400.woff2) format('woff2')}
@font-face{font-family:'Source Sans 3';font-style:normal;font-display:swap;font-weight:600;src:url(/fonts/source-sans-3-latin-600.woff2) format('woff2')}
@font-face{font-family:'Source Sans 3';font-style:normal;font-display:swap;font-weight:700;src:url(/fonts/source-sans-3-latin-700.woff2) format('woff2')}
@font-face{font-family:'IBM Plex Sans Arabic';font-style:normal;font-display:swap;font-weight:400;src:url(/fonts/plex-arabic-400.woff2) format('woff2')}
@font-face{font-family:'IBM Plex Sans Arabic';font-style:normal;font-display:swap;font-weight:500;src:url(/fonts/plex-arabic-500.woff2) format('woff2')}
@font-face{font-family:'IBM Plex Sans Arabic';font-style:normal;font-display:swap;font-weight:600;src:url(/fonts/plex-arabic-600.woff2) format('woff2')}

*{box-sizing:border-box}
[hidden]{display:none!important}
html{-webkit-text-size-adjust:100%}
body{margin:0;min-height:100vh;min-height:100dvh;background:var(--bg);color:var(--ink);font:16px/1.5 'Source Sans 3','IBM Plex Sans Arabic',system-ui,sans-serif;font-synthesis:none;-webkit-font-smoothing:antialiased}
button,input{font:inherit;color:inherit}
h1,h2,p{margin:0}
h1,h2,.wordmark{font-family:'Manrope','IBM Plex Sans Arabic',sans-serif}
:is(h1,h2,.wordmark):not(:lang(ar)){letter-spacing:-.015em}
svg{flex-shrink:0;stroke-width:1.9;fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round}
::selection{background:var(--selection);color:var(--selection-ink)}
:focus-visible{outline:3px solid var(--blue);outline-offset:2px}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}

button{cursor:pointer;border:0;background:none;display:inline-flex;align-items:center;justify-content:center;gap:8px;font-weight:600;white-space:nowrap;transition:background-color .16s,color .16s,border-color .16s,transform .1s;-webkit-tap-highlight-color:transparent;touch-action:manipulation}
button:disabled{opacity:.5;cursor:not-allowed}
button:active:not(:disabled){transform:scale(.98)}
.btn{min-height:48px;padding-inline:20px;border-radius:10px;font-size:16px}
.btn.primary{background:var(--command);color:var(--on-command)}
.btn.primary:hover:not(:disabled){background:var(--command-hover)}
.btn.outline{border:1px solid var(--blue);color:var(--blue);background:var(--surface)}
.btn.outline:hover:not(:disabled){background:var(--tint)}
.btn.text{color:var(--blue);padding-inline:12px}
.btn.text:hover:not(:disabled){background:var(--tint)}
.btn.small{min-height:44px;font-size:15px;padding-inline:14px}
.btn.xl{min-height:60px;font-size:18px;border-radius:12px;width:100%}
.pill{min-height:40px;border-radius:20px;padding-inline:16px;font-size:15px;border:1px solid var(--line);color:var(--ink);background:var(--surface)}
.pill:hover{background:var(--soft)}

/* Header */
.top{background:var(--surface);border-block-end:1px solid var(--line)}
.top-in{max-width:640px;margin-inline:auto;height:60px;display:flex;align-items:center;justify-content:space-between;gap:12px;padding-inline:16px}
.brand{display:flex;align-items:center;gap:10px;min-width:0}
.mark{display:grid;place-items:center;width:32px;height:32px;border-radius:8px;background:var(--command);color:var(--on-command)}
.mark svg{width:18px;height:18px;stroke-width:2.2}
.wordmark{font-size:18px;font-weight:700;white-space:nowrap}
.top-end{display:flex;align-items:center;gap:8px}

/* The one screen */
main{max-width:640px;margin-inline:auto;padding:20px 16px 48px;display:flex;flex-direction:column;gap:16px}
.lead{font-size:15px;color:var(--muted)}
label.cap{display:block;font-size:14px;font-weight:600;color:var(--muted);margin-block-end:8px}
.field-row{display:flex;gap:10px;align-items:stretch}
.field{position:relative;flex:1;min-width:0;display:flex;align-items:center;border:1px solid var(--edge);border-radius:10px;background:var(--surface);transition:border-color .16s}
.field:focus-within{border-color:var(--blue);outline:2px solid var(--blue);outline-offset:0}
.field input{flex:1;min-width:0;border:0;background:transparent;outline:0;padding-block:0;padding-inline:16px 8px;font-size:16px;min-height:52px;caret-color:var(--blue);text-overflow:ellipsis}
.field input::placeholder{color:var(--muted);opacity:1}
.field .clear{width:44px;height:44px;margin-inline-end:4px;border-radius:8px;color:var(--muted)}
.field .clear:hover{background:var(--tint);color:var(--blue)}
.field-row .btn{min-width:112px;min-height:52px}
.hint{font-size:14px;color:var(--amber);margin-block-start:8px}

.notice{display:flex;align-items:flex-start;gap:12px;padding:12px 14px;border-radius:10px;border:1px solid var(--line);background:var(--surface);font-size:15px}
.notice p{flex:1;min-width:0}
.notice>svg{color:var(--blue);margin-block-start:2px}
.notice.problem{border-color:color-mix(in srgb,var(--danger) 35%,var(--line));background:var(--danger-tint)}
.notice.problem>svg{color:var(--danger)}
.notice.note{background:var(--amber-tint);border-color:color-mix(in srgb,var(--amber) 30%,var(--line))}
.notice.note>svg{color:var(--amber)}
.notice .btn{margin-block:-4px}

.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius)}
.media{display:grid;grid-template-columns:112px minmax(0,1fr);gap:14px;padding:12px;align-items:center}
.thumb{width:112px;height:63px;border-radius:8px;background:var(--soft);border:1px solid var(--line);display:grid;place-items:center;overflow:hidden;color:var(--muted)}
.thumb img{width:100%;height:100%;object-fit:cover}
.thumb svg{width:24px;height:24px}
.media-body{min-width:0}
.media-title{font-size:16px;font-weight:600;line-height:21px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}
.media-meta{font-size:14px;line-height:19px;color:var(--muted);margin-block-start:2px;font-variant-numeric:tabular-nums}

.choices{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.choice{flex-direction:column;align-items:flex-start;justify-content:flex-start;gap:4px;min-height:112px;padding:16px;border-radius:14px;border:1px solid var(--edge);background:var(--surface);text-align:start;white-space:normal}
.choice:hover:not(:disabled){border-color:var(--blue);background:var(--tint)}
.choice .ico{display:grid;place-items:center;width:40px;height:40px;border-radius:10px;background:var(--tint);color:var(--blue);margin-block-end:6px}
.choice .ico svg{width:22px;height:22px}
.choice .big{font-family:'Manrope','IBM Plex Sans Arabic',sans-serif;font-size:19px;font-weight:700;line-height:24px}
.choice .sub{font-size:14px;font-weight:500;color:var(--muted);line-height:18px}
.segmented{display:inline-flex;border:1px solid var(--edge);border-radius:var(--control);padding:2px;gap:2px;background:var(--surface)}
.segmented button{min-height:36px;padding-inline:14px;border-radius:6px;font-size:14px;color:var(--muted)}
.segmented button:hover{color:var(--ink);background:var(--soft)}
.segmented button[aria-checked=true]{background:var(--tint);color:var(--blue)}
.audio-pick{display:flex;align-items:center;gap:10px;font-size:14px;color:var(--muted)}

.progress{padding:16px;display:flex;flex-direction:column;gap:12px}
.progress-head{display:flex;align-items:baseline;justify-content:space-between;gap:12px;font-size:16px;font-weight:600}
.progress-head .pct{font-variant-numeric:tabular-nums;color:var(--muted);font-weight:500}
.bar{height:8px;border-radius:4px;background:var(--line);overflow:hidden}
.bar>i{display:block;height:100%;width:0;border-radius:4px;background:var(--command);transition:width .4s ease}
.bar.wait>i{width:35%;animation:slide 1.4s ease-in-out infinite}
@keyframes slide{0%{transform:translateX(-100%)}100%{transform:translateX(300%)}}
[dir=rtl] .bar.wait>i{animation-name:slide-rtl}
@keyframes slide-rtl{0%{transform:translateX(100%)}100%{transform:translateX(-300%)}}
@media(prefers-reduced-motion:reduce){.bar.wait>i{animation:none;width:100%;opacity:.5}.bar>i{transition:none}button:active:not(:disabled){transform:none}}

.ready{padding:16px;display:flex;flex-direction:column;gap:12px}
.ready-head{display:flex;align-items:center;gap:10px;font-weight:600;font-size:17px;color:var(--success)}
.ready-head svg{width:22px;height:22px}
.ready-info{display:flex;flex-direction:column;gap:2px}
.ready-name{font-size:15px;font-weight:600;overflow-wrap:anywhere}
.ready-file{font-size:14px;color:var(--muted);overflow-wrap:anywhere}
.ready-row{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}

.sec-head{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:44px}
.sec-head h2{font-size:17px;font-weight:700}
.rows{list-style:none;margin:0;padding:0}
.row{display:grid;grid-template-columns:64px minmax(0,1fr) auto;align-items:center;column-gap:12px;padding:10px 12px;border-block-end:1px solid var(--line);min-height:68px}
.row:last-child{border-block-end:0}
.row .thumb{width:64px;height:36px;border-radius:6px}
.row .thumb svg{width:18px;height:18px}
.row-title{font-size:15px;font-weight:600;line-height:20px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.row-meta{font-size:13px;line-height:18px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.row .gone{font-size:14px;color:var(--muted);padding-inline:12px}

/* Sign-in */
.signin{padding:24px 20px;display:flex;flex-direction:column;gap:16px;align-items:stretch}
.signin h1{font-size:22px;font-weight:700;line-height:28px}
.signin .or{display:flex;align-items:center;gap:12px;color:var(--muted);font-size:14px}
.signin .or::before,.signin .or::after{content:'';flex:1;height:1px;background:var(--line)}
.lock{display:grid;place-items:center;width:48px;height:48px;border-radius:12px;background:var(--tint);color:var(--blue)}
.lock svg{width:24px;height:24px}

@media(min-width:700px){
  main{padding-block:40px 64px;gap:20px}
  .lead{font-size:16px}
  .choice{min-height:128px}
}
@media(max-width:380px){
  .field-row{flex-direction:column}
  .field-row .btn{width:100%}
  .media{grid-template-columns:88px minmax(0,1fr)}
  .thumb{width:88px;height:50px}
}
