:root {
  color-scheme: light;
  --ink: #14213d;
  --muted: #68738a;
  --line: #dfe5ee;
  --paper: #ffffff;
  --wash: #f4f7fb;
  --blue: #2563eb;
  --blue-dark: #174cc7;
  --blue-soft: #eaf1ff;
  --green: #138a5b;
  --red: #c83b48;
  --shadow: 0 24px 70px rgba(25, 44, 79, 0.11);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(37, 99, 235, 0.08), transparent 28rem),
    linear-gradient(180deg, #fbfcff 0%, var(--wash) 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input { font: inherit; }
a { color: inherit; }
.shell { width: min(100% - 40px, 980px); margin: 0 auto; }

.topbar {
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(20, 33, 61, 0.09);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-weight: 760;
  letter-spacing: -0.025em;
  text-decoration: none;
}

.brand img { display: block; border-radius: 11px; box-shadow: 0 6px 16px rgba(37, 99, 235, 0.22); }

.counter {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.counter-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(19, 138, 91, 0.1);
}

.counter.exhausted .counter-dot { background: var(--red); box-shadow: 0 0 0 4px rgba(200, 59, 72, 0.1); }
.hero { padding: 76px 0 43px; text-align: center; }
.eyebrow { margin-bottom: 16px; color: var(--blue); font-size: 12px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(42px, 6.4vw, 68px); line-height: 1.02; letter-spacing: -0.058em; }
.lead { max-width: 610px; margin: 24px auto 0; color: var(--muted); font-size: 18px; line-height: 1.65; }
code { padding: 2px 6px; color: var(--blue-dark); background: var(--blue-soft); border-radius: 5px; font-size: 0.9em; }

.notice { display: flex; gap: 14px; margin: 0 auto 18px; padding: 17px 20px; border: 1px solid #f3c5ca; border-radius: 14px; color: #812530; background: #fff4f5; }
.notice-icon { display: grid; flex: 0 0 auto; place-items: center; width: 25px; height: 25px; color: #fff; background: var(--red); border-radius: 50%; font-weight: 800; }
.notice strong { display: block; }
.notice p { margin: 4px 0 0; font-size: 14px; }

.converter-card { padding: 30px; background: var(--paper); border: 1px solid rgba(25, 44, 79, 0.1); border-radius: 22px; box-shadow: var(--shadow); }
.card-heading, .results-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.card-heading h2, .results-heading h2 { margin: 0; font-size: 20px; letter-spacing: -0.025em; }
.card-heading p, .results-heading p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.retention-badge { display: inline-flex; padding: 7px 11px; color: var(--blue-dark); background: var(--blue-soft); border-radius: 999px; font-size: 11px; font-weight: 750; white-space: nowrap; }

.dropzone { display: flex; min-height: 230px; padding: 32px; align-items: center; justify-content: center; flex-direction: column; cursor: pointer; border: 1.5px dashed #b8c5d8; border-radius: 16px; background: #fafcff; transition: border-color 160ms ease, background 160ms ease, transform 160ms ease; }
.dropzone:hover, .dropzone.dragover { border-color: var(--blue); background: #f4f8ff; transform: translateY(-1px); }
.dropzone.disabled { cursor: not-allowed; opacity: 0.5; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.upload-icon { display: grid; place-items: center; width: 54px; height: 54px; margin-bottom: 18px; color: var(--blue); background: var(--blue-soft); border-radius: 15px; }
.upload-icon svg { width: 25px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.drop-title { font-size: 17px; font-weight: 750; }
.drop-subtitle { margin-top: 7px; color: var(--muted); font-size: 13px; }
.drop-subtitle span { color: var(--blue); font-weight: 650; }

.selected-files { margin-top: 14px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; }
.selected-heading { display: flex; justify-content: space-between; padding: 12px 14px; color: var(--muted); background: #f8faff; font-size: 12px; }
.selected-heading strong { color: var(--ink); }
.file-list, .result-list { padding: 0; margin: 0; list-style: none; }
.file-item { display: flex; align-items: center; gap: 13px; padding: 11px 13px; border-top: 1px solid var(--line); }
.file-type { display: grid; flex: 0 0 auto; place-items: center; width: 42px; height: 42px; color: var(--blue); background: var(--blue-soft); border-radius: 10px; font-size: 9px; font-weight: 850; }
.file-meta { min-width: 0; display: flex; flex: 1; flex-direction: column; gap: 3px; }
.file-meta strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.file-meta span { color: var(--muted); font-size: 11px; }
.remove-file { padding: 8px; color: var(--muted); background: none; border: 0; cursor: pointer; font-size: 23px; line-height: 1; }
.remove-file:hover { color: var(--red); }

.form-error, .result-error { margin-top: 13px; padding: 11px 13px; color: #8c2531; background: #fff1f3; border-radius: 10px; font-size: 13px; }
.convert-button { position: relative; width: 100%; min-height: 52px; margin-top: 14px; color: #fff; background: var(--blue); border: 0; border-radius: 12px; cursor: pointer; font-weight: 750; transition: background 150ms ease, transform 150ms ease; }
.convert-button:hover:not(:disabled) { background: var(--blue-dark); transform: translateY(-1px); }
.convert-button:disabled { cursor: not-allowed; opacity: 0.42; }
.convert-button.loading .button-label { opacity: 0; }
.spinner { display: none; position: absolute; inset: 0; width: 20px; height: 20px; margin: auto; border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; }
.loading .spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

.results { min-height: 300px; }
.result-check { display: grid; flex: 0 0 auto; place-items: center; width: 38px; height: 38px; color: #fff; background: var(--green); border-radius: 50%; font-weight: 800; }
.result-list { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; }
.result-item { display: flex; align-items: center; gap: 13px; padding: 14px; background: #fff; }
.result-item + .result-item { border-top: 1px solid var(--line); }
.result-mark { display: grid; flex: 0 0 auto; place-items: center; width: 30px; height: 30px; color: #fff; border-radius: 50%; font-size: 12px; font-weight: 850; }
.result-item.success .result-mark { background: var(--green); }
.result-item.failed .result-mark { background: var(--red); }
.result-copy { min-width: 0; display: flex; flex: 1; flex-direction: column; gap: 3px; }
.result-copy strong, .result-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-copy strong { font-size: 13px; }
.result-copy span { color: var(--muted); font-size: 11px; }
.download-button { flex: 0 0 auto; padding: 9px 13px; color: var(--green); background: #ecf8f2; border-radius: 9px; font-size: 12px; font-weight: 750; text-decoration: none; }
.download-button:hover { background: #daf2e6; }
.result-actions { display: flex; gap: 10px; margin-top: 18px; }
.archive-button, .new-upload-button { display: inline-flex; min-height: 48px; align-items: center; justify-content: center; padding: 0 18px; border-radius: 11px; font-size: 13px; font-weight: 750; text-decoration: none; cursor: pointer; }
.archive-button { flex: 1; color: #fff; background: var(--blue); }
.archive-button:hover { background: var(--blue-dark); }
.new-upload-button { color: var(--ink); background: #fff; border: 1px solid var(--line); }
.new-upload-button:hover { background: #f7f9fc; }
.new-upload-button:disabled { cursor: wait; opacity: 0.55; }

.details { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 48px 0 52px; overflow: hidden; background: var(--line); border: 1px solid var(--line); border-radius: 16px; }
.details article { padding: 24px; background: rgba(255,255,255,0.72); }
.detail-number { color: var(--blue); font-size: 10px; font-weight: 850; letter-spacing: 0.12em; }
.details h3 { margin: 18px 0 8px; font-size: 14px; }
.details p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.65; }

footer { display: flex; justify-content: space-between; gap: 24px; padding: 24px 0 36px; color: var(--muted); border-top: 1px solid rgba(20, 33, 61, 0.09); font-size: 12px; }
footer a { color: var(--ink); font-weight: 700; text-decoration: none; }
footer a:hover { color: var(--blue); }

@media (max-width: 680px) {
  .shell { width: min(100% - 24px, 980px); }
  .topbar { min-height: 66px; }
  .brand span { display: none; }
  .counter { font-size: 11px; }
  .hero { padding: 55px 0 32px; }
  h1 { font-size: clamp(38px, 12vw, 54px); }
  .lead { font-size: 16px; }
  .converter-card { padding: 18px; border-radius: 18px; }
  .card-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
  .dropzone { min-height: 210px; padding: 22px; text-align: center; }
  .details { grid-template-columns: 1fr; }
  .result-item { align-items: flex-start; flex-wrap: wrap; }
  .result-copy { width: calc(100% - 45px); }
  .download-button { width: 100%; text-align: center; }
  .result-actions { flex-direction: column; }
  .archive-button, .new-upload-button { width: 100%; }
  footer { flex-direction: column; gap: 12px; }
}

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