:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #f8fbff;
  --ink: #111827;
  --muted: #5b6472;
  --line: #d9e2ee;
  --brand: #0069ff;
  --brand-2: #12d7e8;
  --accent: #c92a37;
  --accent-text: #b42332;
  --success: #11a36a;
  --shadow: 0 18px 45px rgba(16, 24, 40, 0.1);
  --topbar: rgba(255, 255, 255, 0.92);
  --hero-start: #061637;
  --hero-mid: #0b1f44;
  --hero-end: #083b8d;
  --dark-band: #07152e;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #08111f;
  --surface: #101b2d;
  --surface-soft: #0d1727;
  --ink: #eef4ff;
  --muted: #a9b5c7;
  --line: #26364d;
  --brand: #4f9bff;
  --brand-2: #28e1ee;
  --accent: #b42332;
  --accent-text: #ff7a86;
  --success: #32d28e;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
  --topbar: rgba(8, 17, 31, 0.92);
  --hero-start: #040914;
  --hero-mid: #0a1830;
  --hero-end: #0b3275;
  --dark-band: #050a13;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

i[data-lucide] {
  display: inline-block;
  flex: 0 0 auto;
  height: 24px;
  width: 24px;
}

.topbar {
  align-items: center;
  background: var(--topbar);
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 18px;
  grid-template-columns: auto 1fr auto;
  left: 0;
  padding: 12px clamp(18px, 4vw, 56px);
  position: sticky;
  right: 0;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(16px);
}

.brand {
  align-items: center;
  display: inline-flex;
  font-size: 1.2rem;
  font-weight: 800;
  gap: 10px;
  min-width: 0;
}

.brand img {
  border: 2px solid rgba(0, 105, 255, 0.24);
  border-radius: 50%;
  height: 42px;
  object-fit: cover;
  width: 42px;
}

.topbar-actions {
  align-items: center;
  display: inline-flex;
  gap: 10px;
}

.theme-toggle {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  height: 44px;
  justify-content: center;
  width: 44px;
}

.nav {
  display: flex;
  gap: clamp(12px, 3vw, 32px);
  justify-content: center;
}

.nav a {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}

.hero {
  align-items: center;
  background:
    radial-gradient(circle at 84% 18%, rgba(18, 215, 232, 0.18), transparent 30%),
    linear-gradient(135deg, var(--hero-start) 0%, var(--hero-mid) 44%, var(--hero-end) 100%);
  color: white;
  display: grid;
  gap: 38px;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  min-height: 590px;
  padding: clamp(64px, 10vw, 116px) clamp(18px, 6vw, 84px);
}

.hero h1 {
  font-size: clamp(3.4rem, 8vw, 7rem);
  line-height: 0.9;
  margin: 0 0 18px;
}

.hero-text {
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(1.05rem, 2.4vw, 1.35rem);
  line-height: 1.55;
  margin: 0;
  max-width: 740px;
}

.eyebrow {
  color: var(--brand-2);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  margin: 0 0 10px;
  text-transform: uppercase;
}

.hero-actions,
.workspace-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.primary-button,
.secondary-button,
.telegram-button,
.ghost-button {
  align-items: center;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  font-weight: 850;
  gap: 8px;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.primary-button {
  background: var(--accent);
  color: white;
  box-shadow: 0 12px 28px rgba(239, 68, 68, 0.26);
}

.secondary-button {
  background: rgba(255, 255, 255, 0.13);
  color: white;
  outline: 1px solid rgba(255, 255, 255, 0.22);
}

.telegram-button {
  background: #0879b2;
  color: white;
  box-shadow: 0 12px 28px rgba(34, 158, 217, 0.24);
}

.ghost-button {
  background: var(--surface-soft);
  color: var(--brand);
}

.primary-button:hover,
.secondary-button:hover,
.telegram-button:hover,
.ghost-button:hover,
.tool-card:hover {
  transform: translateY(-2px);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--brand-2);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

.hero-panel {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.panel-header {
  align-items: center;
  color: rgba(255, 255, 255, 0.84);
  display: flex;
  font-weight: 800;
  gap: 8px;
}

.status-dot {
  background: var(--success);
  border-radius: 99px;
  display: inline-block;
  height: 10px;
  width: 10px;
}

.quick-list {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.quick-list span {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  font-weight: 750;
  padding: 14px;
}

.tools-section,
.workspace,
.benefits,
.nexora-band {
  padding: clamp(46px, 7vw, 82px) clamp(18px, 5vw, 72px);
}

.section-heading {
  margin: 0 auto 30px;
  max-width: 780px;
  text-align: center;
}

.section-heading h2,
.workspace-header h2,
.info-band h2 {
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 1;
  margin: 0 0 12px;
}

.section-heading p,
.info-band p,
.workspace-header p {
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}

.tool-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  margin: 0 auto;
  max-width: 1180px;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(16, 24, 40, 0.05);
  cursor: pointer;
  min-height: 190px;
  padding: 22px;
  text-align: left;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
  position: relative;
}

.tool-card-cta {
  align-items: center;
  color: var(--accent-text);
  display: inline-flex;
  font-size: 0.9rem;
  font-weight: 900;
  gap: 6px;
  margin-top: 18px;
}

.tool-card.active {
  border-color: var(--brand);
  box-shadow: 0 18px 40px rgba(0, 105, 255, 0.14);
}

.tool-icon {
  align-items: center;
  background: var(--surface-soft);
  border-radius: 8px;
  color: var(--brand);
  display: inline-flex;
  height: 46px;
  justify-content: center;
  margin-bottom: 16px;
  width: 46px;
}

.tool-card h3 {
  font-size: 1.18rem;
  margin: 0 0 8px;
}

.tool-card p {
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

.workspace {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  scroll-margin-top: 74px;
}

.workspace-header {
  align-items: start;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin: 0 auto 22px;
  max-width: 980px;
}

.workspace-header-actions {
  display: inline-flex;
  gap: 8px;
}

.icon-button {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  height: 44px;
  justify-content: center;
  min-width: 44px;
}

.dropzone {
  align-items: center;
  background: var(--surface-soft);
  border: 2px dashed #b7c7dc;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  gap: 10px;
  justify-items: center;
  margin: 0 auto;
  max-width: 980px;
  min-height: 220px;
  padding: 28px;
  text-align: center;
}

.dropzone.dragging {
  background: rgba(0, 105, 255, 0.08);
  border-color: var(--brand);
}

.dropzone input {
  display: none;
}

.dropzone svg {
  color: var(--brand);
  height: 42px;
  width: 42px;
}

.dropzone strong {
  color: var(--ink);
  font-size: clamp(1.25rem, 3vw, 2rem);
  line-height: 1.1;
}

.dropzone small {
  color: var(--muted);
}

.privacy-note {
  align-items: center;
  background: rgba(17, 163, 106, 0.1);
  border: 1px solid rgba(17, 163, 106, 0.26);
  border-radius: 8px;
  color: var(--success);
  display: inline-flex;
  font-size: 0.9rem;
  font-weight: 850;
  gap: 8px;
  margin-top: 6px;
  padding: 8px 10px;
}

.privacy-note svg {
  height: 18px;
  width: 18px;
}

.select-file-button {
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  box-shadow: 0 14px 30px rgba(239, 68, 68, 0.28);
  color: white;
  cursor: pointer;
  font-weight: 900;
  min-height: 52px;
  padding: 0 24px;
}

.options,
.output-options,
.file-list,
.workspace-actions {
  margin-left: auto;
  margin-right: auto;
  max-width: 980px;
}

.options {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 18px;
}

.output-options {
  margin-top: 18px;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.field-label {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.signature-field {
  grid-column: 1 / -1;
}

.signature-canvas {
  background: var(--surface);
  border: 2px solid var(--brand);
  border-radius: 10px;
  height: 150px;
  max-width: 640px;
  touch-action: none;
  width: 100%;
}

.signature-clear {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
  justify-self: start;
  min-height: 38px;
  padding: 0 14px;
}

.option-note {
  align-items: center;
  background: rgba(0, 105, 255, 0.08);
  border: 1px solid rgba(0, 105, 255, 0.18);
  border-radius: 8px;
  color: var(--muted);
  display: flex;
  gap: 10px;
  line-height: 1.45;
  padding: 12px;
}

.option-note svg {
  color: var(--brand);
  flex: 0 0 auto;
}

.field input,
.field select {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 44px;
  padding: 0 12px;
}

.file-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.file-item {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: auto 1fr auto auto;
  padding: 12px;
}

.file-item[draggable="true"] {
  cursor: grab;
}

.file-item svg {
  color: var(--accent);
}

.file-meta {
  min-width: 0;
}

.file-name {
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  color: var(--muted);
  font-size: 0.88rem;
}

.remove-file {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
}

.file-order-actions {
  align-items: center;
  display: inline-flex;
  gap: 4px;
}

.move-file {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.move-file:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.preview-panel {
  margin: 20px auto 0;
  max-width: 980px;
}

.preview-header {
  align-items: end;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.preview-header h3 {
  margin: 0;
}

.preview-header p,
.preview-empty {
  color: var(--muted);
  margin: 0;
}

.preview-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
}

.preview-card {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  min-height: 136px;
  padding: 10px;
}

.preview-card img {
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
  height: 150px;
  object-fit: contain;
  width: 100%;
}

.preview-page-button {
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 0;
}

.page-preview.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14);
}

.page-preview.deleted {
  opacity: 0.45;
}

.page-preview.deleted img {
  filter: grayscale(1);
}

.page-actions {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(3, 1fr);
}

.page-actions button {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  height: 32px;
  justify-content: center;
}

.preview-card strong {
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-card span {
  color: var(--muted);
  font-size: 0.82rem;
}

.preview-file-icon,
.preview-more {
  align-items: center;
  color: var(--brand);
  display: grid;
  justify-content: center;
}

.preview-file-icon {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  height: 70px;
}

.preview-more {
  min-height: 180px;
  text-align: center;
}

.preview-more strong {
  font-size: 2rem;
}

.progress-wrap {
  margin: 18px auto 0;
  max-width: 980px;
}

.progress-bar {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  height: 12px;
  overflow: hidden;
}

.progress-bar span {
  background: linear-gradient(90deg, var(--accent), var(--brand));
  display: block;
  height: 100%;
  transition: width 180ms ease;
  width: 0;
}

.progress-wrap p {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 8px 0 0;
}

#statusText {
  color: var(--muted);
  margin: 0;
}

.info-band {
  align-items: center;
  background: var(--dark-band);
  color: white;
  display: grid;
  gap: 26px;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr);
  padding: clamp(42px, 7vw, 76px) clamp(18px, 6vw, 84px);
}

.info-band p {
  color: rgba(255, 255, 255, 0.74);
}

.benefits-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  margin: 0 auto;
  max-width: 980px;
}

.benefits-grid article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
}

.benefits-grid svg {
  color: var(--brand);
}

.benefits-grid h3 {
  margin: 14px 0 8px;
}

.benefits-grid p {
  color: var(--muted);
  line-height: 1.55;
  margin: 0;
}

.nexora-band {
  align-items: center;
  background: var(--surface);
  border-top: 1px solid var(--line);
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.nexora-band h2 {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
  margin: 0 0 12px;
}

.nexora-band p:last-child {
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
  max-width: 760px;
}

.nexora-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.footer {
  align-items: center;
  background: #050b17;
  color: rgba(255, 255, 255, 0.74);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  padding: 24px clamp(18px, 5vw, 72px);
}

.footer span:first-child {
  color: white;
  font-weight: 900;
}

.not-found {
  align-content: center;
  background:
    radial-gradient(circle at 70% 20%, rgba(18, 215, 232, 0.14), transparent 28%),
    linear-gradient(135deg, var(--hero-start), var(--hero-end));
  color: white;
  display: grid;
  justify-items: center;
  min-height: 100vh;
  padding: 32px;
  text-align: center;
}

.not-found img {
  border-radius: 50%;
  height: 82px;
  margin-bottom: 22px;
  width: 82px;
}

.not-found h1 {
  font-size: clamp(2.4rem, 7vw, 5rem);
  line-height: 1;
  margin: 0 0 14px;
}

.not-found p:not(.eyebrow) {
  color: rgba(255, 255, 255, 0.78);
  margin: 0 0 26px;
}

@media (max-width: 780px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .nav {
    display: none;
  }

  .hero,
  .info-band,
  .nexora-band {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    padding-top: 46px;
  }

  .hero-panel {
    order: -1;
  }

  .workspace-header,
  .file-item {
    grid-template-columns: auto 1fr auto;
  }

  .file-order-actions {
    grid-column: 2 / 3;
  }

  .preview-header {
    align-items: start;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .ghost-button {
    display: none;
  }

  .hero-actions,
  .workspace-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }
}
