:root {
  --surface: rgba(255, 252, 255, 0.86);
  --surface-line: rgba(255, 137, 195, 0.2);
  --text: #6e2d55;
  --text-strong: #43142f;
  --muted: #9b6384;
  --pink-1: #ff92c8;
  --pink-2: #ff5ba9;
  --pink-3: #ff3d96;
  --pink-4: #ffd5e9;
  --shadow: 0 28px 90px rgba(214, 108, 167, 0.2);
  --radius-xl: 34px;
  --radius-lg: 24px;
  --radius-md: 18px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100svh;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 10%, rgba(255, 184, 220, 0.95), transparent 26%),
    radial-gradient(circle at 85% 12%, rgba(255, 218, 232, 0.9), transparent 24%),
    radial-gradient(circle at 20% 94%, rgba(255, 206, 230, 0.95), transparent 26%),
    linear-gradient(180deg, #fff8fc 0%, #fff0f8 50%, #ffe8f4 100%);
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: 0;
  filter: blur(2px);
}

body::before {
  top: 5svh;
  right: -2rem;
  width: 14rem;
  height: 14rem;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.78) 0 18%, transparent 19%),
    radial-gradient(circle at 70% 30%, rgba(255, 166, 209, 0.7) 0 20%, transparent 21%),
    radial-gradient(circle at 35% 70%, rgba(255, 220, 230, 0.9) 0 24%, transparent 25%);
  animation: drift 13s ease-in-out infinite;
}

body::after {
  bottom: -3rem;
  left: -2rem;
  width: 15rem;
  height: 15rem;
  background:
    radial-gradient(circle at 30% 35%, rgba(255, 197, 222, 0.9) 0 26%, transparent 27%),
    radial-gradient(circle at 75% 65%, rgba(255, 255, 255, 0.65) 0 18%, transparent 19%),
    radial-gradient(circle at 50% 50%, rgba(255, 214, 227, 0.55) 0 42%, transparent 43%);
  animation: drift 16s ease-in-out infinite reverse;
}

a {
  color: inherit;
}

button {
  font: inherit;
}

.page-shell {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  width: min(850px, calc(100vw - 28px));
  margin: 0 auto;
  padding: clamp(14px, 4vw, 34px) 0;
  display: grid;
  place-items: center;
}

.viewer-panel {
  position: relative;
  width: 100%;
  overflow: hidden;
  padding: clamp(18px, 4vw, 32px);
  border: 1px solid var(--surface-line);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, var(--surface) 0%, rgba(255, 245, 251, 0.94) 100%);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  animation: riseIn 0.85s ease-out both;
}

.viewer-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(130deg, rgba(255, 255, 255, 0.4), transparent 34%),
    radial-gradient(circle at top right, rgba(255, 201, 226, 0.26), transparent 32%);
}

.app-header,
.status-row,
.image-stage,
.action-row,
.credit-row,
.api-note {
  position: relative;
  z-index: 1;
}

.app-header {
  display: grid;
  gap: clamp(18px, 3vw, 26px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  position: relative;
  width: clamp(54px, 11vw, 72px);
  height: clamp(54px, 11vw, 72px);
  flex: 0 0 auto;
  border-radius: 28px;
  background:
    radial-gradient(circle at 30% 31%, rgba(255, 255, 255, 0.96) 0 14%, transparent 15%),
    radial-gradient(circle at 70% 31%, rgba(255, 255, 255, 0.96) 0 14%, transparent 15%),
    linear-gradient(145deg, #ffc1e0, #ff74b8 72%);
  box-shadow: 0 18px 36px rgba(255, 96, 166, 0.28);
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  top: -7px;
  width: 21px;
  height: 21px;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(160deg, #ff89c3, #ff589f);
}

.brand-mark::before {
  left: 9px;
  transform: rotate(-22deg);
}

.brand-mark::after {
  right: 9px;
  transform: rotate(22deg);
}

.kicker,
.credit-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  color: var(--text-strong);
  font-family: "Fredoka", sans-serif;
}

h1 {
  font-size: clamp(2.6rem, 9vw, 5.4rem);
  line-height: 0.92;
}

h2 {
  max-width: 20ch;
  font-size: clamp(2rem, 6vw, 4rem);
  line-height: 1.02;
  text-wrap: balance;
}

.section-copy {
  display: grid;
  gap: 12px;
}

.lede {
  max-width: 58ch;
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.98rem, 2.6vw, 1.08rem);
  line-height: 1.65;
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: clamp(16px, 3vw, 24px) 0 14px;
}

.status-pill,
.countdown-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(255, 155, 206, 0.24);
  box-shadow: inset 0 -2px 0 rgba(255, 255, 255, 0.35);
}

.status-pill {
  font-weight: 800;
}

.status-pill[data-tone="loading"] {
  color: #c25490;
}

.status-pill[data-tone="success"] {
  color: #b13073;
}

.status-pill[data-tone="error"] {
  color: #a14463;
}

.status-pill[data-tone="soft"] {
  color: #874467;
}

.countdown-pill {
  color: var(--text-strong);
  font-weight: 800;
}

.countdown-label {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.image-stage {
  min-height: clamp(330px, 55svh, 600px);
  display: grid;
  place-items: center;
  padding: clamp(14px, 3vw, 22px);
  border-radius: calc(var(--radius-xl) - 8px);
  background:
    linear-gradient(180deg, rgba(255, 240, 248, 0.92) 0%, rgba(255, 230, 241, 0.96) 100%);
  border: 1px solid rgba(255, 167, 210, 0.24);
  overflow: hidden;
}

.image-stage::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 28px;
  border: 1px dashed rgba(255, 116, 184, 0.26);
  pointer-events: none;
}

.image-halo {
  position: absolute;
  width: min(76vw, 480px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.95) 0 16%, rgba(255, 209, 233, 0.8) 38%, rgba(255, 194, 218, 0.12) 70%, transparent 72%);
  filter: blur(4px);
  opacity: 0.88;
}

#catImage {
  position: relative;
  z-index: 2;
  max-width: 100%;
  max-height: min(52svh, 520px);
  border-radius: clamp(20px, 4vw, 28px);
  object-fit: contain;
  opacity: 0;
  transform: translateY(18px) scale(0.98);
  transition: opacity 0.45s ease, transform 0.45s ease;
  box-shadow: 0 26px 60px rgba(167, 76, 126, 0.22);
}

#catImage.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.stage-message {
  position: absolute;
  z-index: 3;
  display: grid;
  justify-items: center;
  gap: 12px;
  max-width: 28ch;
  padding: 20px;
  color: #9e5b7f;
  text-align: center;
}

.fallback-cat {
  position: absolute;
  z-index: 2;
  width: clamp(128px, 32vw, 210px);
  height: clamp(128px, 32vw, 210px);
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.fallback-cat__face {
  position: absolute;
  inset: 24% 10% 8%;
  border-radius: 46% 46% 42% 42%;
  background:
    radial-gradient(circle at 34% 42%, #6a2a50 0 4%, transparent 5%),
    radial-gradient(circle at 66% 42%, #6a2a50 0 4%, transparent 5%),
    linear-gradient(160deg, #fff8fc 0%, #ffd7eb 100%);
  border: 2px solid rgba(255, 121, 189, 0.22);
  box-shadow: 0 22px 50px rgba(196, 83, 144, 0.2);
}

.fallback-cat__ear {
  position: absolute;
  top: 14%;
  width: 34%;
  height: 34%;
  border-radius: 18% 74% 18% 74%;
  background: linear-gradient(150deg, #ff9fcc 0%, #ffd5e9 100%);
  border: 2px solid rgba(255, 121, 189, 0.18);
}

.fallback-cat__ear--left {
  left: 14%;
  transform: rotate(-20deg);
}

.fallback-cat__ear--right {
  right: 14%;
  transform: scaleX(-1) rotate(-20deg);
}

.fallback-cat__eye,
.fallback-cat__nose,
.fallback-cat__whisker {
  position: absolute;
  display: block;
}

.fallback-cat__eye {
  top: 34%;
  width: 8%;
  height: 8%;
  border-radius: 999px;
  background: #5b2343;
}

.fallback-cat__eye--left {
  left: 31%;
}

.fallback-cat__eye--right {
  right: 31%;
}

.fallback-cat__nose {
  top: 49%;
  left: 46%;
  width: 8%;
  height: 7%;
  border-radius: 45% 45% 60% 60%;
  background: #ff6fae;
}

.fallback-cat__whisker {
  top: 56%;
  width: 26%;
  height: 2px;
  border-radius: 999px;
  background: rgba(109, 49, 83, 0.58);
}

.fallback-cat__whisker--left {
  left: 10%;
  transform: rotate(8deg);
}

.fallback-cat__whisker--right {
  right: 10%;
  transform: rotate(-8deg);
}

.stage-message p {
  margin: 0;
  font-weight: 800;
  line-height: 1.6;
}

.stage-dot {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ff98cb 0%, #ff569e 100%);
  box-shadow:
    0 0 0 8px rgba(255, 126, 185, 0.12),
    0 0 0 18px rgba(255, 171, 212, 0.08);
  animation: pulse 1.6s ease-in-out infinite;
}

.image-stage[data-state="ready"] .stage-message {
  display: none;
}

.image-stage[data-state="loading"] #catImage,
.image-stage[data-state="error"] #catImage {
  opacity: 0;
  transform: translateY(18px) scale(0.98);
}

.image-stage[data-state="error"] .fallback-cat {
  opacity: 1;
  transform: translateY(-28px) scale(1);
}

.image-stage[data-state="error"] .stage-dot {
  display: none;
}

.image-stage[data-state="error"] .stage-message {
  margin-top: clamp(154px, 36vw, 236px);
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.primary-button,
.secondary-button {
  min-height: 58px;
  padding: 0 18px;
  border: 0;
  border-radius: 18px;
  cursor: pointer;
  font-weight: 900;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    opacity 0.2s ease;
}

.primary-button {
  color: white;
  background: linear-gradient(135deg, var(--pink-2) 0%, var(--pink-3) 100%);
  box-shadow: 0 18px 30px rgba(255, 74, 154, 0.28);
}

.secondary-button {
  color: var(--text-strong);
  background: linear-gradient(135deg, #ffd9ea 0%, #ffc0db 100%);
  box-shadow: 0 16px 28px rgba(255, 156, 203, 0.18);
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-2px);
}

.primary-button:focus-visible,
.secondary-button:focus-visible {
  outline: 3px solid rgba(255, 108, 178, 0.35);
  outline-offset: 2px;
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none;
  transform: none;
}

.credit-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  color: var(--muted);
  text-align: center;
}

#photographerLink {
  color: var(--text-strong);
  font-weight: 900;
  text-decoration: none;
}

#photographerLink:hover,
#photographerLink:focus-visible {
  text-decoration: underline;
}

.api-note {
  max-width: 62ch;
  margin: 10px auto 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.55;
  text-align: center;
}

@media (max-width: 620px) {
  body {
    background:
      radial-gradient(circle at 20% 4%, rgba(255, 184, 220, 0.9), transparent 24%),
      radial-gradient(circle at 85% 8%, rgba(255, 218, 232, 0.86), transparent 24%),
      linear-gradient(180deg, #fff8fc 0%, #fff0f8 48%, #ffe8f4 100%);
  }

  body::before,
  body::after {
    opacity: 0.7;
  }

  .page-shell {
    width: min(100vw - 16px, 850px);
    align-items: start;
    padding: 8px 0 18px;
  }

  .viewer-panel {
    padding: 16px;
    border-radius: 28px;
  }

  .app-header {
    gap: 14px;
  }

  .brand-lockup {
    gap: 10px;
  }

  .brand-mark {
    border-radius: 22px;
  }

  h1 {
    font-size: clamp(2.25rem, 12vw, 3.25rem);
  }

  h2 {
    max-width: none;
    font-size: clamp(1.8rem, 8.6vw, 2.45rem);
  }

  .lede {
    font-size: 0.96rem;
    line-height: 1.5;
  }

  .status-row {
    margin: 12px 0 10px;
  }

  .status-pill,
  .countdown-pill {
    min-height: 40px;
    padding: 0 13px;
    font-size: 0.88rem;
  }

  .image-stage {
    min-height: min(47svh, 390px);
    padding: 12px;
    border-radius: 22px;
  }

  .image-stage::before {
    inset: 9px;
    border-radius: 18px;
  }

  #catImage {
    max-height: 42svh;
    border-radius: 20px;
  }

  .action-row {
    gap: 10px;
    margin-top: 12px;
  }

  .primary-button,
  .secondary-button {
    min-height: 52px;
  }
}

@media (max-width: 350px) {
  .action-row {
    grid-template-columns: 1fr;
  }
}

@media (max-height: 720px) and (max-width: 620px) {
  .brand-mark {
    width: 46px;
    height: 46px;
  }

  h1 {
    font-size: clamp(2rem, 10vw, 2.8rem);
  }

  h2 {
    font-size: clamp(1.55rem, 7vw, 2.05rem);
  }

  .lede {
    display: none;
  }

  .image-stage {
    min-height: 38svh;
  }

  #catImage {
    max-height: 34svh;
  }

  .credit-row {
    margin-top: 8px;
    font-size: 0.84rem;
  }

  .api-note {
    font-size: 0.68rem;
    line-height: 1.45;
  }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(24px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.16);
  }
}

@keyframes drift {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }

  50% {
    transform: translate3d(0, 18px, 0);
  }
}
