:root {
  color-scheme: dark;
  --ink: #171411;
  --ivory: #eee5d5;
  --muted: #b6ab99;
  --gold: #9c8561;
  --line: #e9dcc32b;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "SimSun", serif;
  font-family:
    -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue",
    sans-serif;
  color: var(--ivory);
  background: var(--ink);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-width: 320px;
  background: var(--ink);
}
button,
a {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
button {
  font: inherit;
  cursor: pointer;
}
a {
  color: inherit;
  text-decoration: none;
}
button,
a,
.photo-stage {
  -webkit-user-select: none;
  user-select: none;
}
[hidden] {
  display: none !important;
}
svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
:focus-visible {
  outline: 2px solid var(--ivory);
  outline-offset: 5px;
}

/* The painting is scenery; live photographs always retain their own colors. */
.gallery-art {
  position: fixed;
  inset: 0;
  min-height: 680px;
  pointer-events: none;
  overflow: hidden;
  transition: opacity 600ms cubic-bezier(.22,1,.36,1);
  animation: painting-in 700ms ease;
}
.gallery-art picture,
.gallery-art img {
  display: block;
  width: 100%;
  height: 100%;
}
.gallery-art img {
  object-fit: cover;
  object-position: 50% 50%;
}
.gallery-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    #17141166,
    transparent 34%,
    transparent 58%,
    #17141170
  );
}
body.has-photo .gallery-art {
  opacity: 0.16;
}
body.is-immersive .gallery-art {
  opacity: 0;
}
.site-header {
  position: absolute;
  inset: 0 0 auto;
  z-index: 5;
  height: 100px;
  padding: 0 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 16px;
}
.brand-emblem {
  display: block;
  width: 106px;
  height: 42px;
  flex-shrink: 0;
  background: #eedbb6;
  mask-image: url("/logo-intaglio.png");
  mask-mode: luminance;
  mask-size: contain;
  mask-position: center;
  mask-repeat: no-repeat;
}
.brand-wordmark {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 3px;
}
.header-note {
  font-size: 12px;
  letter-spacing: 3px;
  color: #c3b7a2;
}
main {
  position: relative;
  z-index: 1;
}
main[data-state="empty"] {
  min-height: max(680px, 100svh);
}
.intro {
  position: absolute;
  top: 17.5svh;
  left: 24px;
  right: 24px;
  text-align: center;
  pointer-events: none;
  animation: content-in 600ms 80ms both;
}
.eyebrow {
  margin: 0 0 22px;
  color: #c0ab85;
  font-size: 12px;
  letter-spacing: 5px;
}
h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(38px, 4.2vw, 64px);
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: 5px;
}
.mobile-break {
  display: none;
}
.intro-copy {
  margin: 20px 0 0;
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 3px;
}
main[data-state="empty"] .workspace {
  position: absolute;
  top: 73.5%;
  left: 24px;
  right: 24px;
  text-align: center;
}
.upload-entry {
  animation: content-in 600ms 160ms both;
}
.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  min-height: 48px;
  padding: 0 27px;
  border: 1px solid transparent;
  border-radius: 5px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 1px;
  white-space: nowrap;
  transition:
    background 0.22s,
    border-color 0.22s,
    transform 0.22s,
    color 0.22s;
}
.button svg {
  width: 20px;
  height: 20px;
}
.primary {
  color: #30261a;
  background: var(--ivory);
  border-color: var(--ivory);
}
.primary:hover {
  background: #fff6e6;
  border-color: #fff6e6;
  transform: translateY(-2px);
}
.secondary {
  color: var(--ivory);
  background: #17141160;
  border-color: #d8c9ad65;
}
.secondary:hover {
  background: #342c22;
  border-color: #d8c9adb0;
  transform: translateY(-2px);
}
.button:active {
  transform: translateY(0) scale(0.98);
}
.button:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}
.upload-area {
  min-width: 184px;
}
.upload-description {
  font-size: 14px;
  letter-spacing: 1px;
  color: #c9bdab;
  margin: 19px 0 0;
}
.file-note {
  font-size: 12px;
  color: var(--muted);
  margin: 12px 0 0;
  line-height: 1.65;
}
.file-note span {
  margin-left: 15px;
}
footer {
  position: absolute;
  z-index: 2;
  top: max(630px, calc(100svh - 50px));
  left: 48px;
  right: 48px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  letter-spacing: 1.5px;
  pointer-events: none;
}
.footer-signature {
  letter-spacing: 4px;
  color: #a18e6e;
}
.drop-veil {
  position: fixed;
  inset: 16px;
  z-index: 10;
  display: grid;
  place-items: center;
  background: #171411d9;
  border: 1px solid var(--gold);
  border-radius: 6px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.2s,
    visibility 0.2s;
}
.drop-veil span {
  font-family: var(--serif);
  font-size: clamp(20px, 3vw, 32px);
  letter-spacing: 2px;
  text-align: center;
  padding: 24px;
}
body.is-dragging .drop-veil {
  opacity: 1;
  visibility: visible;
}

/* Preview and controls. */
main:not([data-state="empty"]) {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 110px 24px 64px;
}
main:not([data-state="empty"]) .intro,
main:not([data-state="empty"]) .upload-entry,
body.has-photo footer {
  display: none;
}
main:not([data-state="empty"]) .workspace {
  width: min(760px, 100%);
}
.photo-panel {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}
.photo-stage {
  position: relative;
  isolation: isolate;
  width: min(100%, var(--photo-width));
  aspect-ratio: var(--photo-ratio, 1.5);
  max-height: 100%;
  border-radius: 6px;
  overflow: hidden;
  background: #211b16;
  --split: 50%;
}
.photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  -webkit-user-drag: none;
  image-orientation: from-image;
}
.below-photo {
  text-align: center;
}
.quality-picker {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  width: max-content;
  margin: 23px auto 0;
}
.quality-picker button {
  position: relative;
  font-size: 14px;
  letter-spacing: 2px;
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 10px 6px;
  min-width: 48px;
  min-height: 44px;
}
.quality-picker button::after {
  content: "";
  position: absolute;
  left: 6px;
  right: 8px;
  bottom: 3px;
  height: 1px;
  background: var(--gold);
  transform: scaleX(0);
  transition: transform 0.2s;
}
.quality-picker button[aria-pressed="true"] {
  color: var(--ivory);
}
.quality-picker button[aria-pressed="true"]::after {
  transform: scaleX(1);
}
.quality-picker button:hover {
  color: #fff6e6;
}
.quality-picker button:disabled {
  opacity: 0.6;
  cursor: wait;
}
.actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 17px auto 0;
}
.footnote {
  font-size: 12px;
  line-height: 1.7;
  margin: 18px auto 0;
  color: var(--muted);
  max-width: 550px;
}
main[data-state="empty"] .footnote {
  display: none;
}
.message {
  margin: 16px auto 0;
  font-size: 14px;
  line-height: 1.6;
  max-width: 560px;
  color: #d5c5ab;
}
.message:empty {
  display: none;
}
.message.error {
  color: #f0b3a0;
}
/* The photograph takes over the canvas once the rescue begins. */
body.is-immersive {
  overflow: hidden;
}
body.is-immersive .site-header {
  position: fixed;
  height: 82px;
  background: linear-gradient(#171411c9, #17141100);
  pointer-events: none;
}
body.is-immersive .brand {
  pointer-events: auto;
  text-shadow: 0 1px 8px #000;
}
body.is-immersive .header-note {
  display: none;
}
body.is-immersive main {
  display: block;
  height: 100svh;
  min-height: 0;
  padding: 0;
}
body.is-immersive .photo-panel {
  position: fixed;
  inset: 0;
  height: 100svh !important;
  animation: none;
}
body.is-immersive .photo-stage {
  max-width: 100vw;
  max-height: 100svh;
  border-radius: 0;
  background: transparent;
}
body.is-immersive .below-photo {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  padding: 32px 20px max(20px, env(safe-area-inset-bottom));
  background: linear-gradient(transparent, #171411c9 52%);
  pointer-events: none;
}
body.is-immersive .below-photo .actions,
body.is-immersive .quality-picker {
  pointer-events: auto;
}
body.is-immersive .footnote {
  color: #ded2bf;
  margin-top: 12px;
  text-shadow: 0 1px 4px #000;
}
body.is-immersive .message.error {
  padding: 12px 18px;
  border-left: 1px solid #c88f79;
  background: #171411ed;
  width: fit-content;
}
body.is-immersive .secondary {
  background: #171411b8;
}
.processing {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: #17141126;
}
.processing-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 26px;
  color: #fff4e3;
  font-size: 14px;
  letter-spacing: 2px;
  background: radial-gradient(ellipse, #171411bd, transparent 72%);
  text-shadow: 0 1px 8px #000;
}
.breathing-dot {
  width: 5px;
  height: 5px;
  background: #eddbb8;
  border-radius: 50%;
  animation: breathe 2.8s ease-in-out infinite;
}
.result-layer {
  position: absolute;
  inset: 0;
  clip-path: inset(0 0 0 var(--split));
}
.photo-labels {
  position: absolute;
  inset: 94px 20px auto;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}
.photo-labels span {
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 1px;
  color: #fff4e3;
  background: #171411b8;
  padding: 5px 9px;
  border-radius: 4px;
}
.comparison {
  position: absolute;
  inset: 0;
  cursor: ew-resize;
  touch-action: none;
}
.comparison:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px #e8d7b3;
}
.comparison-handle {
  position: absolute;
  top: 50%;
  left: var(--split);
  transform: translate(-50%, -50%);
  width: 36px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  border: 1px solid #eee5d5ba;
  background: #211b16ed;
  color: #eee5d5;
  pointer-events: none;
}
.comparison-handle svg {
  width: 23px;
  height: 18px;
}
body.compact-view .site-header {
  height: 50px;
}
body.compact-view .below-photo {
  padding-top: 16px;
  padding-bottom: 10px;
}
body.compact-view .photo-labels {
  top: 52px;
}
body.compact-view .footnote {
  display: none;
}

@keyframes painting-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes content-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes breathe {
  0%,
  100% {
    opacity: 0.4;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1.3);
  }
}
@media (max-width: 600px) {
  .gallery-art {
    min-height: 700px;
  }
  .site-header {
    height: 80px;
    padding: 0 24px;
  }
  .brand {
    gap: 12px;
  }
  .brand-emblem {
    width: 82px;
    height: 34px;
  }
  .brand-wordmark {
    font-size: 18px;
    letter-spacing: 2px;
  }
  .header-note {
    display: none;
  }
  main[data-state="empty"] {
    min-height: max(700px, 100svh);
  }
  .intro {
    top: max(110px, 16svh);
    left: 20px;
    right: 20px;
  }
  .eyebrow {
    font-size: 12px;
    letter-spacing: 3px;
    margin-bottom: 17px;
  }
  h1 {
    font-size: 39px;
    line-height: 1.45;
    letter-spacing: 3px;
  }
  .mobile-break {
    display: block;
  }
  .intro-copy {
    margin-top: 15px;
    font-size: 14px;
    letter-spacing: 2px;
  }
  main[data-state="empty"] .workspace {
    top: 74%;
    left: 18px;
    right: 18px;
  }
  .file-note {
    font-size: 12px;
  }
  .file-note span {
    display: block;
    margin: 3px 0 0;
  }
  footer {
    top: max(665px, calc(100svh - 37px));
    left: 20px;
    right: 20px;
    justify-content: center;
    letter-spacing: 1px;
  }
  .footer-signature {
    display: none;
  }
  main:not([data-state="empty"]) {
    padding: 96px 20px 42px;
  }
  .actions {
    gap: 10px;
  }
  .button {
    padding: 0 23px;
  }
  .photo-labels {
    inset: 84px 12px auto;
  }
  body.is-immersive .site-header {
    height: 70px;
  }
  body.is-immersive .below-photo {
    padding-left: 16px;
    padding-right: 16px;
  }
  .footnote {
    font-size: 12px;
    max-width: 340px;
  }
  .processing-status {
    font-size: 14px;
    letter-spacing: 1px;
    padding: 20px 12px;
  }
}
@media (max-width: 350px) {
  h1 {
    font-size: 34px;
  }
  .upload-description {
    letter-spacing: 0;
  }
}
@media (max-height: 700px) and (min-width: 601px) {
  .intro {
    top: 120px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* Accounts retain the gallery's typography and quiet, flat controls. */
.account-toggle {
  pointer-events: auto;
  background: #17141185;
  color: var(--ivory);
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 13px;
  padding: 10px 15px;
  min-height: 44px;
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-toggle:hover {
  border-color: var(--gold);
}
#account-dialog,
.admin-dialog {
  color: var(--ivory);
  background: #1d1915;
  border: 1px solid #9c856147;
  box-shadow: -20px 0 80px #0004;
  border-radius: 0;
  position: fixed;
  inset: 0 0 0 auto;
  margin: 0;
  width: min(480px, 100%);
  height: 100dvh;
  max-height: 100dvh;
  max-width: 100%;
  padding: 0;
  z-index: 20;
}
#account-dialog::backdrop,
.admin-dialog::backdrop {
  background: #0008;
  backdrop-filter: blur(4px);
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 25px 28px;
  position: sticky;
  top: 0;
  z-index: 2;
  background: #1d1915;
  border-bottom: 1px solid var(--line);
}
.panel-header h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: 2px;
  font-size: 24px;
}
.icon-button {
  font-size: 26px;
  color: var(--muted);
  border: 0;
  background: none;
  width: 44px;
  height: 44px;
}
.panel-body {
  padding: 8px 28px 30px;
}
.panel-status {
  font-size: 14px;
  line-height: 1.7;
  color: #d4c199;
  overflow-wrap: anywhere;
}
.panel-status:empty {
  display: none;
}
.panel-status.error {
  color: #f0b3a0;
}
.panel-tabs {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin: 22px 0 26px;
  border-bottom: 1px solid var(--line);
}
.panel-tabs button {
  font-size: 14px;
  color: var(--muted);
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  min-height: 44px;
  padding: 0 0 12px;
  letter-spacing: 1px;
}
.panel-tabs button.selected {
  color: var(--ivory);
  border-bottom-color: var(--gold);
}
.panel-body label,
.admin-shell label,
.admin-dialog label {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 18px 0;
  font-size: 14px;
  color: var(--ivory);
}
.panel-body input,
.admin-shell input,
.admin-shell select,
.admin-dialog input,
.admin-dialog textarea {
  background: #100e0c;
  border: 1px solid #b6ab9950;
  border-radius: 5px;
  color: var(--ivory);
  font: inherit;
  min-height: 46px;
  padding: 10px 12px;
  max-width: 100%;
  width: 100%;
}
.subtle {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}
.wallet-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 15px;
  margin: 20px 0;
}
.wallet-heading p {
  margin: 0 0 10px;
}
.wallet-heading strong {
  font-size: 40px;
  font-family: var(--serif);
  font-weight: 400;
}
.wallet-heading span {
  font-size: 12px;
  color: var(--muted);
}
.text-button {
  font-size: 13px;
  line-height: 1.6;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: #dec69e;
  background: none;
  border: 0;
  padding: 8px 0;
  cursor: pointer;
}
.text-button:disabled {
  opacity: 0.35;
  cursor: default;
}
.member-footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid var(--line);
  margin-top: 40px;
  padding-top: 15px;
}
.record {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  overflow-wrap: anywhere;
}
.record strong {
  display: block;
  font-weight: 500;
  line-height: 1.6;
}
.record small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}
.record p {
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
  margin: 10px 0 0;
}
.pagination {
  display: flex;
  gap: 25px;
  justify-content: flex-end;
  margin: 16px 0;
}
@media (max-width: 600px) {
  .account-toggle {
    font-size: 12px;
    padding: 8px 10px;
    max-width: 145px;
  }
  .site-header {
    padding-left: 18px;
    padding-right: 18px;
    gap: 10px;
  }
  .site-header .brand {
    gap: 8px;
  }
  .site-header .brand-wordmark {
    font-size: 16px;
    letter-spacing: 1px;
  }
  .site-header .brand-emblem {
    width: 60px;
    height: 30px;
  }
  .panel-header {
    padding: 18px 22px;
  }
  .panel-body {
    padding-left: 22px;
    padding-right: 22px;
  }
  .panel-tabs {
    gap: 16px;
  }
}
@media (max-width: 350px) {
  .site-header .brand-emblem {
    display: none;
  }
  .account-toggle {
    max-width: 135px;
  }
}
