@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('fonts/inter-latin.woff2') format('woff2');
}

:root {
  --bg: #fbf6ee;
  --surface: #ffffff;
  --ink: #1f1d2b;
  --muted: #5f5b6e;
  --rule: #e6dccd;
  --accent: #9e3468;
  --accent-ink: #ffffff;
  --accent-soft: #f6e3ec;
  --error: #a3261b;
  --shadow: 0 1px 2px rgb(60 40 20 / 0.08), 0 8px 24px rgb(60 40 20 / 0.10);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17151d;
    --surface: #221f2a;
    --ink: #f2eef6;
    --muted: #b4aec2;
    --rule: #3a3445;
    --accent: #f0a6c8;
    --accent-ink: #2a0f1d;
    --accent-soft: #3d2533;
    --error: #ff9a8f;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 24px rgb(0 0 0 / 0.35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
img { max-width: 100%; display: block; }
::selection { background: var(--accent-soft); color: var(--ink); }
button { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.top {
  display: flex;
  height: 60px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
}
.logo { height: 34px; width: auto; }
@media (prefers-color-scheme: dark) { .logo { background: #fff; border-radius: 8px; padding: 3px 6px; height: 36px; } }
.lang { display: flex; gap: 2px; }
.lang button {
  border: 0;
  background: none;
  padding: 8px 9px;
  min-width: 40px;
  min-height: 40px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.lang button[aria-pressed="true"] { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--rule); }

main { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 0 16px; display: flex; flex-direction: column; }
.screen { flex: 1; display: flex; flex-direction: column; }

h1 {
  font-size: clamp(27px, 7.4vw, 38px);
  margin-top: 14px;
  line-height: 1.12;
  letter-spacing: -0.022em;
  font-weight: 760;
  margin-bottom: 14px;
  text-wrap: balance;
}
.lead { font-size: 17px; margin: 0 0 14px; color: var(--ink); text-wrap: pretty; }
.meta { font-size: 14px; color: var(--muted); margin: 0 0 18px; }
.sub { font-size: 18px; font-weight: 700; margin: 26px 0 10px; letter-spacing: -0.01em; }

.primary {
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 17px;
  font-weight: 650;
  min-height: 54px;
  padding: 0 28px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 120ms ease, filter 120ms ease;
}
@media (hover: hover) { .primary:hover { filter: brightness(1.06); } }
.primary:active { transform: scale(0.98); }
#intro .primary, #done .primary { align-self: stretch; }
@media (min-width: 520px) { #intro .primary, #done .primary { align-self: flex-start; } }

/* Intro: three designs fanned like cards */
.peek { display: flex; justify-content: center; margin: 6px 0 22px; height: 190px; }
.peek img {
  width: 128px;
  height: auto;
  border-radius: 10px;
  box-shadow: var(--shadow);
  background: var(--surface);
}
.peek img:nth-child(1) { transform: rotate(-7deg) translate(18px, 14px); }
.peek img:nth-child(2) { transform: translateY(-2px); z-index: 1; }
.peek img:nth-child(3) { transform: rotate(7deg) translate(-18px, 14px); }

/* Rating screen: everything fits one phone screen; the picture takes what is left */
body[data-screen="rate"] .foot { display: none; }
#rate {
  flex: none;
  padding-bottom: 6px;
  height: calc(100dvh - 60px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  min-height: 460px;
}
.progress { height: 4px; border-radius: 4px; background: var(--rule); overflow: hidden; }
.progress span { display: block; height: 100%; width: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1); }
.rate-head { display: flex; justify-content: space-between; align-items: baseline; margin: 8px 0 6px; }
.design-label { font-weight: 700; font-size: 16px; }
.progress-text { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }

.art {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  border: 0;
  padding: 0;
  background: none;
  cursor: zoom-in;
}
/* absolutely placed so the picture shrinks to whatever height is left */
.art img {
  position: absolute;
  inset: 0;
  margin: auto;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border-radius: 10px;
  box-shadow: var(--shadow);
  background: var(--surface);
  transition: opacity 420ms cubic-bezier(0.16, 1, 0.3, 1), transform 420ms cubic-bezier(0.16, 1, 0.3, 1);
}
.art img.is-loading { opacity: 0; transform: translateX(28px) scale(0.985); transition: none; }
.art img.is-back { transform: translateX(-28px) scale(0.985); }
.question { font-size: 17px; font-weight: 650; text-align: center; margin: 12px 0 8px; letter-spacing: -0.01em; }

.scale { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.scale button {
  min-height: 48px;
  border-radius: 10px;
  border: 1px solid var(--rule);
  background: var(--surface);
  font-size: 17px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  padding: 0;
  transition: background 120ms ease, color 120ms ease, transform 120ms ease;
  touch-action: manipulation;
}
@media (hover: hover) { .scale button:hover { border-color: var(--accent); } }
.scale button:active { transform: scale(0.94); }
.scale button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); animation: pop 260ms cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes pop { 0% { transform: scale(0.9); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }
.scale button:disabled { cursor: default; }
@media (max-width: 339px) { .scale { grid-template-columns: repeat(5, 1fr); } }
.scale-ends { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 5px; }

.error { color: var(--error); font-size: 14px; font-weight: 600; text-align: center; margin: 8px 0 0; }
.nav { display: flex; justify-content: space-between; margin-top: 4px; }
.link {
  border: 0;
  background: none;
  padding: 10px 4px;
  min-height: 44px;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
}
.nav .link:only-child, .nav #skipBtn { margin-left: auto; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Done screen */
.favs, .all { display: grid; gap: 10px; }
.favs { grid-template-columns: repeat(3, 1fr); margin-bottom: 18px; }
.all { grid-template-columns: repeat(3, 1fr); margin-bottom: 8px; }
@media (min-width: 520px) { .all { grid-template-columns: repeat(4, 1fr); } }
.thumb {
  border: 0;
  padding: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.thumb img { width: 100%; height: auto; border-radius: 8px; box-shadow: var(--shadow); background: var(--surface); }
.thumb span { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.favs .thumb span { color: var(--ink); font-weight: 650; }

.foot {
  width: 100%;
  max-width: 640px;
  margin: 28px auto 0;
  padding: 16px 16px 24px;
  border-top: 1px solid var(--rule);
  font-size: 13px;
  color: var(--muted);
}
.foot p { margin: 0 0 6px; }

dialog#zoom {
  border: 0;
  padding: 12px;
  background: transparent;
  max-width: 100vw;
  max-height: 100dvh;
  width: 100vw;
  height: 100dvh;
  margin: 0;
}
dialog#zoom[open] { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
dialog#zoom::backdrop { background: rgb(15 12 20 / 0.86); }
#zoomImg { max-height: calc(100dvh - 96px); width: auto; border-radius: 8px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .art img.is-loading, .art img.is-back { transform: none; }
}
