:root {
  --bg: #f6f4ef;
  --surface: #fdfcf9;
  --ink: #1c1b19;
  --ink-2: #5f5c56;
  --ink-3: #8a867e;
  --line: #e3dfd6;
  --accent: #1f5f55;
  --accent-ink: #f6f4ef;
  --accent-soft: #e3eeeb;
  --error: #a8402f;
  --ok: #2f7d4f;
  --warn: #b07a12;
  --shadow: 0 1px 2px rgb(60 50 30 / 0.05), 0 8px 24px -12px rgb(60 50 30 / 0.12);

  --sans: "Geist", "Noto Sans Bengali", system-ui, sans-serif;
  --bangla: "Noto Sans Bengali", "Geist", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, monospace;
  --radius: 14px;
  --radius-sm: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151513;
    --surface: #1c1c19;
    --ink: #ecebe5;
    --ink-2: #a9a69d;
    --ink-3: #7d7a72;
    --line: #2d2c28;
    --accent: #7cbcae;
    --accent-ink: #10211e;
    --accent-soft: #1f2d2a;
    --error: #e08a78;
    --ok: #7dc79a;
    --warn: #e0b45c;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px -12px rgb(0 0 0 / 0.5);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
html[lang="bn"] body { font-family: var(--bangla); }
[hidden] { display: none !important; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: 6px; z-index: 10; }
.skip:focus { left: 12px; }

/* header */
.top { display: flex; justify-content: space-between; align-items: center; gap: 16px; width: 100%; max-width: 760px; margin: 0 auto; padding: 22px 20px 0; }
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand-mark { font-family: var(--bangla); font-weight: 600; font-size: 1.25rem; color: var(--accent); }
.brand-sub { font-size: 0.85rem; color: var(--ink-3); }
.status { display: inline-flex; align-items: center; gap: 7px; margin: 0 0 0 auto; font-size: 0.82rem; color: var(--ink-2); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: none; }
.status[data-status="checking"] .dot { animation: pulse 1.2s ease-in-out infinite; }
.status[data-status="ready"] .dot { background: var(--ok); }
.status[data-status="asleep"] .dot { background: var(--warn); }
.status[data-status="offline"] .dot { background: var(--error); }
@keyframes pulse { 50% { opacity: 0.3; } }
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--surface); }
.lang button {
  font: inherit; font-size: 0.82rem; border: 0; background: transparent; color: var(--ink-2);
  padding: 5px 12px; border-radius: 999px; cursor: pointer; transition: background 0.2s, color 0.2s;
}
.lang button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

/* main column */
main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 56px 20px 40px; }
h1 { font-size: clamp(1.9rem, 4.5vw, 2.6rem); line-height: 1.12; letter-spacing: -0.025em; font-weight: 600; margin: 0 0 14px; text-wrap: balance; }
html[lang="bn"] h1 { letter-spacing: 0; line-height: 1.3; }
.lede { color: var(--ink-2); font-size: 1.05rem; max-width: 58ch; margin: 0 0 32px; text-wrap: pretty; }
h2 { font-size: 1.15rem; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 18px; }

/* the card that holds every state */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }

.drop {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--line); border-radius: var(--radius-sm); padding: 52px 20px 48px;
  transition: border-color 0.2s, background 0.2s;
}
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop:focus-within { border-color: var(--accent); }
.drop-icon { width: 30px; height: 30px; color: var(--accent); margin-bottom: 6px; }
.drop-title { font-weight: 500; font-size: 1.02rem; }
.drop-limits { font-size: 0.85rem; color: var(--ink-3); }

.file { display: flex; align-items: center; gap: 12px; padding: 4px 2px 18px; }
.file-icon { width: 26px; height: 26px; color: var(--accent); flex: none; }
.file-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.file-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { font-size: 0.85rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.primary {
  display: inline-flex; justify-content: center; align-items: center; width: 100%;
  font: inherit; font-weight: 500; font-size: 1rem; text-decoration: none; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); border: 0; border-radius: var(--radius-sm); padding: 13px 18px;
  transition: filter 0.2s, transform 0.1s;
}
.primary:hover { filter: brightness(1.08); }
.primary:active { transform: translateY(1px); }
.link {
  font: inherit; font-size: 0.9rem; background: none; border: 0; padding: 4px 0; color: var(--accent); cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
}

/* progress */
.steps { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 10px; }
.steps li { display: flex; align-items: center; gap: 10px; color: var(--ink-3); transition: color 0.2s; }
.tick { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--line); flex: none; position: relative; transition: all 0.2s; }
.steps li.active { color: var(--ink); font-weight: 500; }
.steps li.active .tick { border-color: var(--accent); border-top-color: transparent; animation: spin 0.9s linear infinite; }
.steps li.done { color: var(--ink-2); }
.steps li.done .tick { background: var(--accent); border-color: var(--accent); }
.steps li.done .tick::after { content: ""; position: absolute; left: 4.5px; top: 1.5px; width: 4px; height: 8px; border: solid var(--accent-ink); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.step-count { margin-left: auto; font-family: var(--mono); font-size: 0.82rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
@keyframes spin { to { transform: rotate(360deg); } }

.bar { height: 4px; background: var(--line); border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width 0.4s ease; }
.note { font-size: 0.85rem; color: var(--ink-3); margin: 14px 0 0; }
#elapsed { font-family: var(--mono); color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* result */
.summary { color: var(--ink-2); margin: -8px 0 18px; font-variant-numeric: tabular-nums; }
.cues {
  list-style: none; margin: 18px 0 14px; padding: 4px 0; max-height: min(60vh, 520px); overflow: auto;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.cues li { display: grid; grid-template-columns: 4.2em 1fr; gap: 12px; padding: 8px 16px; }
.cues li + li { border-top: 1px solid var(--line); }
.cue-time { font-family: var(--mono); font-size: 0.8rem; color: var(--ink-3); padding-top: 0.2em; font-variant-numeric: tabular-nums; }
.cue-text { font-family: var(--bangla); white-space: pre-line; line-height: 1.6; }
.error { color: var(--error); margin: -6px 0 18px; }

/* how it works */
.how { margin-top: 48px; }
.how h2 { font-size: 1rem; color: var(--ink-2); font-weight: 500; }
.how ol { margin: 0; padding-left: 1.2em; display: grid; gap: 8px; color: var(--ink-2); max-width: 62ch; }
.how li::marker { color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* footer */
.foot {
  width: 100%; max-width: 760px; margin: 0 auto; padding: 24px 20px 36px; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 0.85rem; color: var(--ink-3);
}
.foot a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }
.foot a:hover { color: var(--ink); text-decoration-color: currentColor; }
.foot span { margin-left: auto; }

@media (max-width: 560px) {
  .top { flex-wrap: wrap; row-gap: 10px; }
  .brand-sub { display: none; }
  .status { order: 3; width: 100%; margin: 0; }
  main { padding-top: 36px; }
  .card { padding: 16px; }
  .drop { padding: 40px 16px 36px; }
  .foot span { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
