
.game-body {
  display: grid;
  gap: 7px;
  padding: 14px;
  flex: 1;
  align-content: space-between;
}

.game-body h3 {
  margin: 0 0 4px;
  font-size: 1.04rem;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.game-body p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.tag-row {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.tag {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  text-transform: uppercase;
}

.play-area {
  margin-top: 36px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.score-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.score-strip span {
  min-width: 118px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
}

.score-strip strong {
  color: var(--ink);
}

.stage-shell {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 900 / 520;
  min-height: 280px;
  max-height: 72vh;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #121924;
  box-shadow: var(--shadow);
}

.stage-shell:fullscreen {
  width: 100vw;
  height: 100vh;
  max-height: none;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
}

#gameCanvas,
.dom-game-layer,
.stage-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#gameCanvas {
  display: block;
  object-fit: contain;
}

.dom-game-layer {
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 2vw, 22px);
  color: #fff;
}

.dom-game-layer.is-visible {
  display: flex;
}

.dom-game-layer.is-frame {
  display: block;
  padding: 0;
  background: #101820;
}

.external-frame-wrap {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: 1fr auto;
}

.external-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #101820;
}

.external-note {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: rgba(15, 23, 42, 0.96);
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.9rem;
}

.external-note a {
  color: #fff;
  font-weight: 850;
}

.stage-overlay {
  display: none;
  z-index: 5;
  place-items: center;
  background: rgba(9, 14, 22, 0.68);
  color: #fff;
  text-align: center;
  pointer-events: none;
}

.stage-overlay strong {
  display: block;
  margin-bottom: 8px;
  font-size: clamp(2rem, 8vw, 4.5rem);
  line-height: 1;
}

.stage-overlay span {
  color: rgba(255, 255, 255, 0.78);
  font-weight: 750;
}

.rotate-overlay {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 10;
  background: rgba(9, 14, 22, 0.95);
  color: #fff;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  backdrop-filter: blur(8px);
}

.rotate-overlay svg {
  margin-bottom: 20px;
  color: var(--brand);
  animation: rotate-hint 2s infinite ease-in-out;
}

@keyframes rotate-hint {
  0% { transform: rotate(0deg); }
  25% { transform: rotate(90deg); }
  50% { transform: rotate(90deg); }
  75% { transform: rotate(0deg); }
  100% { transform: rotate(0deg); }
}

.rotate-overlay strong {
  display: block;
  margin-bottom: 8px;
  font-size: clamp(1.5rem, 6vw, 2.5rem);
  line-height: 1.2;
}

.rotate-overlay span {
  color: rgba(255, 255, 255, 0.78);
  font-weight: 600;
  max-width: 80%;
  line-height: 1.5;
}

.stage-shell.is-paused .stage-overlay {
  display: grid;
}

.stage-shell.is-paused .dom-game-layer {
  pointer-events: none;
}

.memory-grid,
.tic-grid {
  display: grid;
  gap: 10px;
  width: min(520px, 100%);
}

.memory-grid {
  grid-template-columns: repeat(4, minmax(54px, 1fr));
}

.memory-tile,
.tic-cell {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 900;
}

.memory-tile {
  aspect-ratio: 1;
  font-size: clamp(1.4rem, 5vw, 2.5rem);
}

.memory-tile.is-open {
  background: var(--accent);
  color: #121924;
}

.memory-tile.is-matched {
  background: var(--mint);
  color: #082217;
}

.tic-grid {
  grid-template-columns: repeat(3, minmax(76px, 1fr));
  max-width: 430px;
}

.tic-cell {
  aspect-ratio: 1;
  font-size: clamp(2.3rem, 10vw, 5rem);
}

.control-row {
  display: grid;
  grid-template-columns: repeat(8, minmax(80px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.icon-btn {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 800;
  transition: all 0.1s ease;
}

.icon-btn:active,
.icon-btn.is-pressed {
  background: var(--brand);
  color: #fff;
  transform: scale(0.92);
}


