/* Seashell scratch engine (bq-sc-). Uses the site tokens from brook.css. */

.bq-sc {
  container-type: inline-size;
  width: 100%;
  max-width: 470px;
}

.bq-sc-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* The ticket: sand-coloured card with a scalloped sea-blue rim */
.bq-sc-ticket {
  --sand: #fbf0d9;
  position: relative;
  display: grid;
  gap: clamp(8px, 2.2cqw, 14px);
  padding: clamp(14px, 4cqw, 24px);
  border-radius: 22px;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(255, 255, 255, 0.7), transparent 60%),
    repeating-linear-gradient(135deg, rgba(222, 196, 150, 0.16) 0 6px, transparent 6px 14px),
    var(--sand);
  color: #20444a;
  box-shadow: 0 0 0 6px #3fb6c9, 0 0 0 9px #f6fbfb, 0 0 0 12px rgba(6, 23, 25, 0.35), 0 24px 48px rgba(0, 0, 0, 0.5);
  margin: 12px;
}

.bq-sc-ticket.is-fresh { animation: bq-sc-deal 420ms var(--bq-ease-out); }

@keyframes bq-sc-deal {
  from { transform: translateY(14px) rotate(-1.5deg) scale(0.97); opacity: 0.4; }
  to { transform: none; opacity: 1; }
}

.bq-sc-head { text-align: center; }

.bq-sc-title {
  margin: 0;
  font-family: var(--bq-font-display);
  font-size: clamp(22px, 6cqw, 30px);
  font-weight: 900;
  color: #0f6c7c;
  letter-spacing: -0.01em;
}

.bq-sc-sub {
  margin: 2px 0 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #c4573c;
}

/* Pay key */
.bq-sc-key {
  list-style: none;
  margin: 0;
  padding: 6px;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 4px;
  border-radius: 14px;
  background: rgba(15, 108, 124, 0.08);
}

.bq-sc-key__item {
  display: grid;
  justify-items: center;
  gap: 1px;
  padding: 4px 2px;
  border-radius: 10px;
  transition: background-color var(--bq-fast) var(--bq-ease-out), transform var(--bq-fast) var(--bq-ease-out);
}

.bq-sc-key__sym { width: clamp(26px, 7.5cqw, 38px); height: auto; }

.bq-sc-key__mult {
  font-family: var(--bq-font-display);
  font-size: 13px;
  font-weight: 900;
  color: #20444a;
  font-variant-numeric: tabular-nums;
}

.bq-sc-key__item.is-lit { background: #ffcf5a; transform: scale(1.06); box-shadow: 0 4px 14px rgba(196, 140, 20, 0.35); }

/* Play area: symbols under a canvas foil */
.bq-sc-play { position: relative; }

.bq-sc-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(6px, 2cqw, 12px);
}

.bq-sc-cell {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: radial-gradient(circle at 50% 40%, #ffffff, #f3e4c4);
  box-shadow: inset 0 0 0 2px rgba(15, 108, 124, 0.18), inset 0 -6px 12px rgba(190, 150, 90, 0.18);
  transition: opacity var(--bq-med) var(--bq-ease-out), box-shadow var(--bq-med) var(--bq-ease-out);
}

.bq-sc-sym { width: 74%; height: 74%; }
.bq-sc-cell.is-open .bq-sc-sym { animation: bq-sc-pop 360ms var(--bq-ease-out); }
.bq-sc-cell.is-dim { opacity: 0.7; }

.bq-sc-cell.is-match {
  box-shadow: inset 0 0 0 3px #ffcf5a, 0 0 0 3px rgba(255, 207, 90, 0.5), 0 0 26px rgba(255, 207, 90, 0.75);
  background: radial-gradient(circle at 50% 40%, #fffdf2, #ffe7a3);
}

.bq-sc-cell.is-match .bq-sc-sym { animation: bq-sc-wiggle 700ms var(--bq-ease-out) 2; }

@keyframes bq-sc-pop {
  0% { transform: scale(0.95); opacity: 0.6; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); }
}

@keyframes bq-sc-wiggle {
  0%, 100% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(-7deg) scale(1.08); }
  60% { transform: rotate(6deg) scale(1.08); }
}

.bq-sc-foil {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 14px;
  touch-action: pan-y;
}

.bq-sc.is-open .bq-sc-foil { touch-action: none; cursor: crosshair; }

.bq-sc-cover {
  position: absolute;
  left: 50%;
  top: 50%;
  margin: 0;
  width: max-content;
  max-width: 86%;
  padding: 10px 16px;
  border-radius: var(--bq-r-pill);
  background: rgba(6, 23, 25, 0.86);
  color: var(--bq-ink);
  font-family: var(--bq-font-display);
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: opacity var(--bq-med) var(--bq-ease-out), transform var(--bq-med) var(--bq-ease-out);
}

.bq-sc.is-open .bq-sc-cover,
.bq-sc.is-done .bq-sc-cover { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }

.bq-sc-banner {
  position: absolute;
  left: 50%;
  bottom: -14px;
  padding: 8px 18px;
  border-radius: var(--bq-r-pill);
  background: linear-gradient(180deg, #ffe08a, #f4b73a);
  color: var(--bq-on-gold);
  font-family: var(--bq-font-display);
  font-size: 16px;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 8px) scale(0.95);
  transition: opacity var(--bq-med) var(--bq-ease-out), transform var(--bq-med) var(--bq-ease-out);
}

.bq-sc-banner.is-on { opacity: 1; transform: translate(-50%, 0) scale(1); }
.bq-sc-banner.is-flat { background: #20444a; color: #f2fbf8; font-size: 14px; }

.bq-sc-foot {
  margin: 14px 0 0;
  text-align: center;
  font-size: 12px;
  color: #5b7a7c;
}

@container (max-width: 400px) {
  .bq-sc-key { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bq-sc-key__item { grid-template-columns: auto auto; align-items: center; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .bq-sc-ticket.is-fresh,
  .bq-sc-cell.is-open .bq-sc-sym,
  .bq-sc-cell.is-match .bq-sc-sym { animation: none; }
}
