:root {
  --bg: #0d0d10;
  --card: rgba(21, 21, 27, .86);
  --card-strong: #17171d;
  --line: rgba(255,255,255,.11);
  --text: #fff7ef;
  --muted: #bcb7b5;
  --muted-2: #7e7775;
  --red: #e11d2e;
  --red-2: #ff4053;
  --red-dark: #7f0d18;
  --cream: #f7efe4;
  --ok: #35d08c;
  --warn: #ffbd4a;
  --danger: #ff5f68;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 14% 6%, rgba(225, 29, 46, .33), transparent 28rem),
    radial-gradient(circle at 86% 18%, rgba(255, 64, 83, .18), transparent 24rem),
    linear-gradient(140deg, #09090b 0%, #161216 46%, #09090b 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .24;
  background-image:
    linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 85%);
}

button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }

.page-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0;
}

.hero-card {
  position: relative;
  overflow: hidden;
  min-height: calc(100vh - 56px);
  padding: clamp(18px, 3vw, 38px);
  border: 1px solid var(--line);
  border-radius: 34px;
  background: linear-gradient(145deg, rgba(23, 23, 29, .92), rgba(13, 13, 16, .78));
  box-shadow: 0 30px 90px rgba(0,0,0,.46), inset 0 1px 0 rgba(255,255,255,.06);
}

.hero-glow {
  position: absolute;
  border-radius: 999px;
  filter: blur(8px);
  pointer-events: none;
}
.hero-glow-a {
  width: 320px; height: 320px;
  right: -120px; top: -110px;
  background: rgba(225, 29, 46, .36);
}
.hero-glow-b {
  width: 240px; height: 240px;
  left: -88px; bottom: 18%;
  background: rgba(255, 64, 83, .20);
}

.topbar {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: clamp(26px, 4vw, 62px);
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 54px; height: 54px;
  display: grid; place-items: center;
  border-radius: 18px;
  color: white;
  font-weight: 1000;
  letter-spacing: -.08em;
  background: linear-gradient(135deg, var(--red), #34060b);
  box-shadow: 0 12px 30px rgba(225,29,46,.35);
}
.brand-title { font-weight: 950; font-size: 1.18rem; letter-spacing: .02em; }
.brand-subtitle { color: var(--muted); font-size: .84rem; text-transform: uppercase; letter-spacing: .22em; }
.status-pill {
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(255,255,255,.04);
  white-space: nowrap;
}
.status-pill.ok { color: var(--ok); border-color: rgba(53, 208, 140, .35); }
.status-pill.warn { color: var(--warn); border-color: rgba(255, 189, 74, .38); }

.hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(360px, .72fr);
  gap: clamp(20px, 4vw, 54px);
  align-items: center;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--red-2);
  font-size: .86rem;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
}

h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(2.2rem, 6.4vw, 5.9rem);
  line-height: .92;
  letter-spacing: -.07em;
}

.lead {
  max-width: 610px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  line-height: 1.58;
}

.session-panel {
  max-width: 640px;
  margin-top: 32px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255,255,255,.045);
}
.session-panel label {
  display: block;
  margin-bottom: 9px;
  color: var(--cream);
  font-weight: 800;
}
.session-row { display: flex; gap: 10px; }
.session-row input, .key-dialog input {
  min-width: 0;
  width: 100%;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 16px;
  padding: 13px 14px;
  color: var(--text);
  outline: none;
  background: rgba(0,0,0,.28);
}
.session-row input:focus, .key-dialog input:focus {
  border-color: rgba(255,64,83,.75);
  box-shadow: 0 0 0 4px rgba(225,29,46,.16);
}
.session-panel p {
  margin: 10px 0 0;
  color: var(--muted-2);
  font-size: .91rem;
}

.drop-panel { min-width: 0; }
.drop-zone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 430px;
  padding: 34px;
  text-align: center;
  border: 1.5px dashed rgba(255,255,255,.26);
  border-radius: 32px;
  background:
    linear-gradient(180deg, rgba(225,29,46,.16), rgba(255,255,255,.035)),
    rgba(255,255,255,.045);
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.drop-zone.drag-over {
  transform: translateY(-4px) scale(1.01);
  border-color: rgba(255,64,83,.88);
  background: linear-gradient(180deg, rgba(225,29,46,.28), rgba(255,255,255,.06));
}
.drop-icon {
  width: 102px; height: 102px;
  display: grid; place-items: center;
  margin: 0 auto 22px;
  border-radius: 32px;
  background: linear-gradient(135deg, rgba(255,255,255,.12), rgba(225,29,46,.18));
  border: 1px solid rgba(255,255,255,.14);
}
.drop-icon span {
  width: 44px; height: 44px;
  border-radius: 12px;
  border: 3px solid white;
  border-top-color: var(--red-2);
  transform: rotate(45deg);
}
.drop-zone h2 { margin: 0 0 10px; font-size: clamp(1.45rem, 2.4vw, 2.1rem); }
.drop-zone p { margin: 0 auto 22px; max-width: 420px; color: var(--muted); line-height: 1.5; }
.drop-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

.primary-button, .secondary-button, .ghost-button {
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  font-weight: 850;
}
.primary-button {
  color: white;
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  box-shadow: 0 14px 32px rgba(225,29,46,.28);
}
.secondary-button, .ghost-button {
  color: var(--cream);
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.07);
}
.ghost-button { padding-inline: 15px; }
.small { padding: 11px 15px; font-size: .92rem; }

.queue-card {
  position: relative;
  z-index: 1;
  margin-top: 28px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(0,0,0,.22);
}
.queue-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  margin-bottom: 14px;
}
.queue-head h2 { margin: 0 0 5px; }
.queue-head p { margin: 0; color: var(--muted); }
.queue-actions { display: flex; gap: 10px; }
.total-progress {
  overflow: hidden;
  height: 10px;
  margin-bottom: 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
}
.total-progress span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), var(--red-2));
  transition: width .2s ease;
}
.file-list { display: grid; gap: 10px; }
.file-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 13px 14px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 18px;
  background: rgba(255,255,255,.045);
}
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; }
.file-meta { margin-top: 4px; color: var(--muted-2); font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-state { color: var(--muted); font-size: .9rem; text-align: right; }
.file-state.done { color: var(--ok); }
.file-state.error { color: var(--danger); }
.item-progress {
  grid-column: 1 / -1;
  overflow: hidden;
  height: 7px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
}
.item-progress span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), var(--red-2));
}

.key-dialog {
  width: min(430px, calc(100% - 26px));
  border: 1px solid var(--line);
  border-radius: 28px;
  color: var(--text);
  background: #15151b;
  box-shadow: 0 30px 90px rgba(0,0,0,.7);
}
.key-dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(7px); }
.key-dialog form { display: grid; gap: 14px; padding: 12px; }
.key-dialog h2, .key-dialog p { margin: 0; }
.key-dialog p { color: var(--muted); line-height: 1.5; }
.dialog-mark { font-size: 2rem; }

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  max-width: min(420px, calc(100% - 36px));
  padding: 14px 16px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 16px;
  color: var(--text);
  background: rgba(15,15,19,.94);
  box-shadow: 0 20px 60px rgba(0,0,0,.36);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 880px) {
  .hero-grid { grid-template-columns: 1fr; }
  .drop-zone { min-height: 320px; }
  .queue-head { flex-direction: column; }
  .queue-actions { width: 100%; }
  .queue-actions button { flex: 1; }
}

@media (max-width: 560px) {
  .page-shell { width: min(100% - 18px, 1180px); padding: 9px 0; }
  .hero-card { border-radius: 24px; padding: 16px; }
  .topbar { align-items: start; flex-direction: column; }
  .session-row { flex-direction: column; }
  .file-item { grid-template-columns: 1fr; }
  .file-state { text-align: left; }
}
