:root {
  color-scheme: dark;
  --page: #080808;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-strong: rgba(255, 255, 255, 0.075);
  --line: rgba(255, 255, 255, 0.14);
  --text: #f7f7f7;
  --muted: rgba(255, 255, 255, 0.66);
  --soft: rgba(255, 255, 255, 0.44);
  --radius-lg: 28px;
  --radius-md: 20px;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html { background: var(--page); overflow-x: clip; max-width: 100%; }
body {
  margin: 0;
  max-width: 100%;
  overflow-x: clip;
  min-width: 320px;
  background:
    radial-gradient(circle at 78% -10%, rgba(255,255,255,.09), transparent 33%),
    var(--page);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input { font: inherit; }

.app-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 96px;
}
.hero { max-width: 900px; margin-bottom: 48px; }
.eyebrow {
  margin: 0 0 18px;
  color: var(--soft);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .15em;
  text-transform: uppercase;
}
h1 {
  margin: 0;
  max-width: 820px;
  font-size: clamp(44px, 7vw, 92px);
  line-height: .96;
  letter-spacing: -.055em;
}
.hero-copy {
  max-width: 720px;
  margin: 26px 0 0;
  color: var(--muted);
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.55;
}

.step-panel {
  margin-top: 22px;
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--panel-strong), var(--panel));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), var(--shadow);
}
.step-heading {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 28px;
}
.step-heading > span {
  color: var(--soft);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .1em;
  padding-top: 7px;
}
.step-heading h2 { margin: 0; font-size: clamp(27px, 4vw, 42px); letter-spacing: -.035em; }
.step-heading p { margin: 8px 0 0; color: var(--muted); line-height: 1.55; }

/* Artwork browser uses .gallery-grid column masonry from gallery.css. */
.print-grid {
  margin-top: 4px;
}
.print-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: 100%;
  margin: 0 0 clamp(1.15rem, 2.4vw, 1.85rem);
  break-inside: avoid;
  page-break-inside: avoid;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  min-height: 0;
  overflow: visible;
}
.print-card__figure {
  position: relative;
  display: block;
  overflow: hidden;
  background: #1c1a16;
  aspect-ratio: var(--art-ratio, 4 / 5);
}
.print-card--landscape .print-card__figure {
  aspect-ratio: var(--art-ratio, 16 / 10);
}
.print-card--square .print-card__figure {
  aspect-ratio: var(--art-ratio, 1);
}
.print-card--portrait .print-card__figure {
  aspect-ratio: var(--art-ratio, 4 / 5);
}
.print-card__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #1c1a16;
}
.print-card__title {
  position: static;
  font-family: var(--font-display, Georgia, serif);
  font-size: clamp(1.15rem, 1.7vw, 1.45rem);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.15;
}
.print-card__figure.is-image-failed .print-card__image {
  visibility: hidden;
}
.print-card__figure.is-image-failed::before {
  content: "Image unavailable";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  color: rgba(255,255,255,.55);
  font-family: Inter, ui-sans-serif, sans-serif;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
}
@media (hover: hover) and (pointer: fine) {
  .print-card:hover .print-card__figure,
  .print-card:focus-visible .print-card__figure {
    box-shadow: inset 0 0 0 1px rgba(224, 170, 114, 0.7);
  }
}
.print-card[aria-pressed="true"] .print-card__figure,
.print-card.is-selected .print-card__figure {
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.92);
}
.print-card.is-loading {
  opacity: 0.72;
}

.catalogue-status {
  margin: 0 0 10px;
}
.catalogue-retry {
  margin: 0 0 14px;
}
.catalogue-retry[hidden] {
  display: none !important;
}

.selected-print-summary {
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,.03);
}
.selected-print-summary[hidden] {
  display: none !important;
}
.selected-print-label {
  margin: 0 0 10px;
  color: var(--soft);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.selected-print-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.selected-print-thumbnail {
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  object-fit: cover;
  border-radius: 8px;
  background: #121212;
}
.selected-print-details {
  display: grid;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.selected-print-details strong {
  font-size: 16px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.change-print-button {
  justify-self: start;
  min-height: 40px;
}

#printSelectionPanel[hidden] {
  display: none !important;
}

.upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 22px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 999px;
  background: white;
  color: #111;
  font-weight: 750;
  cursor: pointer;
}
.upload-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.toolbar {
  display: flex;
  gap: 20px;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.finish-picker {
  border: 0;
  padding: 0;
  margin: 0;
}
.finish-picker legend { margin-bottom: 10px; color: var(--soft); font-size: 12px; text-transform: uppercase; letter-spacing: .11em; }
.finish-picker label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0 13px 8px 0;
  color: var(--muted);
}
.finish-picker input { accent-color: white; }
.finish-picker label:has(input:disabled) { opacity: .38; }
.finish-note {
  margin: 4px 0 0;
  color: var(--soft);
  font-size: 12px;
  line-height: 1.4;
}
.finish-note[hidden] { display: none; }
.size-picker {
  border: 0;
  padding: 0;
  margin: 0;
}
.size-picker legend {
  margin-bottom: 10px;
  color: var(--soft);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .11em;
}
.size-picker label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0 13px 8px 0;
  color: var(--muted);
}
.size-picker input { accent-color: white; }
.workspace-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
  max-width: 52ch;
}
.privacy-note {
  margin: 14px 0 0;
  color: var(--soft);
  font-size: 13px;
  line-height: 1.5;
}
.viewer-purchase-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.toolbar-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.button.ghost {
  border: 1px solid transparent;
  background: transparent;
  color: var(--soft);
}
.button.ghost:hover { color: white; border-color: rgba(255,255,255,.12); }
.button {
  min-height: 46px;
  border-radius: 999px;
  padding: 0 18px;
  font-weight: 750;
  cursor: pointer;
}
a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  text-align: center;
}
a.configure-cta {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 13px;
}
.finish-picker input,
.size-picker input,
.upload-button input,
input,
select,
textarea {
  font-size: 16px;
}
.button.primary { border: 1px solid white; background: white; color: #111; }
.button.secondary { border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.05); color: white; }
.button:disabled { opacity: .42; cursor: not-allowed; }

.canvas-wrap {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: min(520px, 62vh);
  min-height: min(520px, 62dvh);
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 22px;
  background:
    linear-gradient(45deg, #111 25%, transparent 25%),
    linear-gradient(-45deg, #111 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #111 75%),
    linear-gradient(-45deg, transparent 75%, #111 75%),
    #0d0d0d;
  background-size: 28px 28px;
  background-position: 0 0, 0 14px, 14px -14px, -14px 0;
  touch-action: none;
}
#previewCanvas { display: block; max-width: 100%; max-height: 70vh; max-height: 70dvh; cursor: grab; }
#previewCanvas.is-dragging { cursor: grabbing; }
.empty-state[hidden] { display: none; }
.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
  pointer-events: none;
  color: var(--muted);
}
.empty-state strong { color: white; font-size: 20px; }
.disclaimer, .status { color: var(--soft); line-height: 1.5; }
.disclaimer { margin: 14px 0 0; font-size: 13px; }
.sizing-help { margin-top: 8px; color: var(--soft); font-size: 13px; line-height: 1.5; }
.sizing-help summary { cursor: pointer; color: var(--muted); }
.sizing-help p { margin: 8px 0 0; }
.status { min-height: 1.5em; margin: 12px 0 0; font-size: 14px; }

@media (max-width: 900px) {
  .canvas-wrap { min-height: min(430px, 54vh); min-height: min(430px, 54dvh); }
}
@media (max-width: 600px) {
  .app-shell { width: min(100% - 20px, 1280px); padding: 28px 0 calc(48px + env(safe-area-inset-bottom)); }
  .step-panel { padding: 22px 16px; border-radius: 20px; }
  .toolbar-actions, .toolbar-actions .button { width: 100%; }
  .canvas-wrap { min-height: min(320px, 46vh); min-height: min(320px, 46dvh); border-radius: 16px; }
  #previewCanvas { max-height: 48vh; max-height: 48dvh; }
  .finish-picker, .size-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
  .finish-picker legend, .size-picker legend { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

.photo-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.secondary-upload { background: rgba(255,255,255,.055); color: white; }
.capture-note { margin: 14px 0 0; color: var(--soft); font-size: 13px; line-height: 1.5; }
.straighten-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.straighten-actions[hidden] { display: none; }
.straighten-actions .button { min-height: 42px; }

.straighten-modal[hidden] { display: none; }
.straighten-modal {
  position: fixed;
  z-index: 1001;
  inset: 0;
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  background: rgba(0,0,0,.94);
  display: grid;
  place-items: center;
}
.straighten-shell {
  width: min(920px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: 20px 20px max(28px, calc(20px + env(safe-area-inset-bottom)));
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 24px;
  background: #0a0a0a;
  box-shadow: 0 34px 100px rgba(0,0,0,.6);
  -webkit-overflow-scrolling: touch;
}
.straighten-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 12px;
}
.straighten-header h2 {
  margin: 0;
  font-size: clamp(22px, 4vw, 34px);
  letter-spacing: -.035em;
}
.straighten-status {
  min-height: 1.4em;
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}
.straighten-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}
.straighten-compare figure {
  margin: 0;
  display: grid;
  gap: 8px;
  justify-items: center;
}
.straighten-compare canvas {
  display: block;
  max-width: 100%;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  background: #111;
}
.straighten-compare figcaption {
  color: var(--soft);
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.straighten-modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.straighten-diagnostics {
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px;
  background: rgba(255,255,255,.03);
}
.straighten-diagnostics[hidden] { display: none; }
.straighten-diagnostics summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.straighten-diag-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0 8px;
}
.straighten-diag-copy-status {
  min-height: 1.2em;
  margin: 0 0 8px;
  color: var(--soft);
  font-size: 12px;
}
.straighten-diag-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.straighten-diag-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
.straighten-diag-list strong {
  color: white;
  font-weight: 650;
  word-break: break-word;
}
.straighten-diag-badge {
  justify-self: end;
  min-width: 5.5em;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14);
  text-align: center;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .04em;
}
.straighten-diag-badge.pass { color: #8ce6a8; border-color: rgba(91,220,132,.35); }
.straighten-diag-badge.fail { color: #ffb4b4; border-color: rgba(255,120,120,.35); }
.straighten-diag-badge.waiting { color: #e8b64d; border-color: rgba(232,182,77,.35); }
.straighten-diag-badge.neutral { color: var(--soft); }
.straighten-diag-fallback-wrap {
  margin: 12px 0 0;
  padding-bottom: max(18px, env(safe-area-inset-bottom));
}
.straighten-diag-fallback-wrap[hidden] { display: none; }
.straighten-diag-fallback-label {
  display: block;
  margin: 0 0 6px;
  color: var(--soft);
  font-size: 12px;
}
.straighten-diag-fallback {
  display: block;
  width: 100%;
  min-height: 220px;
  max-height: min(48vh, 420px);
  box-sizing: border-box;
  margin: 0;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 10px;
  background: #111;
  color: #ddd;
  font: 11px/1.45 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  overflow: auto;
  -webkit-user-select: text;
  user-select: text;
  resize: vertical;
}
.straighten-after-hidden { display: none; }

@media (max-width: 700px) {
  .straighten-compare { grid-template-columns: 1fr; }
  .straighten-modal-actions,
  .straighten-modal-actions .button,
  .straighten-diag-actions .button { width: 100%; }
  .straighten-actions, .straighten-actions .button { width: 100%; }
}

.camera-modal[hidden] { display: none; }
.camera-modal {
  position: fixed;
  z-index: 1000;
  inset: 0;
  width: 100%;
  max-width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  background: rgba(0,0,0,.94);
  display: grid;
  place-items: center;
}
.camera-shell {
  width: min(820px, 100%);
  height: min(920px, 100%);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 24px;
  background: #0a0a0a;
  box-shadow: 0 34px 100px rgba(0,0,0,.6);
}
.camera-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 20px; }
.camera-header h2 { margin: 0; font-size: clamp(22px, 4vw, 34px); letter-spacing: -.035em; }
.camera-close { flex-shrink: 0; width: 44px; min-width: 44px; height: 44px; min-height: 44px; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; background: rgba(255,255,255,.06); color: white; font-size: 30px; line-height: 1; cursor: pointer; }
.camera-view { position: relative; overflow: hidden; min-height: 0; background: #050505; }
.camera-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.camera-grid { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to right, transparent 33.1%, rgba(255,255,255,.18) 33.3%, transparent 33.5%, transparent 66.4%, rgba(255,255,255,.18) 66.6%, transparent 66.8%), linear-gradient(to bottom, transparent 33.1%, rgba(255,255,255,.18) 33.3%, transparent 33.5%, transparent 66.4%, rgba(255,255,255,.18) 66.6%, transparent 66.8%); opacity: .55; }
.level-guide { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); display: grid; justify-items: center; gap: 10px; width: min(330px, calc(100% - 34px)); padding: 14px 16px 12px; border: 1px solid rgba(255,255,255,.2); border-radius: 24px; background: rgba(8,8,8,.58); backdrop-filter: blur(12px); transition: border-color .18s ease, background .18s ease; }
.level-target { position: relative; width: 150px; height: 150px; border-radius: 50%; background: rgba(4,4,4,.16); }
.level-ring { position: absolute; inset: 7px; border: 3px solid rgba(255,255,255,.78); border-radius: 50%; transition: border-color .18s ease, box-shadow .18s ease; }
.level-fixed-line { position: absolute; left: -34px; right: -34px; top: 50%; height: 3px; transform: translateY(-50%); border-radius: 999px; background: rgba(255,255,255,.36); }
.level-horizon { position: absolute; left: 50%; top: 50%; width: 96px; height: 4px; transform: translate(-50%, -50%); transform-origin: center; border-radius: 999px; background: rgba(255,255,255,.94); transition: background .15s ease; }
.level-pitch-line { position: absolute; left: 50%; top: 50%; width: 54px; height: 4px; transform: translate(-50%, -50%); border-radius: 999px; background: rgba(255,255,255,.94); transition: background .15s ease; }
.level-copy { min-width: 0; display: grid; gap: 3px; text-align: center; }
.level-copy strong { font-size: 14px; line-height: 1.25; }
.level-copy span { color: rgba(255,255,255,.66); font-size: 11px; line-height: 1.35; }
.level-guide.red { border-color: rgba(220,110,96,.7); background: rgba(48,16,14,.68); }
.level-guide.red .level-ring { border-color: rgba(232,120,108,.92); }
.level-guide.yellow { border-color: rgba(232,182,77,.55); background: rgba(42,31,8,.62); }
.level-guide.yellow .level-ring { border-color: rgba(232,182,77,.88); }
.level-guide.green { border-color: rgba(91,220,132,.74); background: rgba(12,46,25,.66); }
.level-guide.green .level-ring { border-color: #5bdc84; box-shadow: 0 0 0 5px rgba(91,220,132,.12); }
.level-guide.waiting { border-color: rgba(255,255,255,.22); }
.level-horizon.aligned, .level-pitch-line.aligned { background: #5bdc84; }
.level-horizon.amber, .level-pitch-line.amber { background: #e8b64d; }
.level-guide.red .level-horizon:not(.aligned):not(.amber),
.level-guide.red .level-pitch-line:not(.aligned):not(.amber) { background: #f0a090; }
.level-guide.unavailable .level-horizon, .level-guide.unavailable .level-pitch-line { background: #9d9d9d; }
.level-guide.unavailable .level-ring { border-color: rgba(255,255,255,.42); }
.camera-badge { justify-self: stretch; display: grid; place-items: center; min-height: 42px; padding: 0 12px; border: 1px solid rgba(255,255,255,.13); border-radius: 999px; color: rgba(255,255,255,.62); background: rgba(255,255,255,.035); font-size: 12px; font-weight: 700; text-align: center; }
.camera-badge.green { color: #8ce6a8; border-color: rgba(91,220,132,.34); background: rgba(91,220,132,.08); }
.camera-badge.yellow { color: #f0d08a; border-color: rgba(232,182,77,.4); background: rgba(232,182,77,.1); }
.camera-badge.red { color: #f0b0a4; border-color: rgba(220,110,96,.4); background: rgba(220,110,96,.1); }
.camera-badge.unavailable { color: rgba(255,255,255,.48); }
.camera-controls { padding: 16px 20px 20px; }
.camera-status { min-height: 22px; margin: 0 0 12px; color: var(--muted); text-align: center; font-size: 13px; }
.camera-buttons { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; }
.capture-button { width: 70px; height: 70px; padding: 5px; border-radius: 50%; border: 2px solid white; background: transparent; cursor: pointer; }
.capture-button span { display: block; width: 100%; height: 100%; border-radius: 50%; background: white; }
.capture-button:disabled,
.capture-button[aria-disabled="true"] { opacity: .4; cursor: not-allowed; pointer-events: none; }

.straighten-actions[hidden],
.straighten-modal[hidden] { display: none !important; }

@media (max-width: 600px) {
  .photo-actions, .photo-actions .upload-button { width: 100%; }
  .camera-modal { padding: 0; }
  .camera-shell { width: 100%; height: 100%; border: 0; border-radius: 0; }
  .camera-header { padding: max(14px, env(safe-area-inset-top)) 16px 12px; }
  .camera-controls { padding: 12px 14px max(14px, env(safe-area-inset-bottom)); }
  .camera-buttons .button { min-height: 42px; padding: 0 12px; font-size: 13px; }
}
