.game-shape .shape-play {
  display: grid;
  gap: 12px;
}

.game-shape .shape-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  min-height: 220px;
  max-height: min(58vh, 560px);
  border-radius: var(--r-lg);
  background-color: var(--md-surface-container-low);
  background-image: radial-gradient(
    circle,
    color-mix(in oklab, var(--md-outline-variant) 45%, transparent) 1px,
    transparent 1.5px
  );
  background-size: 20px 20px;
  background-position: center;
  border: 1px solid var(--md-outline-variant);
  overflow: hidden;
  isolation: isolate;
}

.game-shape .shape-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  animation: shape-settle var(--dur-long) var(--ease-emph) both;
}

@keyframes shape-settle {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: none; }
}

.game-shape .shape-veil {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 6px;
  padding: 24px;
  text-align: center;
  background: color-mix(in oklab, var(--md-surface-container-low) 88%, transparent);
  backdrop-filter: blur(2px);
}

.game-shape .shape-veil[hidden] { display: none; }

.game-shape .shape-veil-icon {
  width: 40px;
  height: 40px;
  color: var(--md-on-surface-variant);
}

.game-shape .shape-veil-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--md-on-surface);
}

.game-shape .shape-veil-note {
  max-width: 32ch;
  font-size: 0.85rem;
  line-height: 1.4;
}

.game-shape .shape-veil .btn { margin-top: 8px; }

.game-shape .shape-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 32px;
}

.game-shape .shape-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.game-shape .shape-answer {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 6px 14px 6px 8px;
  border-radius: var(--r-full);
  background: var(--md-tertiary-container);
  color: var(--md-on-tertiary-container);
  animation: shape-rise var(--dur-med) var(--ease-spring) both;
}

@keyframes shape-rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.game-shape .shape-answer-flag {
  width: 30px;
  height: 20px;
  border-radius: var(--r-xs);
  /* contain, never cover: cropping would mangle the flags that are not 3:2 */
  object-fit: contain;
}

.game-shape .shape-answer-name {
  font-family: var(--font-display);
  font-weight: 500;
}

.game-shape .shape-answer-note {
  color: inherit;
  opacity: 0.78;
  font-size: 0.85rem;
}

/* guess list */

.game-shape .shape-side {
  display: grid;
  gap: 10px;
  align-content: start;
}

.game-shape .shape-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.game-shape .shape-side-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--md-on-surface);
}

.game-shape .shape-pips {
  display: flex;
  align-items: center;
  gap: 5px;
}

.game-shape .shape-pip {
  width: 9px;
  height: 9px;
  border-radius: var(--r-full);
  background: var(--md-outline-variant);
  transition: background-color var(--dur-short) var(--ease-emph),
    width var(--dur-short) var(--ease-spring);
}

.game-shape .shape-pip[data-state='miss'] { background: var(--md-error); }

/* Wider as well as differently coloured: the low-chroma themes barely separate
   error from primary by hue, so form carries the distinction too. */
.game-shape .shape-pip[data-state='hit'] {
  width: 20px;
  background: var(--md-primary);
}

.game-shape .shape-counter {
  margin: 0;
  font-size: 0.85rem;
}

.game-shape .shape-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* The rows themselves come from ui.guessRow and keep the shared `.guess-row`
   entrance animation from games.css, so all four games move alike. */

.game-shape .shape-empty {
  margin: 0;
  padding: 16px;
  border: 1px dashed var(--md-outline-variant);
  border-radius: var(--r-md);
  font-size: 0.85rem;
  line-height: 1.45;
}

/* footer: input, bonus round, end-of-round actions */

.game-shape .shape-footer {
  display: grid;
  gap: 12px;
}

.game-shape .shape-done {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.game-shape .shape-bonus {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: var(--r-lg);
}

.game-shape .shape-bonus-label {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  color: var(--md-on-surface);
}

.game-shape .shape-bonus-label .icon { color: var(--md-tertiary); }

.game-shape .shape-bonus-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.game-shape .shape-flag {
  position: relative;
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 0;
  border: 2px solid var(--md-outline-variant);
  border-radius: var(--r-md);
  background: var(--md-surface-container-high);
  cursor: pointer;
  overflow: hidden;
  transition: transform var(--dur-short) var(--ease-spring),
    border-color var(--dur-short) var(--ease-emph),
    box-shadow var(--dur-short) var(--ease-emph);
}

.game-shape .shape-flag img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: contain;
  padding: 4px;
}

.game-shape .shape-flag::after {
  content: '';
  position: absolute;
  inset: 0;
  background: currentColor;
  opacity: 0;
  transition: opacity var(--dur-short) var(--ease-emph);
  pointer-events: none;
}

.game-shape .shape-flag:hover:not(:disabled) {
  border-color: var(--md-primary);
  box-shadow: var(--e2);
}

.game-shape .shape-flag:hover:not(:disabled)::after { opacity: 0.08; }
.game-shape .shape-flag:active:not(:disabled) { transform: scale(0.97); }
.game-shape .shape-flag:active:not(:disabled)::after { opacity: 0.12; }

.game-shape .shape-flag:focus-visible {
  outline: 2px solid var(--md-primary);
  outline-offset: 2px;
}

.game-shape .shape-flag:disabled { cursor: default; }

.game-shape .shape-flag[data-state='right'] { border-color: var(--md-primary); }
.game-shape .shape-flag[data-state='wrong'] { border-color: var(--md-error); }

.game-shape .shape-flag:disabled:not([data-state]) img { opacity: 0.45; }

.game-shape .shape-flag-mark {
  position: absolute;
  inset-inline-end: 6px;
  inset-block-start: 6px;
  display: grid;
  place-items: center;
  width: 0;
  height: 24px;
  border-radius: var(--r-full);
  overflow: hidden;
  box-shadow: var(--e1);
  transition: width var(--dur-short) var(--ease-spring);
}

.game-shape .shape-flag[data-state] .shape-flag-mark { width: 24px; }

.game-shape .shape-flag[data-state='right'] .shape-flag-mark {
  background: var(--md-primary);
  color: var(--md-on-primary);
}

.game-shape .shape-flag[data-state='wrong'] .shape-flag-mark {
  background: var(--md-error);
  color: var(--md-on-error);
}

.game-shape .shape-bonus-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.game-shape .shape-bonus-result,
.game-shape .shape-bonus-summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  margin-inline-end: auto;
  font-size: 0.9rem;
  font-weight: 500;
}

.game-shape .shape-bonus-result[data-state='right'],
.game-shape .shape-bonus-summary[data-state='right'] { color: var(--md-primary); }

.game-shape .shape-bonus-result[data-state='wrong'],
.game-shape .shape-bonus-summary[data-state='wrong'] { color: var(--md-error); }

.game-shape .shape-help-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-inline-start: 20px;
  line-height: 1.5;
}

@media (min-width: 640px) {
  .game-shape .shape-bonus-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 480px) {
  .game-shape .shape-stage {
    aspect-ratio: 1 / 1;
    max-height: 46vh;
  }
}

/* Reduced motion is handled once, globally, in games.css — both for
   `prefers-reduced-motion` and for `:root[data-motion='reduced']`, which
   store.js sets from settings.reducedMotion. Nothing is needed here. */
