/* =========================================================
   QUICKFILETOOLS - SIGN PDF STYLES
   All colors derived from tokens.css ("the desk" design tokens).
   Supports Light & Dark themes, accessibility, touch targets.
========================================================= */

@font-face {
  font-family: 'Dancing Script';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/dancing-script-latin.woff2') format('woff2');
}

@font-face {
  font-family: 'Great Vibes';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/great-vibes-latin.woff2') format('woff2');
}

@font-face {
  font-family: 'Caveat';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/caveat-latin.woff2') format('woff2');
}

@font-face {
  font-family: 'Sacramento';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/sacramento-latin.woff2') format('woff2');
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

.converter-wrapper {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 16px 64px;
  text-align: center;
}

.page-title {
  font-family: var(--font-sans);
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 10px;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.page-subtitle {
  font-size: 15px;
  color: var(--ink-muted);
  max-width: 620px;
  margin: 0 auto;
  line-height: 1.5;
}

.device-note {
  margin: 12px auto 0;
  font-size: 13px;
  color: var(--ink-muted);
}

.device-note-mark {
  background: var(--marker);
  color: var(--on-marker, var(--ink));
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-control);
}

.converter-card {
  background: var(--sheet);
  border-radius: var(--radius-sheet);
  padding: 20px;
  margin-top: 20px;
  border: 1px solid var(--hairline);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  text-align: left;
}

[data-theme="dark"] .converter-card {
  box-shadow: none;
}

/* Drop Zone */
.drop-box {
  border: 2px dashed var(--rule);
  border-radius: var(--radius-sheet);
  padding: 44px 20px;
  cursor: pointer;
  background: var(--paper);
  text-align: center;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.drop-box:hover {
  border-color: var(--action);
}

.drop-box.dragover {
  border-color: var(--action);
  background: var(--marker);
  color: var(--on-marker, var(--ink));
}

.drop-box.dragover .drop-heading,
.drop-box.dragover p {
  color: var(--on-marker, var(--ink)) !important;
}

.drop-icon {
  font-size: 40px;
  margin-bottom: 10px;
  line-height: 1;
  display: flex;
  justify-content: center;
}

.drop-icon svg {
  width: 44px;
  height: 44px;
  stroke: var(--ink);
}

.drop-heading {
  font-family: var(--font-sans);
  font-size: 19px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 6px;
}

.drop-divider {
  margin: 4px 0 12px;
  color: var(--ink-muted);
  font-size: 13px;
}

.drop-hint {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--ink-muted);
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  background: var(--action);
  color: var(--on-action);
  padding: 10px 24px;
  border-radius: var(--radius-control);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  border: 1px solid transparent;
  text-decoration: none;
  max-width: 240px;
  width: 100%;
  box-sizing: border-box;
  transition: background-color 0.15s ease;
}

.upload-btn:hover {
  background: color-mix(in srgb, var(--action) 88%, var(--ink));
}

.upload-btn:focus-visible {
  outline: 2px solid var(--action);
  outline-offset: 2px;
}

/* File Card */
.file-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-control);
  margin-bottom: 16px;
}

.file-info-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.file-name-row {
  font-weight: 600;
  color: var(--ink);
  font-size: 14px;
  word-break: break-all;
}

.file-meta-row {
  font-size: 12px;
  color: var(--ink-muted);
}

.sig-warning {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--warn);
  border-left-width: 4px;
  background: color-mix(in srgb, var(--warn) 10%, var(--sheet));
  border-radius: var(--radius-control);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
}

.sig-warning p {
  margin: 0 0 6px;
}

.honesty-note {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-left: 3px solid var(--rule);
  background: var(--paper);
  border-radius: var(--radius-control);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
}

.note-link {
  color: var(--action);
  text-decoration: underline;
}

/* =========================================================
   V2 SIGN EDITOR LAYOUT (Desktop >= 900px, Phone < 900px)
========================================================= */

.sign-editor {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-top: 14px;
  position: relative;
}

.editor-main {
  flex: 1 1 0%;
  min-width: 0;
  max-width: 100%;
}

.pages-column {
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center;
  width: 100%;
}

.page-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.page-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  margin-bottom: 6px;
  text-align: center;
}

.page-stage {
  position: relative;
  max-width: 100%;
  line-height: 0;
  border: 1px solid var(--hairline);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  background: #ffffff;
  cursor: crosshair;
  user-select: none;
  overflow: visible;
}

.page-stage.is-idle {
  cursor: default;
}

.page-canvas {
  display: block;
  width: 100%;
  height: auto;
}

/* Placements */
.sig-placement {
  position: absolute;
  padding: 0;
  margin: 0;
  border: 1px dashed var(--action);
  background: transparent;
  cursor: move;
  touch-action: none;
  line-height: 1;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.sig-placement.is-selected {
  border: 1.5px solid var(--action);
  outline: 2px solid var(--action);
  outline-offset: 1px;
}

.sig-placement:focus-visible {
  outline: 3px solid var(--action);
  outline-offset: 2px;
}

.sig-placement img {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  object-fit: fill;
}

.placement-text {
  display: block;
  width: 100%;
  height: 100%;
  white-space: nowrap;
  pointer-events: none;
  font-family: Arial, Helvetica, sans-serif;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
}

.sig-handle {
  position: absolute;
  right: -12px;
  bottom: -12px;
  width: 24px;
  height: 24px;
  box-sizing: border-box;
  border-radius: 50%;
  background: var(--action);
  border: 2px solid var(--sheet);
  cursor: nwse-resize;
  touch-action: none;
}

.sig-placement:not(.is-selected) .sig-handle {
  display: none;
}

/* Sidebar (Desktop >= 900px) */
.editor-sidebar {
  width: 320px;
  flex: 0 0 320px;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sheet);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-sizing: border-box;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-heading {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}

.sidebar-subheading {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}

.fields-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.field-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 4px;
  min-height: 52px;
  background: var(--sheet);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-control);
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  position: relative;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.field-btn:hover {
  border-color: var(--action);
  background: var(--paper);
}

.field-btn:focus-visible {
  outline: 2px solid var(--action);
  outline-offset: 2px;
}

.field-btn-label {
  line-height: 1;
}

.field-btn-key {
  position: absolute;
  top: 3px;
  right: 4px;
  font-size: 10px;
  color: var(--ink-muted);
  font-weight: 400;
}

.sidebar-status {
  font-size: 12px;
  color: var(--ink-muted);
  margin: 2px 0 0;
  text-align: center;
  line-height: 1.4;
}

/* Field Options Section */
.section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-action-group {
  display: flex;
  gap: 6px;
}

.field-opt-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}

.opt-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
}

.form-input, .form-select {
  min-height: 38px;
  padding: 6px 10px;
  font-size: 13px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-control);
  background: var(--sheet);
  color: var(--ink);
  width: 100%;
  box-sizing: border-box;
}

.form-input-lg {
  min-height: 44px;
  font-size: 16px;
  padding: 8px 12px;
}

.form-input:focus-visible, .form-select:focus-visible {
  outline: 2px solid var(--action);
  outline-offset: 2px;
}

.non-latin-note {
  font-size: 11px;
  color: var(--ink-muted);
  margin: 2px 0 0;
}

.segmented-control {
  display: flex;
  border: 1px solid var(--rule);
  border-radius: var(--radius-control);
  overflow: hidden;
  background: var(--sheet);
}

.seg-item {
  flex: 1;
  text-align: center;
  cursor: pointer;
  position: relative;
}

.seg-item input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.seg-item span {
  display: block;
  padding: 6px 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
}

.seg-item input:checked + span {
  background: var(--action);
  color: var(--on-action);
}

.colour-swatches {
  display: flex;
  gap: 10px;
  align-items: center;
}

.swatch-label {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
}

.swatch-label input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.swatch {
  display: inline-block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--sheet);
  box-shadow: 0 0 0 1px var(--rule);
}

.swatch-label input:checked + .swatch {
  box-shadow: 0 0 0 2px var(--action);
}

.swatch-text {
  font-size: 12px;
  color: var(--ink);
}

.swatch-black { background: #000000; }
.swatch-blue { background: #1e3a8a; }
.swatch-red { background: #b91c1c; }

.custom-range-wrap {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.nudge-cluster {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.btn-sm {
  min-height: 36px;
  padding: 4px 12px;
  font-size: 12px;
}

.btn-danger {
  color: var(--error) !important;
}

.history-row {
  display: flex;
  gap: 8px;
}

.history-row .btn-quiet {
  flex: 1;
}

.placement-count {
  margin: 0;
  font-size: 12px;
  color: var(--ink-muted);
  text-align: center;
}

.btn-full {
  width: 100%;
}

/* =========================================================
   MODAL DIALOG
========================================================= */

.sig-dialog {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sheet);
  background: var(--sheet);
  color: var(--ink);
  padding: 24px;
  max-width: 580px;
  width: calc(100% - 32px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  margin: auto;
  box-sizing: border-box;
}

.sig-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.dialog-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dialog-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}

.dialog-close-btn {
  background: transparent;
  border: 0;
  font-size: 18px;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-control);
  min-height: 36px;
}

.dialog-close-btn:focus-visible {
  outline: 2px solid var(--action);
}

.dialog-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--hairline);
}

.dialog-tab {
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  min-height: 44px;
}

.dialog-tab.is-active {
  color: var(--action);
  border-bottom-color: var(--action);
}

.dialog-tab:focus-visible {
  outline: 2px solid var(--action);
}

.dialog-colour-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tab-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dialog-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

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

.font-card {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  position: relative;
}

.font-card input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}

.font-card-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 16px 8px;
  border: 1.5px solid var(--hairline);
  border-radius: var(--radius-control);
  background: var(--paper);
  min-height: 84px;
  gap: 6px;
  transition: border-color 0.15s ease;
  box-sizing: border-box;
}

.font-card input:checked + .font-card-body {
  border-color: var(--action);
  background: var(--sheet);
  outline: 2px solid var(--action);
}

.font-card:focus-within .font-card-body {
  outline: 2px solid var(--action);
}

.font-preview-text {
  font-size: 26px;
  line-height: 1.2;
  text-align: center;
  color: var(--ink);
  word-break: break-word;
}

.font-dancing-script { font-family: 'Dancing Script', cursive; }
.font-great-vibes { font-family: 'Great Vibes', cursive; font-size: 28px; }
.font-caveat { font-family: 'Caveat', cursive; font-size: 28px; }
.font-sacramento { font-family: 'Sacramento', cursive; font-size: 30px; }

.font-card-name {
  font-size: 11px;
  color: var(--ink-muted);
  font-weight: 600;
}

.sig-pad {
  display: block;
  width: 100%;
  height: 180px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-control);
  touch-action: none;
  cursor: crosshair;
  background: #ffffff;
}

.sig-pad:focus-visible {
  outline: 2px solid var(--action);
  outline-offset: 2px;
}

.pad-hint {
  margin: 0;
  font-size: 12px;
  color: var(--ink-muted);
}

.pad-tools-row {
  display: flex;
  gap: 10px;
}

.upload-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rotate-hint {
  font-size: 12px;
  color: var(--ink);
  font-weight: 600;
  margin: 0;
}

.sig-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 84px;
  padding: 10px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-control);
  --preview-a: var(--checker-a);
  --preview-b: var(--checker-b);
  background-color: var(--preview-a);
  background-image: conic-gradient(var(--preview-b) 25%, var(--preview-a) 0 50%, var(--preview-b) 0 75%, var(--preview-a) 0);
  background-size: 16px 16px;
}

[data-theme="dark"] .sig-preview {
  --preview-a: var(--ink);
  --preview-b: color-mix(in srgb, var(--ink) 82%, var(--paper));
}

.sig-preview img {
  display: block;
  max-width: 100%;
  max-height: 120px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

/* Common Buttons & Controls */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  background: var(--action);
  color: var(--on-action);
  padding: 10px 24px;
  border-radius: var(--radius-control);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: background-color 0.15s ease;
  box-sizing: border-box;
}

.btn-primary:hover:not(:disabled) {
  background: color-mix(in srgb, var(--action) 88%, var(--ink));
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary:focus-visible {
  outline: 2px solid var(--action);
  outline-offset: 2px;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  background: var(--paper);
  color: var(--ink);
  padding: 8px 18px;
  border-radius: var(--radius-control);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--hairline);
  transition: background-color 0.15s ease, border-color 0.15s ease;
  box-sizing: border-box;
}

.btn-secondary:hover:not(:disabled) {
  background: var(--sheet);
  border-color: var(--rule);
}

.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary:focus-visible {
  outline: 2px solid var(--action);
  outline-offset: 2px;
}

.btn-quiet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  background: transparent;
  color: var(--action);
  padding: 6px 12px;
  border-radius: var(--radius-control);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--hairline);
  text-decoration: none;
  transition: background-color 0.15s ease;
  box-sizing: border-box;
  gap: 4px;
}

.btn-quiet:hover:not(:disabled) {
  background: var(--paper);
  border-color: var(--action);
}

.btn-quiet:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-quiet:focus-visible {
  outline: 2px solid var(--action);
  outline-offset: 2px;
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

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

.inline-fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
}

.inline-fieldset legend {
  float: left;
  margin-right: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.option-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink);
  min-height: 36px;
}

.option-label input[type="radio"] {
  accent-color: var(--action);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink);
}

.check-label input[type="checkbox"] {
  accent-color: var(--action);
  width: 18px;
  height: 18px;
  cursor: pointer;
  flex: 0 0 auto;
}

.slider-label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink);
  min-height: 40px;
}

.slider-label input[type="range"] {
  accent-color: var(--action);
  width: min(200px, 100%);
  min-height: 24px;
}

/* Result Row */
.result-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 14px;
  border: 1px solid var(--ok);
  border-radius: var(--radius-control);
  background: color-mix(in srgb, var(--ok) 8%, var(--sheet));
  color: var(--ink);
  font-size: 13px;
}

.result-name {
  font-weight: 600;
  word-break: break-all;
  min-width: 0;
}

/* Status Box */
.status-box {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: var(--radius-control);
  font-size: 14px;
  line-height: 1.5;
  display: none;
  color: var(--ink);
}

.status-box.info {
  background: var(--paper);
  border: 1px solid var(--hairline);
  color: var(--ink);
}

.status-box.error {
  background: color-mix(in srgb, var(--error) 10%, var(--sheet));
  border: 1px solid var(--error);
  color: var(--ink);
}

.status-box.success {
  background: color-mix(in srgb, var(--ok) 10%, var(--sheet));
  border: 1px solid var(--ok);
  color: var(--ink);
}

/* Trust Strip */
.trust-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px 20px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--hairline);
  font-size: 13px;
  color: var(--ink-muted);
}

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

.ui-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

/* Content Info */
.content-info {
  margin-top: 44px;
  text-align: left;
  line-height: 1.7;
  color: var(--ink);
}

.content-info h2 {
  font-family: var(--font-sans);
  font-size: 20px;
  color: var(--ink);
  margin: 32px 0 10px;
}

.content-info h2:first-child {
  margin-top: 0;
}

.content-info ol {
  color: var(--ink-muted);
  padding-left: 20px;
  margin: 0;
}

.content-info ol li {
  margin-bottom: 6px;
}

.content-info ol strong {
  color: var(--ink);
}

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

.feature-card {
  background: var(--sheet);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-control);
  padding: 16px;
}

.feature-card h3 {
  margin: 0 0 6px;
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--ink);
}

.feature-card p {
  margin: 0;
  font-size: 13px;
  color: var(--ink-muted);
}

.related-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}

.related-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: var(--radius-control);
  background: var(--sheet);
  border: 1px solid var(--hairline);
  color: var(--action);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.related-link:hover {
  border-color: var(--action);
  background: var(--paper);
}

.related-link:focus-visible {
  outline: 2px solid var(--action);
  outline-offset: 2px;
}

.faq-card {
  border-bottom: 1px solid var(--hairline);
  padding: 12px 0;
}

.faq-card summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
  min-height: 44px;
  display: flex;
  align-items: center;
}

.faq-card p {
  margin: 6px 0 0;
  color: var(--ink-muted);
  font-size: 13px;
  line-height: 1.6;
}

.qft-check {
  margin: 32px 0 16px;
  padding: 16px;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sheet);
}

.qft-check h2 {
  font-size: 17px;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.qft-check ol {
  margin: 0;
  padding-left: 20px;
  color: var(--ink);
  font-size: 13px;
}

.qft-check-note {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--ink-muted);
}

[hidden] {
  display: none !important;
}

/* =========================================================
   PHONE LAYOUT (< 900px)
========================================================= */

@media (max-width: 899px) {
  /* Compact bottom panel: options only when asked for; room to scroll the
     last page above the panel. */
  .sign-editor {
    padding-bottom: 180px;
  }

  .options-toggle:not([hidden]) {
    display: block;
    width: 100%;
    min-height: 44px;
    margin: 6px 0;
    border: 1px solid var(--rule);
    border-radius: var(--radius-control);
    background: var(--paper);
    color: var(--ink);
    font: inherit;
    font-weight: var(--font-weight-semibold);
  }

  .editor-sidebar:not(.options-open) #fieldOptionsSection {
    display: none;
  }

  .converter-wrapper {
    padding: 12px 10px 80px;
  }

  .converter-card {
    padding: 14px 10px;
    margin-top: 10px;
  }

  .sign-editor {
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
  }

  .editor-sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    flex: none;
    top: auto;
    max-height: 50vh;
    border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    border-top: 1px solid var(--hairline);
    background: var(--sheet);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.12);
    padding: 10px 12px;
    z-index: 100;
  }

  .fields-grid {
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
    gap: 6px;
  }

  .field-btn {
    flex: 0 0 72px;
    min-height: 48px;
    padding: 6px 2px;
    font-size: 11px;
  }

  .field-btn-key {
    display: none;
  }

  .font-previews-grid {
    grid-template-columns: 1fr;
  }
}

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

/* The options toggle is only for the phone layout. */
@media (min-width: 900px) {
  .options-toggle {
    display: none;
  }
}
