/* ════════════════════════════════════════════════════════════════════════
   COLLECTIONS + ARCADE (inc/collections.php, inc/arcade.php)
   Loaded on the shop page, collection pages, the Collections map and the
   Arcade. Each collection/game sets --col (its colour) and --blob (its own
   wobbly outline) inline. Everything else paints through the theme's
   variables, so night mode and Pink Night re-tint it automatically.
   ════════════════════════════════════════════════════════════════════════ */

.tomo-collections-page .section-label,
.tomo-arcade-page .section-label,
.tomo-colstrip .section-label {
  font-family: 'Fredoka', sans-serif; font-size: 0.7rem; font-weight: 600;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em;
  margin: 0 0 12px;
}
.tomo-page-intro {
  max-width: 640px; margin: -18px auto 32px; text-align: center;
  font-family: 'Nunito', sans-serif; color: var(--muted); line-height: 1.6;
}

@keyframes tomoBob   { 0%, 100% { translate: 0 0; } 50% { translate: 0 -7px; } }
@keyframes tomoMorph { 0%, 100% { border-radius: var(--blob); } 50% { border-radius: var(--blob2, var(--blob)); } }
@keyframes tomoSpinSlow { to { rotate: 360deg; } }

/* ── Collection strip (shop page) ─────────────────────────────────── */
.tomo-colstrip { margin: -12px 0 30px; text-align: center; }
.tomo-colstrip-list {
  list-style: none; margin: 0; padding: 6px 4px 10px;
  display: flex; gap: 18px; justify-content: center; flex-wrap: wrap;
}
.tomo-colbubble {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: 96px; text-decoration: none; color: var(--ink);
  font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 0.82rem; line-height: 1.15;
}
.tomo-colbubble-blob {
  position: relative; display: grid; place-items: center;
  width: 78px; height: 78px;
  background: var(--col, var(--card-bg));
  border-radius: var(--blob, 50%);
  border: 3px solid var(--card-outline);
  box-shadow: var(--tomo-shadow);
  transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.2s;
  animation: tomoBob 3.4s ease-in-out var(--d, 0s) infinite;
}
.tomo-colbubble-blob img { width: 74%; height: 74%; object-fit: contain; filter: var(--tomo-drop); }
.tomo-colbubble-blob .tomo-mood { width: 52%; height: 52%; --mood-head: #fff; --mood-feat: var(--logo-blue); }
.tomo-colbubble-map .tomo-colbubble-blob { background: var(--bg); color: var(--ink); border-style: dashed; }
.tomo-colbubble-map svg { width: 44%; height: 44%; }
.tomo-colbubble:hover .tomo-colbubble-blob,
.tomo-colbubble:focus-visible .tomo-colbubble-blob { transform: scale(1.1) rotate(-6deg); box-shadow: var(--tomo-shadow-hover); }
.tomo-colbubble.is-current .tomo-colbubble-blob { border-width: 5px; transform: scale(1.06); }
.tomo-colbubble.is-current .tomo-colbubble-name { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
@media (max-width: 600px) {
  .tomo-colstrip-list { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scroll-snap-type: x mandatory; padding-inline: 8px; }
  .tomo-colstrip-list li { scroll-snap-align: start; flex: 0 0 auto; }
  .tomo-colbubble { width: 80px; }
  .tomo-colbubble-blob { width: 64px; height: 64px; }
}

/* ── Collection banner (top of a collection's page) ───────────────── */
.tomo-colbanner {
  display: flex; align-items: center; justify-content: center; gap: 36px;
  max-width: 900px; margin: 0 auto 34px; padding: 12px 24px;
}
.tomo-colbanner-art { position: relative; flex: 0 0 auto; width: 190px; height: 190px; display: grid; place-items: center; }
.tomo-colbanner-blob {
  position: absolute; inset: 0;
  background-color: var(--col);
  background-image: radial-gradient(circle, rgba(255,255,255,0.45) 3px, transparent 3px);
  background-size: 16px 16px;
  border-radius: var(--blob);
  border: 4px solid var(--card-outline);
  box-shadow: var(--tomo-shadow);
  animation: tomoMorph 7s ease-in-out infinite;
  --blob2: 58% 42% 46% 54% / 47% 60% 40% 53%;
}
.tomo-colbanner-img { position: relative; width: 82%; height: 82%; object-fit: contain; filter: var(--tomo-drop); animation: tomoBob 3.6s ease-in-out infinite; }
.tomo-colbanner-face { position: relative; width: 46%; height: 46%; --mood-head: #fff; --mood-feat: var(--logo-blue); }
.tomo-colbanner-text { text-align: left; max-width: 520px; }
.tomo-colbanner-tagline { font-family: 'Fredoka', sans-serif; font-weight: 500; font-size: 1.1rem; color: var(--ink); margin: 6px 0 0; }
.tomo-colbanner-desc { font-family: 'Nunito', sans-serif; color: var(--muted); line-height: 1.6; margin-top: 10px; }
.tomo-colbanner-desc p { margin: 0 0 8px; }
@media (max-width: 600px) {
  .tomo-colbanner { flex-direction: column; gap: 18px; text-align: center; }
  .tomo-colbanner-text { text-align: center; }
  .tomo-colbanner-art { width: 150px; height: 150px; }
}

/* ── Collections map ──────────────────────────────────────────────── */
.tomo-colmap {
  position: relative;
  border: var(--card-border-outer) solid var(--card-outline);
  border-radius: calc(var(--radius) + 8px);
  background-color: var(--bg);
  /* the "sea": little ripples */
  background-image:
    radial-gradient(circle at 50% 50%, var(--border-soft) 2px, transparent 2.5px),
    radial-gradient(circle at 50% 50%, var(--border-soft) 2px, transparent 2.5px);
  background-size: 34px 34px; background-position: 0 0, 17px 17px;
  box-shadow: var(--tomo-shadow);
  padding: 44px 24px 56px;
  overflow: hidden;
}
.tomo-colmap-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 28px 40px;
}
.tomo-island-wrap { width: 230px; margin-top: var(--lift, 0); }
.tomo-island {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  text-decoration: none; color: var(--ink);
  rotate: var(--tilt, 0deg);
  transition: rotate 0.3s ease;
}
.tomo-island-art {
  position: relative; width: 200px; height: 180px; display: grid; place-items: center;
  animation: tomoBob 4.2s ease-in-out var(--d, 0s) infinite;
}
.tomo-island-blob {
  position: absolute; inset: 8px 4px;
  background-color: var(--col);
  background-image: radial-gradient(circle, rgba(255,255,255,0.45) 3px, transparent 3px);
  background-size: 15px 15px;
  border: 4px solid var(--card-outline);
  border-radius: var(--blob);
  box-shadow: var(--tomo-shadow);
  animation: tomoMorph 8s ease-in-out var(--d, 0s) infinite;
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.25s;
}
.tomo-island-img {
  position: relative; z-index: 2; max-width: 64%; max-height: 72%; object-fit: contain;
  filter: var(--tomo-drop);
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
}
.tomo-island-face {
  position: absolute; z-index: 3; width: 42px; height: 42px; right: 6px; bottom: 4px;
  rotate: 12deg;
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
}
.tomo-island-face .tomo-mood { --mood-head: var(--bg); --mood-feat: var(--ink); filter: var(--tomo-drop); }
/* No picture: the face is the island's main character */
.tomo-island-art:not(:has(.tomo-island-img)) .tomo-island-face { position: relative; inset: auto; width: 70px; height: 70px; rotate: -4deg; }

/* Product stickers floating around the island */
.tomo-island-sticker {
  position: absolute; z-index: 1; width: 52px; height: 52px; object-fit: cover;
  border-radius: 14px; border: 3px solid var(--bg); background: var(--bg);
  box-shadow: var(--tomo-shadow);
  transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
.tomo-island-sticker-0 { left: -4px;  top: 14px;   rotate: -12deg; }
.tomo-island-sticker-1 { right: -6px; top: 2px;    rotate: 10deg; }
.tomo-island-sticker-2 { left: 10px;  bottom: -6px; rotate: 7deg; }

.tomo-island-name {
  margin-top: 10px; display: inline-block;
  font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 1.12rem;
  background: var(--bg); padding: 4px 14px; border-radius: 100px;
  border: 2.5px solid var(--card-outline); box-shadow: var(--tomo-shadow);
}
.tomo-island-tag { margin-top: 8px; font-family: 'Nunito', sans-serif; font-size: 0.86rem; color: var(--muted); line-height: 1.35; max-width: 210px; }
.tomo-island-count { margin-top: 4px; font-family: 'Fredoka', sans-serif; font-size: 0.75rem; color: var(--muted); letter-spacing: 0.04em; }

.tomo-island:hover, .tomo-island:focus-visible { rotate: 0deg; }
.tomo-island:hover .tomo-island-blob, .tomo-island:focus-visible .tomo-island-blob { transform: scale(1.07); box-shadow: var(--tomo-shadow-hover); }
.tomo-island:hover .tomo-island-img, .tomo-island:focus-visible .tomo-island-img { transform: scale(1.12) rotate(-4deg); }
.tomo-island:hover .tomo-island-face, .tomo-island:focus-visible .tomo-island-face { transform: scale(1.25) rotate(-20deg); }
.tomo-island:hover .tomo-island-sticker-0 { transform: translate(-16px, -10px) rotate(-10deg) scale(1.1); }
.tomo-island:hover .tomo-island-sticker-1 { transform: translate(16px, -12px) rotate(12deg) scale(1.1); }
.tomo-island:hover .tomo-island-sticker-2 { transform: translate(-10px, 14px) rotate(-8deg) scale(1.1); }
.tomo-island:focus-visible { outline: none; }
.tomo-island:focus-visible .tomo-island-name { outline: 3px solid var(--ink); outline-offset: 3px; }
@media (max-width: 600px) {
  .tomo-colmap { padding: 30px 10px 40px; border-width: 4px; }
  .tomo-colmap-list { gap: 26px 12px; }
  .tomo-island-wrap { width: 160px; margin-top: calc(var(--lift, 0px) / 2); }
  .tomo-island-art { width: 150px; height: 136px; }
  .tomo-island-sticker { width: 40px; height: 40px; border-radius: 10px; }
  .tomo-island-name { font-size: 0.98rem; }
}

/* ── Arcade: the cabinets ─────────────────────────────────────────── */
.tomo-arcade-row {
  list-style: none; margin: 0 auto; padding: 0; max-width: 1100px;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 34px;
}
.tomo-cab-wrap { width: 280px; display: flex; }
.tomo-cab {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  flex: 1; padding: 16px 18px 22px; text-decoration: none; color: var(--ink);
  background: var(--bg);
  border: var(--card-border-outer) solid var(--card-outline);
  border-radius: 34px 34px 22px 22px;
  box-shadow: var(--tomo-shadow);
  rotate: var(--tilt, 0deg);
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.2s, rotate 0.3s;
}
.tomo-cab:hover, .tomo-cab:focus-visible { transform: translateY(-8px); rotate: 0deg; box-shadow: var(--tomo-shadow-hover); outline: none; }
.tomo-cab-marquee {
  width: 100%; padding: 8px 10px; border-radius: 18px;
  background: var(--col); color: #2e37fb;
  font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 1.25rem; text-align: center;
  border: 3px solid var(--card-outline);
}
.tomo-cab-screen {
  position: relative; display: block; width: 100%; aspect-ratio: 4 / 3; overflow: hidden;
  border-radius: 18px; border: 3px solid var(--card-outline);
  background-color: var(--card-bg);
  background-image: radial-gradient(circle, rgba(255,255,255,0.7) 2.5px, transparent 2.5px);
  background-size: 14px 14px;
  box-shadow: inset 0 0 0 6px rgba(255,255,255,0.35);
}
[data-theme="dark"] .tomo-cab-screen { background-color: #1a1a22; background-image: radial-gradient(circle, rgba(255,255,255,0.06) 2.5px, transparent 2.5px); }
.tomo-cab-blurb { font-family: 'Nunito', sans-serif; font-size: 0.92rem; color: var(--muted); text-align: center; line-height: 1.45; min-height: 2.9em; }
.tomo-cab-prize {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 0.82rem;
  color: var(--tomo-pink-text); background: var(--bg);
  border: 2px dashed currentColor; border-radius: 100px; padding: 3px 12px 3px 5px;
}
.tomo-cab-prize-face { width: 20px; height: 20px; --mood-head: currentColor; --mood-feat: var(--bg); animation: tomoSpinSlow 6s linear infinite; }
.tomo-cab-play {
  margin-top: auto;
  font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 1rem; letter-spacing: 0.08em;
  background: var(--ink); color: var(--bg); border-radius: 100px; padding: 9px 28px;
  transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
}
.tomo-cab:hover .tomo-cab-play { transform: scale(1.08); }

/* Screen: Blob Drop — faces piled in a jar, one dropping in */
.tomo-scr-blobdrop { position: absolute; inset: 0; }
.tomo-scr-face { position: absolute; left: var(--x); top: var(--y); width: var(--s); height: var(--s); margin: calc(var(--s) / -2) 0 0 calc(var(--s) / -2); }
.tomo-scr-face .tomo-mood { --mood-head: var(--c); --mood-feat: #2e37fb; }
.tomo-scr-line { position: absolute; left: 8%; right: 8%; top: 24%; border-top: 2px dashed var(--border); }
.tomo-scr-dropper { animation: tomoScrDrop 2.6s cubic-bezier(0.5,0,0.75,0.4) infinite; }
@keyframes tomoScrDrop {
  0%, 15% { top: 12%; opacity: 1; scale: 1; }
  55%     { top: 56%; scale: 1; }
  62%     { top: 52%; scale: 1.15 0.85; }
  70%     { top: 56%; scale: 1; opacity: 1; }
  85%, 100% { top: 56%; opacity: 0; scale: 1.4; }
}
.tomo-cab:hover .tomo-scr-face:not(.tomo-scr-dropper) { animation: tomoBob 0.9s ease-in-out infinite; }

/* Screen: Solitaire — a fanned hand of stage cards */
.tomo-scr-cards { position: absolute; inset: 0; display: block; }
.tomo-scr-card {
  position: absolute; left: 50%; bottom: -18%; width: 34%; aspect-ratio: 88 / 125;
  border: 2.5px solid #2e37fb; border-radius: 10px; background-color: var(--c);
  transform-origin: 50% 120%;
  rotate: calc((var(--i) - 1.5) * 14deg);
  translate: -50% 0;
  display: grid; place-items: center;
  box-shadow: var(--tomo-shadow);
  transition: rotate 0.35s cubic-bezier(0.34,1.56,0.64,1);
}
.tomo-scr-dots { background-image: radial-gradient(circle, rgba(46,55,251,0.18) 2.5px, transparent 2.5px); background-size: 11px 11px; }
.tomo-scr-stripes { background-image: repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(46,55,251,0.16) 5px, rgba(46,55,251,0.16) 9px); }
.tomo-scr-card img { width: 78%; filter: drop-shadow(2px 2px 0 #2e37fb); }
.tomo-cab:hover .tomo-scr-card { rotate: calc((var(--i) - 1.5) * 22deg); }

/* Screen: Alien Maker */
.tomo-scr-alien { position: absolute; inset: 0; display: grid; place-items: center; color: #2e37fb; }
.tomo-scr-alien svg { width: 52%; animation: tomoBob 2.8s ease-in-out infinite; overflow: visible; }
.tomo-scr-antenna { transform-origin: 40px 26px; animation: tomoWiggle 1.6s ease-in-out infinite; }
@keyframes tomoWiggle { 0%, 100% { rotate: -4deg; } 50% { rotate: 4deg; } }

/* ── Arcade: one game ─────────────────────────────────────────────── */
.tomo-arcade-back {
  display: inline-block; margin-bottom: 8px;
  font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 0.9rem;
  color: var(--muted); text-decoration: none;
}
.tomo-arcade-back:hover { color: var(--ink); }
.tomo-arcade-game {
  display: flex; gap: 28px; align-items: flex-start; justify-content: center;
  max-width: 1100px; margin: 0 auto;
}
.tomo-arcade-stage { flex: 0 1 auto; min-width: 0; display: flex; justify-content: center; }
.tomo-arcade-blob-drop .tomo-arcade-stage { flex: 0 1 460px; width: 100%; }
.tomo-arcade-blobdrop { width: 100%; }
.tomo-arcade-blob-drop .tomo-blob-drop {
  width: 100%; height: min(72vh, 660px); min-height: 440px;
  border: var(--card-border-outer) solid var(--card-outline); border-radius: var(--radius);
  box-shadow: var(--tomo-shadow);
}
.tomo-arcade-side { flex: 0 0 260px; display: flex; flex-direction: column; gap: 16px; }
.tomo-arcade-card {
  background: var(--bg); border: 3px solid var(--card-outline); border-radius: 22px;
  padding: 16px 18px; box-shadow: var(--tomo-shadow);
  font-family: 'Nunito', sans-serif; color: var(--ink); line-height: 1.5; font-size: 0.92rem;
}
.tomo-arcade-card p { margin: 0 0 6px; }
.tomo-arcade-card p:last-child { margin-bottom: 0; }
.tomo-arcade-prizecard { border-style: dashed; border-color: var(--tomo-pink-text); }
.tomo-arcade-prizecard strong { font-family: 'Fredoka', sans-serif; color: var(--tomo-pink-text); font-size: 1.05rem; }
.tomo-arcade-rule { color: var(--muted); }
.tomo-arcade-more { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tomo-arcade-more a { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: 'Fredoka', sans-serif; font-weight: 600; }
.tomo-arcade-more a:hover { text-decoration: underline; }
.tomo-arcade-more-dot { width: 16px; height: 16px; border-radius: 45% 55% 50% 50%; background: var(--col); border: 2px solid var(--card-outline); }

/* Games in a frame (Solitaire): native width, shrunk to fit (js/arcade.js) */
.tomo-game-frame { --game-scale: 1; width: calc(720px * var(--game-scale)); max-width: 100%; flex-shrink: 0; overflow: hidden; }
.tomo-game-frame iframe {
  display: block; width: 720px; border: 0; background: transparent; color-scheme: normal;
  transform: scale(var(--game-scale)); transform-origin: 0 0;
}
.tomo-arcade-solitaire .tomo-arcade-stage { flex: 1 1 720px; }

@media (max-width: 1000px) {
  .tomo-arcade-game { flex-direction: column; align-items: center; }
  /* flex-basis would become a height in the column layout */
  .tomo-arcade-stage, .tomo-arcade-solitaire .tomo-arcade-stage, .tomo-arcade-blob-drop .tomo-arcade-stage { flex: 0 0 auto; width: 100%; }
  .tomo-arcade-blob-drop .tomo-arcade-stage { max-width: 460px; }
  .tomo-arcade-side { flex: 0 0 auto; width: 100%; max-width: 720px; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
}
@media (max-width: 600px) {
  .tomo-cab-wrap { width: 100%; max-width: 320px; }
  .tomo-arcade-blob-drop .tomo-blob-drop { height: 68vh; min-height: 380px; border-width: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .tomo-colbubble-blob, .tomo-colbanner-blob, .tomo-colbanner-img, .tomo-island-art, .tomo-island-blob,
  .tomo-scr-dropper, .tomo-scr-alien svg, .tomo-scr-antenna, .tomo-cab-prize-face, .tomo-scr-face { animation: none !important; }
}
