/* Seaside spotter: the card fills the left of the screen (game.js sets --side to the biggest square that fits),
   choices and the card code on the right. */
.bg-main { flex-direction: row; align-items: stretch; gap: clamp(16px, 2.5vw, 40px); }
.bg-play { flex: 1; min-width: 0; min-height: 0; display: grid; place-items: center; }

.bg-card {
  --side: 600px; --gap: clamp(6px, 0.8vw, 12px);
  width: var(--side); height: var(--side); padding: var(--gap); gap: var(--gap); border-radius: var(--radius);
  display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); grid-template-rows: repeat(var(--n, 4), minmax(0, 1fr));
  background: var(--sea-deep);
  --label: clamp(13px, calc(var(--side) / var(--n, 4) * 0.11), 24px);
}

.bg-cell {
  position: relative; min-width: var(--tap); min-height: var(--tap); overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4%;
  padding: 6%; border: 0; border-radius: 14px; background: var(--cream); cursor: pointer; touch-action: manipulation;
  transition: background 0.2s;
}
.bg-cell:active { transform: scale(0.97); }
.bg-icon { flex: 1 1 auto; min-height: 0; width: 100%; display: grid; place-items: center; }
.bg-icon svg {
  height: 100%; max-height: 100%; width: auto; aspect-ratio: 1; overflow: visible;
  fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round;
}
.bg-label { flex: 0 0 auto; font-size: var(--label); font-weight: 400; line-height: 1.15; text-align: center; color: var(--ink); }

/* the stamp: a coral ring with a tick, pressed onto the square */
.bg-stamp { position: absolute; inset: 8%; display: grid; place-items: center; pointer-events: none; opacity: 0; }
.bg-stamp svg { width: 92%; height: 92%; fill: rgba(224, 91, 75, 0.16); stroke: #c8402e; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.bg-cell.is-marked { background: #f6e3d6; }
.bg-cell.is-marked .bg-stamp { opacity: 0.9; transform: rotate(-12deg); }
.bg-cell.is-new .bg-stamp { animation: stamp 0.35s cubic-bezier(.2,.9,.3,1.2); }
@keyframes stamp {
  0% { opacity: 0; transform: scale(1.8) rotate(-30deg); }
  70% { opacity: 1; transform: scale(0.92) rotate(-10deg); }
  100% { opacity: 0.9; transform: rotate(-12deg); }
}

.bg-cell.is-free { background: var(--sand); cursor: default; }
.bg-cell.is-free .bg-label { font-family: var(--serif); font-size: calc(var(--label) * 1.4); font-weight: 600; color: var(--sea-deep); }
.bg-star svg { fill: #e2b33c; stroke: #a37d1f; }
.bg-cell.is-line { box-shadow: inset 0 0 0 5px #e2b33c; }

/* ---------- side panel ---------- */
.bg-panel { flex: 0 0 auto; width: clamp(320px, 28vw, 500px); display: flex; flex-direction: column; justify-content: center; gap: 16px; min-height: 0; }
.bg-panel .choice, .bg-dialog .choice { display: flex; }
.bg-panel .choice button, .bg-dialog .choice button { flex: 1 1 auto; min-height: var(--tap); padding: 0 0.7em; }
.bg-themes { flex-direction: column; }
.bg-code { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 18px; border-radius: var(--radius); background: var(--sand); }
.bg-code-label { font-size: 1rem; color: #4a5157; }
.bg-code-value { flex: 1; font-family: var(--sans); font-weight: 600; font-size: 1.7rem; letter-spacing: 0.08em; color: var(--sea-deep); }
.bg-message { text-align: left; min-height: 2.4em; font-size: 1.25rem; }

/* ---------- make a card from a code ---------- */
.bg-dialog { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(22,44,51,0.55); }
.bg-dialog[hidden] { display: none; }
.bg-dialog-box {
  display: flex; flex-direction: column; align-items: stretch; gap: 12px; width: min(94vw, 560px); max-height: 96vh; overflow: hidden;
  padding: 24px 32px; border-radius: 28px; background: var(--cream); box-shadow: 0 24px 70px rgba(0,0,0,0.35);
}
.bg-dialog-box h2 { font-size: 2rem; color: var(--sea-deep); text-align: center; }
.bg-dialog .bg-themes { flex-direction: row; flex-wrap: wrap; }
.bg-entry { text-align: center; font-weight: 600; font-size: 2rem; letter-spacing: 0.12em; color: var(--sea-deep); }
.bg-keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bg-keypad button {
  min-height: var(--tap); border: 0; border-radius: 14px; background: var(--sand-deep); cursor: pointer;
  font-size: 1.5rem; font-weight: 400; touch-action: manipulation;
}
.bg-keypad button:active { transform: scale(0.96); }
.bg-dialog .gbtn:disabled { opacity: 0.45; cursor: default; }

@media (prefers-reduced-motion: reduce) { .bg-cell.is-new .bg-stamp { animation: none; } }
