:root {
  --bg: #16161d;
  --text: #f2f0ea;
  --muted: #9a98a6;
  --accent: #ffd166;
  --empty: #24242e;
  --card: linear-gradient(150deg, #f5ead0, #dcc38f);
  --pack: linear-gradient(150deg, #ffd166, #ef8a3c);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, sans-serif;
}

/* Full-width bars, content no wider than 1200px. */
.topbar, main, .footer { padding-inline: max(16px, (100% - 1200px) / 2); }
main { flex: 1; padding-block: 32px 48px; width: 100%; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 64px;
  border-bottom: 1px solid var(--empty);
}
h1 { margin: 0; font-size: 1.5rem; letter-spacing: -0.02em; }
.topbar .subtitle { color: var(--muted); font-weight: 600; }
@media (max-width: 480px) { .topbar h1 { font-size: 1.15rem; } }
h2 { font-size: 1.1rem; }
.muted { color: var(--muted); font-weight: normal; }

.account { display: flex; align-items: center; gap: 8px; }
.lang { display: flex; gap: 4px; }
.lang button, .link {
  font: inherit; font-size: .85rem;
  min-height: 44px; min-width: 44px;
  border: 1px solid var(--empty); border-radius: 999px;
  background: none; color: var(--muted); cursor: pointer;
}
.lang button[aria-pressed="true"] { color: var(--text); border-color: var(--muted); }
.link { padding: 0 16px; }

.footer {
  display: flex; gap: 24px; justify-content: center;
  padding-block: 20px;
  border-top: 1px solid var(--empty);
  font-size: .9rem;
}
.footer a { color: var(--muted); }
.footer a:hover { color: var(--text); }

.pack { text-align: center; margin-bottom: 32px; }

#open {
  font: inherit;
  font-weight: 700;
  font-size: 1.2rem;
  padding: 14px 32px;
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #16161d;
  cursor: pointer;
}
#open:disabled { background: var(--empty); color: var(--muted); cursor: default; }
#open:focus-visible { outline: 3px solid var(--text); outline-offset: 3px; }

.timer { color: var(--muted); min-height: 1.4em; }

/* The opening scene: slice the pack, then one card at a time. */
.scene {
  position: fixed; inset: 0; z-index: 10;
  display: grid; place-items: center; align-content: center; gap: 20px;
  background: rgb(10 10 14 / .96);
  cursor: default;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.scene-hint { margin: 0; color: var(--muted); }
.pack-art, .next {
  position: relative;
  /* Twice the old 240px, but never taller than the screen minus the hint and counter. */
  width: min(80vw, 480px, (100dvh - 180px) * 5 / 7); aspect-ratio: 5 / 7;
  border: 0; padding: 0; background: none; font: inherit;
}
.pack-art, .next { cursor: grab; }
.pack-art:active, .next:active { cursor: grabbing; }
.summary { cursor: pointer; }
/* Cards in the scene always glow; keyboard focus makes the glow stronger instead of drawing a ring. */
.next .card, .summary .card { box-shadow: 0 12px 32px rgb(0 0 0 / .5), 0 0 36px rgb(255 209 102 / .3); }
.pack-art:focus-visible, .next:focus-visible, .summary:focus-visible { outline: none; }
.pack-art:focus-visible .body { box-shadow: 0 0 40px rgb(255 209 102 / .55); }
.next:focus-visible .card:first-child, .summary:focus-visible .card { box-shadow: 0 12px 32px rgb(0 0 0 / .5), 0 0 48px rgb(255 209 102 / .65); }
.next { animation: rise 500ms cubic-bezier(.2, .8, .3, 1.1) both; }
.summary .new {
  position: absolute; top: 6px; left: 50%; transform: translateX(-50%);
  padding: 1px 8px; border-radius: 999px;
  background: var(--accent); color: #16161d;
  font-size: .75rem; font-weight: 800; letter-spacing: .04em;
}
/* 3 cards on top, 2 below, as big as fits two rows on the screen. */
.summary {
  --w: min(29vw, 300px, (100dvh - 150px) / 2 * 5 / 7);
  display: flex; flex-wrap: wrap; justify-content: center; gap: 16px;
  max-width: calc(3 * var(--w) + 2 * 16px + 1px);
  border: 0; padding: 0; background: none; font: inherit;
}
.summary .card { width: var(--w); animation: flip-in 400ms cubic-bezier(.2, .8, .3, 1.2) both; }
.pack-art .lid, .pack-art .body { position: absolute; left: 0; right: 0; background: var(--pack); }
.pack-art .lid { top: 0; height: 18%; border-radius: 12px 12px 0 0; border-bottom: 2px dashed rgb(0 0 0 / .35); }
.pack-art .body {
  top: 18%; bottom: 0; border-radius: 0 0 12px 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 2.6rem; font-weight: 800; letter-spacing: -0.03em; color: #16161d;
}
.pack-art .brand { font-size: .9rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .6; }
.pack-art .paw { font-size: 3rem; }
.scene.cut .lid { transition: transform 500ms ease-in, opacity 500ms; transform: translate(40%, -140%) rotate(25deg); opacity: 0; }
.scene.cut .body { transition: transform 450ms ease-in 100ms, opacity 400ms 150ms; transform: translateY(30%) scale(.95); opacity: 0; }
.slice {
  position: fixed; height: 3px; border-radius: 2px;
  background: #fff; box-shadow: 0 0 10px #fff;
  transform-origin: 0 50%; pointer-events: none;
}
.next .card { position: absolute; inset: 0; border-radius: 12px; transition: transform 220ms ease-out; }

/* The stack comes up out of the cut pack. */
@keyframes rise {
  from { transform: translateY(35%) scale(.92); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@keyframes flip-in {
  from { transform: rotateY(90deg) scale(.8); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.binder-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.binder {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (min-width: 720px) {
  .binder { grid-template-columns: repeat(auto-fill, minmax(192px, 1fr)); gap: 24px; }
}

.card {
  position: relative;
  aspect-ratio: 5 / 7;
  border-radius: 8px;
  display: grid;
  place-items: center;
  overflow: hidden;
  container-type: inline-size;
  background: var(--card);
  color: #1d1b26;
  box-shadow: 0 2px 6px rgb(0 0 0 / .35);
}
/* The number scales with the card, in the binder and in the opening scene alike. */
.card .big { font-size: 45cqi; font-weight: 800; letter-spacing: -0.04em; }
.card .count {
  position: absolute; bottom: 6px; right: 6px;
  font-size: .8rem; font-weight: 700;
  background: rgb(0 0 0 / .65); color: #fff;
  border-radius: 999px; padding: 0 5px;
}
.card.empty { background: var(--empty); color: #3a3a48; box-shadow: none; }

/* Changelog and privacy pages. */
.page { max-width: 680px; }
.page h2 { margin-top: 32px; }
.page a { color: var(--accent); }
.page h1 { font-size: 2rem; }
.home { color: inherit; text-decoration: none; }


@media (prefers-reduced-motion: reduce) {
  .next, .summary .card { animation: none; }
  .scene.cut .lid, .scene.cut .body { transition: none; }
}

.notice {
  position: fixed; left: 16px; right: 16px; bottom: 16px;
  margin: 0 auto; max-width: 480px;
  padding: 12px 16px; border-radius: 8px;
  background: #2c2c3a; color: var(--text);
  box-shadow: 0 4px 16px rgb(0 0 0 / .4);
}
