:root {
  --bg-top: #c9d4dd;
  --bg-bottom: #0b1c25;
  --paper: rgba(255, 251, 242, 0.92);
  --panel: rgba(22, 48, 65, 0.92);
  --ink: #24303a;
  --muted: #516271;
  --line: rgba(30, 115, 190, 0.16);
  --accent: #3fa9f5;
  --accent-dark: #1e73be;
  --accent-soft: rgba(63, 169, 245, 0.14);
  --gold: #f6c453;
  --gold-soft: rgba(246, 196, 83, 0.16);
  --success: #1d7a59;
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --shadow: 0 28px 90px rgba(6, 20, 31, 0.22);
  --tool-card-height: 1140px;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(201, 212, 221, 0.94), rgba(11, 28, 37, 0.96)),
    radial-gradient(circle, rgba(255,255,255,.12) 1px, transparent 1px);
  background-size: cover, 24px 24px;
  background-attachment: fixed, fixed;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  border-radius: 999px;
  pointer-events: none;
  filter: blur(8px);
}

body::before {
  width: 420px;
  height: 420px;
  top: -110px;
  right: -120px;
  background: rgba(246, 196, 83, 0.22);
}

body::after {
  width: 320px;
  height: 320px;
  left: -70px;
  bottom: 14%;
  background: rgba(63, 169, 245, 0.14);
}

body.auth-pending .page-shell {
  opacity: 0;
  pointer-events: none;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 0;
}

.intro-grid {
  display: grid;
  gap: 24px;
  margin-bottom: 28px;
}

.intro-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(300px, 0.95fr);
  gap: 24px;
  align-items: stretch;
  margin-top: 28px;
}

.hero-copy,
.hero-panel,
.tool-card,
.info-card {
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-copy {
  padding: 34px;
  border-radius: var(--radius-xl);
  background:
    linear-gradient(160deg, rgba(255, 251, 242, 0.96), rgba(239, 245, 249, 0.84));
}

.hero-copy h1 {
  margin: 0 0 14px;
  max-width: 12ch;
  font-size: clamp(2.4rem, 6vw, 4.8rem);
  line-height: 0.92;
  letter-spacing: -0.05em;
}

.hero-copy--wide h1 {
  max-width: 13ch;
}

.hero-copy--wide .lede {
  max-width: none;
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.hero-logo {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 24px rgba(30, 115, 190, 0.18);
  object-fit: cover;
}

.eyebrow,
.section-kicker,
.panel-label {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-dark);
}

.lede {
  margin: 0;
  max-width: 48ch;
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.7;
}

.hero-panel {
  padding: 28px;
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 24%),
    var(--panel);
  color: #f7f2ea;
  position: relative;
  overflow: hidden;
}

.hero-panel::after {
  content: "";
  position: absolute;
  inset: auto -40px -50px auto;
  width: 220px;
  height: 220px;
  border-radius: 999px;
  background: rgba(246, 196, 83, 0.18);
  filter: blur(18px);
}

.hero-mascot {
  position: relative;
  z-index: 1;
  display: block;
  width: min(100%, 260px);
  margin: 8px auto 18px;
  filter: drop-shadow(0 18px 34px rgba(0, 0, 0, 0.2));
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
  display: grid;
  gap: 12px;
}

.feature-menu {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
}

.feature-button {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.08);
  color: #f7f2ea;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
  display: grid;
  gap: 4px;
}

.feature-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}

.feature-button:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.12);
}

.feature-button:disabled:hover {
  transform: none;
  background: rgba(255, 255, 255, 0.05);
}

.feature-button.is-active {
  background: rgba(246, 196, 83, 0.18);
  border-color: rgba(246, 196, 83, 0.42);
  color: #fff8ea;
}

.feature-button.is-active:disabled {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
  color: rgba(247, 242, 234, 0.74);
}

.feature-button strong,
.feature-button span {
  display: block;
}

.feature-button strong {
  font-size: 0.98rem;
  font-weight: 700;
}

.feature-button span {
  color: rgba(247, 242, 234, 0.8);
  font-size: 0.82rem;
  line-height: 1.45;
}

.feature-button.is-active span {
  color: rgba(255, 248, 234, 0.88);
}

.feature-button.is-active:disabled span {
  color: rgba(247, 242, 234, 0.58);
}

.feature-list li {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  z-index: 1;
}

.tool-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.95fr) minmax(0, 1.75fr);
  gap: 24px;
  align-items: stretch;
}

.side-column {
  display: grid;
  gap: 24px;
  align-self: stretch;
}

.tool-column {
  display: grid;
  gap: 24px;
}

.tool-card,
.info-card {
  border-radius: var(--radius-xl);
  background: var(--paper);
}

.tool-card {
  padding: 28px;
}

.tool-card-main {
  min-width: 0;
  position: relative;
  height: var(--tool-card-height);
  min-height: var(--tool-card-height);
  max-height: var(--tool-card-height);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.functions-panel {
  height: var(--tool-card-height);
  min-height: var(--tool-card-height);
  max-height: var(--tool-card-height);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.tool-card-scroll {
  width: 100%;
  height: 100%;
  flex: 1 1 auto;
  max-height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 24px;
  overflow-y: auto;
  scrollbar-gutter: stable;
  padding-right: 8px;
}

.tool-card-scroll::-webkit-scrollbar {
  width: 10px;
}

.tool-card-scroll::-webkit-scrollbar-track {
  background: rgba(30, 115, 190, 0.08);
  border-radius: 999px;
}

.tool-card-scroll::-webkit-scrollbar-thumb {
  background: rgba(30, 115, 190, 0.28);
  border-radius: 999px;
}

.tool-card-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(30, 115, 190, 0.42);
}

.functions-panel.is-locked .hero-mascot {
  opacity: 0.68;
  filter: grayscale(0.18) drop-shadow(0 18px 34px rgba(0, 0, 0, 0.16));
}

.functions-lock-message {
  position: relative;
  z-index: 1;
  margin: 16px 0 0;
  color: rgba(247, 242, 234, 0.82);
  line-height: 1.55;
}

.subscription-card {
  padding: 28px;
  align-self: stretch;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.subscription-summary {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.info-card {
  padding: 28px;
  align-self: start;
}

.tool-header,
.queue-head,
.actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.tool-header h2,
.info-card h2,
.queue-head h3 {
  margin: 0;
}

.tool-title-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.tool-icon {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 14px 28px rgba(30, 115, 190, 0.14);
  object-fit: cover;
}

.beta-pill {
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: #6f4a00;
  font-weight: 700;
  font-size: 0.88rem;
}

.tool-panel {
  display: block;
}

.tool-panel-fusion {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  align-items: stretch;
}

.tool-panel-gallery {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  align-items: stretch;
}

.tool-card-main.is-locked > :not(.tool-access-overlay) {
  opacity: 0.34;
  filter: grayscale(0.22);
  pointer-events: none;
  user-select: none;
}

.tool-access-overlay {
  position: absolute;
  inset: 24px;
  display: grid;
  align-content: center;
  gap: 10px;
  padding: 28px;
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(255, 251, 242, 0.96), rgba(239, 245, 249, 0.94));
  border: 1px solid rgba(30, 115, 190, 0.12);
  box-shadow: 0 18px 44px rgba(6, 20, 31, 0.12);
  text-align: left;
  z-index: 4;
}

.tool-access-overlay h3 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

.tool-access-overlay .lede {
  max-width: none;
}

.tool-access-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.api-config {
  display: grid;
  gap: 8px;
  margin-top: 24px;
}

.api-config span {
  font-size: 0.9rem;
  font-weight: 700;
}

.field-hint {
  color: var(--muted);
  line-height: 1.5;
}

.api-config input,
.ghost-button,
.primary-button,
.download-link {
  border-radius: var(--radius-md);
  font: inherit;
}

.api-config input {
  width: 100%;
  border: 1px solid var(--line);
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.85);
}

.dropzone {
  position: relative;
  margin-top: 20px;
  padding: 28px;
  border: 2px dashed rgba(30, 115, 190, 0.28);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(63, 169, 245, 0.08)),
    #fff;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
  cursor: pointer;
}

.dropzone-large {
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fusion-dropzone {
  flex: 1 1 auto;
  min-height: 0;
  align-items: stretch;
  justify-content: flex-start;
  gap: 18px;
  overflow: hidden;
}

.tool-drop-gallery {
  flex: 1 1 auto;
  min-height: 0;
  align-items: stretch;
  justify-content: flex-start;
  gap: 18px;
  overflow: hidden;
}

.tool-drop-gallery input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  inset: auto;
  opacity: 0;
}

.tool-drop-gallery .dropzone-copy {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.tool-drop-gallery.has-content .dropzone-copy {
  display: none;
}

.tool-drop-gallery .page-list,
.tool-drop-gallery .file-list {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  align-content: start;
  overflow-y: auto;
  padding-right: 6px;
}

.tool-drop-gallery .page-list:empty,
.tool-drop-gallery .file-list:empty {
  display: none;
}

.tool-drop-gallery .page-row,
.tool-drop-gallery .file-item:not(.fusion-file-item) {
  grid-template-columns: 1fr;
  gap: 12px;
  align-content: start;
  padding: 12px;
}

.tool-drop-gallery .page-preview {
  width: 100%;
  min-width: 0;
  min-height: 152px;
}

.tool-drop-gallery .page-meta {
  align-items: center;
  text-align: center;
}

.tool-drop-gallery .page-actions,
.tool-drop-gallery .file-actions {
  justify-content: center;
  flex-wrap: wrap;
}

.fusion-dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  inset: auto;
  opacity: 0;
}

.fusion-dropzone-copy {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-right: 0;
  text-align: center;
}

.fusion-dropzone.has-files .fusion-dropzone-copy {
  display: none;
}

.fusion-dropzone-copy .drop-title {
  margin-bottom: 4px;
}

.fusion-dropzone-copy .drop-subtitle {
  max-width: 52ch;
  margin-left: auto;
  margin-right: auto;
}

.fusion-file-list {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
  align-content: start;
  overflow-y: auto;
  padding-right: 6px;
}

.file-list.fusion-file-list:empty {
  min-height: 0;
  display: none;
  border: 0;
  background: transparent;
  margin-top: 0;
}

.file-list.fusion-file-list:empty::before {
  content: none;
  display: none;
}

.file-item.fusion-file-item {
  grid-template-columns: 1fr;
  align-content: start;
  cursor: grab;
  gap: 12px;
  padding: 12px;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    margin 160ms ease,
    opacity 160ms ease;
}

.file-item.fusion-file-item.is-dragging {
  opacity: 0.72;
  transform: translateY(-6px) rotate(-1deg);
  border-color: rgba(30, 115, 190, 0.3);
  box-shadow: 0 26px 40px rgba(17, 43, 61, 0.18);
}

.file-item.fusion-file-item.is-drop-target {
  margin-top: 12px;
  border-color: rgba(30, 115, 190, 0.36);
  box-shadow:
    inset 0 0 0 2px rgba(63, 169, 245, 0.18),
    0 12px 28px rgba(63, 169, 245, 0.12);
}

.page-row.reorder-page-row {
  cursor: grab;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    margin 160ms ease,
    opacity 160ms ease;
}

.page-row.reorder-page-row.is-dragging {
  opacity: 0.72;
  transform: translateY(-6px) rotate(-1deg);
  border-color: rgba(30, 115, 190, 0.3);
  box-shadow: 0 26px 40px rgba(17, 43, 61, 0.18);
}

.page-row.reorder-page-row.is-drop-target {
  border-color: rgba(30, 115, 190, 0.36);
  box-shadow:
    inset 0 0 0 2px rgba(63, 169, 245, 0.18),
    0 12px 28px rgba(63, 169, 245, 0.12);
}

.page-row.reorder-page-row.is-drop-before {
  margin-top: 18px;
}

.page-row.reorder-page-row.is-drop-after {
  margin-bottom: 18px;
}

.fusion-file-preview {
  position: relative;
  min-height: 152px;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

.fusion-file-preview img,
.fusion-file-preview-placeholder {
  width: 116px;
  border-radius: 12px;
  border: 1px solid rgba(31, 40, 54, 0.1);
  box-shadow: 0 10px 24px rgba(31, 40, 54, 0.08);
  background: #fff;
}

.fusion-file-preview img {
  display: block;
  height: auto;
}

.fusion-file-preview-placeholder {
  min-height: 152px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(31, 40, 54, 0.03));
}

.reorder-page-preview {
  touch-action: none;
}

.reorder-page-row .page-preview img,
.reorder-page-row .page-preview-placeholder {
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.file-meta.fusion-file-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.file-meta.fusion-file-meta strong {
  display: block;
  width: 100%;
  white-space: normal;
  line-height: 1.4;
  overflow: visible;
  text-overflow: clip;
  word-break: break-word;
}

.file-meta.fusion-file-meta span {
  display: block;
  width: 100%;
  margin-top: 0;
}

.fusion-remove-button {
  width: 32px;
  height: 32px;
  min-width: 32px;
  padding: 0;
  display: grid;
  place-items: center;
  position: absolute;
  top: 8px;
  right: 8px;
  border-radius: 999px;
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1;
  background: #d83b3b !important;
  color: #fff !important;
  box-shadow: 0 10px 20px rgba(216, 59, 59, 0.28);
}

.fusion-remove-button:hover {
  background: #c52b2b !important;
}

.fusion-remove-button:disabled:hover {
  background: #d83b3b !important;
}

.dropzone:hover,
.dropzone:focus-visible,
.dropzone.is-active {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 18px 40px rgba(63, 169, 245, 0.16);
  outline: none;
}

.dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dropzone-copy {
  text-align: center;
}

.drop-title {
  margin: 0 0 6px;
  font-size: 1.16rem;
  font-weight: 700;
}

.drop-subtitle {
  margin: 0;
  color: var(--muted);
}

.queue-head {
  margin-top: 28px;
}

.file-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.page-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.file-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(31, 40, 54, 0.08);
}

.file-index {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--gold-soft);
  color: #6f4a00;
  font-weight: 800;
}

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

.file-meta strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

.rotation-badge {
  display: inline-flex;
  width: fit-content;
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.85rem;
  font-weight: 700;
}

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

.page-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(31, 40, 54, 0.08);
}

.page-row.is-removed {
  background: rgba(255, 241, 241, 0.92);
  border-color: rgba(170, 47, 47, 0.18);
}

.page-row.is-selected {
  background: rgba(235, 247, 255, 0.92);
  border-color: rgba(30, 115, 190, 0.18);
}

.page-row.is-duplicated {
  background: rgba(255, 248, 231, 0.92);
  border-color: rgba(246, 196, 83, 0.24);
}

.page-row.is-removed .page-preview img,
.page-row.is-removed .page-preview-placeholder {
  opacity: 0.52;
}

.page-preview {
  width: 152px;
  min-width: 152px;
  min-height: 152px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.remove-page-preview {
  position: relative;
}

.page-preview img,
.page-preview-placeholder {
  width: 116px;
  border-radius: 12px;
  border: 1px solid rgba(31, 40, 54, 0.1);
  box-shadow: 0 10px 24px rgba(31, 40, 54, 0.08);
  background: #fff;
}

.page-preview img {
  display: block;
  height: auto;
  transform-origin: center center;
  transition: transform 180ms ease;
}

.page-preview-placeholder {
  min-height: 152px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(31, 40, 54, 0.03));
  transform-origin: center center;
  transition: transform 180ms ease;
}

.page-meta {
  display: grid;
  gap: 8px;
}

.page-badge {
  display: inline-flex;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(31, 40, 54, 0.08);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.page-badge.is-active {
  background: var(--gold-soft);
  color: #6f4a00;
}

.page-badge.is-danger {
  background: rgba(170, 47, 47, 0.12);
  color: #aa2f2f;
}

.page-badge.is-accent {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.page-badge.is-gold {
  background: var(--gold-soft);
  color: #6f4a00;
}

.page-order-chip {
  display: inline-flex;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.85rem;
  font-weight: 700;
}

.page-caption {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.page-actions {
  display: flex;
  gap: 10px;
}

.remove-page-toggle {
  width: 32px;
  height: 32px;
  min-width: 32px;
  padding: 0;
  display: grid;
  place-items: center;
  position: absolute;
  top: 8px;
  right: 8px;
  border-radius: 999px;
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1;
  background: #d83b3b !important;
  color: #fff !important;
  box-shadow: 0 10px 20px rgba(216, 59, 59, 0.28);
}

.remove-page-toggle:hover {
  background: #c52b2b !important;
}

.mini-button,
.arrow-button,
.ghost-button,
.primary-button {
  border: 0;
  cursor: pointer;
}

.mini-button,
.arrow-button,
.ghost-button {
  padding: 10px 12px;
  background: rgba(31, 40, 54, 0.06);
  color: var(--ink);
}

.mini-button:hover,
.arrow-button:hover,
.ghost-button:hover {
  background: rgba(31, 40, 54, 0.1);
}

.mini-button:disabled,
.arrow-button:disabled,
.ghost-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.mini-button:disabled:hover,
.arrow-button:disabled:hover,
.ghost-button:disabled:hover {
  background: rgba(31, 40, 54, 0.06);
}

.mini-button.is-danger {
  background: rgba(170, 47, 47, 0.1);
  color: #8d2424;
}

.mini-button.is-danger:hover {
  background: rgba(170, 47, 47, 0.16);
}

.mini-button.is-accent {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.mini-button.is-accent:hover {
  background: rgba(63, 169, 245, 0.2);
}

.mini-button.is-gold {
  background: var(--gold-soft);
  color: #6f4a00;
}

.mini-button.is-gold:hover {
  background: rgba(246, 196, 83, 0.24);
}

.arrow-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  font-size: 1.15rem;
  font-weight: 700;
  padding: 0;
}

.actions {
  margin-top: 26px;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.inline-actions {
  margin-top: 18px;
}

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

.primary-button,
.download-link {
  padding: 14px 18px;
  text-decoration: none;
}

.primary-button {
  background: linear-gradient(135deg, #3fa9f5 0%, #1e73be 100%);
  color: #fff7f0;
  font-weight: 700;
  box-shadow: 0 16px 34px rgba(30, 115, 190, 0.28);
}

.primary-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.download-link {
  background: rgba(29, 122, 89, 0.12);
  color: var(--success);
  font-weight: 700;
}

.status {
  margin: 18px 0 0;
  min-height: 1.5em;
  color: var(--muted);
}

.status.is-error {
  color: #aa2f2f;
}

.status.is-success {
  color: var(--success);
}

.info-mascot-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}

.info-mascot {
  width: min(100%, 188px);
  filter: drop-shadow(0 14px 28px rgba(0, 0, 0, 0.18));
}

.info-card p {
  color: var(--muted);
  line-height: 1.7;
}

.info-block {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(63, 169, 245, 0.08);
}

.info-block strong,
.info-block code {
  display: block;
}

.info-block code {
  margin-top: 4px;
}

.closing-card {
  margin-top: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.closing-card h2 {
  margin: 0 0 14px;
  font-size: clamp(1.9rem, 4vw, 3rem);
  line-height: 0.96;
  letter-spacing: -0.04em;
}

.closing-card .info-block {
  margin-top: 16px;
}

.closing-card .lede {
  max-width: none;
}

.closing-link {
  display: inline-flex;
  margin-top: 18px;
}

.privacy-page .hero {
  display: grid;
  gap: 24px;
  margin-bottom: 28px;
}

.privacy-card {
  height: auto;
}

.privacy-article {
  display: grid;
  gap: 22px;
}

.privacy-section {
  display: grid;
  gap: 10px;
}

.privacy-section p,
.privacy-section li {
  margin: 0;
  color: var(--muted);
  line-height: 1.72;
}

.privacy-section ul {
  margin: 0;
  padding-left: 1.25rem;
  display: grid;
  gap: 8px;
}

.privacy-section a {
  color: var(--accent-dark);
}

.social-icons {
  text-align: center;
  margin: 1.8rem 0 0;
}

.social-icons a {
  display: inline-block;
  margin: 0 0.8em;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.social-icons img {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.social-icons a:hover img {
  transform: scale(1.2) rotate(5deg);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.site-footer {
  margin-top: 2.2rem;
  padding: 1.2rem 1rem 1.6rem;
  text-align: center;
  color: #fffdfa;
  background: linear-gradient(135deg, var(--accent-dark), rgba(11, 28, 37, 0.92));
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.site-footer a {
  color: #fff;
  font-weight: 900;
  text-decoration: none;
}

.site-footer-title {
  font-weight: 1000;
  letter-spacing: 0.2px;
  font-size: 1.05rem;
}

.site-footer-meta {
  opacity: 0.92;
  margin-top: 0.25rem;
  font-weight: 800;
}

.access-sections {
  display: grid;
  gap: 24px;
  margin-top: 24px;
}

.pricing-card .info-block code {
  font-size: 0.95rem;
  line-height: 1.55;
  white-space: normal;
}

.access-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.access-actions--billing {
  align-items: flex-start;
}

.access-actions--billing .status {
  width: 100%;
  margin-top: 0;
}

.offer-block {
  display: grid;
  gap: 4px;
}

.offer-meta {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.apple-apps-card {
  display: grid;
  gap: 14px;
}

.native-download-card {
  margin-top: 26px;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.95fr);
  gap: 22px;
  align-items: center;
}

.native-download-copy {
  display: grid;
  gap: 10px;
}

.native-download-copy h2 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.native-download-copy .subscription-summary {
  margin: 0;
}

.native-download-actions {
  display: grid;
  gap: 14px;
  justify-items: start;
}

.store-badge-link {
  display: inline-flex;
  align-items: center;
  transition: transform 180ms ease, filter 180ms ease;
}

.store-badge-link:hover {
  transform: translateY(-2px);
  filter: drop-shadow(0 12px 20px rgba(11, 28, 37, 0.14));
}

.store-badge {
  display: block;
  width: min(100%, 220px);
  height: auto;
}

.app-store-list {
  display: grid;
  gap: 14px;
  margin-top: 4px;
}

.app-store-item {
  display: grid;
  gap: 5px;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(63, 169, 245, 0.08);
  color: var(--ink);
  text-decoration: none;
  border: 1px solid rgba(30, 115, 190, 0.12);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.app-store-item:hover {
  transform: translateY(-1px);
  border-color: rgba(30, 115, 190, 0.28);
  box-shadow: 0 14px 30px rgba(30, 115, 190, 0.12);
}

.app-store-item strong {
  font-size: 1rem;
}

.app-store-item span {
  color: var(--muted);
  line-height: 1.55;
}

.legal-links {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.hidden,
.file-list:empty::before {
  display: none;
}

.file-list:empty,
.page-list:empty {
  min-height: 108px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(31, 40, 54, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.52);
}

.file-list:empty::before,
.page-list:empty::before {
  display: block;
  color: var(--muted);
}

.file-list:empty::before {
  content: "Aucun PDF ajoute pour le moment.";
}

.page-list:empty::before {
  content: "Les pages du PDF apparaitront ici.";
  color: var(--muted);
}

@media (max-width: 940px) {
  .intro-bottom,
  .tool-layout,
  .native-download-card,
  .access-grid {
    grid-template-columns: 1fr;
  }

  .hero-copy h1 {
    max-width: 100%;
  }

  .native-download-actions {
    justify-items: stretch;
  }
}

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

  .hero-copy,
  .hero-panel,
  .tool-card,
  .info-card,
  .closing-card {
    padding: 22px;
  }

  .tool-header,
  .queue-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .tool-title-wrap {
    align-items: flex-start;
  }

  .functions-panel,
  .tool-card-main {
    height: auto;
    min-height: 0;
    max-height: none;
  }

  .functions-panel,
  .tool-card-scroll {
    justify-content: flex-start;
  }

  .tool-card-scroll {
    overflow: visible;
    max-height: none;
    padding-right: 0;
  }

  .tool-icon {
    width: 56px;
    height: 56px;
    flex-basis: 56px;
  }

  .file-item {
    grid-template-columns: 1fr;
  }

  .file-actions {
    flex-wrap: wrap;
  }

  .page-row {
    grid-template-columns: 1fr;
  }

  .page-preview {
    width: 100%;
    justify-content: flex-start;
  }
}

/* Installation */
.install-settings { margin-top: 18px; padding: 22px; }
.install-settings summary { cursor: pointer; font-weight: 700; }
.install-settings p { line-height: 1.5; }
.install-suggestion { position: fixed; z-index: 1000; bottom: 20px; right: 20px; width: min(420px, calc(100vw - 40px)); padding: 24px; border-radius: var(--radius-lg); background: #fffaf0; color: var(--ink); box-shadow: var(--shadow); border: 1px solid var(--line); }
.install-suggestion[hidden] { display: none; }
.install-suggestion .actions { flex-wrap: wrap; }

/* Paramètres : accès discret et panneau dédié. */
body #openSettings.settings-fab { position: fixed; z-index: 10000; right: 24px; bottom: 24px; right: max(24px, env(safe-area-inset-right, 0px)); bottom: max(24px, env(safe-area-inset-bottom, 0px)); display: grid; place-items: center; width: 60px; height: 60px; border: 1px solid #ffffff70; border-radius: 50%; background: linear-gradient(145deg, #318fd5, #15558a); color: white; box-shadow: 0 8px 28px #06141f55, inset 0 1px 0 #ffffff50; cursor: pointer; transition: transform .25s, box-shadow .25s; }
.settings-fab svg { width: 28px; height: 28px; transition: transform .5s; }
.settings-fab:hover { transform: translateY(-3px); box-shadow: 0 12px 30px #06141f77; }
.settings-fab:hover svg { transform: rotate(60deg); }
.settings-fab:focus-visible, .settings-dialog :focus-visible { outline: 3px solid #e9aa22; outline-offset: 4px; }
.settings-open { overflow: hidden; }
.settings-dialog { width: min(680px, calc(100% - 28px)); max-height: calc(100dvh - 40px); padding: 0; border: 1px solid #ffffff90; border-radius: 28px; background: #f6f8fa; color: var(--ink); box-shadow: 0 32px 100px #06141f66; overscroll-behavior: contain; }
.settings-dialog::backdrop { background: #081c32a8; backdrop-filter: blur(8px); }
.settings-dialog[open] { animation: settings-enter .25s ease-out; }
.settings-header { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 24px 28px; background: #f6f8faf5; border-bottom: 1px solid var(--line); }
.settings-header h2 { margin: 4px 0 0; font-size: 30px; }
.settings-header .section-kicker { margin: 0; }
.settings-close { display: grid; place-items: center; flex-shrink: 0; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; background: white; color: var(--ink); font: 28px/1 sans-serif; cursor: pointer; }
.settings-content { display: grid; gap: 16px; padding: 24px; }
.settings-section { padding: 24px; border: 1px solid var(--line); border-radius: 20px; background: white; }
.settings-section .section-kicker { margin: 0 0 10px; font-size: 11px; }
.settings-section h3 { margin: 0 0 10px; font-size: 21px; }
.settings-section p { line-height: 1.6; color: var(--muted); margin: 10px 0 16px; }
.settings-install { background: linear-gradient(135deg, #e9f4ff, #fff8e8); }
.install-button { position: relative; isolation: isolate; overflow: hidden; display: flex; align-items: center; gap: 16px; width: 100%; padding: 16px 20px; text-align: left; color: white; border: 1px solid #ffffff70; border-radius: 18px; background: linear-gradient(115deg, #15558a, #247fc2, #196aa6); box-shadow: 0 8px 22px #1e73be30; cursor: pointer; transition: transform .25s, box-shadow .25s; font: inherit; }
.install-button::after { content: ''; position: absolute; z-index: -1; inset: 0; background: linear-gradient(110deg, transparent 25%, #ffffff25 48%, transparent 70%); transform: translateX(-120%); animation: install-shimmer 5s ease-in-out infinite; }
.install-button:hover { transform: translateY(-2px); box-shadow: 0 12px 28px #1e73be45; }
.install-logo { display: grid; place-items: center; width: 58px; height: 58px; flex-shrink: 0; background: #fff; border-radius: 16px; }
.install-logo img { width: 48px; height: 48px; object-fit: contain; animation: install-float 4s ease-in-out infinite; }
.install-button strong { display: block; font-size: 18px; }
.install-button small { display: block; margin-top: 5px; color: #e5f3ff; font-size: 12px; }
.install-button > svg { margin-left: auto; width: 24px; height: 24px; flex-shrink: 0; }
.install-button:disabled { cursor: default; opacity: .75; transform: none; box-shadow: none; }
.install-button:disabled::after, .install-button:disabled img { animation: none; }
.settings-link { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; color: #15558a; font-weight: 600; text-decoration: none; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.settings-link:hover { text-decoration: underline; }
.settings-account-status { overflow-wrap: anywhere; }
.settings-free-badge { display: inline-block; margin-left: 8px; padding: 5px 10px; border-radius: 30px; font-size: 15px; background: #e5f5ed; color: #196747; }
.settings-facts { display: grid; gap: 14px; padding: 16px; border-radius: 12px; background: #f5f8fa; }
.settings-facts strong, .settings-facts span { display: block; font-size: 14px; line-height: 1.6; }
.settings-facts span { color: var(--muted); }
.settings-dialog [hidden] { display: none; }
.site-footer { padding-bottom: 100px; }
.install-suggestion { bottom: 96px; }
@keyframes settings-enter { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes install-shimmer { 0%, 55% { transform: translateX(-120%); } 85%, 100% { transform: translateX(120%); } }
@keyframes install-float { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-3px) rotate(3deg); } }
@media (max-width: 520px) { .settings-header { padding: 20px; } .settings-content { padding: 12px; gap: 12px; } .settings-section { padding: 20px 16px; } .install-button { gap: 12px; padding: 14px; } .install-button strong { font-size: 16px; } .install-logo { width: 48px; height: 48px; } .install-logo img { width: 40px; height: 40px; } }
@media (prefers-reduced-motion: reduce) { .settings-dialog[open], .install-button::after, .install-logo img { animation: none; } .settings-fab, .settings-fab svg, .install-button { transition: none; } }

.icon-definitions { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
.pictogram { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tool-icon.pictogram { padding: 14px; color: #15558a; }
.feature-button { position: relative; padding-left: 64px; }
.feature-icon { position: absolute; left: 18px; top: 20px; width: 28px; height: 28px; color: #d6ecff; }
.feature-button.is-active .feature-icon { color: currentColor; }

/* Un espace de réglages large, avec une navigation et un défilement discrets. */
.settings-dialog { width: min(1040px, calc(100vw - 64px)); max-height: min(880px, calc(100dvh - 64px)); overflow: hidden; border-radius: 24px; border: 1px solid #ffffffa0; background: #fbfcfd; }
.settings-dialog[open] { display: flex; flex-direction: column; }
.settings-dialog::backdrop { background: #102d465e; backdrop-filter: blur(5px); }
.settings-header { position: static; flex-shrink: 0; padding: 20px 30px 16px; background: transparent; border: 0; }
.settings-heading { display: flex; align-items: center; gap: 12px; }
.settings-heading > img { width: 42px; height: 42px; object-fit: contain; border-radius: 12px; }
.settings-header h2 { margin: 0; font-size: 24px; letter-spacing: -.6px; }
.settings-heading p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.settings-close { width: 34px; height: 34px; border: 0; border-radius: 10px; background: #eaf0f5; font-size: 24px; }
.settings-close:hover { background: #dde8f1; }
.settings-nav { flex-shrink: 0; display: flex; gap: 6px; padding: 0 30px 12px; border-bottom: 1px solid #e4eaf0; overflow-x: auto; scrollbar-width: thin; }
.settings-nav button { flex-shrink: 0; padding: 8px 12px; border: 0; border-radius: 8px; background: transparent; color: #516271; font: 500 13px/1.3 "Avenir Next", "Segoe UI", sans-serif; cursor: pointer; }
.settings-nav button:hover, .settings-nav button:focus-visible { background: #eaf3fc; color: #15558a; }
.settings-content { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #bccbd7 transparent; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 32px; padding: 8px 30px 24px; background: #fff; scroll-padding-top: 16px; }
.settings-content::-webkit-scrollbar { width: 5px; }
.settings-content::-webkit-scrollbar-thumb { background: #bccbd7; border-radius: 8px; }
.settings-content::-webkit-scrollbar-track { background: transparent; }
.settings-section { min-width: 0; padding: 24px 0; border: 0; border-bottom: 1px solid #e8eef3; border-radius: 0; background: transparent; }
.settings-section .section-kicker { color: #658095; font-size: 10px; letter-spacing: .12em; margin-bottom: 9px; }
.settings-section h3 { font-size: 19px; letter-spacing: -.35px; margin-bottom: 8px; }
.settings-section p { font-size: 14px; line-height: 1.6; margin: 8px 0 14px; }
#settingsInstallSection { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .85fr); column-gap: 40px; align-items: center; padding: 24px; margin-top: 16px; border: 1px solid #dfebf5; border-radius: 16px; background: linear-gradient(115deg, #f1f7fd, #f9fbfd 70%, #fffaf0); }
#settingsInstallSection .section-kicker, #settingsInstallSection h3, #settingsInstallSection > p { grid-column: 1; }
#settingsInstallSection > p { margin-bottom: 0; }
#settingsInstallSection .install-button { grid-column: 2; grid-row: 1 / 4; border-radius: 13px; padding: 14px; gap: 12px; }
#settingsInstallSection #installHelp { grid-column: 1 / -1; padding-top: 14px; margin-top: 18px; border-top: 1px solid #dce6ef; font-size: 12px; }
.install-logo { width: 48px; height: 48px; border-radius: 12px; }
.install-logo img { width: 40px; height: 40px; }
.install-button strong { font-size: 16px; }
.settings-link { padding: 12px 0; font-size: 13px; }
.settings-account-status { display: inline-block; padding: 7px 11px; border-radius: 8px; background: #f1f6fa; }
.settings-facts { padding: 12px 14px; gap: 10px; background: #f5f8fa; }
.settings-facts strong, .settings-facts span { font-size: 12px; }
#settingsFreeSection, #settingsContactSection { border-bottom: 0; }
@media (max-width: 700px) {
  .settings-dialog { width: calc(100vw - 20px); max-height: calc(100dvh - 28px); border-radius: 20px; }
  .settings-header { padding: 18px 18px 14px; }
  .settings-nav { padding: 0 12px 10px; gap: 0; }
  .settings-nav button { padding: 8px 10px; font-size: 12px; }
  .settings-content { grid-template-columns: minmax(0, 1fr); padding: 0 20px 16px; gap: 0; }
  .settings-section { padding: 22px 0; }
  #settingsInstallSection { display: block; padding: 18px; }
  #settingsInstallSection .install-button { margin-top: 18px; }
  #settingsFreeSection { border-bottom: 1px solid #e8eef3; }
}
