/* Shared interaction language. Artwork and photograph colors stay independent. */
:root {
  --motion-fast: 180ms;
  --motion-tab: 240ms;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --surface: #211c17;
  --danger: #efb09a;
}
html { scrollbar-gutter: stable; }
html.modal-open { overflow: hidden; }
html.modal-open body { overflow: hidden; }
/* Intrinsic rows retain the composition while allowing enlarged text to grow. */
main[data-state="empty"] {
  display: grid; grid-template-rows: auto minmax(100px, 1fr) auto;
  padding: max(calc(var(--site-header-height, 100px) + 24px), 17.5svh) 24px max(76px, calc(26.5svh - 116px));
}
main[data-state="empty"] .intro { position: static; grid-row: 1; }
main[data-state="empty"] .workspace { position: static; grid-row: 3; width: 100%; }
footer { position: relative; top: auto; left: auto; right: auto; margin: -50px 48px 0; }
button, input, select, textarea, .button, .text-button {
  transition: color var(--motion-fast), background-color var(--motion-fast), border-color var(--motion-fast), box-shadow var(--motion-fast), transform var(--motion-fast) var(--ease-out), opacity var(--motion-fast);
}
.button { position: relative; border-radius: 8px; gap: 12px; }
.button.primary { box-shadow: inset 0 1px #fff9, 0 3px 12px #0002; }
.button svg { transition: transform 240ms var(--ease-out); flex-shrink: 0; }
.button:active:not(:disabled), .account-toggle:active:not(:disabled), .icon-button:active:not(:disabled) {
  transform: scale(.96);
  transition-duration: 100ms;
}
.text-button:active:not(:disabled), .panel-tabs button:active:not(:disabled), .quality-picker button:active:not(:disabled) {
  transform: translateY(1px);
  color: #fff6e6;
  transition-duration: 100ms;
}
.icon-button { border-radius: 50%; flex-shrink: 0; }
.text-button { padding-inline: 8px; border-radius: 6px; }
button:disabled { cursor: default; }
.is-pending { cursor: wait !important; }
.is-pending::before {
  content: ""; display: inline-block; width: 13px; height: 13px;
  border: 1.5px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: ui-spin 800ms linear infinite; flex-shrink: 0; margin-right: 6px;
}
.account-toggle {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  overflow: visible; text-overflow: clip; white-space: normal; border-radius: 8px;
  min-width: 96px;
}
.account-name { overflow-wrap: anywhere; text-align: left; min-width: 0; line-height: 1.45; }
.account-balance { white-space: nowrap; color: #dfcaa6; font-variant-numeric: tabular-nums; }
.site-header { min-height: 100px; height: auto; padding-block: 16px; gap: 24px; }
.brand { flex-shrink: 0; }
@media (hover: hover) and (pointer: fine) {
  .primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: inset 0 1px #fff, 0 7px 24px #0004; }
  .upload-area:hover svg { transform: translateX(4px); }
  .secondary:hover:not(:disabled) { transform: translateY(-2px); }
  .icon-button:hover, .text-button:hover:not(:disabled) { background: #ead5af0e; color: #fff3dc; }
  .account-toggle:hover { background: #2d251def; border-color: #c8ad7b; }
}
@media (hover: none) {
  .primary:hover, .secondary:hover { transform: none; }
}
.panel-body input, .admin-shell input, .admin-shell select, .admin-dialog input, .admin-dialog textarea {
  font-size: 16px; border-radius: 8px; line-height: 1.5;
}
input:focus-visible, textarea:focus-visible, select:focus-visible {
  border-color: #d1b986; outline: 2px solid #d1b98680; outline-offset: 3px;
  background: #17130f; box-shadow: 0 0 0 5px #d1b9860a;
}
.panel-body label { line-height: 1.5; }
.panel-body form > .button { min-width: 112px; margin-top: 8px; }
.panel-body .subtle { font-size: 13px; }
.panel-status { padding: 12px 14px; border: 1px solid #d3b17f35; border-radius: 8px; background: #d3b17f09; }
.panel-status.error { border-color: #f0b3a045; background: #f0b3a008; }
.panel-status:empty { display: none; }
.panel-tabs {
  position: relative; flex-wrap: nowrap; gap: 20px; padding: 0 2px;
  overflow-x: auto; scrollbar-width: thin; scrollbar-color: #9c856160 transparent;
}
.panel-tabs button { flex-shrink: 0; border-bottom: 0; padding: 0 2px 12px; min-width: 44px; }
.panel-tabs button.selected { border-bottom-color: transparent; }
.tab-indicator {
  position: absolute; height: 2px; left: 0; bottom: 0; border-radius: 2px;
  background: #dbc08e; pointer-events: none;
}
[role="tabpanel"]:focus-visible { outline-offset: 3px; }
.quality-picker { gap: 4px; border: 1px solid var(--line); padding: 4px; border-radius: 10px; background: #171411b0; }
.quality-picker button { padding: 10px 16px; border-radius: 6px; letter-spacing: 1px; }
.quality-picker button[aria-pressed="true"] { background: #ddc39816; box-shadow: inset 0 0 0 1px #ddc39826; }
.quality-picker button::after { bottom: 4px; left: 20%; right: 20%; }
.wallet-heading { align-items: center; flex-wrap: wrap; }
.wallet-heading strong { display: inline-block; font-variant-numeric: tabular-nums; }
#member-name { overflow-wrap: anywhere; font-size: 18px; }
.record { padding: 20px 4px; }
.record p, .record small { line-height: 1.7; }
.record .text-button { margin-top: 8px; }
.pagination { gap: 12px; }
.list-loading, .list-error { padding: 22px 16px; min-height: 192px; }
.list-error { font-size: 14px; color: var(--danger); line-height: 1.7; }
.skeleton-line { display: block; height: 12px; margin: 22px 0; border-radius: 4px; background: #e9d8b914; animation: ui-pulse 1.5s ease-in-out infinite; }
.skeleton-line:nth-of-type(2) { width: 76%; animation-delay: 120ms; }
.skeleton-line:nth-of-type(3) { width: 88%; animation-delay: 240ms; }
.danger { color: var(--danger); }
.button.primary.danger { color: #f8d6c8; background: #603b2d; border-color: #c78d6e80; box-shadow: none; }
#account-dialog, .admin-dialog {
  overflow: hidden; border-left: 1px solid #bca07755;
  height: var(--visual-height, 100dvh); max-height: var(--visual-height, 100dvh);
  inset: auto 0 var(--visual-bottom, 0px) auto;
  box-shadow: -24px 0 100px #0006;
}
#account-dialog[open], .admin-dialog[open] { display: flex; flex-direction: column; }
.panel-header { position: relative; flex-shrink: 0; padding-top: max(22px, env(safe-area-inset-top)); }
.panel-body { overflow-y: auto; overscroll-behavior: contain; min-height: 0; padding-bottom: max(30px, env(safe-area-inset-bottom)); }
#account-dialog::backdrop, .admin-dialog::backdrop {
  background: #0806049c; backdrop-filter: blur(4px);
  animation: ui-backdrop-in 320ms ease both;
}
#account-dialog[data-motion="closing"]::backdrop, .admin-dialog[data-motion="closing"]::backdrop {
  animation: ui-backdrop-out 260ms ease both;
}
.message { min-height: 23px; overflow-wrap: anywhere; }
body.is-immersive .message:not(:empty) { padding: 10px 14px; border: 1px solid #d3b17f30; border-radius: 8px; background: #171411e8; width: fit-content; }
body.is-immersive .message:not(.error):not(:empty) { position: absolute; bottom: calc(100% - 12px); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 36px); margin: 0; }
body.is-immersive .site-header { min-height: 82px; height: auto; padding-top: max(12px, env(safe-area-inset-top)); }
body.is-immersive .below-photo { padding-top: 24px; }
body.is-immersive .photo-panel { top: var(--canvas-top, 90px); bottom: var(--canvas-bottom, 128px); height: auto !important; }
body.is-immersive .photo-stage { max-height: 100%; }
body.is-immersive .photo-labels { top: 12px; }
.processing-status { background: #171411dd; border: 1px solid #d2b88635; border-radius: 100px; padding: 14px 22px; box-shadow: 0 8px 36px #0004; }
.breathing-dot { width: 7px; height: 7px; box-shadow: 0 0 14px #eddbb84d; }
.comparison-handle { width: 44px; height: 44px; border-radius: 12px; transition: background 180ms, box-shadow 180ms, scale 100ms; }
.comparison.is-dragging .comparison-handle { scale: 1.12; background: #3d3022; box-shadow: 0 4px 24px #0006; }
.photo-labels { inset-inline: 24px; }
.photo-labels span { border: 1px solid #e8d5b32b; padding: 6px 10px; border-radius: 6px; }
.actions { flex-wrap: wrap; }
.footnote { text-wrap: pretty; }
@media (max-width: 600px) {
  main[data-state="empty"] { padding: max(calc(var(--site-header-height, 80px) + 24px), 16svh) 18px max(54px, calc(26svh - 142px)); }
  footer { margin: -37px 20px 0; }
  .site-header { min-height: 80px; padding-block: 12px; gap: 10px; }
  .account-toggle { max-width: min(45vw, 180px); flex-wrap: wrap; gap: 2px 8px; padding: 8px 10px; }
  .account-name { text-align: center; }
  .account-balance { font-size: 11px; }
  #account-dialog, .admin-dialog {
    inset: auto 0 var(--visual-bottom, 0px); width: 100%; height: auto;
    max-height: calc(var(--visual-height, 100dvh) - max(16px, env(safe-area-inset-top)));
    border-radius: 22px 22px 0 0; border: 1px solid #bca07755; border-bottom: 0;
    box-shadow: 0 -20px 80px #0006;
  }
  .panel-header { padding: 20px 22px 14px; }
  .panel-header::before { content: ""; position: absolute; top: 8px; left: calc(50% - 18px); width: 36px; height: 3px; background: #c9b48e50; border-radius: 3px; }
  .panel-header h2 { font-size: 23px; }
  .panel-body { padding: 0 22px max(26px, env(safe-area-inset-bottom)); }
  .panel-tabs { gap: 16px; margin-top: 20px; margin-bottom: 22px; }
  .panel-body form > .button { width: 100%; }
  .member-footer { margin-top: 26px; }
  .quality-picker button { padding-inline: 12px; }
  body.is-immersive .site-header { min-height: 70px; }
  .processing-status { font-size: 13px; letter-spacing: .5px; max-width: calc(100vw - 36px); }
  .photo-labels { inset-inline: 12px; }
}
@media (max-height: 500px) {
  .panel-header { padding: 8px 20px; }
  .panel-tabs { margin: 14px 0; }
  body.is-immersive .site-header { min-height: 50px; padding-block: 5px; }
  body.is-immersive .below-photo { padding-top: 8px; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
}
@keyframes ui-spin { to { transform: rotate(360deg); } }
@keyframes ui-pulse { 50% { opacity: .35; } }
@keyframes ui-backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes ui-backdrop-out { from { opacity: 1; } to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, *::backdrop { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* A compact, scalable restoration seal. */
.site-header .brand { gap: 10px; }
.site-header .brand-emblem { display: block; width: 38px; height: 38px; background: url('/logo-renewal.svg') center / contain no-repeat; mask-image: none; }
.site-header .brand-wordmark { font-size: 16px; letter-spacing: 1px; }
.return-home { margin-left: auto; pointer-events: auto; white-space: nowrap; }
@media (max-width: 600px) {
  .site-header { gap: 8px; flex-wrap: wrap; }
  .site-header .brand-emblem { width: 30px; height: 30px; }
  .site-header .brand-wordmark { font-size: 14px; letter-spacing: .5px; }
  .return-home { order: 3; flex-basis: 100%; text-align: left; margin: 0; padding: 6px 0; min-height: 44px; }
}
.site-header .brand { order: 0; }
.site-header .return-home { order: 1; }
.site-header #account-toggle { order: 2; }
@media (max-width: 600px) { .site-header .return-home { order: 3; } }
body.is-immersive .site-header { height: auto; }
