.game-frame {
  max-width: 720px;
  margin: 0 auto var(--space-12);
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.game-frame__bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg-subtle);
  border-bottom: 1px solid var(--color-border-subtle);
}
.game-frame__dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--color-tag-bg);
  border: 1px solid var(--color-border-subtle);
}
.game-frame__dot:nth-child(1) { background: rgba(220, 38, 38, 0.35) }
.game-frame__dot:nth-child(2) { background: rgba(234, 179, 8, 0.35) }
.game-frame__dot:nth-child(3) { background: rgba(34, 197, 94, 0.35) }
.game-mount { padding: var(--space-6) }
.game { max-width: 620px; margin: 0 auto }
.game-status {
  text-align: center;
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  line-height: var(--leading-normal);
  min-height: 1.6em;
  margin-bottom: var(--space-4);
}
.game-status--win { color: #16a34a }
.game-status--lose { color: #dc2626 }
.game-status--draw { color: var(--color-text-muted) }
.game-status--win-x { color: var(--color-accent-strong) }
.game-status--win-o { color: #16a34a }
[data-theme="dark"] .game-status--win { color: #4ade80 }
[data-theme="dark"] .game-status--lose { color: #f87171 }
[data-theme="dark"] .game-status--win-o { color: var(--color-brand) }
.game-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--color-border-subtle);
}
.tool-group { display: flex; align-items: center; gap: var(--space-2) }
.tool-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-default), background-color var(--duration-fast) var(--ease-default), color var(--duration-fast) var(--ease-default);
}
.tool-pill .ic { width: 15px; height: 15px; flex: none }
.tool-pill:hover { border-color: var(--color-accent); color: var(--color-text) }
.tool-pill.is-active {
  background: var(--color-accent-subtle);
  border-color: var(--color-accent);
  color: var(--color-accent-strong);
}
.tool-pill--sound { color: var(--color-text-muted) }
.tool-label {
  font-size: 0.6875rem;
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}
.fancy-select { position: relative; display: inline-block; width: max-content; min-width: 0 }
.fancy-select__btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-1) var(--space-2);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text);
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-default);
}
.fancy-select__btn::after {
  content: '';
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--color-text-muted);
  border-bottom: 2px solid var(--color-text-muted);
  transform: rotate(45deg) translateY(-2px);
  transition: transform var(--duration-fast) var(--ease-default);
}
.fancy-select.is-open .fancy-select__btn::after { transform: rotate(-135deg) translateY(-1px) }
.fancy-select__btn:hover, .fancy-select__btn:focus, .fancy-select.is-open .fancy-select__btn {
  border-color: var(--color-accent);
  outline: none;
}
.fancy-select__menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  width: max-content;
  min-width: auto;
  padding: var(--space-1);
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity var(--duration-fast) var(--ease-default), transform var(--duration-fast) var(--ease-default), visibility var(--duration-fast);
}
[data-theme="dark"] .fancy-select__menu { background: #171a21 }
.fancy-select.is-open .fancy-select__menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.fancy-select__option {
  display: block;
  width: 100%;
  padding: var(--space-1) var(--space-2);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text);
  text-align: left;
  white-space: nowrap;
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.fancy-select__option:hover { background: var(--color-bg-subtle) }
.fancy-select__option.is-active { color: var(--color-accent-strong) }
.fancy-select--icon { min-width: 0 }
.fancy-select--icon .fancy-select__btn {
  min-width: 42px;
  justify-content: center;
  padding: var(--space-1);
}
.fancy-select--icon .fancy-select__btn::after { display: none }
.fancy-select--icon .fancy-select__menu {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  width: 216px;
  padding: var(--space-2);
  left: auto;
  right: 0;
}
#ttt-token-x .fancy-select__menu { left: 0; right: auto }
.fancy-select--icon .fancy-select__option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px;
  font-size: 0.625rem;
  text-align: center;
}
.fancy-select--icon .fancy-select__option.is-active { background: var(--color-accent-subtle) }
.fancy-select--icon .fancy-select__option:hover { background: var(--color-accent-subtle) }
.fancy-select__img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  flex: none;
}
.fancy-select--icon .fancy-select__img { width: 30px; height: 30px }
.btn--copy.is-copied, .fancy-select--icon .fancy-select__btn.is-copied {
  border-color: #3c9;
  color: #3c9;
}
.ttt__cell .ttt__token {
  width: 72%;
  height: 72%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}
.game-score__side-label { display: inline-flex; align-items: center }
.game-score__side-label .ttt__token {
  width: 16px;
  height: 16px;
  object-fit: contain;
  display: inline-block;
}
.game-actions {
  display: flex;
  justify-content: center;
  gap: var(--space-3);
  margin-top: var(--space-6);
}
.game-actions--row { margin-top: var(--space-4) }
.game-score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-6);
  margin-top: var(--space-5);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.game-score__side {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: var(--weight-semibold);
}
.game-score__side[data-score="X"] { color: var(--color-accent-strong) }
.game-score__side[data-score="O"] { color: var(--color-brand) }
.game-score__side b { font-size: var(--text-xl); color: var(--color-text) }
.game-score__side.is-winner b { color: inherit }
.game-score__sep { width: 24px; height: 1px; background: var(--color-border) }
.game-info { max-width: var(--container-narrow); margin: 0 auto; padding-top: var(--space-2) }
.game-info__title {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
  margin-bottom: var(--space-3);
}
.game-info__text { color: var(--color-text-secondary); line-height: var(--leading-relaxed) }
.ic { width: 15px; height: 15px; flex: none }
.game-input {
  padding: var(--space-3) var(--space-4);
  font-family: inherit;
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}
.game-input:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
  border-color: transparent;
}
.ttt__board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
  width: min(300px, 100%);
  margin: 0 auto;
}
.ttt__cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  color: var(--color-text);
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--duration-fast) var(--ease-default), background-color var(--duration-fast) var(--ease-default), transform var(--duration-fast) var(--ease-default);
}
.ttt__cell:hover:not(:disabled) {
  border-color: var(--color-accent);
  background: var(--color-accent-subtle);
  transform: translateY(-2px);
}
.ttt__cell:disabled { cursor: default; opacity: 1 }
.ttt__cell[data-v] { animation: tttPop 0.25s var(--ease-out) both }
.ttt__cell[data-v="X"] { background: rgba(45, 147, 253, 0.10) }
.ttt__cell[data-v="O"] { background: rgba(122, 221, 115, 0.14) }
[data-theme="dark"] .ttt__cell[data-v="X"] { background: rgba(45, 147, 253, 0.16) }
[data-theme="dark"] .ttt__cell[data-v="O"] { background: rgba(122, 221, 115, 0.16) }
.ttt__cell--win { animation: tttPop 0.3s var(--ease-out) both, winLinePulse 1.2s var(--ease-default) 0.8s infinite }
.ttt__cell--win[data-v="X"] {
  --ttt-win-glow: rgba(45, 147, 253, 0.35);
  background: var(--color-accent-subtle);
  border-color: var(--color-accent);
}
.ttt__cell--win[data-v="O"] {
  --ttt-win-glow: rgba(122, 221, 115, 0.35);
  background: var(--color-brand-subtle);
  border-color: var(--color-brand);
}
@keyframes tttPop {
  0% { transform: scale(0.4);
  opacity: 0.3;
  } 60% { transform: scale(1.12);
  } 100% { transform: scale(1);
  opacity: 1;
  };
}
@keyframes winPulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--color-accent-subtle);
  } 50% { box-shadow: 0 0 0 8px var(--color-accent-subtle);
  };
}
@keyframes winLinePulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--ttt-win-glow, rgba(45, 147, 253, 0.35));
  } 50% { box-shadow: 0 0 0 8px var(--ttt-win-glow, rgba(45, 147, 253, 0.35));
  };
}
.c4__dropbar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--space-1);
  width: min(420px, 100%);
  margin: 0 auto var(--space-3);
  padding: 0 var(--space-3);
  border: 1px solid transparent;
}
.c4__drop {
  position: relative;
  height: 34px;
  border-radius: var(--radius-full);
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border-subtle);
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-default), background-color var(--duration-fast) var(--ease-default);
}
.c4__drop::after {
  content: "↓";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: var(--text-lg);
  line-height: 1;
  color: var(--color-text-muted);
  opacity: 0.55;
  transition: color var(--duration-fast) var(--ease-default), opacity var(--duration-fast) var(--ease-default);
}
.c4__drop:hover:not(.is-full) {
  border-color: var(--color-accent);
  background: var(--color-accent-subtle);
}
.c4__drop:hover:not(.is-full)::after { color: var(--color-accent-strong); opacity: 1 }
.c4__drop.is-full { cursor: default; opacity: 0.35 }
.c4__dropbar.is-busy .c4__drop { cursor: wait }
.c4__dropbar.is-busy .c4__drop:hover:not(.is-full) {
  border-color: var(--color-border-subtle);
  background: var(--color-bg-subtle);
}
.c4__dropbar.is-busy .c4__drop:hover:not(.is-full)::after {
  color: var(--color-text-muted);
  opacity: 0.55;
}
.c4__board {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--space-1);
  width: min(420px, 100%);
  margin: 0 auto;
  padding: var(--space-3);
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.06), var(--shadow-sm);
  overflow: hidden;
}
.c4__cell {
  position: relative;
  display: block;
  aspect-ratio: 1;
  border-radius: var(--radius-full);
  background: var(--color-bg);
  border: 1px solid var(--color-border-subtle);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}
.c4__cell::after {
  content: "";
  position: absolute;
  inset: 20%;
  border-radius: var(--radius-full);
  background: var(--color-accent-subtle);
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-default);
}
.c4__cell--X {
  background: var(--color-accent);
  border-color: transparent;
  box-shadow: 0 2px 6px rgba(45, 147, 253, 0.35);
}
.c4__cell--O {
  background: var(--color-brand);
  border-color: transparent;
  box-shadow: 0 2px 6px rgba(122, 221, 115, 0.35);
}
.c4__board--O .c4__drop:not(.is-full) { border-color: var(--color-brand) }
.c4__board--O .c4__drop:not(.is-full)::after { color: var(--color-brand); opacity: 0.8 }
.c4__cell--new { animation: c4Drop 0.5s var(--ease-out) both }
.c4__cell--win { z-index: 1; animation: c4WinPulse 1.2s var(--ease-default) 0.4s infinite }
.c4__cell--X.c4__cell--win { --c4-glow: rgba(45, 147, 253, 0.35) }
.c4__cell--O.c4__cell--win { --c4-glow: rgba(122, 221, 115, 0.4) }
@keyframes c4WinPulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--c4-glow, rgba(45, 147, 253, 0.35));
  } 50% { box-shadow: 0 0 0 10px var(--c4-glow, rgba(45, 147, 253, 0.35));
  };
}
.c4__cell.is-preview::after { opacity: 1 }
.c4__board--O .c4__cell.is-preview::after { background: var(--color-brand-subtle) }
@keyframes c4Drop { from { transform: translateY(-280px); } to { transform: translateY(0); } }
.rps__choices {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}
.rps__choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  width: 96px;
  padding: var(--space-4) var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text);
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--duration-fast) var(--ease-default), background-color var(--duration-fast) var(--ease-default), transform var(--duration-fast) var(--ease-default), box-shadow var(--duration-fast) var(--ease-default);
}
.rps__choice .ic { width: 40px; height: 40px; color: var(--color-accent-strong) }
.rps__choice:hover {
  transform: translateY(-3px);
  border-color: var(--color-accent);
  background: var(--color-accent-subtle);
  box-shadow: var(--shadow-md);
}
.rps__field {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-5);
  margin-bottom: var(--space-5);
}
.rps__side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  min-width: 118px;
  padding: var(--space-4) var(--space-3);
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
}
.rps__label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}
.rps__pick {
  min-height: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text);
  animation: rpsPop 0.3s var(--ease-out) both;
}
.rps__pick .ic { width: 42px; height: 42px; color: var(--color-accent-strong) }
.rps__vs { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-text-muted) }
.rps__score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}
.rps__score b { font-size: var(--text-xl); color: var(--color-text) }
.rps__score-num { font-weight: var(--weight-bold); color: var(--color-text-secondary) }
.rps__score-sep { width: 20px; height: 1px; background: var(--color-border) }
@keyframes rpsPop {
  0% { transform: scale(0.5);
  opacity: 0;
  } 70% { transform: scale(1.1);
  } 100% { transform: scale(1);
  opacity: 1;
  };
}
.rps__pick--anim { animation: rpsPick 0.35s var(--ease-out) both }
.rps__pick--spin { animation: rpsSpin 0.16s ease-in-out infinite }
@keyframes rpsPick {
  0% { transform: scale(0.9);
  } 60% { transform: scale(1.06);
  } 100% { transform: scale(1);
  };
}
@keyframes rpsSpin { 0%, 100% { transform: scale(1); } 50% { transform: scale(0.85); } }
.mem__status {
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-accent-strong);
  margin-bottom: var(--space-3);
}
.mem__board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2);
  width: min(440px, 100%);
  margin: 0 auto;
  perspective: 900px;
}
.mem__board[data-cols="6"] { grid-template-columns: repeat(6, 1fr); width: min(600px, 100%) }
.mem__card {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  background: transparent;
  border: 0;
  cursor: pointer;
  perspective: 800px;
}
.mem__card-inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform var(--duration-normal) var(--ease-out);
}
.mem__card.is-open .mem__card-inner, .mem__card.is-matched .mem__card-inner { transform: rotateY(180deg) }
.mem__face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.mem__face-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: var(--radius-sm);
  pointer-events: none;
}
.mem__face--back {
  background: var(--color-accent-subtle);
  border: 1px solid var(--color-border);
  color: var(--color-accent-strong);
  font-weight: var(--weight-bold);
  font-size: var(--text-xl);
  transition: border-color var(--duration-fast) var(--ease-default);
}
.mem__card:hover .mem__face--back { border-color: var(--color-accent) }
.mem__face--front {
  transform: rotateY(180deg);
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  font-size: 1.6rem;
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
}
.mem__card.is-matched .mem__face--front {
  background: var(--color-brand-subtle);
  border-color: transparent;
  color: var(--color-accent-strong);
  box-shadow: none;
  animation: winPulse 1.4s var(--ease-default) infinite;
}
.mem__moves {
  margin-top: var(--space-4);
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.ah__entry { max-width: 460px; margin: 0 auto; text-align: center }
.ah__entry-row {
  display: flex;
  justify-content: center;
  gap: var(--space-3);
  margin-top: var(--space-4);
  flex-wrap: wrap;
}
.ah__handoff {
  max-width: 420px;
  margin: 0 auto;
  padding: var(--space-6);
  text-align: center;
  background: var(--color-accent-subtle);
  border: 1px dashed var(--color-accent);
  border-radius: var(--radius-lg);
}
.ah__handoff p { margin-bottom: var(--space-4); color: var(--color-text-secondary) }
.ah__scene { text-align: center; color: var(--color-text-secondary); margin-bottom: var(--space-2) }
.ah__part {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  opacity: 0;
}
.ah__part.show { opacity: 1; animation: ahPop 0.35s var(--ease-out) both }
.ah__part[data-part="0"], .ah__part[data-part="1"], .ah__part[data-part="2"], .ah__part[data-part="3"] { opacity: 1 }
@keyframes ahPop {
  from { opacity: 0;
  transform: scale(0.3);
  transform-origin: 65px 55px;
  } to { opacity: 1;
  transform: scale(1);
  };
}
.ah__word {
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  letter-spacing: 0.18em;
  color: var(--color-text);
  margin-bottom: var(--space-4);
  min-height: 1.4em;
  word-break: break-all;
}
.ah__fails, .ah__used {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}
.ah__used { min-height: 1.4em }
.ah__letters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-1);
  max-width: 480px;
  margin: 0 auto;
}
.ah__letter {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-default), background-color var(--duration-fast) var(--ease-default), transform var(--duration-fast) var(--ease-default);
}
.ah__letter:hover:not(:disabled) {
  border-color: var(--color-accent);
  background: var(--color-accent-subtle);
  transform: translateY(-1px);
}
.ah__letter:disabled { cursor: default; opacity: 1 }
.ah__letter.is-right {
  color: #16a34a;
  background: var(--color-brand-subtle);
  border-color: transparent;
}
.ah__letter.is-wrong { color: var(--color-text-muted); opacity: 0.5; text-decoration: line-through }
[data-theme="dark"] .ah__letter.is-right { color: #4ade80 }
.ms__hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(520px, 100%);
  margin: 0 auto var(--space-3);
}
.ms__hud-item {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.ms__hud-item b {
  font-size: var(--text-xl);
  color: var(--color-text);
  min-width: 2ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.ms__hud-item--right b { text-align: left }
.ms__boardwrap { width: min(520px, 100%); margin: 0 auto }
.ms__board { display: grid; gap: 4px; margin: 0 auto }
.ms__board[data-cols="8"] { grid-template-columns: repeat(8, 1fr); max-width: 384px }
.ms__board[data-cols="12"] { grid-template-columns: repeat(12, 1fr); max-width: 480px }
.ms__board[data-cols="16"] { grid-template-columns: repeat(16, 1fr); max-width: 520px }
.ms__cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-family: var(--font-mono);
  font-size: clamp(10px, 2.2vmin, 15px);
  font-weight: var(--weight-bold);
  color: var(--color-text);
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: border-color 0.12s var(--ease-default), background-color 0.12s var(--ease-default);
}
.ms__cell:hover:not(.is-revealed) {
  border-color: var(--color-accent);
  background: var(--color-accent-subtle);
}
.ms__cell.is-revealed {
  background: var(--color-surface);
  border-color: var(--color-border-subtle);
  cursor: default;
}
.ms__cell.is-mine { background: rgba(220, 38, 38, 0.16); color: #dc2626 }
[data-theme="dark"] .ms__cell.is-mine { color: #f87171 }
.ms__cell.is-flag { color: var(--color-accent-strong); border-color: var(--color-accent) }
.ms__cell.n1 { color: #2563eb }
.ms__cell.n2 { color: #16a34a }
.ms__cell.n3 { color: #dc2626 }
.ms__cell.n4 { color: #7c3aed }
.ms__cell.n5 { color: #be185d }
.ms__cell.n6 { color: #0d9488 }
.ms__cell.n7 { color: #9333ea }
.ms__cell.n8 { color: #52525b }
[data-theme="dark"] .ms__cell.n1 { color: #60a5fa }
[data-theme="dark"] .ms__cell.n2 { color: #4ade80 }
[data-theme="dark"] .ms__cell.n3 { color: #f87171 }
[data-theme="dark"] .ms__cell.n4 { color: #c084fc }
[data-theme="dark"] .ms__cell.n5 { color: #f472b6 }
[data-theme="dark"] .ms__cell.n6 { color: #2dd4bf }
[data-theme="dark"] .ms__cell.n7 { color: #c084fc }
[data-theme="dark"] .ms__cell.n8 { color: #a1a1aa }
.ms__hint {
  text-align: center;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-3);
  white-space: pre-line;
}
.snake__hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  width: min(520px, 100%);
  margin: 0 auto var(--space-3);
}
.snake__hud-item {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.snake__hud-item b {
  font-size: var(--text-xl);
  color: var(--color-text);
  min-width: 2ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.snake__hud-item--right { margin-left: auto }
.snake__hud-item--right b { text-align: left }
.snake__boardwrap {
  position: relative;
  width: min(520px, 100%);
  margin: 0 auto;
}
.snake__board {
  display: grid;
  gap: 2px;
  margin: 0 auto;
  border-radius: var(--radius-md);
  outline: none;
  touch-action: pan-y;
}
.snake__board.is-live { touch-action: none; cursor: crosshair }
.snake__board:focus-visible {
  box-shadow: 0 0 0 3px var(--color-accent-subtle);
}
.snake__board[data-cols="15"] { grid-template-columns: repeat(15, 1fr); max-width: 420px }
.snake__board[data-cols="19"] { grid-template-columns: repeat(19, 1fr); max-width: 480px }
.snake__board[data-cols="23"] { grid-template-columns: repeat(23, 1fr); max-width: 520px }
.snake__cell {
  position: relative;
  aspect-ratio: 1;
  background: transparent;
  border-radius: var(--radius-sm);
  transition: background-color 0.1s var(--ease-default);
}
.snake__board.is-grid .snake__cell { background: var(--color-bg-subtle); }
.snake__board .snake__cell.is-snake {
  background: var(--color-accent);
  border-radius: 3px;
}
.snake__board .snake__cell.is-head {
  background: var(--color-accent-strong);
  border-radius: 50%;
}
[data-theme="dark"] .snake__board .snake__cell.is-snake { background: #2f6f4f }
[data-theme="dark"] .snake__board .snake__cell.is-head { background: var(--color-brand) }
.snake__board .snake__cell.is-food {
  background: #dc2626;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.2);
}
.snake__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  text-align: center;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--color-text);
  background: color-mix(in srgb, var(--color-bg) 78%, transparent);
  border-radius: var(--radius-md);
  cursor: pointer;
}
.snake__hint {
  text-align: center;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-3);
  white-space: pre-line;
}
.game-settings {
  width: min(520px, 100%);
  margin: 0 auto var(--space-4);
}
.game-settings__toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 7px var(--space-4);
  border-radius: 999px;
  background: var(--color-tag-bg);
  color: var(--color-text-secondary);
  border: 1px solid transparent;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  cursor: pointer;
  transition: background-color 0.15s var(--ease-default), color 0.15s var(--ease-default), border-color 0.15s var(--ease-default);
}
.game-settings__toggle .ic { width: 15px; height: 15px }
.game-settings__toggle:hover { color: var(--color-text) }
.game-settings__toggle.is-open {
  background: var(--color-accent-subtle);
  color: var(--color-accent-strong);
  border-color: var(--color-accent);
}
.game-settings__panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}
.game-switch {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px var(--space-3);
  align-items: center;
  cursor: pointer;
}
.game-switch input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
}
.game-switch__track {
  grid-row: span 2;
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  transition: background-color 0.18s var(--ease-default), border-color 0.18s var(--ease-default);
}
.game-switch__dot {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-text-muted);
  transition: transform 0.18s var(--ease-default), background-color 0.18s var(--ease-default);
}
.game-switch input:checked + .game-switch__track { background: var(--color-accent); border-color: var(--color-accent) }
.game-switch input:checked + .game-switch__track .game-switch__dot { transform: translateX(18px); background: #fff }
.game-switch input:focus-visible + .game-switch__track { box-shadow: 0 0 0 3px var(--color-accent-subtle) }
.game-switch__text { display: flex; flex-direction: column; gap: 2px; min-width: 0 }
.game-switch__text b {
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--color-text);
}
.game-switch__text i {
  font-style: normal;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.card__link--play {
  padding: var(--space-2) var(--space-5);
  background: var(--color-accent);
  color: #fff;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  box-shadow: var(--shadow-sm);
  transition: background-color var(--duration-fast) var(--ease-default), transform var(--duration-fast) var(--ease-default), box-shadow var(--duration-fast) var(--ease-default);
}
.card__link--play:hover { background: var(--color-accent-strong); color: #fff; transform: translateY(-1px); box-shadow: var(--shadow-md) }
.card__link--play::after { content: none }
.card__image--minigame { object-fit: contain; padding: var(--space-2) }
@media (prefers-reduced-motion: reduce) {
  .ttt__cell[data-v], .ttt__cell--win, .c4__cell--new, .c4__cell--win, .mem__card-inner, .mem__card.is-matched .mem__face--front, .rps__pick, .ah__part.show {
    animation: none !important;
    transition: none !important;
  }
}
.game-frame :where(button, .ttt__cell, .c4__drop, .mem__card, .rps__choice, .ah__letter) { touch-action: manipulation }
.game-frame :where(.ttt__cell, .c4__drop, .mem__card, .rps__choice, .ah__letter) { -webkit-tap-highlight-color: transparent }
@media (max-width: 768px) {
  .game-mount { padding: var(--space-5) }
}
@media (max-width: 640px) {
  .game-mount { padding: var(--space-4) }
  .game-status { font-size: var(--text-base) }
  .game-info { text-align: center }
  .game-toolbar { gap: var(--space-2) }
  .tool-group { flex-wrap: wrap; justify-content: center }
  .fancy-select:not(.fancy-select--icon) { flex: 0 1 auto; width: max-content; min-width: 0 }
  .fancy-select--icon { flex: 0 0 auto }
  .c4__drop { height: 40px }
  .mem__board { gap: var(--space-1) }
  .rps__field { gap: var(--space-3) }
  .rps__side { min-width: 96px }
  .rps__choice { width: 88px; padding: var(--space-3) var(--space-2) }
  .ah__letter { width: 32px; height: 32px }
  .ms__board { gap: 3px }
}
@media (max-width: 400px) {
  .ttt__board { width: min(280px, 100%) }
  .ttt__cell { font-size: var(--text-2xl) }
  .c4__dropbar { gap: 3px; padding: 0 var(--space-2) }
  .c4__drop::after { font-size: var(--text-base) }
  .c4__board { padding: var(--space-2) }
  .rps__choice { width: 78px; padding: var(--space-2) }
  .rps__choice .ic { width: 34px; height: 34px }
  .rps__side { min-width: 84px; padding: var(--space-3) var(--space-2) }
  .rps__pick { min-height: 52px }
  .rps__pick .ic { width: 34px; height: 34px }
  .mem__face--front { font-size: clamp(0.9rem, 6vw, 1.3rem) }
  .ah__word { font-size: var(--text-lg); letter-spacing: 0.14em; word-spacing: 4px }
  .ah__letter { width: 30px; height: 30px; font-size: var(--text-xs) }
  .ah__letters { gap: 4px }
  .ms__cell { border-radius: 4px }
  .ms__hud { font-size: var(--text-xs) }
  .game-score__side b { font-size: var(--text-lg) }
  .fancy-select--icon .fancy-select__menu { grid-template-columns: repeat(5, 1fr); width: 188px }
  .game-actions { flex-wrap: wrap }
  .game-online__menu { padding: var(--space-4) }
  .game-online__bar { flex-direction: column; gap: var(--space-2) }
}
.game-online {
  display: grid;
  gap: var(--space-3);
  width: 100%;
  max-width: var(--container-narrow);
  margin: 0 auto;
}
.game-online[hidden] { display: none }
.game-online__menu {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-3);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  background: var(--color-bg-elevated);
}
.game-online__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.game-online__row--actions { flex-wrap: wrap; justify-content: center }
.game-online__or {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  gap: var(--space-2);
}
.game-online__or::before, .game-online__or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border-subtle);
}
.game-online__join { display: grid; gap: var(--space-2) }
.game-online__msg {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  text-align: center;
}
.game-online__msg--error { color: #e8766a }
.game-online__bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-subtle);
}
.game-online__bar[hidden] { display: none }
.game-online__code {
  font-family: var(--font-mono);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  color: var(--color-accent);
}
.game-online__you { color: var(--color-accent); font-weight: var(--weight-semibold) }
.game-online__status { color: var(--color-text-muted); font-size: var(--text-xs) }
.game-online__status--turn { color: var(--color-accent) }
.game-online__code-input {
  font-family: var(--font-mono);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  text-align: center;
}
@media (prefers-color-scheme: dark) {
  .game-online__msg--error { color: #ff9c93 }
}
