:root {
  color-scheme: light;
  --ink: #17203a;
  --muted: #65708a;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-soft: #f7f8ff;
  --line: rgba(83, 91, 132, 0.16);
  --blue: #2868f5;
  --violet: #7250ee;
  --turquoise: #0db9c8;
  --success: #159b6c;
  --danger: #c03d55;
  --shadow: 0 24px 70px rgba(40, 43, 92, 0.16);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 5%, rgba(13, 185, 200, .15), transparent 30rem),
    radial-gradient(circle at 90% 5%, rgba(114, 80, 238, .16), transparent 30rem),
    linear-gradient(145deg, #f8fbff 0%, #f5f3ff 48%, #effcff 100%);
}

button, input { font: inherit; }
button { color: inherit; }

.background-orb {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(18px);
  opacity: .65;
  pointer-events: none;
}
.orb-one { width: 260px; height: 260px; left: -90px; top: 32%; background: rgba(40, 104, 245, .13); }
.orb-two { width: 320px; height: 320px; right: -140px; bottom: 5%; background: rgba(114, 80, 238, .14); }

.app-shell {
  width: min(100% - 28px, 940px);
  margin: 0 auto;
  padding: 30px 0 24px;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 34px 38px 42px;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  color: #fff;
  background: linear-gradient(118deg, #245fe8 0%, #6551ee 53%, #0eb6c3 115%);
  box-shadow: var(--shadow);
}

.hero::before, .hero::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.16);
}
.hero::before { width: 250px; height: 250px; right: -70px; top: -120px; }
.hero::after { width: 120px; height: 120px; right: 80px; bottom: -80px; }

.brand {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -.02em;
}
.brand strong { font-weight: 820; }
.brand-icon { width: 34px; height: 34px; display: inline-flex; }
.brand-icon svg { width: 100%; height: 100%; fill: currentColor; }
.brand-lines { fill: none; stroke: #6957e8; stroke-width: 3; stroke-linecap: round; }

.hero-copy { position: relative; z-index: 1; max-width: 690px; margin-top: 44px; }
.eyebrow {
  margin: 0 0 10px;
  font-size: .78rem;
  font-weight: 780;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: rgba(255,255,255,.78);
}
h1 { margin: 0; font-size: clamp(2rem, 6vw, 3.5rem); line-height: 1.02; letter-spacing: -.055em; }
.hero-text { max-width: 610px; margin: 18px 0 0; font-size: clamp(1rem, 2.5vw, 1.15rem); line-height: 1.6; color: rgba(255,255,255,.84); }

.workspace {
  position: relative;
  padding: 28px;
  border: 1px solid rgba(255,255,255,.72);
  border-top: 0;
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.upload-panel, .file-panel, .result-panel { animation: rise .38s ease both; }

.drop-zone {
  width: 100%;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 30px;
  border: 2px dashed rgba(83, 91, 132, .25);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgba(250,251,255,.9), rgba(245,248,255,.72));
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.drop-zone:hover, .drop-zone:focus-visible, .drop-zone.dragover {
  outline: none;
  transform: translateY(-2px);
  border-color: var(--violet);
  background: linear-gradient(145deg, rgba(244,247,255,.98), rgba(245,240,255,.9));
  box-shadow: 0 14px 35px rgba(75, 65, 167, .12);
}
.upload-icon {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  margin-bottom: 8px;
  border-radius: 21px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--violet));
  box-shadow: 0 12px 25px rgba(81, 75, 223, .24);
}
.upload-icon svg { width: 32px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.drop-title { font-size: 1.22rem; font-weight: 780; letter-spacing: -.02em; }
.drop-subtitle { color: var(--muted); }
.select-pill {
  margin-top: 12px;
  padding: 10px 17px;
  border-radius: 999px;
  color: #5c4cd5;
  background: rgba(114,80,238,.1);
  font-size: .9rem;
  font-weight: 750;
}

.privacy-note {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 9px;
  margin: 18px auto 0;
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.45;
  text-align: center;
}
.privacy-note svg { flex: 0 0 auto; width: 18px; fill: none; stroke: var(--success); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.file-summary {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}
.file-icon {
  flex: 0 0 auto;
  width: 54px;
  height: 62px;
  display: grid;
  place-items: end center;
  padding-bottom: 9px;
  border-radius: 9px 15px 9px 9px;
  color: #fff;
  background: linear-gradient(145deg, #ef4c63, #b82f56);
  font-size: .7rem;
  font-weight: 900;
  box-shadow: 0 9px 18px rgba(190, 48, 84, .18);
}
.file-copy { min-width: 0; flex: 1; }
.file-label { margin: 0 0 4px; color: var(--muted); font-size: .78rem; font-weight: 720; text-transform: uppercase; letter-spacing: .08em; }
.file-name { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 780; }
.file-meta { margin: 5px 0 0; color: var(--muted); font-size: .88rem; }
.icon-button {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  color: var(--muted);
  background: rgba(86, 96, 135, .08);
  cursor: pointer;
}
.icon-button:hover, .icon-button:focus-visible { color: var(--danger); outline: 2px solid rgba(192,61,85,.18); }
.icon-button svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.rule-preview {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  margin: 22px 0;
  padding: 18px;
  border-radius: var(--radius-md);
  background: linear-gradient(120deg, rgba(40,104,245,.06), rgba(114,80,238,.07), rgba(13,185,200,.06));
}
.rule-item { display: flex; align-items: center; gap: 11px; min-width: 0; }
.rule-item div { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.rule-item strong { font-size: .9rem; }
.rule-item div span { overflow: hidden; color: var(--muted); font-size: .82rem; text-overflow: ellipsis; white-space: nowrap; }
.rule-number, .step-badge {
  width: 31px;
  height: 31px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  background: var(--blue);
  font-weight: 850;
  font-size: .86rem;
}
.rule-number.second, .step-badge.second { background: var(--violet); }
.rule-arrow { color: #8a91a7; font-size: 1.2rem; }

.primary-button, .download-button, .secondary-button {
  border: 0;
  cursor: pointer;
  font-weight: 780;
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}
.primary-button {
  position: relative;
  width: 100%;
  min-height: 58px;
  display: grid;
  place-items: center;
  border-radius: 17px;
  color: #fff;
  background: linear-gradient(110deg, var(--blue), var(--violet) 63%, #5b69ee);
  box-shadow: 0 13px 26px rgba(80, 72, 216, .24);
}
.primary-button:hover:not(:disabled), .download-button:hover, .secondary-button:hover { transform: translateY(-2px); }
.primary-button:focus-visible, .download-button:focus-visible, .secondary-button:focus-visible { outline: 3px solid rgba(40,104,245,.25); outline-offset: 3px; }
.primary-button:disabled { cursor: wait; opacity: .75; }
.button-spinner { display: none; width: 22px; height: 22px; border: 3px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .72s linear infinite; }
.primary-button.loading .button-label { display: none; }
.primary-button.loading .button-spinner { display: block; }

.status-message {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  line-height: 1.45;
  font-size: .92rem;
}
.status-message.error { color: #8f243d; background: rgba(207, 67, 92, .1); border: 1px solid rgba(207,67,92,.19); }
.status-message.info { color: #28559f; background: rgba(40,104,245,.09); border: 1px solid rgba(40,104,245,.16); }

.success-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.success-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 15px; color: #fff; background: linear-gradient(135deg, #13a973, #0db9a1); box-shadow: 0 10px 22px rgba(20,157,111,.2); }
.success-icon svg { width: 26px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.result-kicker { margin: 0 0 3px; color: var(--success); font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .09em; }
.result-panel h2 { margin: 0; font-size: clamp(1.35rem, 4vw, 1.8rem); letter-spacing: -.035em; }
.download-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.download-card { min-width: 0; padding: 21px; border: 1px solid var(--line); border-radius: 19px; background: #fff; }
.first-card { box-shadow: inset 0 3px 0 rgba(40,104,245,.75); }
.second-card { box-shadow: inset 0 3px 0 rgba(114,80,238,.75); }
.card-topline { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: .82rem; font-weight: 720; }
.download-card h3 { margin: 17px 0 7px; font-size: 1.08rem; letter-spacing: -.025em; }
.page-sequence { min-height: 44px; margin: 0 0 18px; color: var(--muted); font-size: .88rem; line-height: 1.45; }
.download-button { width: 100%; min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 8px; border-radius: 14px; color: #fff; }
.download-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.first-download { background: linear-gradient(110deg, #2568ef, #3983f9); box-shadow: 0 9px 18px rgba(40,104,245,.17); }
.second-download { background: linear-gradient(110deg, #6c4fe2, #8a5bef); box-shadow: 0 9px 18px rgba(114,80,238,.17); }
.print-note { display: flex; align-items: flex-start; gap: 11px; margin-top: 17px; padding: 14px 16px; border-radius: 14px; color: #4f5975; background: rgba(13,185,200,.08); font-size: .88rem; line-height: 1.5; }
.print-note > span { width: 21px; height: 21px; display: grid; flex: 0 0 auto; place-items: center; border: 1px solid rgba(13,150,167,.4); border-radius: 50%; color: #087f91; font-weight: 850; }
.print-note p { margin: 0; }
.secondary-button { display: block; margin: 20px auto 0; padding: 12px 18px; border-radius: 13px; color: #5545cc; background: rgba(114,80,238,.09); }

footer { padding: 18px; color: #7b849a; text-align: center; font-size: .8rem; }
footer p { margin: 0; }

.hidden { display: none !important; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }
.noscript { position: fixed; inset: auto 14px 14px; padding: 14px; border-radius: 12px; color: #fff; background: #9c2945; text-align: center; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 680px) {
  .app-shell { width: min(100% - 18px, 940px); padding-top: 9px; }
  .hero { padding: 25px 22px 32px; border-radius: 24px 24px 0 0; }
  .hero-copy { margin-top: 35px; }
  h1 { font-size: 2.25rem; }
  .workspace { padding: 18px; border-radius: 0 0 24px 24px; }
  .drop-zone { min-height: 250px; padding: 24px 16px; }
  .privacy-note { text-align: left; }
  .rule-preview { grid-template-columns: 1fr; gap: 12px; }
  .rule-arrow { display: none; }
  .download-grid { grid-template-columns: 1fr; }
  .file-summary { align-items: flex-start; }
}

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

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ink: #f2f4ff;
    --muted: #aeb6cc;
    --surface: rgba(20, 24, 45, .92);
    --surface-soft: #222743;
    --line: rgba(188, 196, 231, .15);
    --shadow: 0 24px 70px rgba(0,0,0,.38);
  }
  body { background: radial-gradient(circle at 13% 4%, rgba(13,185,200,.14), transparent 28rem), radial-gradient(circle at 90% 5%, rgba(114,80,238,.22), transparent 28rem), #111426; }
  .drop-zone { background: linear-gradient(145deg, rgba(31,36,63,.95), rgba(27,31,57,.85)); }
  .drop-zone:hover, .drop-zone:focus-visible, .drop-zone.dragover { background: linear-gradient(145deg, rgba(34,42,75,.98), rgba(41,31,70,.92)); }
  .download-card { background: #1c213b; }
  .print-note { color: #c0c8de; }
}
