/* Scatta con Gina — styled after superscatto.com: cream and white
   surfaces, ink text, red pill buttons, yellow accents, Nunito Sans. */
:root {
  --bg: #fdf7f0;            /* SuperScatto cream */
  --paper: #ffffff;
  --ink: #14141f;
  --ink-2: #56565e;
  --ink-3: rgba(20, 20, 31, 0.48);
  --line: rgba(20, 20, 31, 0.1);
  --line-2: rgba(20, 20, 31, 0.18);
  --red: #c0221b;           /* buttons */
  --red-dark: #9c1c16;
  --red-soft: #fbeceb;
  --yellow: #fdd22a;        /* accents, the "Un selfie con Gina" strip */
  --yellow-soft: #fff4c9;
  --brand: #cc6633;         /* the logo's orange */
  --ok: #2fb866;
  --gold: #f5b800;
  --radius: 18px;
  --font: 'Nunito Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --shadow: 0 18px 50px rgba(20, 20, 31, 0.16);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  font-family: var(--font);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

#stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

/* softens the location photo behind menus */
.veil {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(253, 247, 240, 0.5), rgba(253, 247, 240, 0.82));
  transition: opacity 0.4s ease;
}
.veil.off { opacity: 0; }

.hidden { display: none !important; }

svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Screens ---------- */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  animation: fadeIn 0.3s ease;
}
.screen.active { display: flex; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }

.panel-screen {
  align-items: center;
  justify-content: center;
  padding: calc(64px + var(--safe-t)) 16px calc(16px + var(--safe-b));
  overflow-y: auto;
}
.panel {
  width: 100%;
  max-width: 440px;
  margin: auto;
  padding: 26px 22px 22px;
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: rise 0.35s ease;
}
.panel.wide { max-width: 640px; }
.panel.narrow { max-width: 380px; }
.panel.center { text-align: center; }

h1, h2 { margin: 0; font-weight: 800; letter-spacing: -0.01em; line-height: 1.08; color: var(--ink); }
h1 { font-size: clamp(38px, 10vw, 60px); }
h2 { font-size: clamp(24px, 6vw, 30px); margin-bottom: 16px; }
/* small yellow label, like the numbered steps on the site */
.eyebrow {
  display: inline-block;
  margin: 0 0 10px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--yellow);
  color: var(--ink);
  font: 800 11.5px/1 var(--font);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.lead { font-size: 17px; line-height: 1.5; color: var(--ink-2); margin: 14px 0 26px; }
.note { font-size: 14px; line-height: 1.5; color: var(--ink-2); margin: 14px 0 0; }
.note.center { text-align: center; }
.fineprint { font-size: 12.5px; color: var(--ink-3); margin: 16px 0 0; }

/* ---------- Buttons (red pills, as on the site) ---------- */
.btn {
  appearance: none;
  border: 2px solid transparent;
  font: 800 16px/1 var(--font);
  letter-spacing: 0.01em;
  padding: 0 24px;
  height: 52px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--ink);
  background: var(--paper);
  text-decoration: none;
  transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s, opacity 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--red); color: #fff; box-shadow: 0 8px 22px rgba(192, 34, 27, 0.28); }
.btn.primary:hover { background: var(--red-dark); }
.btn.secondary { background: var(--paper); border-color: var(--red); color: var(--red); }
.btn.secondary:hover { background: var(--red-soft); }
.btn.share { background: var(--yellow); color: var(--ink); }
.btn.share:hover { background: #f7c800; }
.btn.big { height: 60px; font-size: 18px; padding: 0 40px; }
.btn.small { height: 42px; font-size: 14px; padding: 0 16px; white-space: nowrap; }
.btn.wide { width: 100%; margin-top: 12px; }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.btn svg { width: 20px; height: 20px; stroke-width: 2.2; }

.link-btn {
  appearance: none;
  background: none;
  border: none;
  color: var(--ink-2);
  font: 700 14px var(--font);
  padding: 10px 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.link-btn:hover { color: var(--red); }
.link-btn svg { width: 18px; height: 18px; }

.row { display: flex; gap: 10px; justify-content: center; align-items: center; flex-wrap: wrap; margin-top: 18px; }
.row > .btn { flex: 1 1 0; min-width: 120px; }

.icon-btn {
  appearance: none;
  border: 1px solid var(--line);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 0 4px 14px rgba(20, 20, 31, 0.12);
  transition: background 0.15s, transform 0.08s;
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn.glass { background: rgba(255, 255, 255, 0.88); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.icon-btn.small { width: 38px; height: 38px; box-shadow: none; }
.icon-btn.small svg { width: 18px; height: 18px; }

a.icon-btn { text-decoration: none; }

/* Home: always one tap away (the client asked for it on every screen).
   The pill is for the panel screens; the camera, the framing editor and the
   game have their own round Home button in their top bar. */
.home-pill {
  position: absolute;
  top: calc(12px + var(--safe-t));
  left: 14px;
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--ink);
  font: 800 15px var(--font);
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(20, 20, 31, 0.12);
}
.home-pill svg { width: 20px; height: 20px; }
.home-pill:active { transform: scale(0.96); }
#app[data-screen="screen-camera"] .home-pill,
#app[data-screen="screen-frame"] .home-pill,
#app[data-screen="play"] .home-pill { display: none; }
.cam-nav { display: flex; gap: 8px; }

#app[data-screen="screen-camera"] .mute,
#app[data-screen="screen-frame"] .mute { display: none; }
.mute {
  position: absolute;
  right: 14px;
  bottom: calc(14px + var(--safe-b));
  z-index: 30;
}

/* ---------- Camera (stays dark: it is a viewfinder) ---------- */
.camera { background: #000; color: #fff; }
.cam-view { position: absolute; inset: 0; overflow: hidden; }
.cam-view video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}
.cam-view video.mirror { transform: scaleX(-1); }
.cam-guide {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(86vw, 62vh);
  height: auto;
  transform: translate(-50%, -54%);
  stroke: rgba(255, 255, 255, 0.75);
  stroke-width: 2;
  stroke-dasharray: 7 7;
  fill: none;
  pointer-events: none;
}
.cam-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent calc(33.33% - 0.5px), rgba(255,255,255,0.35) 33.33%, transparent calc(33.33% + 0.5px), transparent calc(66.66% - 0.5px), rgba(255,255,255,0.35) 66.66%, transparent calc(66.66% + 0.5px)),
    linear-gradient(180deg, transparent calc(33.33% - 0.5px), rgba(255,255,255,0.35) 33.33%, transparent calc(33.33% + 0.5px), transparent calc(66.66% - 0.5px), rgba(255,255,255,0.35) 66.66%, transparent calc(66.66% + 0.5px));
}
.countdown {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 300 clamp(110px, 30vw, 180px)/1 var(--font);
  color: #fff;
  text-shadow: 0 6px 40px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}
.countdown span { animation: tick 0.9s ease both; }
@keyframes tick { 0% { transform: scale(1.25); opacity: 0; } 20% { opacity: 1; } 100% { transform: scale(0.9); opacity: 0.2; } }
.cam-msg {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 32px;
  text-align: center;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink-2);
  background: var(--bg);
}
.screen-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity 0.12s; }
.screen-flash.on { opacity: 1; transition: none; }
.cam-top {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  padding: calc(14px + var(--safe-t)) 14px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.5), transparent);
}
.cam-tools { display: flex; gap: 6px; padding: 4px; border-radius: 999px; background: rgba(255, 255, 255, 0.88); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2); }
.tool {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink);
  height: 36px;
  min-width: 36px;
  padding: 0 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font: 800 12px var(--font);
  cursor: pointer;
}
.tool svg { width: 18px; height: 18px; }
.tool[aria-pressed="true"], .tool.on { background: var(--yellow); }
.cam-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 36px 26px calc(26px + var(--safe-b));
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.66), transparent);
}
.cam-bottom > :first-child { justify-self: start; }
.cam-left { display: flex; flex-direction: column; align-items: center; gap: 16px; }
/* the avatar button, pointed out (yellow label and ring) until first opened */
.avatar-wrap { position: relative; display: flex; justify-content: center; }
.avatar-tip {
  position: absolute;
  bottom: calc(100% + 12px);
  left: -6px;
  display: none;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--yellow);
  color: var(--ink);
  font: 800 14px/1.1 var(--font);
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
  animation: nudge 1.6s ease-in-out infinite;
}
.avatar-tip::after { content: ''; position: absolute; left: 30px; top: 100%; border: 8px solid transparent; border-top-color: var(--yellow); }
.avatar-wrap.tip .avatar-tip { display: block; }
.avatar-wrap.tip .round-btn svg { outline: 3px dashed var(--yellow); outline-offset: 5px; }
@keyframes nudge { 50% { transform: translateY(-4px); } }
.cam-bottom > :last-child { justify-self: end; }
.round-btn {
  appearance: none;
  border: none;
  background: none;
  color: #fff;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font: 800 11.5px var(--font);
  letter-spacing: 0.03em;
}
.round-btn svg { width: 26px; height: 26px; padding: 13px; box-sizing: content-box; border-radius: 50%; background: rgba(255, 255, 255, 0.92); color: var(--ink); }
.shutter {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: transparent;
  padding: 5px;
  cursor: pointer;
}
.shutter span { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--red); transition: transform 0.12s ease; }
.shutter:active span { transform: scale(0.88); }
.shutter:disabled { opacity: 0.35; }

/* bottom sheet over the camera: the avatars */
.sheet {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  animation: fadeIn 0.2s ease;
}
.sheet-panel {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: 88%;
  overflow-y: auto;
  padding: 12px 18px calc(22px + var(--safe-b));
  border-radius: 26px 26px 0 0;
  background: var(--bg);
  color: var(--ink);
  text-align: center;
  animation: sheetUp 0.32s cubic-bezier(.2, .9, .3, 1);
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
.sheet-grip { display: block; width: 44px; height: 5px; margin: 0 auto 14px; border-radius: 3px; background: var(--line-2); }
.sheet-close { position: absolute; top: 14px; right: 14px; }
.sheet-panel h2 { margin: 6px 0 4px; }
.sheet-sub { margin: 0; font-weight: 800; color: var(--ink-2); }
.sheet-panel .note { margin: 6px auto 16px; max-width: 420px; text-wrap: balance; }
.avatar-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (min-width: 560px) { .avatar-list { grid-template-columns: repeat(5, 1fr); } }
.avatar-card { appearance: none; border: none; background: none; padding: 0; cursor: pointer; color: var(--ink); font: 800 13.5px var(--font); }
.avatar-card .pic {
  display: block;
  aspect-ratio: 4 / 5;
  margin-bottom: 6px;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid transparent;
  /* checkerboard: a transparent background */
  background: repeating-conic-gradient(#e7e3dd 0 25%, #fff 0 50%) 0 0 / 16px 16px;
  transition: border-color 0.15s, transform 0.1s;
}
.avatar-card img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; display: block; }
.avatar-card:hover .pic, .avatar-card:focus-visible .pic { border-color: var(--red); }
.avatar-card:active .pic { transform: scale(0.96); }

/* Gina speaks: her face and a speech bubble */
.say { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; text-align: left; }
.say img { width: 46px; height: 46px; flex: none; border-radius: 50%; box-shadow: 0 3px 10px rgba(20, 20, 31, 0.18); }
.say p {
  position: relative;
  margin: 0;
  padding: 10px 14px;
  border-radius: 16px;
  background: var(--yellow-soft);
  font: 800 16px/1.3 var(--font);
  color: var(--ink);
}
.say p::before { content: ''; position: absolute; left: -7px; top: 50%; margin-top: -7px; border: 7px solid transparent; border-left: 0; border-right-color: var(--yellow-soft); }
.say.pop p { animation: pop 0.35s cubic-bezier(.2, 1.4, .4, 1) both; transform-origin: 0 50%; }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }
.say.floating { position: absolute; left: 50%; top: calc(80px + var(--safe-t)); z-index: 5; width: max-content; max-width: min(92vw, 420px); transform: translateX(-50%); pointer-events: none; }
.say.floating p { background: #fff; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3); }
.say.floating p::before { border-right-color: #fff; }
.prize-panel .say { justify-content: center; margin: 4px 0 6px; }

/* the difficulty screen opens the game: the logo and its name on top */
.diff-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font: 800 15px var(--font); color: var(--ink-2); }
.diff-brand img { height: 26px; width: auto; }
.fineprint.center { text-align: center; }

/* ---------- Framing editor ---------- */
.editor { flex-direction: column; background: var(--bg); }
.bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(12px + var(--safe-t)) 14px 8px;
}
.bar-title { flex: 1; text-align: center; min-width: 0; }
.bar-title h2 { font-size: 21px; margin: 0; }
.bar-title p { margin: 4px 0 0; font-size: 13.5px; color: var(--ink-2); line-height: 1.35; }
.bar-spacer { width: 44px; flex: none; }
.framer { position: relative; flex: 1; min-height: 0; touch-action: none; }
.framer-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
.framer-canvas:active { cursor: grabbing; }
.editor-controls {
  padding: 10px 16px calc(16px + var(--safe-b));
  display: grid;
  gap: 12px;
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
}
.zoom { display: flex; align-items: center; gap: 10px; }
.zoom input { flex: 1; }
input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  height: 28px;
  background: transparent;
}
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: var(--line-2); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--line-2); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; margin-top: -10px; border-radius: 50%; background: var(--red); border: 3px solid #fff; box-shadow: 0 2px 8px rgba(20, 20, 31, 0.3); }
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border: 3px solid #fff; border-radius: 50%; background: var(--red); box-shadow: 0 2px 8px rgba(20, 20, 31, 0.3); }

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: rgba(20, 20, 31, 0.06);
  border-radius: 999px;
  padding: 4px;
}
.segmented button {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink-2);
  font: 800 14px var(--font);
  height: 40px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}
.segmented button svg { width: 18px; height: 18px; }
.segmented button.active { background: var(--paper); color: var(--ink); box-shadow: 0 2px 10px rgba(20, 20, 31, 0.12); }

/* ---------- Preview ---------- */
.preview-photo {
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  max-height: 52vh;
  margin: 0 auto;
  background: #eee9e2;
  box-shadow: 0 14px 34px rgba(20, 20, 31, 0.18);
}
.preview-photo canvas { width: 100%; height: 100%; display: block; object-fit: cover; }

/* ---------- Difficulty ---------- */
.diff-sub { margin: -6px 0 18px; font-size: 15px; line-height: 1.45; color: var(--ink-2); }
.diff-sub b { color: var(--ink); font-weight: 800; }
.diff-list { display: grid; gap: 10px; }
/* icon | name, description, sets | prize | arrow */
.diff-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  padding: 10px 12px 10px 16px;
  border-radius: 16px;
  background: var(--bg);
  border: 2px solid transparent;
  color: var(--ink);
  transition: transform 0.1s, border-color 0.15s, background 0.15s;
}
.diff-card:hover { border-color: var(--line-2); }
.diff-card:has(.diff-pick:active) { transform: scale(0.985); }
.diff-card.sel { border-color: var(--red); background: var(--red-soft); }
/* the card's own button, stretched over it; "Vedi codice" sits above */
.diff-pick {
  position: absolute;
  inset: 0;
  z-index: 1;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: none;
  cursor: pointer;
}
.diff-pick:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
.diff-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--yellow);
  flex: none;
  color: var(--ink);
}
.diff-icon img { width: 100%; height: 100%; object-fit: contain; }
.diff-icon svg { width: 32px; height: 32px; stroke-width: 1.7; }
.diff-info { align-self: stretch; display: flex; flex-direction: column; justify-content: center; padding-left: 16px; border-left: 1px solid var(--line); }
.diff-card b { display: block; font-size: 19px; font-weight: 800; }
.diff-info .desc { display: block; font-size: 14px; line-height: 1.3; color: var(--ink-2); margin-top: 3px; }
.sets { display: flex; gap: 6px; }
.diff-info .sets { margin-top: 10px; }
.sets i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-2); flex: none; }
.sets i.on { background: var(--red); border-color: var(--red); }
.diff-prize { align-self: stretch; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 140px; padding-left: 12px; border-left: 1px solid var(--line); text-align: center; }
.prize-title { margin: 0; font-size: 15px; font-weight: 800; line-height: 1.15; }
.prize-title em, .prize-name em, .prize-strip em { font-style: normal; }
.t-yellow { color: #e0a400; }
.t-red { color: var(--red); }
.prize-sub { margin: 2px 0 0; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.prize-open {
  position: relative;
  z-index: 2;
  margin-top: 6px;
  padding: 5px 12px;
  border: 0;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font: 800 12.5px var(--font);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(192, 34, 27, 0.28);
}
.prize-open:hover { background: var(--red-dark); }
.won-badge {
  position: absolute;
  right: 2%;
  top: 0;
  z-index: 3;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ok);
  color: #fff;
  box-shadow: 0 3px 10px rgba(20, 20, 31, 0.25);
  pointer-events: none;
}
.won-badge svg { width: 16px; height: 16px; stroke-width: 3; }
.chev { width: 22px; height: 22px; stroke-width: 2.4; color: var(--ink); }
.diff-foot { display: flex; align-items: center; gap: 14px; margin-top: 10px; padding: 10px 16px; border-radius: 16px; background: var(--bg); text-align: left; }
.diff-foot .trophy { width: 56px; height: 49px; }
.diff-foot b { display: block; font-size: 16px; font-weight: 800; }
.diff-foot small { display: block; margin-top: 2px; font-size: 13.5px; color: var(--ink-2); }

/* the prize pictures (js/prizes.js): a gift box, or three Polaroids */
.prize-art { position: relative; width: 100px; aspect-ratio: 6 / 5; margin: 0 auto 4px; }
.art-svg { position: absolute; inset: 0; width: 100%; height: 100%; stroke: none; stroke-width: 3; stroke-linecap: round; overflow: visible; }
.art-svg text { font: 900 19px var(--font); letter-spacing: -0.02em; }
.art-svg.sparks { z-index: 3; }
.pol {
  position: absolute;
  width: 36%;
  padding: 2.4% 2.4% 8%;
  background: #fff;
  border-radius: 2px;
  box-shadow: 0 4px 12px rgba(20, 20, 31, 0.22);
  transform: rotate(var(--r));
}
.pol img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }

/* ---------- Prize ---------- */
.prize-panel { position: relative; z-index: 1; }
.prize-panel h2 { margin-bottom: 6px; }
.prize-panel .note { margin-top: 6px; text-wrap: balance; }
.prize-panel .prize-art { width: 200px; margin: 14px auto 10px; }
.prize-panel .art-svg text { font-size: 19px; }
.prize-name { margin: 0; font-size: 24px; font-weight: 800; line-height: 1.15; }
.prize-name small { display: block; margin-top: 3px; font-size: 15px; font-weight: 700; color: var(--ink-2); }
.code-box { margin-top: 18px; padding: 12px 12px 12px 16px; border: 2px dashed var(--red); border-radius: 14px; background: var(--red-soft); text-align: left; }
.code-box small { display: block; margin-bottom: 6px; font: 800 11px var(--font); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); }
.code-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.code { min-width: 0; font: 600 22px/1.2 var(--mono); letter-spacing: 0.05em; color: var(--ink); word-break: break-all; user-select: all; -webkit-user-select: all; -webkit-touch-callout: default; }
#btn-copy { flex: none; }
#btn-copy.done { background: var(--ok); box-shadow: 0 8px 22px rgba(47, 184, 102, 0.3); }
.code.msg { font: 700 15px/1.35 var(--font); letter-spacing: 0; word-break: normal; user-select: none; -webkit-user-select: none; }
.code-box.busy .code { animation: blink 1.2s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.45; } }
.prize-panel .fineprint { margin-top: 10px; }
/* falls over the whole screen when the prize is won */
.confetti { position: absolute; inset: 0; z-index: 2; overflow: hidden; pointer-events: none; }
.confetti i {
  position: absolute;
  top: -16px;
  left: var(--x);
  width: 9px;
  height: 14px;
  border-radius: 2px;
  background: var(--c);
  box-shadow: 0 0 0 1px rgba(20, 20, 31, 0.06);
  opacity: 0;
  animation: fall var(--d) var(--delay) cubic-bezier(.25, .6, .45, 1) forwards;
}
@keyframes fall {
  0% { opacity: 1; transform: translate(0, 0) rotate(0); }
  85% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--drift), 105vh) rotate(var(--rot)); }
}
@media (prefers-reduced-motion: reduce) { .confetti { display: none; } }

/* under the print: sets left for the prize, or a way back to it */
.prize-strip {
  width: 100%;
  margin-top: 14px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 14px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  text-align: left;
}
.prize-strip:disabled { cursor: default; }
.prize-strip .sets i { width: 12px; height: 12px; }
.prize-strip .txt { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.3; color: var(--ink-2); }
.prize-strip .txt b { color: var(--ink); font-weight: 800; }
.prize-strip.won { background: var(--yellow-soft); cursor: pointer; box-shadow: inset 0 0 0 2px var(--yellow); }
.prize-strip.won:hover { background: #ffeaa3; }
.prize-strip.won em { color: inherit; }
.prize-strip.won .trophy { width: 40px; height: 35px; }
.prize-strip.won small { display: block; font: 800 11px var(--font); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); }
.prize-strip.won b { display: block; font-size: 16px; }
.prize-strip .go { flex: none; font-size: 14px; font-weight: 800; color: var(--red); }

/* phones: no dividers, everything a bit smaller */
@media (max-width: 520px) {
  #screen-difficulty { padding-bottom: calc(76px + var(--safe-b)); } /* clear of the sound button */
  .diff-sub { font-size: 14px; margin-bottom: 14px; }
  .diff-card { gap: 10px; padding: 12px 6px 12px 12px; }
  .diff-icon { width: 46px; height: 46px; }
  .diff-icon svg { width: 24px; height: 24px; }
  .diff-info, .diff-prize { padding-left: 0; border-left: 0; }
  .diff-card b { font-size: 16.5px; }
  .diff-info .desc { font-size: 12.5px; }
  .diff-info .sets { margin-top: 8px; gap: 4px; }
  .diff-info .sets i { width: 12px; height: 12px; }
  .diff-prize { width: 98px; }
  .diff-prize .prize-art { width: 84px; }
  .prize-title { font-size: 13px; }
  .prize-sub { font-size: 11.5px; }
  .prize-open { padding: 4px 10px; font-size: 11.5px; }
  .won-badge { width: 22px; height: 22px; }
  .won-badge svg { width: 13px; height: 13px; }
  .chev { width: 16px; height: 16px; }
  .diff-foot { gap: 10px; padding: 10px 12px; }
  .diff-foot .trophy { width: 48px; height: 42px; }
  .diff-foot b { font-size: 14px; }
  .diff-foot small { font-size: 12.5px; }
  .prize-panel .prize-art { width: 170px; }
  .code { font-size: 19px; }
}

/* ---------- Levels ---------- */
.level-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 620px) { .level-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; } }
.level-card {
  position: relative;
  border: none;
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  background: #eee9e2;
  font: inherit;
  color: #fff;
  text-align: left;
  aspect-ratio: 4 / 3;
  box-shadow: 0 6px 18px rgba(20, 20, 31, 0.14);
  transition: transform 0.12s ease, box-shadow 0.15s;
}
.level-card:hover { box-shadow: 0 10px 26px rgba(20, 20, 31, 0.22); }
.level-card:active { transform: scale(0.98); }
.level-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.level-card:hover img { transform: scale(1.04); }
.level-card::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 38%, rgba(0,0,0,0.72)); }
.level-card .meta { position: absolute; left: 12px; right: 12px; bottom: 10px; z-index: 1; }
.level-card .name { font-weight: 800; font-size: 17px; }
.level-card .place { display: flex; align-items: center; gap: 4px; font: 700 11.5px var(--font); letter-spacing: 0.06em; text-transform: uppercase; color: rgba(255, 255, 255, 0.85); margin-top: 2px; }
.level-card .place svg { width: 12px; height: 12px; }
.level-card .lstars { position: absolute; top: 10px; right: 10px; z-index: 1; font: 800 11.5px var(--font); padding: 4px 9px; border-radius: 999px; background: var(--paper); color: var(--ink); }
.level-card .lock { position: absolute; inset: 0; z-index: 2; display: none; place-items: center; background: rgba(253, 247, 240, 0.45); }
.level-card .lock svg { width: 26px; height: 26px; padding: 11px; box-sizing: content-box; border-radius: 50%; background: var(--paper); color: var(--ink); box-shadow: 0 4px 14px rgba(20, 20, 31, 0.2); }
.level-card.locked { cursor: not-allowed; }
.level-card.locked img { filter: grayscale(1) brightness(0.85); }
.level-card.locked .lock { display: grid; }

/* ---------- HUD (white pills over the photo) ---------- */
#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  padding: calc(10px + var(--safe-t)) 12px 12px;
}
.hud-top { display: flex; align-items: center; gap: 10px; }
.hud-top .icon-btn { pointer-events: auto; }
.hud-title {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #fff;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.55);
}
.hud-title span { font-weight: 800; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.hud-title small { font: 700 11.5px var(--font); letter-spacing: 0.1em; text-transform: uppercase; color: rgba(255, 255, 255, 0.9); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.hud-score {
  min-width: 74px;
  text-align: right;
  font: 800 20px var(--font);
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(20, 20, 31, 0.2);
}
.hud-score small { font-size: 11px; color: var(--ink-3); margin-left: 4px; }
.hud-row { display: flex; justify-content: space-between; margin-top: 10px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(20, 20, 31, 0.18);
}
.chip svg { width: 16px; height: 16px; color: var(--ink-2); }
.film { display: flex; gap: 3px; }
.film i { width: 6px; height: 14px; border-radius: 2px; background: var(--ink); }
.film i.used { background: rgba(20, 20, 31, 0.18); }
.hits { display: flex; gap: 6px; }
.hits i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(20, 20, 31, 0.4); }
.hits i.on { background: var(--yellow); border-color: var(--ink); }
.hud-hint {
  position: absolute;
  left: 50%;
  bottom: calc(76px + var(--safe-b));
  transform: translateX(-50%);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 6px 18px rgba(20, 20, 31, 0.2);
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  max-width: calc(100% - 32px);
  width: max-content;
  transition: opacity 0.5s;
}
.hud-snaps {
  position: absolute;
  left: 12px;
  bottom: calc(12px + var(--safe-b));
  display: flex;
  gap: 8px;
}
.hud-snaps .snap {
  width: 46px;
  background: #fbfaf7;
  padding: 3px 3px 9px;
  border-radius: 2px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  animation: snapIn 0.55s cubic-bezier(.2, 1.5, .4, 1);
  position: relative;
}
.hud-snaps .snap:nth-child(odd) { transform: rotate(-3deg); }
.hud-snaps .snap:nth-child(even) { transform: rotate(2.5deg); }
.hud-snaps .snap canvas { width: 100%; display: block; }
.hud-snaps .snap.miss canvas { filter: blur(1.5px) grayscale(0.4); }
@keyframes snapIn { from { transform: translateY(-140px) rotate(-18deg) scale(1.7); opacity: 0; } to { opacity: 1; } }

/* ---------- Result ---------- */
.result-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 16px; }
.result-head > div:first-child { min-width: 0; }
.result-head .eyebrow { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-head { align-items: center; }
.site-btn { margin-top: 18px; text-transform: uppercase; letter-spacing: 0.06em; }
.result-score { text-align: right; font: 700 12px var(--font); letter-spacing: 0.04em; color: var(--ink-2); white-space: nowrap; }
.stars { display: flex; gap: 3px; justify-content: flex-end; margin-bottom: 4px; }
.stars svg { width: 20px; height: 20px; fill: var(--gold); stroke: var(--gold); stroke-width: 1; }
.stars svg.off { fill: transparent; stroke: rgba(20, 20, 31, 0.25); }
.print {
  max-width: min(340px, 38vh);
  margin: 0 auto;
  border-radius: 3px;
  overflow: hidden;
  box-shadow: 0 18px 44px rgba(20, 20, 31, 0.24);
  transform: rotate(-0.6deg);
  animation: develop 1.1s ease both;
}
@keyframes develop { from { filter: brightness(1.8) saturate(0); transform: rotate(-0.6deg) translateY(10px); } to { filter: none; } }
.print img { width: 100%; display: block; -webkit-touch-callout: default; user-select: auto; }
/* the next set, as a big card: its photo, its name and an arrow */
.next-card {
  appearance: none;
  border: none;
  width: 100%;
  margin-top: 16px;
  padding: 10px 18px 10px 10px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-radius: 16px;
  background: var(--red);
  color: #fff;
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(192, 34, 27, 0.3);
  transition: transform 0.08s ease, background 0.15s;
}
.next-card:hover { background: var(--red-dark); }
.next-card:active { transform: scale(0.98); }
.next-card img { width: 76px; height: 56px; object-fit: cover; border-radius: 10px; flex: none; }
.next-card .txt { flex: 1; min-width: 0; }
.next-card small { display: block; font: 800 11.5px var(--font); letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.85; }
.next-card b { display: block; font-size: 19px; font-weight: 800; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.next-card svg { width: 26px; height: 26px; stroke-width: 2.4; }
.badge { width: 64px; height: 64px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 50%; background: var(--yellow); color: var(--ink); }
.badge svg { width: 28px; height: 28px; }

/* ---------- Loading ---------- */
.loading {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: rgba(253, 247, 240, 0.94);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  padding: 24px;
}
.loading p { margin: 18px 0 0; font-size: 18px; font-weight: 800; }
.loading small { font-size: 14px; color: var(--ink-2); max-width: 300px; line-height: 1.4; }
/* camera aperture iris */
.aperture {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2.5px solid var(--red);
  overflow: hidden;
  animation: spin 2.4s linear infinite;
}
.aperture i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
  border-right: 2.5px solid var(--red);
  transform-origin: 50% 50%;
  animation: iris 1.6s ease-in-out infinite alternate;
}
.aperture i:nth-child(1) { --r: 0deg; }
.aperture i:nth-child(2) { --r: 60deg; }
.aperture i:nth-child(3) { --r: 120deg; }
.aperture i:nth-child(4) { --r: 180deg; }
.aperture i:nth-child(5) { --r: 240deg; }
.aperture i:nth-child(6) { --r: 300deg; }
@keyframes iris { from { transform: rotate(var(--r)) translateX(-6px); } to { transform: rotate(var(--r)) translateX(-20px); } }
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: absolute;
  left: 50%;
  top: calc(18px + var(--safe-t));
  transform: translateX(-50%);
  z-index: 50;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  box-shadow: var(--shadow);
  animation: rise 0.3s ease;
}

@media (min-width: 900px) {
  .panel { padding: 30px 28px 26px; }
}
@media (max-height: 680px) {
  .preview-photo { max-height: 42vh; }
  .lead { margin: 10px 0 18px; font-size: 15px; }
}
