:root {
  --g-bg: #eef3f6;
  --g-ink: #1c2e3a;
  --g-muted: #536572;
  --g-surface: #ffffff;
  --g-line: #cfd9e1;
  --g-accent: #c2412e;
  --g-brand: #166e72;
  --g-font: "Nunito", "Segoe UI", sans-serif;
  --g-display: "Fredoka", "Trebuchet MS", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--g-font);
  color: var(--g-ink);
  background: var(--g-bg);
}

body.embed {
  background: #e8f0f4;
}

.game-app {
  width: min(100% - 1.25rem, 520px);
  margin: 0.75rem auto 1.25rem;
  background: var(--g-surface);
  border: 1px solid var(--g-line);
  border-radius: 14px;
  padding: 0.75rem 0.85rem 0.55rem;
  box-shadow: 0 8px 22px rgba(28, 46, 58, 0.08);
}

.game-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.game-top h1 {
  font-family: var(--g-display);
  font-size: 1.25rem;
  margin: 0;
}

.meta {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-weight: 700;
  color: var(--g-brand);
  font-size: 0.95rem;
}

.bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.55rem;
}

button.gbtn {
  border: 0;
  border-radius: 999px;
  min-height: 2.4rem;
  padding: 0.45rem 1rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  background: var(--g-accent);
  color: #fff;
}

button.gbtn.secondary {
  background: var(--g-brand);
}

button.gbtn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.status {
  margin: 0.35rem 0 0;
  min-height: 0;
  color: var(--g-muted);
  font-weight: 700;
  font-size: 0.9rem;
}

.disclaimer {
  width: min(100%, 720px);
  margin: 0.75rem auto 1.25rem;
  padding: 0.8rem 1rem;
  border: 1px solid #edd8b0;
  background: #fff8ea;
  border-radius: 12px;
  color: #8a5a12;
  font-size: 0.92rem;
}

.disclaimer a { color: #8a5a12; font-weight: 700; }

html.embed,
body.embed {
  height: 100%;
  width: 100%;
  margin: 0;
  overflow: hidden;
  background: #eef3f6;
}

body.embed .site-chrome,
body.embed .site-header,
body.embed .site-footer,
body.embed .disclaimer,
body.embed .age-gate,
body.embed .cookie-banner,
body.embed .skip-link { display: none !important; }

body.embed #main > section.page-hero,
body.embed .page-hero {
  display: none !important;
}

body.embed .back-games { display: none !important; }

body.embed #main,
body.embed #main > section:not(.page-hero),
body.embed #main .wrap {
  display: block !important;
  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.embed .play-panel.demo-frame {
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  height: 100% !important;
  background: #0f2a2c !important;
}

body.embed .iframe-shell,
body.embed .iframe-shell.iframe-slot {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 100% !important;
  max-height: none !important;
  aspect-ratio: auto !important;
  border-radius: 0 !important;
}

/* Natural-size card; JS scales it to the iframe */
body.embed .game-app {
  width: min(100%, 420px);
  max-width: 420px;
  height: auto;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0.65rem 0.7rem 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  box-sizing: border-box;
  background: var(--g-surface);
  overflow: visible;
}

body.embed .game-top {
  margin: 0;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
}

body.embed .game-top h1 {
  font-size: 1.1rem;
}

body.embed .meta {
  font-size: 0.88rem;
}

body.embed .bar {
  margin: 0;
  flex-shrink: 0;
}

body.embed button.gbtn {
  min-height: 2.15rem;
  padding: 0.35rem 0.9rem;
  font-size: 0.9rem;
}

body.embed .status {
  margin: 0;
  min-height: 1.1em;
  font-size: 0.82rem;
  flex-shrink: 0;
}

body.embed .board-m3 {
  width: 100%;
  aspect-ratio: 1;
  flex: 0 0 auto;
}

body.embed .board-ql,
body.embed .board-dm {
  width: 100%;
  flex: 0 0 auto;
}

body.embed .board-mem {
  width: 100%;
  aspect-ratio: 1;
  gap: 6px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
  flex: 0 0 auto;
}

body.embed .card-mem {
  aspect-ratio: unset !important;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0.2rem;
  border-radius: 10px;
}

body:not(.embed) {
  background: var(--bg, #eef3f6);
}

body:not(.embed) .game-app {
  margin: 0 auto 1.5rem;
  max-width: 560px;
}

/* Match three */
.board-m3 {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  aspect-ratio: 1;
  touch-action: manipulation;
}

.cell-m3 {
  border: 0;
  border-radius: 10px;
  font-size: clamp(1.1rem, 4.5vw, 1.6rem);
  cursor: pointer;
  background: #f3f7f9;
  transition: transform 0.12s ease, outline 0.12s ease;
}

.cell-m3.selected {
  outline: 3px solid var(--g-brand);
  transform: scale(0.94);
}

.cell-m3.pop {
  animation: pop 0.28s ease;
}

@keyframes pop {
  50% { transform: scale(0.7); opacity: 0.3; }
}

/* Quad link */
.board-ql {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  background: #1a6f8f;
  padding: 10px;
  border-radius: 14px;
}

.cell-ql {
  aspect-ratio: 1;
  border-radius: 50%; /* deslop-ignore 19 — game token discs */
  border: 0;
  background: #0f4256;
  cursor: pointer;
  padding: 0;
}

.cell-ql.p1 { background: #c2412e; }
.cell-ql.p2 { background: #f0c14a; }
.cell-ql:disabled { cursor: default; }

/* Dig miner */
.board-dm {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
}

.cell-dm {
  aspect-ratio: 1;
  border: 0;
  border-radius: 8px;
  background: #d8b78a;
  cursor: pointer;
  font-weight: 800;
  font-size: clamp(0.85rem, 3.2vw, 1.1rem);
  color: var(--g-ink);
  padding: 0;
}

.cell-dm.open {
  background: #f4efe6;
  cursor: default;
}

.cell-dm.gem { background: #c9f0e4; color: #0f6b57; }
.cell-dm.boom { background: #f6c9c2; color: #a33; }
.cell-dm.flag { background: #f0c14a; }

@media (max-width: 420px) {
  .game-app { padding: 0.7rem; }
  .board-ql { gap: 4px; padding: 7px; }
}
