/* ============================================================
   PlayHive components.css — buttons, pills, hex badges, cards,
   toast, modal, chips, progress, theme toggle
   ============================================================ */

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  font-weight: 600;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
h1, h2, h3 { font-family: var(--font-head); font-weight: 400; letter-spacing: 0.3px; margin: 0; }
button { font-family: var(--font-body); }
a { color: inherit; }
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Chunky 3D buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
  background: var(--panel);
  box-shadow: 0 6px 0 var(--edge-panel);
  cursor: pointer;
  text-decoration: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.15s ease;
}
.btn:hover { filter: brightness(1.04); }
.btn:active { transform: translateY(3px); box-shadow: 0 3px 0 var(--edge-panel); }
.btn--orange { background: var(--orange); color: var(--on-orange); box-shadow: 0 6px 0 var(--edge-orange); }
.btn--orange:active { box-shadow: 0 3px 0 var(--edge-orange); }
.btn--green { background: var(--green); color: var(--on-green); box-shadow: 0 6px 0 var(--edge-green); }
.btn--green:active { box-shadow: 0 3px 0 var(--edge-green); }
.btn--blue { background: var(--blue); color: var(--on-blue); box-shadow: 0 6px 0 var(--edge-blue); }
.btn--blue:active { box-shadow: 0 3px 0 var(--edge-blue); }
.btn--red { background: var(--red); color: var(--on-red); box-shadow: 0 6px 0 var(--edge-red); }
.btn--red:active { box-shadow: 0 3px 0 var(--edge-red); }
.btn--ghost {
  background: var(--panel-2);
  box-shadow: 0 6px 0 var(--edge-panel);
  color: var(--text);
}
.btn--ghost:active { box-shadow: 0 3px 0 var(--edge-panel); }
.btn--sm { padding: 8px 14px; font-size: 14px; box-shadow: 0 4px 0 var(--edge-panel); }
.btn--sm:active { box-shadow: 0 2px 0 var(--edge-panel); }
.btn--orange.btn--sm { box-shadow: 0 4px 0 var(--edge-orange); }
.btn--orange.btn--sm:active { box-shadow: 0 2px 0 var(--edge-orange); }
.btn--green.btn--sm { box-shadow: 0 4px 0 var(--edge-green); }
.btn--green.btn--sm:active { box-shadow: 0 2px 0 var(--edge-green); }
.btn--block { width: 100%; }

/* ---------- Hexagon badges ---------- */
.hex {
  width: var(--hex-size-w);
  height: var(--hex-size-h);
  clip-path: var(--hex);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  position: relative;
  background: var(--hex-outline);
}
.hex__inner {
  width: calc(100% - 6px);
  height: calc(100% - 6px);
  clip-path: var(--hex);
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.hex--avatar { --hex-size-w: 46px; --hex-size-h: 51px; }
.hex--small { --hex-size-w: 40px; --hex-size-h: 44px; }
.hex--small .hex__inner { font-size: 17px; }
.hex--locked .hex__inner { background: var(--panel-2); filter: grayscale(1); opacity: 0.65; }

/* ---------- Resource pill ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 5px 6px 5px 14px;
  font-weight: 800;
  font-size: 15px;
  box-shadow: 0 4px 0 var(--edge-panel);
}
.pill__plus {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: var(--green);
  color: var(--on-green);
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--edge-green);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.pill__plus:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge-green); }

/* ---------- Cards ---------- */
.card {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: 0 6px 0 var(--edge-panel);
  overflow: hidden;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 10px 0 var(--edge-panel), var(--shadow-card); }

.game-card__link { display: block; text-decoration: none; color: inherit; }
.game-card__art {
  position: relative;
  height: 108px;
  background: linear-gradient(135deg, var(--g1, var(--blue)), var(--g2, var(--blue-dark)));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.art-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: transform 0.2s ease;
  z-index: 1;
}
.game-card:hover .art-img { transform: scale(1.06); }
.art-emoji {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 46px;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.22);
  visibility: hidden;
}
.game-card__art.no-thumb .art-emoji { visibility: visible; }
.game-card__tag {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(8, 20, 45, 0.55);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  z-index: 2;
}
.game-card__heart {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(8, 20, 45, 0.5);
  color: #fff;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  transition: transform 0.12s ease, background 0.15s ease;
}
.game-card__heart:hover { transform: scale(1.12); }
.game-card__heart[aria-pressed='true'] { background: var(--red); color: #fff; }
.game-card__foot {
  padding: 10px 12px 12px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.game-card__title {
  font-family: var(--font-head);
  font-size: 17px;
  letter-spacing: 0.02em;
  line-height: 1.2;
  min-height: 2.4em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.game-card__best { font-size: 12px; font-weight: 800; color: var(--muted); white-space: nowrap; }
.game-card__best.is-new { color: var(--green-dark); }
:root[data-theme='dark'] .game-card__best.is-new { color: var(--green); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .game-card__best.is-new { color: var(--green); }
}

/* ---------- Panel card (right column, settings, etc.) ---------- */
.panel {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: 0 6px 0 var(--edge-panel);
  padding: 16px;
}
.panel__title {
  font-size: 18px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* ---------- Filter chips ---------- */
.chip {
  border: 2px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.08s ease;
}
.chip:active { transform: translateY(2px); }
.chip[aria-pressed='true'] {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--on-blue);
  box-shadow: 0 4px 0 var(--edge-blue);
}

/* ---------- Search box ---------- */
.search {
  position: relative;
  flex: 1;
  min-width: 180px;
  max-width: 320px;
}
.search input {
  width: 100%;
  border: 2px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: var(--radius-pill);
  padding: 10px 16px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
}
.search input::placeholder { color: var(--muted); }

/* ---------- Progress / XP bar ---------- */
.bar {
  height: 16px;
  background: var(--panel-2);
  border-radius: var(--radius-pill);
  overflow: hidden;
  border: 2px solid var(--line);
}
.bar__fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--green), #7fe6a1);
  transition: width 0.4s ease;
}
.bar__fill--orange { background: linear-gradient(90deg, var(--orange), var(--gold)); }

/* ---------- Task rows ---------- */
.task {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
}
.task:last-child { border-bottom: 0; }
.task__icon { font-size: 20px; width: 26px; text-align: center; flex: none; }
.task__body { flex: 1; min-width: 0; }
.task__label { font-size: 13.5px; font-weight: 800; }
.task__progress { font-size: 12px; color: var(--muted); font-weight: 800; }

/* ---------- Badge collection ---------- */
.badges { display: flex; flex-wrap: wrap; gap: 12px; }
.badge { text-align: center; width: 76px; }
.badge__name { font-size: 11px; font-weight: 800; margin-top: 4px; line-height: 1.2; }
.badge__how { font-size: 10px; color: var(--muted); line-height: 1.2; }

/* ---------- Toast ---------- */
.toasts {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 90;
  pointer-events: none;
  width: min(92vw, 420px);
}
.toast {
  background: var(--panel);
  color: var(--text);
  border-radius: var(--radius);
  box-shadow: 0 6px 0 var(--edge-panel), var(--shadow-pop);
  padding: 12px 18px;
  font-weight: 800;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toast-in 0.25s ease;
  max-width: 100%;
}
.toast--good { box-shadow: 0 6px 0 var(--edge-green), var(--shadow-pop); }
.toast--warn { box-shadow: 0 6px 0 var(--edge-red), var(--shadow-pop); }
.toast.is-leaving { animation: toast-out 0.25s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(14px); } }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 14, 32, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 80;
  animation: fade-in 0.18s ease;
}
.modal {
  background: var(--panel);
  border-radius: 20px;
  box-shadow: 0 10px 0 var(--edge-panel), var(--shadow-pop);
  padding: 24px;
  width: min(380px, 100%);
  text-align: center;
  animation: pop-in 0.22s cubic-bezier(0.2, 1.4, 0.5, 1);
}
.modal__title { font-size: 28px; margin-bottom: 6px; }
.modal__sub { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.modal__score { font-family: var(--font-head); font-size: 44px; line-height: 1; margin: 8px 0; }
.modal__row { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.modal__banner {
  background: linear-gradient(90deg, var(--gold), var(--orange));
  color: #3a2200;
  font-weight: 800;
  border-radius: var(--radius-pill);
  padding: 7px 16px;
  display: inline-block;
  margin: 4px 0 8px;
  animation: pop-in 0.3s cubic-bezier(0.2, 1.6, 0.5, 1);
}
.modal__stars { font-size: 15px; font-weight: 800; color: var(--muted); }
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.85); } }

/* ---------- Theme toggle ---------- */
.theme-toggle {
  width: 62px;
  height: 34px;
  border: 2px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--panel);
  position: relative;
  cursor: pointer;
  padding: 0;
  flex: none;
  box-shadow: 0 3px 0 var(--edge-panel);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.theme-toggle:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge-panel); }
.theme-toggle__knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
  transition: transform 0.25s cubic-bezier(0.3, 1.4, 0.4, 1), background 0.25s ease;
}
:root[data-theme='dark'] .theme-toggle__knob { transform: translateX(28px); background: #cdd8f5; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .theme-toggle__knob { transform: translateX(28px); background: #cdd8f5; }
}

/* ---------- Rank tag ---------- */
.rank {
  background: var(--blue);
  color: var(--on-blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.4px;
  padding: 4px 9px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

/* ---------- Toggle switch (settings) ---------- */
.switch {
  position: relative;
  width: 58px;
  height: 32px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--line);
  background: var(--panel-2);
  cursor: pointer;
  padding: 0;
  flex: none;
}
.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.2s ease, background 0.2s ease;
}
.switch[aria-checked='true'] { background: var(--green); border-color: var(--green-dark); }
.switch[aria-checked='true']::after { transform: translateX(26px); background: #fff; }

/* ---------- Text input ---------- */
.input {
  border: 2px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 15px;
  width: 100%;
  max-width: 260px;
}

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 6px; }
.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  font-size: 13px;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  cursor: pointer;
}
.tab[aria-selected='true'] { background: var(--panel-2); color: var(--text); }

/* ---------- Empty state ---------- */
.empty {
  text-align: center;
  color: var(--muted);
  padding: 44px 18px;
  font-weight: 800;
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: 0 6px 0 var(--edge-panel);
}
.empty__icon { font-size: 40px; display: block; margin-bottom: 8px; }

/* ---------- Game shell bits ---------- */
.game-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--panel);
  border-bottom: 3px solid var(--edge-panel);
  flex-wrap: wrap;
}
.game-bar__title { font-family: var(--font-head); font-size: 20px; margin-right: auto; }
.game-bar__thumb {
  width: 32px;
  height: 24px;
  object-fit: contain;
  border-radius: 6px;
  flex: none;
}
@media (max-width: 480px) {
  .game-bar__thumb { display: none; }
}
.game-stat {
  background: var(--panel-2);
  border-radius: var(--radius-pill);
  padding: 6px 13px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}
.game-stat b { color: var(--blue); }
.icon-btn {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--text);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--edge-panel);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  flex: none;
}
.icon-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--edge-panel); }
.icon-btn--hex {
  width: var(--hex-size-w);
  height: var(--hex-size-h);
  clip-path: var(--hex);
  box-shadow: none;
  background: var(--blue);
  color: var(--on-blue);
  font-size: 20px;
}
.icon-btn--hex:active { transform: translateY(2px); filter: brightness(0.92); }

.game-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  overflow: auto;
}
.game-stage canvas {
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  touch-action: none;
  background: var(--panel);
}

.game-root {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 560px;
  user-select: none;
  -webkit-user-select: none;
}

/* pause overlay */
.pause-overlay {
  position: absolute;
  inset: 0;
  background: rgba(6, 14, 32, 0.66);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  animation: fade-in 0.15s ease;
}
.pause-overlay__box {
  background: var(--panel);
  border-radius: 20px;
  box-shadow: 0 10px 0 var(--edge-panel), var(--shadow-pop);
  padding: 26px 30px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 230px;
}

/* touch controls */
.touchpad {
  display: grid;
  grid-template-columns: repeat(3, 64px);
  gap: 10px;
  justify-content: center;
}
.touchpad--4 { grid-template-columns: repeat(4, 60px); }
.touch-btn {
  height: 58px;
  border: 0;
  border-radius: var(--radius);
  background: var(--blue);
  color: var(--on-blue);
  font-size: 22px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--edge-blue);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.touch-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--edge-blue); }
.touch-btn--wide { grid-column: span 3; }

/* hint line */
.game-hint {
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
  text-align: center;
}

/* in-game UI helpers shared by DOM games */
.grid-2048 {
  position: relative;
  box-sizing: border-box;
  background: var(--panel-2);
  padding: 10px;
  border-radius: var(--radius);
  width: min(340px, 86vw);
  aspect-ratio: 1;
  touch-action: none;
}
.cell-slot {
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 10px;
  background: var(--line);
  opacity: 0.45;
}
.tile2048 {
  position: absolute;
  left: 0;
  top: 0;
  box-sizing: border-box;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-size: clamp(20px, 7vw, 30px);
  color: #fff;
  background: var(--line);
  transition: transform 0.12s ease;
  will-change: transform;
}
.tile2048.is-new { animation: tile-in 0.14s ease; }
.tile2048.is-merge { animation: tile-pop 0.18s ease; }
.grid-2048.no-anim .tile2048 { transition: none; }
@keyframes tile-in {
  from { scale: 0.3; opacity: 0; }
  to { scale: 1; opacity: 1; }
}
@keyframes tile-pop {
  0% { scale: 1; }
  45% { scale: 1.16; }
  100% { scale: 1; }
}
.tile2048.v2 { background: #9fb6d8; color: #17305c; }
.tile2048.v4 { background: #7fa3d6; color: #17305c; }
.tile2048.v8 { background: #ff9433; color: #381904; }
.tile2048.v16 { background: #ff7a1f; color: #381904; }
.tile2048.v32 { background: #f4553b; }
.tile2048.v64 { background: #e5484d; }
.tile2048.v128 { background: #c9339a; font-size: clamp(16px, 5.6vw, 24px); }
.tile2048.v256 { background: #8e44e8; font-size: clamp(16px, 5.6vw, 24px); }
.tile2048.v512 { background: #3b6ae6; font-size: clamp(16px, 5.6vw, 24px); }
.tile2048.v1024 { background: #2f9e6e; font-size: clamp(13px, 4.6vw, 20px); }
.tile2048.v2048 { background: linear-gradient(135deg, var(--gold), var(--orange)); color: #3a2200; font-size: clamp(13px, 4.6vw, 20px); }
.tile2048.vbig { background: #12254a; font-size: clamp(12px, 4vw, 18px); }

/* memory cards
   Layout needs no JS measurement: grid tracks + aspect-ratio + container-query
   font sizing (games mount detached — see AUDIT X8). */
.mem-grid {
  display: grid;
  grid-template-columns: repeat(var(--mem-cols, 4), 1fr);
  gap: 8px;
  justify-content: center;
  width: min(var(--mem-max, 360px), 92vw);
  touch-action: manipulation;
  perspective: 900px; /* flip perspective on the board, per spec */
}
.mem-card {
  position: relative;
  aspect-ratio: 1;
  width: 100%;
  border: 0;
  padding: 0;
  cursor: pointer;
  background: transparent;
  -webkit-tap-highlight-color: transparent;
  container-type: size; /* children can size against the card (cqi/cqi units) */
}
.mem-card__inner {
  display: block; /* ROOT-CAUSE FIX: was a plain inline span — width/height were
                     ignored, the box collapsed to 0×0, and transform never painted */
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.3s ease;
}
.mem-card.is-flipped .mem-card__inner { transform: rotateY(180deg); }
.mem-card.is-matched .mem-card__inner { animation: mem-pulse 0.45s ease; }
@keyframes mem-pulse {
  0% { scale: 1; }
  40% { scale: 1.08; }
  100% { scale: 1; }
}
.mem-card__face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 52cqi;
  box-shadow: 0 4px 0 var(--edge-panel);
}
.mem-card__face--back {
  /* patterned back: hexagon weave + centred PlayHive hex mark — never a plain ? */
  background-color: var(--blue);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='30' viewBox='0 0 26 30'%3E%3Cpath d='M13 1.5 L24 8 L24 22 L13 28.5 L2 22 L2 8 Z' fill='none' stroke='rgba(255,255,255,0.20)' stroke-width='1.6'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M16 3 L27 9.5 L27 22.5 L16 29 L5 22.5 L5 9.5 Z' fill='none' stroke='rgba(255,255,255,0.9)' stroke-width='2.4'/%3E%3Cpath d='M16 10.5 L21 13.4 L21 19.2 L16 22.1 L11 19.2 L11 13.4 Z' fill='rgba(255,255,255,0.9)'/%3E%3C/svg%3E");
  background-repeat: repeat, no-repeat;
  background-position: center, center;
  background-size: 26px 30px, 44% 44%;
}
.mem-card__face--front { background: var(--panel); transform: rotateY(180deg); }
.mem-card.is-matched .mem-card__face--front { background: #d9f7e3; }
:root[data-theme='dark'] .mem-card.is-matched .mem-card__face--front { background: #1f4a33; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .mem-card.is-matched .mem-card__face--front { background: #1f4a33; }
}

/* tic tac toe */
.ttt-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: min(300px, 80vw);
  touch-action: manipulation;
}
.ttt-cell {
  aspect-ratio: 1;
  border: 0;
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 5px 0 var(--edge-panel);
  font-family: var(--font-head);
  font-size: clamp(34px, 11vw, 52px);
  cursor: pointer;
  color: var(--blue);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.ttt-cell:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--edge-panel); }
.ttt-cell.o { color: var(--red); }
.ttt-cell.win { background: var(--green); color: var(--on-green); }

/* minesweeper */
.mine-wrap { overflow: auto; max-width: 100%; padding: 4px; touch-action: manipulation; }
.mine-grid { display: grid; gap: 2px; width: max-content; margin: 0 auto; }
.mine-cell {
  width: var(--cell, 30px);
  height: var(--cell, 30px);
  border: 0;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: #fff;
  font-weight: 800;
  font-size: calc(var(--cell, 30px) * 0.52);
  cursor: pointer;
  padding: 0;
  box-shadow: 0 3px 0 var(--edge-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.mine-cell:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge-blue); }
.mine-cell.open {
  background: var(--panel-2);
  color: var(--text);
  box-shadow: none;
  cursor: default;
}
.mine-cell.open:active { transform: none; }
.mine-cell.boom { background: var(--red); color: #fff; }
.mine-status {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  flex-wrap: wrap;
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
  .game-card:hover .art-img { transform: none; }
}
