:root {
  --ink: #0b1531;
  --muted: #4f5f7a;
  --blue: #0f62fe;
  --blue-strong: #0849c5;
  --blue-soft: #eff6ff;
  --green: #13a35b;
  --green-soft: #eafaf2;
  --amber: #b96b0d;
  --amber-soft: #fff7e8;
  --surface: #ffffff;
  --soft: #f6f9ff;
  --line: #d8e2ef;
  --line-strong: #c2cfdf;
  --shadow: 0 18px 42px rgba(24, 40, 72, 0.1);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 10%, rgba(15, 98, 254, 0.06), transparent 28%),
    linear-gradient(180deg, #fbfdff 0%, #f7faff 54%, #fbfdff 100%);
  font-family: Inter, "Segoe UI", sans-serif;
  font-size: 15px;
  letter-spacing: 0;
  overflow-x: hidden;
}

body.is-dark {
  --ink: #eef5ff;
  --muted: #aab8cf;
  --surface: #111c31;
  --soft: #0b1528;
  --line: #263854;
  --line-strong: #38506f;
  background: linear-gradient(180deg, #091326 0%, #0d172a 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  align-items: center;
  gap: 28px;
  min-height: 66px;
  padding: 10px 36px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
}

body.is-dark .site-header {
  background: rgba(10, 19, 35, 0.92);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  width: fit-content;
  font-size: 22px;
  font-weight: 500;
  color: #59657a;
  white-space: nowrap;
}

.brand strong {
  color: var(--blue);
  font-weight: 800;
}

.brand-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-size: 18px;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 36px;
  color: #1f2a44;
  font-weight: 600;
}

body.is-dark .main-nav {
  color: #d9e4f7;
}

.main-nav a:hover {
  color: var(--blue);
}

.theme-button,
.icon-button,
.small-button,
.wide-clear {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
}

.theme-button {
  justify-self: end;
  width: 42px;
  height: 36px;
  font-size: 18px;
}

.page-shell {
  width: min(1450px, calc(100vw - 56px));
  margin: 0 auto;
  padding: 28px 0 46px;
}

.hero {
  margin-bottom: 24px;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(34px, 4vw, 48px);
  line-height: 1.08;
  letter-spacing: 0;
}

.hero p {
  max-width: 780px;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}

.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 30px;
  margin-top: 22px;
  color: #2d3a55;
  font-size: 14px;
  font-weight: 600;
}

body.is-dark .trust-row {
  color: #b7c7dc;
}

.trust-row span {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.trust-row span span {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  color: var(--blue);
}

.converter-grid {
  display: grid;
  grid-template-columns: minmax(440px, 1.18fr) minmax(260px, 0.58fr) minmax(440px, 1.08fr);
  gap: 18px;
  align-items: stretch;
}

.upload-column {
  display: grid;
  gap: 12px;
}

.dropzone,
.queue-card,
.options-panel,
.preview-panel,
.info-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

body.is-dark .dropzone,
body.is-dark .queue-card,
body.is-dark .options-panel,
body.is-dark .preview-panel,
body.is-dark .info-panel {
  background: rgba(17, 28, 49, 0.94);
}

.dropzone {
  position: relative;
  display: grid;
  min-height: 174px;
  place-items: center;
  padding: 26px;
  border: 2px dashed var(--blue);
  text-align: center;
  background: linear-gradient(180deg, rgba(247, 251, 255, 0.96), rgba(255, 255, 255, 0.96));
}

body.is-dark .dropzone {
  background: linear-gradient(180deg, rgba(14, 26, 48, 0.96), rgba(18, 31, 53, 0.96));
}

.dropzone.is-dragging {
  background: var(--blue-soft);
  outline: 3px solid rgba(15, 98, 254, 0.12);
}

.dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.upload-icon {
  color: var(--blue);
  font-size: 36px;
  font-weight: 800;
}

.dropzone p {
  margin: 4px 0;
  color: var(--muted);
}

.dropzone p strong {
  color: var(--ink);
}

.drop-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.primary-button,
.download-button {
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  color: #fff;
  font-weight: 800;
}

.primary-button {
  padding: 0 24px;
  background: var(--blue);
  box-shadow: 0 12px 24px rgba(15, 98, 254, 0.22);
}

.primary-button:hover {
  background: var(--blue-strong);
}

.download-button {
  padding: 0 24px;
  background: var(--green);
  box-shadow: 0 12px 24px rgba(19, 163, 91, 0.22);
}

.download-button:disabled {
  cursor: not-allowed;
  background: #91a0b9;
  box-shadow: none;
}

.queue-card,
.options-panel,
.preview-panel,
.info-panel {
  padding: 18px;
}

.card-heading,
.preview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.heading-actions {
  display: flex;
  gap: 8px;
}

.small-button {
  min-height: 34px;
  padding: 0 12px;
  color: #26334d;
  font-weight: 700;
}

body.is-dark .small-button,
body.is-dark .icon-button,
body.is-dark .wide-clear {
  color: #dfe9f8;
}

.file-list {
  display: grid;
  gap: 0;
}

.file-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto 24px;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  border-top: 1px solid var(--line);
}

.file-row:first-child {
  border-top: 0;
}

.file-thumb,
.rail-thumb,
.paper-image {
  background:
    linear-gradient(135deg, rgba(15, 98, 254, 0.18), rgba(19, 163, 91, 0.16)),
    linear-gradient(145deg, #d8e5ff 0%, #eef5ff 45%, #c7ead8 100%);
}

.file-thumb {
  width: 48px;
  height: 38px;
  border-radius: 4px;
  background-size: cover;
  background-position: center;
}

.file-meta strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta span {
  display: inline-flex;
  gap: 8px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.file-state {
  min-width: 118px;
  text-align: right;
}

.state-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--green-soft);
  color: #087444;
  font-size: 12px;
  font-weight: 800;
}

.state-pill.waiting {
  background: #f2f5fa;
  color: #60708b;
}

.state-pill.warning {
  background: var(--amber-soft);
  color: var(--amber);
}

.progress-wrap {
  display: grid;
  gap: 5px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.progress-bar {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #dce6f5;
}

.progress-bar span {
  display: block;
  height: 100%;
  width: 45%;
  border-radius: inherit;
  background: var(--blue);
}

.remove-file {
  border: 0;
  background: transparent;
  color: #76839a;
  font-size: 18px;
}

.options-panel {
  display: grid;
  align-content: start;
  gap: 16px;
}

.options-panel label {
  display: grid;
  gap: 7px;
  color: #1f2d46;
  font-weight: 700;
}

body.is-dark .options-panel label {
  color: #e6eefb;
}

.options-panel select {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
}

.toggle-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.toggle-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-weight: 500;
}

.toggle-row input {
  width: 42px;
  height: 22px;
  accent-color: var(--blue);
}

.tip-box {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  margin-top: 4px;
  padding: 14px;
  border-radius: 8px;
  background: var(--blue-soft);
  color: #244160;
}

body.is-dark .tip-box {
  color: #d6e8ff;
  background: rgba(15, 98, 254, 0.18);
}

.tip-box span {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.tip-box p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}

.status-pill {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 0 12px;
  border: 1px solid #b9ebd4;
  border-radius: 6px;
  background: var(--green-soft);
  color: #087444;
  font-size: 12px;
  font-weight: 800;
}

.preview-layout {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 18px;
  min-height: 322px;
}

.thumbnail-rail {
  display: grid;
  align-content: start;
  gap: 12px;
}

.rail-button {
  position: relative;
  display: grid;
  gap: 4px;
  padding: 4px;
  border: 2px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
}

.rail-button.is-active {
  border-color: var(--blue);
}

.rail-thumb {
  width: 64px;
  height: 48px;
  border-radius: 4px;
  background-size: cover;
  background-position: center;
}

.rail-button span {
  justify-self: center;
  display: grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  font-size: 12px;
  font-weight: 700;
}

.preview-stage {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #27405f;
  font-weight: 700;
}

body.is-dark .preview-toolbar {
  color: #dbe7f8;
}

.icon-button {
  width: 30px;
  height: 30px;
  font-weight: 800;
}

.pdf-paper {
  display: grid;
  width: min(315px, 100%);
  min-height: 268px;
  place-items: center;
  padding: 26px;
  border: 1px solid var(--line);
  background: #f7f9fc;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.8);
}

body.is-dark .pdf-paper {
  background: #0b1424;
}

.paper-image {
  width: 100%;
  aspect-ratio: 1.34;
  border: 1px solid #d0d8e5;
  background-size: cover;
  background-position: center;
  box-shadow: 0 16px 34px rgba(20, 33, 59, 0.16);
}

.paper-image.is-empty {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #eef4ff, #f8fbff);
  color: var(--muted);
  text-align: center;
}

.paper-image.is-empty::after {
  content: "Upload HEIC files to preview PDF pages";
  max-width: 180px;
  line-height: 1.4;
}

.preview-meta {
  color: var(--muted);
  font-size: 13px;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

.wide-clear {
  width: 100%;
  min-height: 38px;
  margin-top: 10px;
  font-weight: 700;
}

.support-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.support-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(360px, 1fr) minmax(320px, 0.9fr);
  gap: 18px;
  margin-top: 18px;
}

.info-panel {
  min-height: 260px;
}

.timeline-list {
  display: grid;
  gap: 22px;
  padding: 0;
  margin: 20px 0 0;
  list-style: none;
}

.timeline-list li {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 16px;
}

.timeline-list li > span {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
}

.timeline-list strong {
  display: block;
  margin-bottom: 4px;
}

.timeline-list p,
.browser-note,
.detail-panel p,
.checklist-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.detail-panel p + p,
.checklist-panel p + p {
  margin-top: 14px;
}

.settings-list,
.checklist {
  display: grid;
  gap: 11px;
  padding: 0;
  margin: 16px 0;
  list-style: none;
}

.settings-list li,
.checklist li {
  position: relative;
  padding-left: 24px;
  color: var(--muted);
  line-height: 1.48;
}

.settings-list li::before,
.checklist li::before {
  position: absolute;
  left: 0;
  top: 2px;
  display: grid;
  width: 16px;
  height: 16px;
  place-items: center;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
  content: "✓";
  font-size: 10px;
  font-weight: 800;
}

.settings-list strong {
  color: var(--ink);
}

.example-table {
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.example-row {
  display: grid;
  grid-template-columns: 1.4fr 0.75fr 1fr 0.8fr;
  border-top: 1px solid var(--line);
}

.example-row:first-child {
  border-top: 0;
}

.example-row span {
  padding: 12px 14px;
  border-left: 1px solid var(--line);
}

.example-row span:first-child {
  border-left: 0;
}

.example-head {
  background: var(--soft);
  font-size: 13px;
  font-weight: 800;
}

.browser-note {
  margin-top: 16px;
}

.faq-list {
  margin-top: 14px;
  border-top: 1px solid var(--line);
}

.faq-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-height: 52px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-weight: 800;
}

.faq-answer {
  display: none;
  padding: 0 0 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.5;
}

.faq-answer.is-open {
  display: block;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 40;
  transform: translateY(20px);
  padding: 12px 16px;
  border-radius: 7px;
  background: #08182f;
  color: #fff;
  opacity: 0;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  pointer-events: none;
}

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

@media (max-width: 1180px) {
  .converter-grid,
  .support-grid {
    grid-template-columns: 1fr;
  }

  .preview-layout {
    grid-template-columns: 72px minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .site-header {
    grid-template-columns: 1fr auto;
    padding: 10px 16px;
  }

  .main-nav {
    grid-column: 1 / -1;
    justify-content: space-between;
    gap: 12px;
    overflow-x: auto;
    font-size: 13px;
  }

  .brand {
    font-size: 18px;
  }

  .page-shell {
    width: min(100% - 24px, 640px);
    padding-top: 20px;
  }

  .trust-row {
    gap: 12px;
  }

  .dropzone {
    min-height: 190px;
    padding: 20px 14px;
  }

  .card-heading,
  .preview-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .file-row {
    grid-template-columns: 52px minmax(0, 1fr) 22px;
  }

  .file-state {
    grid-column: 2 / 3;
    text-align: left;
  }

  .preview-layout {
    grid-template-columns: 1fr;
  }

  .thumbnail-rail {
    display: flex;
    overflow-x: auto;
  }

  .action-row,
  .example-row {
    grid-template-columns: 1fr;
  }

  .example-row span {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .example-row span:first-child {
    border-top: 0;
  }
}
