@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

@font-face {
  font-family: "The Met Sans";
  src: url("/fonts/TheMetSans-Bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  /* Core palette */
  --color-core-violet: #7660a6;
  --color-core-blue: #0050bc;
  --color-core-sky: #048abf;
  --color-core-mint: #afe1a5;
  --color-core-cream: #f6f0a0;
  --color-core-yellow: #f0c800;
  --color-core-red: #e4002b;
  --color-core-coral: #f27d72;
  --color-core-off-white: #f2f0e9;

  /* Card copy palette */
  --color-card-copy-orange: #c65a00;
  --color-card-copy-olive: #78681e;
  --color-card-copy-green: #004032;
  --color-card-copy-teal: #0a4b58;
  --color-card-copy-navy: #001e50;
  --color-card-copy-plum: #5c0041;
  --color-card-copy-light-pink: #f4c3cc;
  --color-card-copy-light-blue: #c8d8eb;
  --color-card-copy-light-cyan: #b2e4e4;
  --color-card-copy-light-mint: #afe1a5;
  --color-card-copy-light-cream: #f6f0a0;
  --color-card-copy-light-yellow: #f8e08e;
  --color-card-copy-violet-contrast: #fff38a;

  /* Surfaces */
  --color-background: var(--color-core-off-white);
  --color-surface: #ffffff;
  --color-surface-subtle: #f8f7f2;
  --color-surface-muted: #e7e7e4;

  /* Content */
  --color-text: #181818;
  --color-text-muted: #62625e;
  --color-text-disabled: #d6d6d2;
  --color-text-error: #d00028;
  --color-border: #b5b5b0;

  /* Effects */
  --color-surface-translucent: rgb(255 255 255 / 70%);
  --color-overlay: rgb(0 0 0 / 48%);
  --color-shadow: rgb(0 0 0 / 18%);

  /* Shape and layout */
  --radius-small: 8px;
  --radius: 30px;
  --button-radius: 999px;
  --space: 16px;
  --shell-width: min(100vw, 600px);
  --card-peek: 72px;
  --navigation-icon-size: 32px;
  --welcome-navigation-height: 0px;
  --welcome-navigation-padding: min(calc(16px + 0.5vw), 24px);
  --welcome-navigation-button-size: 32px;
  --welcome-navigation-icon-size: 24px;
  --safe-inline-start: env(safe-area-inset-left, 0px);
  --safe-inline-end: env(safe-area-inset-right, 0px);
  --shell-navigation-inset-start: max(
    var(--space),
    var(--safe-inline-start),
    calc((100vw - var(--shell-width)) / 2 + var(--space))
  );
  --shell-navigation-inset-end: max(
    var(--space),
    var(--safe-inline-end),
    calc((100vw - var(--shell-width)) / 2 + var(--space))
  );
  --card-flip-angle: 180deg;
  --card-flip-peek-angle: 22deg;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  touch-action: pan-x pan-y;
}

html[dir="rtl"] {
  --safe-inline-start: env(safe-area-inset-right, 0px);
  --safe-inline-end: env(safe-area-inset-left, 0px);
  --card-flip-angle: -180deg;
  --card-flip-peek-angle: -22deg;
}

/* Tracking can damage joined RTL scripts. Let each script use its natural
   spacing even where the LTR design applies custom letter spacing. */
html[dir="rtl"] * {
  letter-spacing: normal !important;
}

* {
  box-sizing: border-box;
}

.i18n-pending body {
  visibility: hidden;
}

[hidden] {
  display: none !important;
}

.i-spy-term {
  display: inline-block;
  direction: ltr;
  unicode-bidi: isolate;
  white-space: nowrap;
}

/* Content omitted from the embedded welcome-guide variant. */
[data-experience-mode="welcome"] [data-standard-only] {
  display: none !important;
}

[data-experience-mode="welcome"][data-experience-shell="top-level"] {
  --welcome-navigation-height: calc(
    (var(--welcome-navigation-padding) * 2) +
      var(--welcome-navigation-button-size)
  );
}

.welcome-navigation {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 120;
  display: flex;
  justify-content: space-between;
  padding: var(--welcome-navigation-padding);
  color: var(--color-text);
  background: var(--color-surface);
  box-shadow: 0 4px 14px var(--color-shadow);
}

.welcome-navigation-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--welcome-navigation-button-size);
  min-width: var(--welcome-navigation-button-size);
  height: var(--welcome-navigation-button-size);
  padding: 4px;
  color: var(--color-text);
  background: var(--color-surface-translucent);
  border: 0;
  border-radius: 4px;
  text-decoration: none;
}

.welcome-navigation-close:focus-visible {
  color: var(--color-text);
  background: var(--color-surface-muted);
}

.welcome-navigation-close svg {
  display: block;
  width: var(--welcome-navigation-icon-size);
  height: var(--welcome-navigation-icon-size);
}

[data-experience-mode="welcome"] body {
  padding-top: var(--welcome-navigation-height);
}

[data-experience-mode="welcome"] .language-link {
  top: calc(var(--welcome-navigation-height) + var(--space));
}

[data-experience-mode="welcome"] :is(
    #start-state,
    #language-state,
    #onboarding-state,
    #desktop-choice-state,
    #accession-number-state,
    #loading-state,
    #cards-state,
    #camera-state,
    #artwork-confirmation-state,
    #surprise-state
  ) {
  height: calc(100dvh - var(--welcome-navigation-height));
}

[data-experience-mode="welcome"] #camera-flow {
  top: var(--welcome-navigation-height);
  height: calc(100dvh - var(--welcome-navigation-height));
}

[data-experience-mode="welcome"] :is(
    .cards-loading-overlay,
    .completion-feedback-backdrop,
    .info-popover-backdrop
  ) {
  top: var(--welcome-navigation-height);
}

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

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

html.home-page {
  min-height: 100dvh;
  background-color: var(--color-background);
}

body.home-page {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100dvh;
  background: transparent;
}

body {
  background: var(--color-background);
  color: var(--color-text);
  font-family: inherit;
  min-height: 100dvh;
  overflow: hidden;
}

.bottom-dock {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  width: auto;
  margin: 0;
  padding-bottom: calc(
    var(--bottom-dock-padding, 0px) + env(safe-area-inset-bottom, 0px)
  );
}

#home-title {
  font-family: "The Met Sans", "Inter", -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

button {
  font: inherit;
  min-height: 48px;
  padding: 12px 18px;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1.5px solid var(--color-text);
  border-radius: var(--button-radius);
  font-size: 15px;
  font-weight: 600;
}

button:active:not(:disabled) {
  background: var(--color-surface-muted);
}

button:focus-visible,
a:focus-visible,
#language-search:focus-visible,
.info-popover-feedback-field:focus-visible {
  outline: 3px solid var(--color-text);
  outline-offset: 3px;
}

button:disabled {
  color: var(--color-text-muted);
  border-color: var(--color-border);
}

/* Shared navigation and icon controls */

.corner-control {
  position: absolute;
  top: var(--space);
  inset-inline-start: max(var(--space), var(--safe-inline-start));
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
}

/* Page-to-page navigation is visually distinct from dismiss/exit controls. */
.page-back {
  width: auto;
  min-width: 44px;
  padding-block: 0;
  padding-inline: 0 12px;
  gap: 6px;
  background: transparent;
  border: 0;
  border-radius: var(--button-radius);
  font-size: 17px;
  font-weight: 600;
  line-height: 1;
}

.page-back:active:not(:disabled) {
  background: transparent;
  opacity: 0.65;
}

.page-back::before {
  position: static;
  top: auto;
  left: auto;
  display: block;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  background: url("/images/n-chevron-left.svg") center / contain no-repeat;
  content: "";
  transform: none;
}

html[dir="rtl"] .page-back::before {
  transform: scaleX(-1);
}

.page-back:not(.page-back--icon-only)::after {
  content: "Back";
}

.dismiss-button {
  width: 44px;
  padding: 1px 0 0;
  background: var(--color-surface);
  border-radius: var(--button-radius);
  font-size: 25px;
  font-weight: 400;
  line-height: 1;
}

.dismiss-button::before {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  background: url("/images/close-x.svg") center / contain no-repeat;
  content: "";
  transform: translate(-50%, -50%);
}

.header-action {
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 2px 4px;
  color: var(--color-text);
  background: transparent;
  border: 0;
  border-radius: var(--button-radius);
}

.header-action:active:not(:disabled) {
  background: transparent;
  opacity: 0.65;
}

.header-action-icon {
  display: block;
  width: var(--navigation-icon-size);
  height: var(--navigation-icon-size);
  flex: 0 0 var(--navigation-icon-size);
  object-fit: contain;
}

.header-action-label {
  font-size: 17px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  unicode-bidi: plaintext;
}

.language-link {
  position: fixed;
  top: var(--space);
  inset-inline-end: var(--shell-navigation-inset-end);
  z-index: 20;
  width: auto;
  text-decoration: none;
}

[data-experience-mode="standard"].home-page .language-link {
  top: calc(var(--space) + env(safe-area-inset-top, 0px));
}

[data-experience-mode="welcome"].home-page .language-link {
  top: calc(
    var(--welcome-navigation-height) + var(--space) +
      env(safe-area-inset-top, 0px)
  );
}

#start-state,
#language-state,
#onboarding-state,
#desktop-choice-state,
#accession-number-state,
#loading-state,
#cards-state,
#camera-state {
  display: flex;
  flex-direction: column;
  gap: var(--space);
  height: 100dvh;
  width: 100%;
  max-width: var(--shell-width);
  margin: 0 auto;
  padding: 80px 24px 28px;
  position: relative;
  overflow: hidden;
}

#start-state,
#accession-number-state,
#loading-state {
  justify-content: center;
  text-align: center;
}

#start-state {
  transform: translateY(40px);
}

#loading-state {
  align-items: center;
  gap: 24px;
}

/* Desktop preview and accession-number choice */

#desktop-choice-state {
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  text-align: center;
}

.desktop-choice-content {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 0;
  width: min(100%, 520px);
}

.desktop-choice-content h1,
.desktop-choice-context {
  margin: 0;
  text-wrap: balance;
}

.desktop-choice-content h1 {
  margin-bottom: 32px;
  font-size: clamp(38px, 5vw, 44px);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.045em;
}

.desktop-choice-context {
  width: min(100%, 420px);
  margin-bottom: 12px;
  font-size: clamp(20px, 2.4vw, 22px);
  font-weight: 400;
  line-height: 1.3;
}

.desktop-choice-actions {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 32px;
  width: min(100%, 420px);
}

.desktop-preview-button {
  width: min(100%, 240px);
  min-width: 220px;
  min-height: 52px;
  padding-inline: 24px;
  font-size: 16px;
}

.desktop-preview-option {
  display: grid;
  justify-items: center;
  gap: 8px;
  width: 100%;
}

.desktop-preview-artwork {
  display: block;
  width: min(100%, 240px);
  height: min(30dvh, 260px);
  background: var(--color-surface);
  object-fit: contain;
}

.desktop-accession-button {
  min-width: 220px;
  min-height: 52px;
  padding-inline: 24px;
  font-size: 16px;
}

#desktop-choice-status {
  margin: -10px 0 0;
  color: var(--color-text-error);
  font-size: 15px;
}

/* Artwork confirmation and loading */

#artwork-confirmation-state {
  position: relative;
  width: 100%;
  max-width: var(--shell-width);
  height: 100dvh;
  margin: 0 auto;
  padding: 68px 16px calc(18px + env(safe-area-inset-bottom));
  text-align: center;
  overflow-y: auto;
}

.artwork-confirmation-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  width: 100%;
  min-height: 100%;
}

#artwork-confirmation-image {
  display: block;
  width: auto;
  max-width: min(100%, 380px);
  height: auto;
  max-height: min(48dvh, 380px);
  border-radius: 0;
}

#artwork-confirmation-title {
  width: min(100%, 520px);
  margin: 0;
  color: var(--color-text);
  font-size: clamp(36px, 10vw, 56px);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.05em;
  text-wrap: balance;
  unicode-bidi: plaintext;
}

#artwork-confirmation-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  width: fit-content;
  max-width: 100%;
}

#artwork-confirmation-actions button {
  flex: 0 1 auto;
  min-width: 96px;
  max-width: 100%;
}

#artwork-confirmation-no-btn {
  background: var(--color-surface-muted);
}

#artwork-confirmation-yes-btn {
  color: var(--color-surface);
  background: var(--color-text);
}

#artwork-choice-state {
  justify-content: center;
}

#artwork-choice-title {
  width: min(100%, 560px);
  margin: 0;
  color: var(--color-text);
  font-size: clamp(26px, 7vw, 40px);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

#artwork-choice-title:focus {
  outline: none;
}

#artwork-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 12px;
  width: min(100%, 540px);
}

.artwork-choice-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  text-align: start;
  transition:
    border-color 160ms ease,
    transform 160ms ease;
}

.artwork-choice-card:active:not(:disabled) {
  background: var(--color-surface);
  border-color: var(--color-text);
  transform: scale(0.985);
}

.artwork-choice-image {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--color-surface-muted);
  object-fit: contain;
}

.artwork-choice-copy {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  width: 100%;
  min-height: 58px;
  padding: 10px 10px 11px;
}

.artwork-choice-name,
.artwork-choice-artist {
  display: -webkit-box;
  overflow: hidden;
  unicode-bidi: plaintext;
  -webkit-box-orient: vertical;
}

.artwork-choice-name {
  -webkit-line-clamp: 2;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}

.artwork-choice-artist {
  color: var(--color-text-muted);
  -webkit-line-clamp: 1;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.2;
}

#artwork-choice-none-btn,
#artwork-choice-accession-btn {
  width: fit-content;
  min-width: 132px;
  max-width: 100%;
}

#artwork-choice-none-btn {
  color: var(--color-surface);
  background: var(--color-text);
}

#artwork-choice-accession-btn {
  min-height: 44px;
  padding: 8px 4px;
  color: var(--color-text-muted);
  background: transparent;
  border: 0;
  border-radius: 0;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

#artwork-choice-accession-btn:active:not(:disabled) {
  color: var(--color-text);
  background: transparent;
}

#loading-artwork-image {
  display: block;
  max-width: min(100%, 340px);
  max-height: min(48dvh, 320px);
  border-radius: 0;
  object-fit: contain;
}

.room-prompts-loading-animation {
  display: block;
  width: min(80vw, 320px);
  height: auto;
  max-height: min(40dvh, 320px);
  object-fit: contain;
  transform: rotate(-2deg);
}

#loading-title {
  margin: 0;
  font-size: clamp(32px, 9vw, 48px);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.045em;
}

#loading-title,
#cards-loading-title {
  color: var(--color-text);
}

.loading-message {
  display: flex;
  align-items: baseline;
  justify-content: center;
  max-width: 100%;
  white-space: nowrap;
}

.loading-dots {
  display: inline-flex;
  flex: 0 0 0.9em;
  width: 0.9em;
  margin-inline-start: 0.12em;
  color: var(--color-text);
  font-size: clamp(32px, 9vw, 48px);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.08em;
  text-align: start;
}

.loading-dot {
  opacity: 0;
}

.loading-dot:first-child {
  opacity: 1;
}

.loading-dot:nth-child(2) {
  animation: loading-dot-two 1.2s steps(1, end) infinite;
}

.loading-dot:nth-child(3) {
  animation: loading-dot-three 1.2s steps(1, end) infinite;
}

@keyframes loading-dot-two {
  0%,
  32% {
    opacity: 0;
  }

  33%,
  100% {
    opacity: 1;
  }
}

@keyframes loading-dot-three {
  0%,
  65% {
    opacity: 0;
  }

  66%,
  100% {
    opacity: 1;
  }
}

/* Homepage */

#start-state {
  align-items: center;
  justify-content: flex-start;
  height: 100%;
  transform: none;
  padding-top: calc(
    clamp(104px, 15dvh, 152px) + env(safe-area-inset-top, 0px)
  );
  padding-bottom: 16px;
}

.home-illustrations {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns:
    minmax(0, 1fr) clamp(112px, 30vw, 160px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  align-items: end;
  flex: 1 1 0;
  width: min(calc(100vw - 60px), 440px);
  min-height: 0;
  margin-top: calc(-52px - var(--space) - 8px);
}

.home-illustration {
  display: block;
  width: auto;
  height: 85%;
  max-width: none;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.home-family-picture {
  display: contents;
}

.home-illustration-family-left {
  position: absolute;
  bottom: 0;
  left: 0;
  z-index: 1;
  filter: brightness(0.86);
  /* Preserve the original visible bounds despite the new source canvas. */
  height: 94.67%;
  transform: translate(calc(-12px + 2.56%), 1.98%);
}

.home-illustration-vase {
  position: relative;
  grid-column: 2;
  align-self: start;
  justify-self: center;
  z-index: 0;
  height: min(26%, 132px);
  margin-top: calc(96px + var(--space));
  transform: translateX(clamp(8px, 2vw, 14px));
}

.home-illustration-family-right {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 1;
  filter: brightness(0.86);
  /* Preserve the original visible bounds despite the new source canvas. */
  height: 79.45%;
  transform: translate(calc(12px + 14.6%), 7.25%);
}

@media (max-width: 600px) {
  .home-illustration-family-left {
    height: 98%;
    transform: translate(calc(-4px + 2.56%), 1.98%);
  }

  .home-illustration-family-right {
    height: 82.23%;
    transform: translate(calc(4px + 14.6%), 7.25%);
  }
}

#home-title,
#accession-number-title,
.onboarding-copy {
  margin: 0;
  font-size: clamp(40px, 12vw, 64px);
  line-height: 0.98;
  font-weight: 600;
  letter-spacing: -0.055em;
}

#home-title {
  font-size: clamp(58px, 18vw, 88px);
  line-height: 0.9;
  font-weight: 700;
  letter-spacing: 0;
}

#home-title,
#start-go-btn {
  transform: translateY(-10px);
}

.home-title-line {
  display: block;
  white-space: nowrap;
}

#start-go-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 200px);
  min-width: 0;
  min-height: 52px;
  padding: 12px 20px;
  color: var(--color-surface);
  background: var(--color-text);
  font-size: 16px;
  text-align: center;
}

#start-go-btn {
  z-index: 1;
  align-self: center;
  width: auto;
  margin-top: 8px;
  font-size: 24px;
}

#prototype-notice {
  --bottom-dock-padding: 12px;
  position: relative;
  right: auto;
  bottom: auto;
  left: auto;
  grid-row: 2;
  padding-top: 12px;
  padding-right: 24px;
  padding-left: 24px;
  color: var(--color-surface);
  background: var(--color-text);
  font-size: 16px;
  line-height: 1.35;
  text-align: center;
}

.desktop-phone-prompt {
  position: fixed;
  inset-inline-end: 24px;
  bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  display: none;
  width: min(280px, calc(100vw - 48px));
  padding: 22px 52px 20px 22px;
  background: var(--color-surface);
  border: 2px solid var(--color-text);
  border-radius: 18px;
  box-shadow: 6px 6px 0 var(--color-text);
  text-align: start;
}

.desktop-phone-prompt p {
  margin: 0 0 5px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
}

.desktop-phone-prompt-url {
  display: inline-block;
  font-size: 21px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

.desktop-phone-prompt-close {
  position: absolute;
  top: 8px;
  inset-inline-end: 8px;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 50%;
}

.desktop-phone-prompt-close::before {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  background: url("/images/close-x.svg") center / contain no-repeat;
  content: "";
  transform: translate(-50%, -50%);
}

.desktop-phone-prompt-close:active:not(:disabled) {
  background: var(--color-surface-muted);
}

@media (any-hover: hover) and (any-pointer: fine) {
  .desktop-phone-prompt {
    display: block;
  }
}

.surprise-thumbnail {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

/* Onboarding */

.onboarding-track {
  display: flex;
  width: 100%;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  touch-action: pan-x;
}

.onboarding-track::-webkit-scrollbar {
  display: none;
}

.onboarding-step {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: calc(var(--space) * 2);
  padding: 80px 24px max(28px, env(safe-area-inset-bottom));
  scroll-snap-align: start;
  scroll-snap-stop: always;
  text-align: center;
}

.onboarding-image {
  display: block;
  width: min(100%, 480px);
  height: auto;
  max-height: min(42dvh, 360px);
  object-fit: contain;
  filter: brightness(0.86);
  border-radius: var(--radius);
  -webkit-user-drag: none;
}

.onboarding-copy {
  width: min(calc(100% - 48px), 440px);
  font-size: clamp(36px, 10vw, 56px);
  text-wrap: balance;
  overflow-wrap: break-word;
  unicode-bidi: plaintext;
}

.camera-onboarding-start-action {
  display: block;
  position: absolute;
  bottom: max(8px, env(safe-area-inset-bottom));
  left: 50%;
  z-index: 10;
  width: max-content;
  min-width: 132px;
  max-width: calc(100% - 48px);
  min-height: 52px;
  padding-inline: 24px;
  transform: translateX(-50%);
  font-size: 16px;
  font-weight: 600;
  white-space: normal;
}

.camera-onboarding-start-action.is-start {
  color: var(--color-surface);
  background: var(--color-text);
}

.camera-onboarding-start-action.is-start:active:not(:disabled) {
  background: var(--color-text);
}

.onboarding-dots {
  position: absolute;
  bottom: calc(max(8px, env(safe-area-inset-bottom)) + 68px);
  left: 50%;
  z-index: 10;
  display: flex;
  transform: translateX(-50%);
}

.onboarding-dots button {
  position: relative;
  width: 24px;
  min-width: 24px;
  min-height: 32px;
  padding: 0;
  background: transparent;
  border: 0;
}

.onboarding-dots button::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 9px;
  height: 9px;
  background: transparent;
  border: 1.5px solid var(--color-text);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.onboarding-dots button.is-current::after {
  background: var(--color-text);
}

.onboarding-dots button:active:not(:disabled) {
  background: transparent;
}

/* Artwork accession-number entry */

#accession-number-state {
  align-items: center;
  justify-content: flex-start;
  padding-top: clamp(104px, 16dvh, 152px);
  overflow-y: auto;
}

#accession-number-context {
  width: min(100%, 440px);
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
}

#accession-number-title {
  width: min(100%, 440px);
  font-size: clamp(32px, 9vw, 48px);
  text-wrap: balance;
}

#accession-number-heading {
  display: inline;
  margin: 0;
  font: inherit;
  letter-spacing: inherit;
}

#accession-number-title-info {
  display: inline-block;
  width: 24px;
  height: 24px;
  margin-inline-start: 6px;
  vertical-align: 6px;
}

#accession-number-form {
  display: grid;
  gap: 12px;
  width: min(100%, 360px);
  margin-top: 12px;
  text-align: start;
}

#accession-number-input {
  width: 100%;
  min-height: 64px;
  padding: 12px 16px;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1.5px solid var(--color-text);
  border-radius: var(--button-radius);
  font: inherit;
  font-size: clamp(24px, 7vw, 32px);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  direction: ltr;
  letter-spacing: 0.04em !important;
  text-align: center;
  unicode-bidi: isolate;
}

#accession-number-input:focus-visible {
  outline: 3px solid var(--color-core-blue);
  outline-offset: 2px;
}

#accession-number-status {
  min-height: 1.4em;
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
  text-align: center;
}

#accession-number-status.is-error {
  color: var(--color-text-error);
}

#accession-number-submit-btn {
  width: min(100%, 200px);
  min-height: 56px;
  justify-self: center;
  color: var(--color-surface);
  background: var(--color-text);
}

#accession-number-submit-btn:disabled {
  color: var(--color-text-muted);
  background: var(--color-surface-muted);
}

#accession-number-state > .ai-label {
  margin-top: auto;
}

/* Language selection */

.state-label {
  width: 100%;
  margin: 20px 0 0;
  color: var(--color-text);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.035em;
  text-align: center;
}

#language-state {
  align-items: center;
  padding-bottom: 0;
}

#language-search {
  flex: 0 0 auto;
  width: min(100%, 520px);
  min-height: 50px;
  padding: 12px 18px;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1.5px solid var(--color-text);
  border-radius: var(--button-radius);
  font: inherit;
  font-size: 16px;
  text-align: start;
  -webkit-appearance: none;
  appearance: none;
}

#language-search::placeholder {
  color: var(--color-text-muted);
}

#language-grid {
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 10px;
  flex: 1 1 auto;
  width: min(100%, 520px);
  min-height: 0;
  padding: 2px 0 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.lang-btn {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  text-align: start;
  border-radius: var(--button-radius);
}

.lang-native {
  min-width: 0;
  overflow-wrap: anywhere;
}

.lang-btn.selected {
  color: var(--color-surface);
  background: var(--color-text);
}

.lang-english {
  flex: 0 1 auto;
  color: var(--color-text-muted);
  font-size: 13px;
  font-weight: 400;
  text-align: end;
}

.lang-btn.selected .lang-english {
  color: var(--color-text-disabled);
}

#language-empty {
  margin: 24px 0 auto;
  color: var(--color-text-muted);
  text-align: center;
}

/* Camera hub */

#camera-title {
  width: 420px;
  max-width: 100%;
  margin: 0;
  color: var(--color-text);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.04em;
  text-align: center;
  white-space: pre-line;
  unicode-bidi: plaintext;
}

#camera-header {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
}

#camera-state {
  justify-content: flex-start;
  gap: 8px;
}

#camera-content {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 0;
}

#camera-flow {
  position: fixed;
  z-index: 100;
  inset: 0;
  width: 100%;
  height: 100dvh;
  background: var(--color-background);
  border: 0;
}

#onboarding-state {
  padding-bottom: 0;
  padding-inline: 0;
}

#camera-onboarding {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  overflow: hidden;
}

#camera-onboarding .onboarding-step {
  gap: var(--space);
  /* Balance the header offset so the illustration and title center on the page. */
  padding: 8px 0 148px;
}

#camera-onboarding .onboarding-image {
  width: min(100%, 440px);
  max-height: min(42dvh, 380px);
}

#camera-onboarding
  .onboarding-step[data-camera-onboarding-step="1"]
  .onboarding-image {
  transform: scale(1.08);
}

#camera-onboarding .onboarding-copy {
  font-size: clamp(32px, 8vw, 48px);
}

#onboarding-language-link,
#camera-collection-btn,
#accession-collection-btn {
  position: absolute;
  top: var(--space);
  inset-inline-end: max(var(--space), var(--safe-inline-end));
}

#camera-collection-btn,
#accession-collection-btn {
  z-index: 20;
  width: auto;
}

#camera-viewfinder {
  position: relative;
  flex: 0 1 min(60dvh, 480px);
  display: block;
  width: 100%;
  height: min(60dvh, 480px);
  min-height: 300px;
  overflow: hidden;
  background: var(--color-surface-muted);
  border: 1.5px solid var(--color-text);
  border-radius: var(--radius);
  touch-action: none;
}

#camera-video {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  background: var(--color-surface-muted);
  transform-origin: center;
  will-change: transform;
}

#camera-canvas {
  display: none;
}

#camera-viewfinder.photo-frozen #camera-video {
  display: none;
}

#camera-viewfinder.photo-frozen #camera-canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
}

#camera-controls {
  display: flex;
  justify-content: center;
}

#camera-shutter-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  min-width: 72px;
  height: 72px;
  min-height: 72px;
  padding: 7px;
  color: var(--color-text);
  background: transparent;
  border: 2px solid var(--color-text);
  border-radius: var(--button-radius);
}

#camera-shutter-btn:active:not(:disabled) {
  background: transparent;
}

.camera-shutter-icon {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--color-text);
  border-radius: 50%;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

#camera-shutter-btn.is-working .camera-shutter-icon {
  opacity: 0.35;
  transform: scale(0.82);
}

#camera-shutter-btn:disabled {
  opacity: 0.55;
}

/* Cards */

#error-msg {
  padding: 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

#cards-title {
  order: 1;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  overflow: hidden;
  font-size: 22px;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.035em;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  unicode-bidi: plaintext;
}

#cards-state {
  --cards-navigation-reserve: 88px;
  --cards-title-extension: 36px;
  padding-inline: 0;
}

#cards-back-btn {
  z-index: 21;
  gap: 2px;
}

#cards-header {
  position: absolute;
  top: var(--space);
  inset-inline-end: max(var(--space), var(--safe-inline-end));
  inset-inline-start: max(var(--space), var(--safe-inline-start));
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  width: auto;
  min-height: 44px;
}

#cards-title-info {
  position: relative;
  z-index: 20;
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 44px;
  min-height: 44px;
  padding-block: 0;
  padding-inline: var(--cards-navigation-reserve);
  color: var(--color-text);
  background: transparent;
  border: 0;
  border-radius: var(--button-radius);
}

#cards-title-info.has-artwork-info {
  padding-inline-start: var(--cards-navigation-reserve);
  padding-inline-end: 0;
}

/* This balances the thumbnail for short titles, then yields its space before
   the title itself truncates. */
#cards-title-info.has-artwork-info::after {
  order: 2;
  width: var(--cards-title-extension);
  min-width: 0;
  flex: 0 1000 var(--cards-title-extension);
  content: "";
}

#cards-title-info:disabled {
  color: var(--color-text);
}

#cards-title-info:focus-visible {
  outline: 0;
}

#cards-title-info:focus-visible .cards-title-thumbnail {
  border-radius: 50%;
  outline: 3px solid var(--color-text);
  outline-offset: 3px;
}

.cards-title-thumbnail {
  order: 3;
  position: relative;
  display: flex;
  flex: 0 0 44px;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-inline-start: 8px;
}

#cards-title-info:not(.has-artwork-info) .cards-title-thumbnail {
  display: none;
}

#cards-artwork-thumbnail {
  display: block;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
}

.cards-thumbnail-info-icon {
  position: absolute;
  inset-inline-end: -3px;
  bottom: -3px;
  display: block;
  width: 20px;
  height: 20px;
  background: var(--color-surface);
  border-radius: 50%;
}

.cards-thumbnail-info-icon::before {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--color-text);
  content: "";
  -webkit-mask: url("/images/icon.svg") center / contain no-repeat;
  mask: url("/images/icon.svg") center / contain no-repeat;
}

#cards-back-btn {
  inset-inline-start: max(var(--space), var(--safe-inline-start));
  min-width: 56px;
}

#cards-carousel {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  align-items: center;
}

#cards-viewport {
  --flip-clearance: 25px;
  width: 100%;
  height: calc(min(58dvh, 430px) + var(--flip-clearance) * 2);
  overflow: hidden;
}

#cards-container {
  display: flex;
  height: calc(100% - var(--flip-clearance) * 2);
  min-height: 0;
  margin-block: var(--flip-clearance);
  touch-action: pan-y pinch-zoom;
}

.card-prompt {
  display: block;
  font-size: clamp(26px, 7vw, 38px);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.035em;
  text-wrap: wrap;
  text-wrap: pretty;
  overflow-wrap: break-word;
  unicode-bidi: plaintext;
}

.prompt-card {
  position: relative;
  flex: 0 0 calc(100% - var(--card-peek));
  margin-inline-end: 12px;
  width: auto;
  height: 100%;
  min-height: 0;
  text-align: start;
  perspective: 1200px;
  -webkit-tap-highlight-color: transparent;
}

.card-flip-cue {
  position: absolute;
  bottom: 18px;
  left: 50%;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 10px;
  color: var(
    --card-front-cue-text,
    var(--card-front-text, var(--color-text))
  );
  background: transparent;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transform: translateX(-50%);
  pointer-events: none;
}

.card-flip-cue-icon {
  display: block;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  background: currentColor;
  -webkit-mask: url("/images/card-flip.svg") center / contain no-repeat;
  mask: url("/images/card-flip.svg") center / contain no-repeat;
}

html[dir="rtl"] .card-flip-cue-icon {
  transform: scaleX(-1);
}

.card-flip-inner {
  position: absolute;
  inset: 0;
  transform: rotateY(0deg);
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  transition: transform 600ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.prompt-card.is-flipped .card-flip-inner {
  transform: rotateY(var(--card-flip-angle));
}

.prompt-card.has-flip-peek .card-flip-inner {
  animation: card-flip-peek 1000ms cubic-bezier(0.2, 0.7, 0.2, 1) 80ms 1;
}

@keyframes card-flip-peek {
  0%,
  20%,
  100% {
    transform: rotateY(0deg);
  }

  55%,
  68% {
    transform: rotateY(var(--card-flip-peek-angle));
  }
}

.image-card.has-flip-peek .card-flip-inner {
  animation-name: image-card-flip-peek;
}

@keyframes image-card-flip-peek {
  0%,
  20%,
  100% {
    transform: translate(-50%, -50%) rotateY(0deg);
  }

  55%,
  68% {
    transform: translate(-50%, -50%) rotateY(var(--card-flip-peek-angle));
  }
}

.card-face {
  position: absolute;
  inset: 0;
  display: grid;
  gap: 12px;
  padding: var(--space);
  align-content: center;
  background: var(--color-surface);
  border: 1.5px solid var(--color-text);
  border-radius: var(--radius);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.card-front {
  color: var(--card-front-text, var(--color-text));
  background: var(--card-front-color, var(--color-surface));
  transform: rotateY(0deg);
}

.prompt-card:not(.special-card) .card-front .card-prompt {
  font-weight: 700;
}

.image-card .card-flip-inner {
  inset: auto;
  top: 50%;
  left: 50%;
  width: min(100%, 400px);
  height: auto;
  aspect-ratio: 1;
  transform: translate(-50%, -50%) rotateY(0deg);
}

.image-card.is-flipped .card-flip-inner {
  transform: translate(-50%, -50%) rotateY(var(--card-flip-angle));
}

.image-card .card-face {
  border-radius: 50%;
}

.prompt-card.discussion-card .card-front {
  inset: auto;
  top: 50%;
  left: 50%;
  width: min(calc(100% - 48px), 360px);
  height: auto;
  aspect-ratio: 1;
  padding: calc(var(--space) * 2);
  color: var(--discussion-card-text, var(--color-text));
  background: transparent;
  border: 0;
  border-radius: 0;
  transform: translate(-50%, -50%);
}

.prompt-card.discussion-card .card-front::before,
.prompt-card.discussion-card .card-front::after {
  content: "";
  position: absolute;
  inset: clamp(-20px, -4vw, -12px);
  -webkit-mask: url("/images/organic-card.svg") center / contain no-repeat;
  mask: url("/images/organic-card.svg") center / contain no-repeat;
}

.prompt-card.discussion-card .card-front::before {
  background: var(--color-text);
}

.prompt-card.discussion-card .card-front::after {
  background: var(--discussion-card-color, var(--color-surface-muted));
  transform: scale(0.992);
}

.discussion-card .special-card-content {
  position: relative;
  z-index: 1;
}

.card-back {
  place-items: center;
  padding: calc(var(--space) * 1.5);
  color: var(--color-text);
  background: var(--color-surface);
  text-align: start;
  transform: rotateY(var(--card-flip-angle));
}

.card-back-copy {
  margin: 0;
  unicode-bidi: plaintext;
}

.image-card .card-back {
  text-align: center;
}

.prompt-card.is-flipped .card-front {
  pointer-events: none;
}

.prompt-card:not(.is-flipped) .card-back {
  pointer-events: none;
}

.special-card .card-front {
  background: var(--color-surface-muted);
}

.break-card .card-front {
  justify-items: center;
  align-content: center;
  text-align: center;
}

.break-card:not(.discussion-card) .card-front {
  background: transparent;
  border-color: transparent;
}

.room-transition .card-prompt {
  max-width: min(100%, 480px);
  font-size: clamp(32px, 9vw, 48px);
  line-height: 1.05;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.special-card-content {
  display: grid;
  gap: 14px;
}

.break-card .special-card-content {
  width: min(100%, 360px);
  justify-items: center;
  align-content: center;
}

.break-card .card-prompt {
  font-weight: 600;
  text-align: center;
}

.checkpoint-card .card-prompt {
  color: var(--color-core-red);
}

.image-card .card-front {
  padding: 0;
  overflow: hidden;
}

.image-card .special-card-image-prompt {
  right: auto;
  bottom: 12%;
  left: 50%;
  width: max-content;
  max-width: 70%;
  padding: 8px 10px;
  font-size: 16px;
  white-space: nowrap;
  transform: translateX(-50%);
}

.image-card .special-card-content,
.image-card .special-card-image {
  width: 100%;
  height: 100%;
}

.image-card .special-card-content {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--radius);
}

.image-card .special-card-image {
  display: block;
  min-height: 0;
  border: 0;
  object-fit: cover;
}

.image-card .generated-cutout-image {
  position: absolute;
  top: 0;
  left: 0;
  max-width: none;
  object-fit: fill;
}

.image-card-back-content {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.image-card-back-thumbnail {
  display: block;
  width: auto;
  height: auto;
  max-width: 78%;
  max-height: 62%;
  object-fit: contain;
}

.image-card-back-title {
  max-width: 82%;
  margin: 0;
  font-size: clamp(16px, 4.5vw, 21px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.025em;
  text-align: center;
  text-wrap: wrap;
  text-wrap: pretty;
  overflow-wrap: break-word;
  unicode-bidi: plaintext;
}

.special-card-image-prompt {
  position: absolute;
  right: 16px;
  bottom: 16px;
  left: 16px;
  padding: 10px 12px;
  color: var(--color-text);
  background: var(--color-surface);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  border-radius: var(--radius);
  z-index: 1;
  unicode-bidi: plaintext;
}

.checkpoint-actions {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: max-content;
  max-width: 100%;
}

.checkpoint-actions button {
  width: 100%;
  min-width: 160px;
  min-height: 52px;
  padding: 12px 20px;
  font-size: 24px;
}

.checkpoint-continue:disabled {
  color: var(--color-text-muted);
  background: var(--color-surface-muted);
  border-color: var(--color-border);
  opacity: 0.7;
}

.cards-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 105;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 24px;
  padding: 32px 24px;
  color: var(--color-text);
  background: var(--color-background);
  text-align: center;
}

#cards-loading-back-btn {
  inset-inline-start: var(--shell-navigation-inset-start);
}

#cards-loading-title {
  margin: 0;
  font-size: clamp(32px, 9vw, 48px);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.045em;
}

/* Feedback shown after the visitor completes a card sequence */

.completion-feedback-backdrop {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--color-overlay);
}

.completion-feedback-dialog {
  position: relative;
  display: grid;
  gap: 24px;
  width: min(440px, 100%);
  max-height: calc(100dvh - 48px);
  padding: 72px 28px 28px;
  overflow-y: auto;
  background: var(--color-surface-muted);
  border: 1.5px solid var(--color-text);
  border-radius: var(--radius);
  box-shadow: 0 16px 48px var(--color-shadow);
  outline: 0;
}

.completion-feedback-close {
  top: 16px;
  inset-inline-start: auto;
  inset-inline-end: 16px;
}

#completion-feedback-prompt {
  margin: 0;
  font-size: clamp(24px, 6.5vw, 34px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  text-align: start;
  text-wrap: balance;
}

.completion-feedback-options {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.completion-feedback-option {
  width: 100%;
  min-width: 0;
  min-height: 52px;
  padding: 12px 16px;
  background: var(--color-surface);
  border-color: var(--color-text);
  border-radius: var(--radius-small);
  font-size: 18px;
  line-height: 1.25;
  text-align: center;
}

.completion-feedback-option.is-selected,
.completion-feedback-submit.is-selected {
  color: var(--color-text);
  border-color: var(--color-text);
  filter: brightness(0.78);
  opacity: 1;
}

.completion-feedback-options.is-emoji {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.completion-feedback-options.is-emoji .completion-feedback-option {
  min-height: 58px;
  padding: 4px;
  background: transparent;
  border-color: transparent;
  font-size: clamp(32px, 10vw, 46px);
  line-height: 1;
}

.completion-feedback-options.is-rating
  .completion-feedback-option:nth-child(1) {
  background: #00b480;
}

.completion-feedback-options.is-rating
  .completion-feedback-option:nth-child(2) {
  background: #afe1a5;
}

.completion-feedback-options.is-rating
  .completion-feedback-option:nth-child(3) {
  background: #f6f0a0;
}

.completion-feedback-options.is-rating
  .completion-feedback-option:nth-child(4) {
  background: #f0c800;
}

.completion-feedback-options.is-rating
  .completion-feedback-option:nth-child(5) {
  background: #e4002b;
}

.completion-feedback-options.is-rating
  .completion-feedback-option.is-muted {
  background: var(--color-surface-muted);
}

.completion-feedback-group-rows {
  display: grid;
  gap: 8px;
}

.completion-feedback-group-row {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.completion-feedback-group-label {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
}

.completion-feedback-counter {
  display: grid;
  grid-template-columns: 44px 32px 44px;
  align-items: center;
  gap: 4px;
}

.completion-feedback-counter button {
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: var(--radius-small);
  font-size: 24px;
  line-height: 1;
}

.completion-feedback-counter output {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  direction: ltr;
  text-align: center;
  unicode-bidi: isolate;
}

.completion-feedback-submit {
  width: 100%;
  margin-top: 6px;
  border-radius: var(--radius-small);
  font-size: 17px;
}

#cards-dots {
  --dot-size: 14px;
  --dot-gap: 8px;
  --dots-window-width: 146px;
  width: auto;
  max-width: var(--dots-window-width);
  align-self: center;
  flex: 0 0 auto;
  overflow: visible;
}

#cards-dots.is-overflowing {
  width: var(--dots-window-width);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(
    90deg,
    transparent,
    var(--color-text) 18%,
    var(--color-text) 82%,
    transparent
  );
  mask-image: linear-gradient(
    90deg,
    transparent,
    var(--color-text) 18%,
    var(--color-text) 82%,
    transparent
  );
}

#cards-dots-track {
  display: flex;
  justify-content: center;
  gap: var(--dot-gap);
  transition: transform 180ms ease;
  will-change: transform;
}

#cards-dots.is-overflowing #cards-dots-track {
  justify-content: flex-start;
  padding-inline: calc((var(--dots-window-width) - var(--dot-size)) / 2);
}

.cards-dot {
  position: relative;
  flex: 0 0 var(--dot-size);
  width: var(--dot-size);
  height: var(--dot-size);
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.cards-dot::before {
  position: absolute;
  top: 50%;
  left: 50%;
  box-sizing: border-box;
  background: transparent;
  border: 1px solid var(--color-text);
  content: "";
  transform: translate(-50%, -50%);
}

.cards-dot-square::before {
  width: 10px;
  height: 14px;
  border-radius: 1.5px;
}

.cards-dot-circle::before {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.cards-dot-filled::before {
  width: 8px;
  height: 8px;
  background: var(--dot-color, var(--color-text));
  border: 0;
  border-radius: 50%;
}

.cards-dot-filled.selected::before {
  width: 12px;
  height: 12px;
}

.cards-dot-organic::before {
  width: 18px;
  height: 18px;
  background: var(--color-text);
  border: 0;
  -webkit-mask: url("/images/organic-dot-outline.svg") center / 14px 14px
    no-repeat;
  mask: url("/images/organic-dot-outline.svg") center / 14px 14px no-repeat;
}

.cards-dot-organic::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  background: var(--color-text);
  content: "";
  transform: translate(-50%, -50%);
  pointer-events: none;
  -webkit-mask: url("/images/organic-dot-outline.svg") center / 14px 14px
    no-repeat;
  mask: url("/images/organic-dot-outline.svg") center / 14px 14px no-repeat;
}

.cards-dot:is(.is-revealed, .selected)::before {
  background: var(--dot-color, var(--color-text));
}

.cards-dot-organic:is(.is-revealed, .selected)::before {
  -webkit-mask: url("/images/organic-dot-filled.svg") center / 14px 14px
    no-repeat;
  mask: url("/images/organic-dot-filled.svg") center / 14px 14px no-repeat;
}

.ai-label {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 14px;
  letter-spacing: 0.02em;
  text-align: center;
  flex: 0 0 auto;
}

.ai-label-info {
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-inline-start: 2px;
  vertical-align: -0.125em;
  transform: translateY(1px);
}

/* Information popovers */

.info-trigger {
  min-height: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: var(--button-radius);
}

.info-trigger:active:not(:disabled) {
  background: transparent;
}

.info-trigger-icon {
  display: block;
  width: 100%;
  height: 100%;
  background: currentColor;
  -webkit-mask: url("/images/icon.svg") center / contain no-repeat;
  mask: url("/images/icon.svg") center / contain no-repeat;
}

.info-popover-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--color-overlay);
}

.info-popover {
  position: relative;
  width: min(480px, 100%);
  max-height: calc(100dvh - 40px);
  padding: 24px;
  overflow-y: auto;
  background: var(--color-surface);
  border: 1.5px solid var(--color-text);
  border-radius: var(--radius);
  box-shadow: 0 16px 48px var(--color-shadow);
  outline: 0;
}

.info-popover.is-artwork {
  width: min(560px, 100%);
  height: min(70dvh, 560px);
  min-height: 320px;
  padding: 0;
  overflow: hidden;
}

.info-popover.is-feedback {
  height: min(68dvh, 520px);
  overscroll-behavior: contain;
  scroll-padding-block: 24px;
  -webkit-overflow-scrolling: touch;
}

.info-popover-close {
  top: 20px;
  inset-inline-start: auto;
  inset-inline-end: 20px;
  width: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
}

.info-popover.is-feedback .info-popover-close {
  position: sticky;
  top: 0;
  inset-inline-end: auto;
  margin-top: -20px;
  margin-bottom: -36px;
  margin-inline-start: auto;
}

.info-popover-artwork {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
}

.info-popover-artwork-image-stage {
  display: grid;
  width: 100%;
  flex: 0 0 auto;
  place-items: center;
  background: #f4f4f4;
}

.info-popover-artwork-image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(52dvh, 420px);
  object-fit: contain;
}

.info-popover-artwork-title {
  margin: 20px 24px 0;
  font-size: clamp(28px, 7vw, 40px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.04em;
  text-align: left;
  unicode-bidi: isolate;
}

.info-popover-artwork-attribution {
  display: flex;
  flex-wrap: wrap;
  gap: 0 8px;
  margin: 12px 24px 0;
  font-size: 18px;
  line-height: 1.25;
  text-align: left;
  unicode-bidi: isolate;
}

.info-popover-artwork-artist {
  font-weight: 700;
}

.info-popover-artwork-culture {
  font-weight: 400;
}

.info-popover-artwork-date {
  margin: 0 24px;
  font-size: 16px;
  line-height: 1.45;
  text-align: left;
  unicode-bidi: isolate;
}

.info-popover-artwork-attribution[hidden]
  + .info-popover-artwork-date:not([hidden]) {
  margin-top: 12px;
}

.info-popover-artwork-web-label {
  margin: 16px 24px 0;
  font-size: 16px;
  line-height: 1.45;
  text-align: left;
  unicode-bidi: isolate;
  white-space: pre-line;
}

.info-popover-artwork-link {
  align-self: flex-start;
  margin: 16px 24px 32px;
  color: var(--color-text);
  font-size: 16px;
  line-height: 1.45;
  text-decoration: underline;
}

.info-popover-illustration {
  position: relative;
  left: 50%;
  display: block;
  width: min(100%, 360px);
  height: auto;
  margin: 40px auto 0;
  object-fit: contain;
  transform: translateX(-50%);
}

.info-popover-illustration[hidden] {
  display: none;
}

.info-popover.is-illustrated .info-popover-message {
  padding-top: 24px;
  font-size: clamp(26px, 6vw, 40px);
}

.info-popover-title {
  margin: 0;
  padding: 44px 0 0;
  font-size: clamp(28px, 7vw, 36px);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.info-popover-title[hidden] {
  display: none;
}

.info-popover-message {
  margin: 0;
  padding: 56px 0 8px;
  font-size: clamp(26px, 7vw, 40px);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.04em;
  text-wrap: wrap;
  text-wrap: pretty;
  orphans: 2;
  widows: 2;
}

.info-popover.is-titled .info-popover-message {
  padding-top: 16px;
  font-size: clamp(17px, 4.6vw, 21px);
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.info-popover.is-feedback .info-popover-title {
  padding-inline-end: 52px;
}

.info-popover-details {
  margin: 12px 0 0;
  font-size: clamp(17px, 4.6vw, 21px);
  line-height: 1.4;
  letter-spacing: -0.01em;
  text-wrap: wrap;
  text-wrap: pretty;
  orphans: 2;
  widows: 2;
}

.info-popover.is-feedback
  :is(.info-popover-message, .info-popover-details) {
  font-size: clamp(15.5px, 4.1vw, 18.5px);
}

.info-popover-privacy-link {
  display: inline-block;
  margin-top: 12px;
  color: var(--color-text);
  font-size: 16px;
  line-height: 1.45;
  text-decoration: underline;
}

.info-popover-details[hidden],
.info-popover-privacy-link[hidden] {
  display: none;
}

.info-popover-feedback-form {
  display: grid;
  gap: 10px;
  margin: 20px 0 0;
}

.info-popover-feedback-label {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
}

.info-popover-feedback-field {
  width: 100%;
  min-height: 112px;
  padding: 12px 14px;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1.5px solid var(--color-text);
  border-radius: var(--radius-small);
  font: inherit;
  font-size: 16px;
  line-height: 1.4;
  resize: vertical;
}

.info-popover-feedback-actions {
  display: flex;
  min-height: 48px;
  margin-top: 8px;
  align-items: center;
  justify-content: flex-end;
}

.info-popover-feedback-form.is-submitted
  > :not(.info-popover-feedback-actions),
.info-popover-feedback-form.is-submitted
  .info-popover-feedback-submit {
  display: none;
}

.info-popover-feedback-form.is-submitted
  .info-popover-feedback-actions {
  min-height: 220px;
  justify-content: center;
}

.info-popover-feedback-form.is-submitted
  .info-popover-feedback-status {
  margin: 0;
  font-size: clamp(36px, 10vw, 56px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.04em;
  text-align: center;
}

.info-popover-feedback-submit {
  display: grid;
  width: auto;
  min-width: 96px;
  height: 48px;
  min-height: 48px;
  padding: 0 18px;
  place-items: center;
  color: var(--color-surface);
  background: var(--color-text);
  font-size: 15px;
}

.info-popover-feedback-submit:active:not(:disabled) {
  background: var(--color-text);
}

/* Checkpoint finish button */

.checkpoint-finish {
  width: 100%;
  min-height: 52px;
  padding: 12px 20px;
  color: var(--color-surface);
  background: var(--color-text);
  font-size: 24px;
}

/* Surprise / visit summary */

html.surprise-page,
body.surprise-page {
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

html.surprise-page {
  background: var(--color-surface-subtle);
}

body.surprise-page,
[data-experience-mode="welcome"].surprise-page {
  background: var(--color-background);
}

#surprise-state {
  display: flex;
  flex-direction: column;
  gap: 32px;
  height: 100dvh;
  min-height: 0;
  width: 100%;
  max-width: var(--shell-width);
  margin: 0 auto;
  padding: 80px 24px calc(48px + env(safe-area-inset-bottom));
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--color-background);
}

.surprise-section {
  flex: 0 0 auto;
  width: 100%;
}

#surprise-title {
  margin: 0;
  font-size: clamp(28px, 8vw, 40px);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.04em;
  text-align: center;
  text-wrap: balance;
}

#surprise-grid {
  display: grid;
  gap: 32px;
  width: 100%;
  margin-top: 20px;
}

.surprise-visit-day {
  width: 100%;
}

.surprise-visit-day-title {
  margin: 0 6px 12px;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.025em;
  text-wrap: balance;
  unicode-bidi: plaintext;
}

.surprise-day-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  column-gap: 16px;
  width: 100%;
  padding: 6px;
}

.surprise-day-column {
  display: grid;
  align-content: start;
  gap: 16px;
  min-width: 0;
}

.surprise-item {
  position: relative;
  display: block;
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: var(--color-surface-muted);
  border: 0;
  border-radius: 0;
  touch-action: manipulation;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 320ms ease,
    transform 420ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.surprise-item:active:not(:disabled) {
  background: var(--color-surface-muted);
}

.surprise-item.is-ready {
  opacity: 1;
  transform: translateY(0);
}

.surprise-actions {
  --bottom-dock-padding: 12px;
  display: grid;
  gap: 0;
  padding-top: 8px;
  padding-right: max(
    24px,
    calc((100vw - var(--shell-width)) / 2 + 24px)
  );
  padding-left: max(
    24px,
    calc((100vw - var(--shell-width)) / 2 + 24px)
  );
  background: var(--color-surface-subtle);
}

.surprise-action {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 44px;
  padding: 8px 4px;
  color: var(--color-text);
  background: transparent;
  border: 0;
  border-radius: var(--button-radius);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  text-align: start;
  text-decoration: none;
}

[data-experience-mode="standard"] #surprise-state {
  padding-bottom: calc(172px + env(safe-area-inset-bottom));
}

.surprise-action:active:not(:disabled) {
  background: transparent;
  opacity: 0.6;
}

.surprise-action:disabled {
  color: var(--color-text-muted);
}

.surprise-action-icon {
  display: block;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
}

/* Status toast */

.status-toast {
  position: fixed;
  bottom: 0;
  left: 50%;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateX(-50%) translateY(100%);
  max-width: calc(100% - 48px);
  padding: 12px 16px;
  color: var(--color-text);
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: 0 5px 18px var(--color-shadow);
  font-size: 15px;
  font-weight: 500;
  text-align: start;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition:
    transform 400ms cubic-bezier(0.2, 0.7, 0.2, 1),
    opacity 400ms ease;
}

.status-toast.is-visible {
  transform: translateX(-50%) translateY(calc(-28px - env(safe-area-inset-bottom)));
  opacity: 1;
}

.status-toast.is-leaving {
  opacity: 0;
  transition:
    transform 300ms ease,
    opacity 300ms ease;
}

@media (prefers-reduced-motion: reduce) {
  .loading-dot {
    opacity: 1;
    animation: none;
  }

  .card-flip-inner {
    transition: none;
  }

  .prompt-card.has-flip-peek .card-flip-inner {
    animation: none;
  }

  .surprise-item {
    transition: none;
  }
}
