:root {
  --bg: #fff6ef;
  --bg2: #ffe9f0;
  --card: #ffffff;
  --ink: #3a2b33;
  --muted: #8a7480;
  --accent: #e2557e;
  --accent-ink: #ffffff;
  --ring: rgba(226, 85, 126, .35);
  --shadow: 0 18px 50px -20px rgba(120, 50, 80, .35), 0 2px 6px rgba(120, 50, 80, .08);
  --photo-bg: #f7eef2;
  --radius: 22px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1d1621;
    --bg2: #2a1b2c;
    --card: #2a2130;
    --ink: #f6e9f0;
    --muted: #b49fae;
    --accent: #ff7aa2;
    --accent-ink: #2a1020;
    --ring: rgba(255, 122, 162, .4);
    --shadow: 0 18px 50px -20px rgba(0, 0, 0, .7), 0 2px 6px rgba(0, 0, 0, .3);
    --photo-bg: #221a27;
  }
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  padding: 24px 16px 120px;
  background: radial-gradient(1200px 600px at 50% -10%, var(--bg2), var(--bg) 70%) fixed, var(--bg);
  color: var(--ink);
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.top { text-align: center; margin: 8px 0 22px; }

h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.1rem);
  font-weight: 800;
  letter-spacing: -.02em;
}

.tag { margin: 4px 0 0; color: var(--muted); font-size: 1rem; }
.back { color: var(--accent); font-weight: 700; }

main {
  width: 100%;
  max-width: 860px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.frame {
  margin: 0;
  width: 100%;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 12px 18px;
}

.photo {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: max(240px, min(100vh - 300px, 520px));
  border-radius: calc(var(--radius) - 8px);
  background: var(--photo-bg);
  overflow: hidden;
}

.photo:focus-visible { outline: 3px solid var(--ring); outline-offset: 3px; }

#kitten {
  display: block;
  max-width: 100%;
  max-height: max(240px, 100vh - 300px);
  width: auto;
  height: auto;
  object-fit: contain;
  transition: opacity .35s ease;
}

.frame[aria-busy="true"] #kitten { opacity: 0; }
#kitten:not([src]) { display: none; }

/* Loading paw, shown while a picture loads. */
.paw {
  position: absolute;
  width: 54px;
  height: 54px;
  opacity: 0;
  transition: opacity .2s ease;
  background: var(--accent);
  -webkit-mask: url("/favicon.svg") center / contain no-repeat;
  mask: url("/favicon.svg") center / contain no-repeat;
  pointer-events: none;
}
.frame[aria-busy="true"] .paw { opacity: .75; animation: bob 1s ease-in-out infinite; }

@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-8deg); }
  50% { transform: translateY(-8px) rotate(8deg); }
}

figcaption { padding: 14px 8px 0; text-align: center; }

.title {
  margin: 0;
  font-size: clamp(1.1rem, 2.6vw, 1.45rem);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.meta { margin: 6px 0 0; font-size: .95rem; }
.meta a { color: var(--muted); text-decoration: none; }
.meta a:hover, .meta a:focus-visible { color: var(--accent); text-decoration: underline; }

.next {
  margin-top: 22px;
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 14px 28px;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent-ink);
  background: var(--accent);
  box-shadow: 0 10px 24px -10px var(--accent);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
.next:hover { transform: translateY(-1px); box-shadow: 0 14px 28px -10px var(--accent); }
.next:active { transform: translateY(1px); }
.next:focus-visible { outline: 3px solid var(--ring); outline-offset: 3px; }
.next:disabled { opacity: .6; cursor: progress; }

.hint { margin: 14px 0 0; color: var(--muted); font-size: .85rem; text-align: center; }

/* Avatar link to lordof.vegas, bottom right. */
.me {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  display: block;
  transition: transform .18s ease;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .25));
}
.me img { width: 100%; height: 100%; display: block; }
.me:hover { transform: translateY(-3px) rotate(-4deg); }
.me:focus-visible { outline: 3px solid var(--ring); outline-offset: 4px; }

@media (max-width: 640px) {
  body { padding: 16px 16px 96px; }
  .keys { display: none; }
  .me { width: 58px; height: 58px; right: 12px; bottom: 12px; }
  .photo { min-height: max(220px, min(100vh - 320px, 46vh)); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
