/* ==========================================================================
   Snap! — styles. Theme tokens and shared components come from
   shared/style.css.

   The prompt is a paper card, tilted a little. Photos are polaroids: a white
   frame, thicker at the bottom, where the caption goes. The vote is a grid of
   them; the winner gets a crown.
   ========================================================================== */

.sn { display: grid; gap: 1rem; max-width: 30rem; margin-inline: auto; padding-block: .75rem 2rem; }
.sn-title { font-size: clamp(1.6rem, 7vw, 2.2rem); text-align: center; }
.sn-subtitle { font-size: 1.25rem; }
.sn-top { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.sn-top > :last-child:not(:first-child) { margin-inline-start: auto; }
.sn-note { font-size: 1.05rem; font-weight: 700; text-align: center; }
.sn-center-btn { justify-self: center; }
.sn-spacer { min-height: .5rem; }

/* ---------- Menu ---------- */

.sn-menu { display: grid; gap: .5rem; }
.sn-tagline { font-size: 1.1rem; font-weight: 700; text-align: center; }
.sn-settings { display: grid; gap: .4rem; }
.sn-art { position: relative; display: flex; justify-content: center; gap: .3rem; padding: 1.2rem 0 .4rem; }
.sn-art__shot {
  display: grid;
  place-items: center;
  width: 4.6rem;
  aspect-ratio: 1;
  font-size: 2.4rem;
  background: var(--surface-2);
  border: 5px solid #fffdf6;
  border-bottom-width: 14px;
  border-radius: 4px;
  box-shadow: 0 0 0 2.5px var(--line), 0 5px 0 2.5px var(--line);
}
.sn-art__shot--0 { rotate: -7deg; }
.sn-art__shot--1 { rotate: 3deg; translate: 0 6px; }
.sn-art__shot--2 { rotate: 8deg; }
.sn-art__crown { position: absolute; top: -.2rem; left: calc(50% + 2.4rem); font-size: 1.8rem; rotate: 14deg; }

.choices { display: grid; gap: .5rem; }
.choices--row { grid-auto-flow: column; grid-auto-columns: 1fr; }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.choice span { display: flex; align-items: center; justify-content: center; min-height: var(--tap); padding: .4rem .7rem; font-weight: 800; text-align: center; background: var(--surface); border: 3px solid var(--line); border-radius: 14px 16px 13px 17px; }
.choice input:checked + span { background: var(--sun); color: var(--ink); box-shadow: 0 3px 0 var(--line); }
.choice input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

.howto { max-width: 30rem; margin: 1.5rem auto 0; padding: .25rem 1rem; }
.howto summary { min-height: var(--tap); display: flex; align-items: center; font-weight: 800; cursor: pointer; }
.howto ol { display: grid; gap: .5rem; padding: 0 0 1rem; padding-inline-start: 1.4rem; list-style: decimal; }

.host--small .host__teta { width: 76px; }
.host--small .bubble { padding: .65rem .9rem; font-weight: 700; }

/* ---------- The prompt ---------- */

.sn-prompt {
  display: grid;
  gap: .5rem;
  padding: 1.2rem 1.1rem;
  color: var(--ink);
  background: #fffdf6;
  border: 3px solid var(--line);
  border-radius: 18px 20px 17px 21px;
  box-shadow: 0 5px 0 var(--line);
  rotate: -1deg;
}
.sn-prompt__kind { font-weight: 800; color: var(--tomato); }
.sn-prompt__text { font-size: clamp(1.45rem, 6.5vw, 1.9rem); font-weight: 900; line-height: 1.2; }
.sn-prompt--small { padding: .7rem .9rem; rotate: 0deg; box-shadow: 0 3px 0 var(--line); }
.sn-prompt--small .sn-prompt__text { font-size: 1.1rem; text-align: center; }

.sn-file { display: none; }
.sn-error { min-height: 1.2em; font-weight: 800; text-align: center; color: var(--tomato); }
.sn-sending { font-weight: 800; text-align: center; animation: sn-pulse 1s ease-in-out infinite; }
@keyframes sn-pulse { 50% { opacity: .45; } }
.sn-two { display: grid; grid-template-columns: 1fr 1.5fr; gap: .6rem; }
.sn-retake { min-height: 56px; }
.sn-caption { font-size: 1.1rem; font-weight: 700; }

.sn-done { display: grid; justify-items: center; gap: .3rem; padding-block: .5rem 0; }
.sn-done__icon { font-size: 3.6rem; animation: sn-bob 1.6s ease-in-out infinite; }
@keyframes sn-bob { 50% { transform: translateY(-8px); } }
.sn-preview { display: grid; justify-items: center; }
.sn-preview .sn-photo { width: min(100%, 22rem); }
.sn-preview.is-sent .sn-photo { width: min(70%, 15rem); rotate: 3deg; }

/* ---------- A photo ---------- */

.sn-photo { display: grid; margin: 0; }
.sn-photo__frame {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--surface-2);
  border: 7px solid #fffdf6;
  border-bottom-width: 7px;
  border-radius: 4px 4px 0 0;
  box-shadow: 0 0 0 2.5px var(--line);
}
.sn-photo__img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sn-photo__img:not([src]) { visibility: hidden; }
.sn-photo__caption {
  min-height: 1.8rem;
  padding: .15rem .5rem .45rem;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  overflow-wrap: anywhere;
  color: var(--ink);
  background: #fffdf6;
  border-radius: 0 0 4px 4px;
  box-shadow: 0 0 0 2.5px var(--line), 0 5px 0 2.5px var(--line);
  clip-path: inset(0 -6px -10px -6px);
}
.sn-photo:not(:has(.sn-photo__caption)) .sn-photo__frame { border-bottom-width: 1.6rem; border-radius: 4px; box-shadow: 0 0 0 2.5px var(--line), 0 5px 0 2.5px var(--line); }

/* ---------- The vote ---------- */

.sn-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem .7rem; }
.sn-cell-wrap { position: relative; }
.sn-cell { display: block; width: 100%; padding: 0; font: inherit; text-align: inherit; color: inherit; background: none; border: 0; cursor: pointer; touch-action: manipulation; transition: transform .12s; }
.sn-cell:nth-child(1) { rotate: -1.2deg; }
.sn-cell-wrap:nth-child(even) .sn-cell { rotate: 1.4deg; }
.sn-cell:active:not(:disabled) { transform: scale(.96); }
.sn-cell:disabled { cursor: default; }
.sn-cell:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
.sn-cell.is-picked .sn-photo__frame { box-shadow: 0 0 0 5px var(--sun), 0 0 0 7.5px var(--line); }
.sn-cell.is-mine .sn-photo { opacity: .75; }
.sn-cell.is-hidden .sn-photo__img { filter: blur(18px) grayscale(1); }
.sn-badge {
  position: absolute;
  inset: auto 50% .4rem auto;
  translate: 50% 0;
  padding: .15rem .6rem;
  font-size: .85rem;
  font-weight: 900;
  white-space: nowrap;
  color: var(--ink);
  background: var(--sun);
  border: 2.5px solid var(--line);
  border-radius: 999px;
}
.sn-badge[hidden] { display: none; }
.sn-hide {
  position: absolute;
  top: -.5rem;
  inset-inline-end: -.5rem;
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  font-size: 1.05rem;
  background: var(--surface);
  border: 2.5px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
}
.sn-hide[hidden] { display: none; }

/* ---------- The result ---------- */

.sn-empty { padding: 1rem; font-size: 1.15rem; font-weight: 800; text-align: center; }
.sn-win { display: grid; justify-items: center; gap: .3rem; padding-top: 1.4rem; }
.sn-photo--win { width: min(80%, 18rem); rotate: -2deg; animation: sn-in .5s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes sn-in { from { opacity: 0; transform: scale(.85) translateY(16px); } }
.sn-crown { position: absolute; top: -.1rem; left: 50%; translate: -50% -45%; font-size: 2.8rem; rotate: -10deg; filter: drop-shadow(0 3px 0 rgb(0 0 0 / .25)); }
.sn-photo--win .sn-photo__frame { overflow: visible; }
.sn-photo--win .sn-photo__img { border-radius: 2px; }
.sn-win__name { font-size: 1.4rem; font-weight: 900; }
.sn-win__votes { font-weight: 700; }
.sn-points { color: var(--olive); white-space: nowrap; }
:root[data-theme="dark"] .sn-points { color: #b7cc6a; }

.sn-list { display: grid; gap: .5rem; }
.sn-row { display: grid; grid-template-columns: 3.4rem 1fr auto; align-items: center; gap: .7rem; padding: .45rem .7rem; background: var(--surface); border: 3px solid var(--line); border-radius: 14px 16px 13px 17px; }
.sn-row.is-you { border-style: dashed; }
.sn-row__who { overflow: hidden; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.sn-photo--thumb .sn-photo__frame { border-width: 3px; border-bottom-width: 8px; }

/* ---------- The end ---------- */

.sn-board { display: grid; gap: .45rem; }
.sn-board__row { display: grid; grid-template-columns: 1.6rem auto 1fr auto; align-items: center; gap: .6rem; padding: .55rem .8rem; background: var(--surface); border: 3px solid var(--line); border-radius: 14px 16px 13px 17px; }
.sn-board__row:first-child { background: var(--sun); color: var(--ink); }
.sn-board__row.is-you { border-style: dashed; }
.sn-board__place { font-size: 1.2rem; text-align: center; }
.sn-board__face { font-size: 1.6rem; }
.sn-board__name { overflow: hidden; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.sn-board__score { font-size: 1.15rem; white-space: nowrap; }

.sn-gallery { display: grid; gap: 1.6rem; }
.sn-gallery__item { display: grid; gap: .5rem; justify-items: center; }
.sn-gallery__item .sn-photo { width: min(85%, 19rem); }
.sn-gallery__item:nth-child(odd) .sn-photo { rotate: -2deg; }
.sn-gallery__item:nth-child(even) .sn-photo { rotate: 2deg; }
.sn-gallery__prompt { font-weight: 800; text-align: center; color: var(--muted); }
.sn-gallery__who { font-size: 1.1rem; font-weight: 900; }

@media (prefers-reduced-motion: reduce) {
  .sn-done__icon, .sn-photo--win, .sn-sending { animation: none; }
}
