:root {
  color-scheme: dark;
  --bg: #05060c;
  --surface: rgba(15, 18, 34, 0.86);
  --surface-strong: rgba(11, 14, 28, 0.96);
  --card: rgba(255,255,255,0.03);
  --border: rgba(116, 255, 175, 0.16);
  --border-strong: rgba(116, 255, 175, 0.34);
  --text: #f2f7ff;
  --muted: rgba(223, 232, 250, 0.68);
  --emerald: #74ffaf;
  --cyan: #54f3ff;
  --violet: #8c74ff;
  --shadow: 0 28px 76px rgba(0, 0, 0, 0.42);
  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-md: 18px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Manrope", sans-serif;
  background:
    radial-gradient(circle at 0% 10%, rgba(116, 255, 175, 0.12), transparent 30%),
    radial-gradient(circle at 85% 18%, rgba(84, 243, 255, 0.12), transparent 24%),
    linear-gradient(180deg, #060811 0%, #04050a 52%, #030409 100%);
  color: var(--text);
  overflow-x: hidden;
}

.page-noise,
.page-grid,
.page-orb {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.page-noise {
  opacity: 0.05;
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,0.55) 1px, transparent 0);
  background-size: 24px 24px;
}

.page-grid {
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(116, 255, 175, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(116, 255, 175, 0.12) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.55), transparent 92%);
}

.page-orb {
  filter: blur(90px);
  opacity: 0.38;
}

.page-orb--emerald {
  inset: auto auto 72% -7%;
  width: 420px;
  height: 420px;
  background: rgba(116, 255, 175, 0.2);
}

.page-orb--violet {
  inset: 10% -10% auto auto;
  width: 360px;
  height: 360px;
  background: rgba(140, 116, 255, 0.18);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1320px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 24px 0 72px;
}

.app-header,
.hero-panel,
.panel,
.footer-panel {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(14, 18, 36, 0.92), rgba(8, 11, 22, 0.88));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 22px;
  border-radius: var(--radius-lg);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: var(--emerald);
  background: linear-gradient(135deg, rgba(116, 255, 175, 0.2), rgba(84, 243, 255, 0.16));
  border: 1px solid rgba(116, 255, 175, 0.24);
}

.brand-icon svg {
  width: 28px;
  height: 28px;
}

.brand-kicker,
.panel-eyebrow,
.hero-eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--emerald);
  font-family: "Orbitron", sans-serif;
}

.brand-name {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.1);
  text-decoration: none;
  color: var(--text);
  background: rgba(255,255,255,0.03);
  transition: transform 180ms ease, border-color 180ms ease, color 180ms ease;
}

.back-link:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  color: var(--emerald);
}

.back-link svg {
  width: 16px;
  height: 16px;
}

.hero-panel {
  margin-top: 20px;
  padding: 34px 34px 30px;
  border-radius: var(--radius-xl);
  display: flex;
  justify-content: space-between;
  gap: 24px;
}

.hero-copy {
  max-width: 760px;
}

.hero-title {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: baseline;
  font-size: clamp(34px, 6vw, 68px);
  line-height: 0.98;
  font-weight: 800;
}

.accent-word {
  background: linear-gradient(135deg, var(--emerald), var(--cyan), var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-description {
  margin: 18px 0 0;
  max-width: 760px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.8;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-content: flex-start;
  justify-content: flex-end;
}

.hero-badge {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  font-size: 13px;
  color: rgba(242, 247, 255, 0.8);
}

.workspace {
  margin-top: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  gap: 22px;
}

.panel {
  border-radius: var(--radius-xl);
  padding: 28px;
}

.panel-header h2 {
  margin: 0;
  font-size: 28px;
}

.upload-zone,
.queue-card,
.preview-shell,
.preview-empty,
.notes-list,
.stat-card,
.meta-card {
  border: 1px solid rgba(255,255,255,0.08);
  background: var(--card);
}

.upload-zone {
  display: grid;
  place-items: center;
  text-align: center;
  gap: 10px;
  min-height: 220px;
  margin-top: 18px;
  padding: 26px;
  border-radius: 24px;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.upload-zone:hover,
.upload-zone.is-dragging {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  background: rgba(116, 255, 175, 0.06);
}

.upload-zone input {
  display: none;
}

.upload-icon {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  color: var(--emerald);
  background: linear-gradient(135deg, rgba(116, 255, 175, 0.18), rgba(84, 243, 255, 0.14));
}

.upload-icon svg {
  width: 34px;
  height: 34px;
}

.upload-zone h3 {
  margin: 0;
  font-size: 28px;
}

.upload-zone p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.upload-badge {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(242, 247, 255, 0.8);
  font-size: 12px;
}

.queue-card,
.setting-block,
.action-row,
.stats-grid,
.preview-meta,
.notes-list {
  margin-top: 18px;
}

.queue-card {
  border-radius: 22px;
  padding: 18px;
}

.queue-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.queue-card__label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.queue-card__name {
  margin: 0;
  font-size: 15px;
  line-height: 1.7;
}

.queue-card__placeholder {
  color: var(--muted);
}

.queue-card__chip {
  min-width: 42px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
  text-align: center;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.stats-grid--compact {
  grid-template-columns: 1fr;
}

.stat-card,
.meta-card {
  border-radius: 18px;
  padding: 14px 16px;
}

.stat-card span,
.meta-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-card strong,
.meta-card strong {
  font-size: 14px;
  line-height: 1.5;
}

.setting-label {
  display: block;
  margin-bottom: 12px;
  font-size: 14px;
  color: rgba(242, 247, 255, 0.92);
}

.field-hint {
  margin: -2px 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.toggle-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.toggle-chip,
.action-btn {
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.toggle-chip {
  min-height: 84px;
  padding: 14px;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  text-align: left;
}

.toggle-chip strong {
  font-size: 15px;
}

.toggle-chip span {
  font-size: 12px;
  color: var(--muted);
}

.toggle-chip:hover,
.toggle-chip.is-active,
.action-btn:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  box-shadow: 0 14px 34px rgba(84, 243, 255, 0.12);
}

.toggle-chip.is-active {
  background: linear-gradient(135deg, rgba(116, 255, 175, 0.18), rgba(84, 243, 255, 0.12));
}

.queue-list {
  display: grid;
  gap: 10px;
}

.queue-empty {
  padding: 18px;
  border-radius: 18px;
  border: 1px dashed rgba(255,255,255,0.12);
  color: var(--muted);
  text-align: center;
}

.queue-item {
  display: grid;
  grid-template-columns: 24px 44px 72px minmax(0, 1fr) 40px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
}

.queue-item.is-over {
  border-color: var(--border-strong);
}

.queue-item.is-dragging {
  opacity: 0.6;
}

.queue-handle,
.queue-index,
.queue-delete {
  display: grid;
  place-items: center;
}

.queue-handle {
  color: var(--muted);
  cursor: grab;
}

.queue-index {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  color: var(--emerald);
  font-family: "Orbitron", sans-serif;
}

.queue-thumb {
  width: 72px;
  height: 72px;
  overflow: hidden;
  border-radius: 16px;
  background: rgba(255,255,255,0.05);
}

.queue-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.queue-meta strong,
.queue-meta span {
  display: block;
}

.queue-meta strong {
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
}

.queue-meta span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.queue-delete {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  cursor: pointer;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.action-btn {
  padding: 12px 16px;
  border-radius: 999px;
  font-size: 14px;
}

.action-btn--primary {
  background: linear-gradient(135deg, rgba(116, 255, 175, 0.2), rgba(84, 243, 255, 0.14));
  border-color: rgba(116, 255, 175, 0.3);
}

.action-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.preview-stage {
  position: relative;
  min-height: 420px;
  margin-top: 18px;
}

.preview-empty,
.preview-shell {
  min-height: 420px;
  border-radius: 26px;
}

.preview-empty {
  display: grid;
  place-items: center;
  text-align: center;
  padding: 36px;
}

.empty-icon {
  width: 84px;
  height: 84px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  color: var(--emerald);
  background: linear-gradient(135deg, rgba(116,255,175,0.18), rgba(84,243,255,0.14));
}

.empty-icon svg {
  width: 36px;
  height: 36px;
}

.preview-empty h3 {
  margin: 0;
  font-size: 28px;
}

.preview-empty p {
  max-width: 520px;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.8;
}

.preview-shell {
  overflow: hidden;
}

.preview-shell__head {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  color: var(--emerald);
  font-family: "Orbitron", sans-serif;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.preview-canvas-wrap {
  height: calc(100% - 47px);
  min-height: 373px;
  display: grid;
  place-items: center;
  padding: 24px;
}

#preview-canvas {
  width: 100%;
  max-width: 680px;
  height: auto;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
}

.preview-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.meta-card--wide {
  grid-column: span 2;
}

.notes-list {
  border-radius: 22px;
  padding: 20px 22px;
}

.notes-list h3 {
  margin: 0 0 14px;
  font-size: 18px;
}

.notes-list ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.8;
}

.footer-panel {
  margin-top: 24px;
  border-radius: var(--radius-xl);
  padding: 24px 28px;
}

.footer-copy h2 {
  margin: 0 0 10px;
  font-size: 28px;
}

.footer-copy p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.image-to-pdf-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  padding: 13px 16px;
  border-radius: 16px;
  border: 1px solid rgba(116,255,175,0.26);
  background: rgba(6, 10, 22, 0.92);
  color: var(--text);
  box-shadow: 0 18px 40px rgba(0,0,0,0.34);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.image-to-pdf-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.image-to-pdf-toast.is-error {
  border-color: rgba(255, 99, 133, 0.32);
}

@media (max-width: 1080px) {
  .workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100vw - 22px, 1320px);
    padding-top: 14px;
  }

  .app-header,
  .hero-panel,
  .panel,
  .footer-panel {
    padding-left: 18px;
    padding-right: 18px;
  }

  .app-header,
  .hero-panel {
    flex-direction: column;
    align-items: flex-start;
  }

  .toggle-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .stats-grid,
  .preview-meta {
    grid-template-columns: 1fr;
  }

  .meta-card--wide {
    grid-column: span 1;
  }

  .queue-item {
    grid-template-columns: 24px 44px minmax(0, 1fr) 40px;
  }

  .queue-thumb {
    display: none;
  }
}
