/* ============================================================================
   NITOEUS FRAMEWORK — PARTY GAMES UI
   Uses the tokens from style.css (light + dark). Markup: assets/js/games.js
   --game-accent is set per game on the stage and on game cards.
   ============================================================================ */

/* ----------------------------------------------------------------------------
   1. PAGE SHELL
   ---------------------------------------------------------------------------- */
.mg-section {
  position: relative;
  padding: 36px 0 56px;
  isolation: isolate;
}

/* Same fine grid + soft light as the home hero, kept to the top of the page */
.mg-section::before,
.mg-section::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: -1;
  pointer-events: none;
}

.mg-section::before {
  height: 420px;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(55% 80% at 30% 0%, #000 20%, transparent 75%);
  mask-image: radial-gradient(55% 80% at 30% 0%, #000 20%, transparent 75%);
}

.mg-section::after {
  height: 480px;
  background: radial-gradient(40% 60% at 30% 0%, var(--glow), transparent 70%);
}

.mg-ico {
  width: 18px;
  height: 18px;
  flex: none;
}

.mg-section .glass-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
}

body.mg-modal-open {
  overflow: hidden;
}

.mg-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.mg-header-text .eyebrow {
  margin-bottom: 6px;
}

.mg-title {
  font-size: clamp(1.7rem, 1.2rem + 1.6vw, 2.3rem);
  font-weight: 750;
  letter-spacing: -0.03em;
}

.mg-desc {
  margin-top: 6px;
  max-width: 620px;
  color: var(--text-2);
  font-size: 15.5px;
}

.mg-header.is-compact {
  align-items: center;
  margin-bottom: 16px;
}

.mg-header.is-compact .eyebrow {
  margin-bottom: 2px;
}

.mg-header.is-compact .mg-title {
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.mg-sound-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  flex: none;
  transition: background var(--t-fast), color var(--t-fast);
}

.mg-sound-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.mg-sound-btn .mg-ico {
  width: 16px;
  height: 16px;
}

.mg-sound-btn.is-off {
  color: var(--text-3);
}

/* Shared labels, chips, inputs */
.mg-label {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
}

.mg-chip,
.mg-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.mg-chip .mg-ico {
  width: 13px;
  height: 13px;
}

.mg-chip.is-warn {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: transparent;
}

.mg-input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.mg-input::placeholder {
  color: var(--text-3);
}

.mg-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus);
}

.mg-input:disabled {
  background: var(--surface-2);
  color: var(--text-3);
  cursor: not-allowed;
}

.mg-input-lg {
  height: 48px;
  font-size: 16px;
}

.mg-input.is-bad {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.mg-select {
  appearance: auto;
  height: 40px;
  font-size: 14px;
}

.mg-select.is-missing {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.mg-link-btn {
  border: 0;
  padding: 0;
  background: none;
  color: var(--accent-text);
  font-size: 13px;
  font-weight: 600;
}

.mg-link-btn:hover {
  text-decoration: underline;
}

.mg-hint {
  color: var(--text-3);
  font-size: 13.5px;
}

.mg-key-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
  color: var(--text-3);
  font-size: 12.5px;
}

.mg-key-hint .mg-ico {
  width: 14px;
  height: 14px;
}

.mg-good {
  color: var(--success);
  font-weight: 600;
}

/* Avatars */
.mg-avatar {
  --pc: #6b7280;
  width: 30px;
  height: 30px;
  flex: none;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--pc);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  -webkit-user-select: none;
  user-select: none;
}

.mg-avatar.is-xs {
  width: 20px;
  height: 20px;
  font-size: 10px;
}

.mg-avatar.is-md {
  width: 40px;
  height: 40px;
  font-size: 16px;
}

.mg-avatar.is-lg {
  width: 52px;
  height: 52px;
  font-size: 20px;
}

.mg-avatar.is-xl {
  width: 68px;
  height: 68px;
  font-size: 26px;
}

.mg-avatar.is-xxl {
  width: 92px;
  height: 92px;
  font-size: 34px;
}

/* Emoji profile pictures: the emoji sits on a soft disc of the player's color */
.mg-avatar.is-emoji {
  background: color-mix(in srgb, var(--pc) 26%, var(--surface));
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--pc) 70%, transparent);
  font-size: 17px;
  font-weight: 400;
}

.mg-avatar.is-emoji.is-xs {
  font-size: 12px;
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--pc) 70%, transparent);
}

.mg-avatar.is-emoji.is-md {
  font-size: 22px;
}

.mg-avatar.is-emoji.is-lg {
  font-size: 28px;
}

.mg-avatar.is-emoji.is-xl {
  font-size: 38px;
}

.mg-avatar.is-emoji.is-xxl {
  font-size: 50px;
  box-shadow: inset 0 0 0 3px var(--pc), 0 10px 30px -10px var(--pc);
}

.mg-avatar.is-empty {
  background: transparent;
  border: 1.5px dashed var(--border-strong);
  color: var(--text-3);
}

/* Small waiting dots */
.mg-dots {
  display: inline-flex;
  gap: 3px;
  margin-left: 2px;
}

.mg-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.3;
  animation: mg-blink 1.2s infinite;
}

.mg-dots i:nth-child(2) {
  animation-delay: 0.2s;
}

.mg-dots i:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes mg-blink {
  0%,
  80%,
  100% {
    opacity: 0.25;
  }
  40% {
    opacity: 1;
  }
}

/* ----------------------------------------------------------------------------
   2. ENTRY SCREEN (not in a room yet)
   ---------------------------------------------------------------------------- */
.mg-entry-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.mg-entry {
  padding: 24px;
}

.mg-entry-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.mg-entry-head h2 {
  font-size: 18px;
}

.mg-entry-head p {
  color: var(--text-2);
  font-size: 14px;
}

.mg-entry-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.mg-btn-create {
  width: 100%;
  height: 48px;
  font-size: 15px;
}

/* Profile: big picture + name */
.mg-profile {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
}

.mg-profile-pic {
  position: relative;
  flex: none;
}

.mg-profile-pic .mg-avatar {
  transition: background var(--t), box-shadow var(--t);
  animation: mg-av-pop 0.35s var(--ease);
}

@keyframes mg-av-pop {
  from {
    transform: scale(0.85);
  }
  to {
    transform: scale(1);
  }
}

.mg-dice {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: transform var(--t), background var(--t-fast);
}

.mg-dice:hover {
  background: var(--surface-hover);
  transform: rotate(-90deg);
}

.mg-dice .mg-ico {
  width: 15px;
  height: 15px;
}

.mg-profile-main {
  flex: 1;
  min-width: 0;
}

.mg-profile-head {
  margin-bottom: 12px;
}

.mg-profile-head h2 {
  font-size: 18px;
}

.mg-profile-head p {
  color: var(--text-2);
  font-size: 13.5px;
}

.mg-name-row {
  display: flex;
  gap: 8px;
}

.mg-name-row .mg-input {
  flex: 1;
  min-width: 0;
}

.mg-name-dice {
  flex: none;
  width: 48px;
  height: auto;
  padding: 0;
  justify-content: center;
  border: 1px solid var(--border);
}

/* Avatar + color picker */
.mg-av-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  margin-bottom: 18px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.mg-av-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 6px;
}

.mg-av-opt {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--surface);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: transform var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}

.mg-av-opt:hover {
  transform: translateY(-2px) scale(1.08);
  border-color: var(--border-strong);
}

.mg-av-opt.is-on {
  background: color-mix(in srgb, var(--pc) 28%, var(--surface));
  border-color: var(--pc);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--pc) 35%, transparent);
}

.mg-av-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mg-av-color {
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--pc);
  cursor: pointer;
  transition: transform var(--t-fast);
}

.mg-av-color:hover {
  transform: scale(1.15);
}

.mg-av-color.is-on {
  border-color: var(--surface);
  box-shadow: 0 0 0 2px var(--pc);
}

.mg-av-opt:focus-visible,
.mg-av-color:focus-visible,
.mg-dice:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Create / join tiles */
.mg-act-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mg-act-tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.mg-act-tile.is-invited {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.mg-act-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.mg-act-head strong {
  display: block;
  font-size: 15px;
}

.mg-act-head p {
  color: var(--text-2);
  font-size: 13px;
}

.mg-act-icon {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}

.mg-act-icon .mg-ico {
  width: 17px;
  height: 17px;
}

.mg-act-tile .mg-join .mg-code-input {
  flex: 1;
  min-width: 0;
}

.mg-or {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-3);
  font-size: 12.5px;
}

.mg-or::before,
.mg-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.mg-join {
  display: flex;
  gap: 8px;
}

.mg-join .btn {
  height: 48px;
  padding: 0 20px;
}

.mg-code-input {
  height: 48px;
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.35em;
  text-align: center;
  text-transform: uppercase;
}

.mg-code-input::placeholder {
  letter-spacing: 0.2em;
  font-weight: 500;
}

.mg-status,
.mg-error {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 14px;
}

.mg-status {
  color: var(--text-2);
}

.mg-error {
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 500;
}

.mg-error .mg-ico {
  width: 16px;
  height: 16px;
}

.mg-how {
  padding: 24px;
  background: var(--surface-2);
  box-shadow: none;
}

.mg-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}

.mg-steps li {
  display: flex;
  gap: 12px;
}

.mg-step-num {
  width: 26px;
  height: 26px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  font-size: 12.5px;
  font-weight: 700;
}

.mg-steps strong {
  display: block;
  font-size: 14.5px;
}

.mg-steps p {
  color: var(--text-2);
  font-size: 13.5px;
}

/* Catalog */
.mg-catalog-head {
  margin: 44px 0 6px;
}

.mg-catalog-head h2 {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.mg-catalog-head p {
  margin-top: 4px;
  color: var(--text-2);
}

.mg-group-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 12px;
}

.mg-group-icon {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--accent-text);
}

.mg-group-head.is-mini .mg-group-icon {
  background: var(--warning-soft);
  color: var(--warning);
}

.mg-group-head h3 {
  font-size: 15.5px;
}

.mg-group-head p {
  color: var(--text-3);
  font-size: 13.5px;
}

.mg-game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.mg-game-grid.is-main {
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.mg-game-card {
  --game-accent: var(--accent);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  overflow: hidden;
  background: linear-gradient(180deg, color-mix(in srgb, var(--game-accent) 8%, var(--surface)), var(--surface) 60%);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  transition: border-color 0.2s, box-shadow 0.2s, opacity 0.2s, transform 0.2s var(--ease);
}

/* Thin line in the game's colour along the top edge */
.mg-game-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 18px;
  right: 18px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--game-accent), transparent);
  opacity: 0.8;
  pointer-events: none;
}

.mg-game-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--game-accent) 40%, var(--border));
  box-shadow: 0 18px 40px -24px color-mix(in srgb, var(--game-accent) 60%, transparent);
}

@media (prefers-reduced-motion: reduce) {
  .mg-game-card:hover {
    transform: none;
  }
}

.mg-game-card.is-unpicked {
  opacity: 0.6;
}

.mg-game-card.is-picked {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

/* Colored banner on top of each card, with a big faded copy of the icon */
.mg-game-card-top {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  min-height: 78px;
  padding: 14px 16px 0;
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--game-accent) 38%, transparent), transparent 60%),
    linear-gradient(135deg, color-mix(in srgb, var(--game-accent) 22%, var(--surface)), color-mix(in srgb, var(--game-accent) 6%, var(--surface)));
  border-bottom: 1px solid color-mix(in srgb, var(--game-accent) 22%, var(--border));
}

.mg-game-card-top .mg-game-icon {
  position: relative;
  width: 48px;
  height: 48px;
  margin-bottom: -20px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--game-accent) 45%, var(--border));
  box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--game-accent) 70%, transparent);
  transition: transform 0.25s var(--ease);
}

html[data-theme="dark"] .mg-game-card-top .mg-game-icon {
  background: color-mix(in srgb, var(--game-accent) 18%, var(--surface));
}

.mg-game-card-top .mg-game-icon svg {
  width: 24px;
  height: 24px;
}

.mg-game-card:hover .mg-game-card-top .mg-game-icon {
  transform: rotate(-6deg) scale(1.06);
}

.mg-game-art {
  position: absolute;
  right: -14px;
  top: -18px;
  width: 112px;
  height: 112px;
  color: var(--game-accent);
  opacity: 0.16;
  transform: rotate(-14deg);
  pointer-events: none;
  transition: transform 0.4s var(--ease), opacity 0.3s;
}

.mg-game-art svg {
  width: 100%;
  height: 100%;
}

.mg-game-card:hover .mg-game-art {
  opacity: 0.26;
  transform: rotate(-4deg) scale(1.06);
}

.mg-game-card-top .mg-game-card-badges {
  position: relative;
  align-self: flex-start;
}

.mg-game-card-top .mg-chip {
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.mg-game-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 28px 16px 16px;
}

.mg-game-card.is-locked .mg-game-card-top {
  filter: saturate(0.55);
}

@media (prefers-reduced-motion: reduce) {
  .mg-game-art,
  .mg-game-card-top .mg-game-icon {
    transition: none;
  }
  .mg-game-card:hover .mg-game-art,
  .mg-game-card:hover .mg-game-card-top .mg-game-icon {
    transform: none;
  }
}

/* Lobby tabs: main games / minigames */
.mg-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  margin: 4px 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface-2);
}

.mg-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 46px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--r);
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}

.mg-tab:hover {
  color: var(--text);
}

.mg-tab.is-on {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

.mg-tab-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-text);
}

.mg-tab.is-mini .mg-tab-icon {
  background: var(--warning-soft);
  color: var(--warning);
}

.mg-tab-icon .mg-ico {
  width: 15px;
  height: 15px;
}

.mg-tab em {
  min-width: 34px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 12px;
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

.mg-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.mg-tab-desc {
  margin: 0 2px 12px;
  color: var(--text-3);
  font-size: 13.5px;
}

/* Marathon: row of the minigames, lit when picked */
.mg-mix-icons {
  display: inline-flex;
  gap: 4px;
}

.mg-mix-dot {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-3);
  opacity: 0.55;
  transition: opacity var(--t-fast), background var(--t-fast);
}

.mg-mix-dot svg {
  width: 14px;
  height: 14px;
}

.mg-mix-dot.is-on {
  opacity: 1;
  border-color: color-mix(in srgb, var(--game-accent) 50%, var(--border));
  background: color-mix(in srgb, var(--game-accent) 20%, var(--surface));
  color: var(--game-accent);
}

.mg-game-card-badges {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mg-game-icon,
.mg-stage-icon {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--r);
  border: 1px solid color-mix(in srgb, var(--game-accent) 30%, transparent);
  background: color-mix(in srgb, var(--game-accent) 14%, transparent);
  color: var(--game-accent);
}

html[data-theme="dark"] .mg-game-icon,
html[data-theme="dark"] .mg-stage-icon {
  border-color: color-mix(in srgb, var(--game-accent) 45%, transparent);
  background: color-mix(in srgb, var(--game-accent) 20%, transparent);
  color: color-mix(in srgb, var(--game-accent) 55%, #ffffff);
}

.mg-game-icon svg,
.mg-stage-icon svg {
  width: 22px;
  height: 22px;
}

.mg-game-card h3 {
  font-size: 15.5px;
}

.mg-game-card p {
  flex: 1;
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.5;
}

.mg-pick {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface);
  color: transparent;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}

.mg-pick .mg-ico {
  width: 16px;
  height: 16px;
}

.mg-pick:hover {
  border-color: var(--accent);
}

.mg-pick.is-on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Host settings inside a game card */
.mg-cfg {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.mg-cfg-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: var(--text-2);
}

.mg-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  overflow: hidden;
}

.mg-stepper button {
  width: 30px;
  height: 30px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
}

.mg-stepper button:hover:not(:disabled) {
  background: var(--surface-3);
}

.mg-stepper button:disabled {
  color: var(--text-3);
  opacity: 0.5;
  cursor: not-allowed;
}

.mg-stepper b {
  min-width: 52px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

/* Start button takes the game's own colour */
.mg-start-btn {
  width: 100%;
  margin-top: 6px;
  background: var(--game-accent, var(--accent));
  color: #fff;
}

.mg-start-btn:not(:disabled):hover {
  opacity: 1;
  filter: brightness(1.12);
}

.mg-start-btn:disabled {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text-3);
  opacity: 1;
}

/* ----------------------------------------------------------------------------
   3. MINIGAME MARATHON
   ---------------------------------------------------------------------------- */
.mg-mix {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
  border-radius: var(--r-lg);
  background:
    radial-gradient(90% 160% at 0% 0%, var(--accent-soft), transparent 60%),
    var(--surface-2);
}

.mg-mix-info {
  display: flex;
  gap: 12px;
  min-width: 0;
  flex: 1 1 320px;
}

.mg-mix-icon {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--accent-text);
}

.mg-mix-info strong {
  font-size: 15px;
}

.mg-mix-info p {
  color: var(--text-2);
  font-size: 13.5px;
}

.mg-mix-picks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.mg-mix-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.mg-mix-actions .mg-cfg-item {
  gap: 8px;
}

.mg-mix-start {
  height: 40px;
}

.mg-mix-next {
  --game-accent: var(--accent);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--game-accent) 35%, var(--border));
  border-radius: var(--r);
  background: color-mix(in srgb, var(--game-accent) 7%, var(--surface));
}

.mg-mix-next > div {
  flex: 1;
  min-width: 140px;
}

.mg-mix-next small {
  display: block;
  color: var(--text-3);
  font-size: 12.5px;
}

.mg-mix-next strong {
  font-size: 16px;
}

/* ----------------------------------------------------------------------------
   4. ROOM LAYOUT: STAGE + SIDE PANEL
   ---------------------------------------------------------------------------- */
.mg-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
  align-items: start;
}

.mg-stage {
  --game-accent: var(--accent);
  position: relative;
  min-height: 460px;
  padding: 20px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--game-accent) 6%, var(--surface)), var(--surface) 180px);
  transition: border-color var(--t), box-shadow var(--t);
}

.mg-stage::before {
  content: "";
  position: absolute;
  top: 0;
  left: 20px;
  right: 20px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--game-accent), transparent);
  opacity: 0.8;
  pointer-events: none;
}

.mg-stage.is-awaiting {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-sm);
}

.mg-side {
  position: sticky;
  top: calc(var(--header-h) + 16px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: calc(100vh - var(--header-h) - 32px);
  overflow-y: auto;
  padding: 16px;
}

/* Room code */
.mg-code-tiles {
  display: flex;
  gap: 6px;
}

.mg-code-tiles span {
  flex: 1;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 700;
}

.mg-code-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 8px;
}

.mg-code-actions .btn {
  border: 1px solid var(--border);
  padding: 0 8px;
}

/* Player list */
.mg-side-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.mg-side-title .mg-ico {
  width: 16px;
  height: 16px;
}

.mg-side-title b {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
}

.mg-score-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: -8px 0 0;
  padding: 0;
  list-style: none;
}

.mg-score-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  transition: background var(--t-fast);
}

.mg-score-list li.is-you {
  background: var(--accent-soft);
}

.mg-score-list li.is-active {
  box-shadow: inset 0 0 0 1px var(--accent);
}

.mg-score-list li.is-empty {
  color: var(--text-3);
}

.mg-rank {
  width: 16px;
  flex: none;
  text-align: center;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
}

.mg-rank.r1 {
  color: #ca8a04;
}

.mg-rank.r2 {
  color: #64748b;
}

.mg-rank.r3 {
  color: #b45309;
}

.mg-pname {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 14px;
  font-weight: 500;
}

.mg-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-3);
  font-size: 10.5px;
  font-style: normal;
  font-weight: 600;
  vertical-align: 1px;
}

.mg-tag-you {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.mg-pstatus {
  width: 22px;
  height: 22px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.mg-pstatus .mg-ico {
  width: 13px;
  height: 13px;
}

.mg-pstatus.is-active {
  background: var(--accent);
  color: #fff;
}

.mg-pstatus.is-done {
  background: var(--success-soft);
  color: var(--success);
}

.mg-pstatus.is-dead {
  background: var(--danger-soft);
  color: var(--danger);
}

.mg-pscore {
  position: relative;
  min-width: 36px;
  text-align: right;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
}

.mg-delta {
  position: absolute;
  right: 0;
  bottom: 100%;
  color: var(--success);
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
  animation: mg-delta 1.7s var(--ease) forwards;
}

@keyframes mg-delta {
  0% {
    opacity: 0;
    transform: translateY(6px);
  }
  15% {
    opacity: 1;
    transform: none;
  }
  75% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-8px);
  }
}

.mg-side-actions {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.mg-side-actions .btn {
  justify-content: flex-start;
  width: 100%;
}

.mg-leave-btn:not(:disabled):hover {
  color: var(--danger);
  background: var(--danger-soft);
}

/* ----------------------------------------------------------------------------
   5. STAGE HEADER, TIMER, STATES
   ---------------------------------------------------------------------------- */
.mg-stage-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 12px;
}

.mg-stage-id {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.mg-stage-id strong {
  display: block;
  font-size: 16px;
  font-weight: 650;
}

.mg-stage-id small {
  display: block;
  color: var(--text-3);
  font-size: 13px;
}

.mg-stage-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.mg-your-move {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
}

.mg-your-move i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  animation: mg-pulse 1.4s infinite;
}

@keyframes mg-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

.mg-timer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13px;
  transition: background var(--t-fast), color var(--t-fast);
}

.mg-timer .mg-ico {
  width: 14px;
  height: 14px;
}

.mg-timer b {
  min-width: 3.2ch;
  font-family: var(--mono);
  font-weight: 600;
  color: var(--text);
}

.mg-timer.is-urgent {
  background: var(--danger-soft);
  border-color: transparent;
  color: var(--danger);
}

.mg-timer.is-urgent b {
  color: var(--danger);
}

.mg-timebar {
  height: 5px;
  margin-bottom: 20px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  overflow: hidden;
}

.mg-timebar i {
  display: block;
  height: 100%;
  background: var(--game-accent);
  transform-origin: left center;
  transition: transform 0.25s linear, background var(--t);
}

.mg-timebar.is-urgent i {
  background: var(--danger);
}

.mg-timebar.is-empty {
  height: 1px;
  background: var(--border);
}

.mg-round-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.mg-round-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--surface-3);
}

.mg-round-dots i.is-done {
  background: color-mix(in srgb, var(--game-accent) 45%, var(--surface-3));
}

.mg-round-dots i.is-current {
  width: 18px;
  border-radius: var(--r-pill);
  background: var(--game-accent);
}

.mg-stage-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 14px;
  font-size: 17px;
  font-weight: 650;
}

.mg-stage-title .mg-ico {
  color: var(--accent);
}

/* Waiting / info blocks */
.mg-wait-card,
.mg-turn-wait {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 14.5px;
}

.mg-wait-card .mg-ico {
  color: var(--success);
}

.mg-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
  font-size: 14.5px;
}

.mg-banner .mg-ico {
  width: 20px;
  height: 20px;
}

.mg-banner.is-good {
  background: var(--success-soft);
  border-color: transparent;
}

.mg-banner.is-good .mg-ico {
  color: var(--success);
}

.mg-banner.is-bad {
  background: var(--danger-soft);
  border-color: transparent;
}

.mg-banner.is-bad .mg-ico {
  color: var(--danger);
}

.mg-locked {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
}

.mg-locked .mg-ico {
  width: 22px;
  height: 22px;
  color: var(--accent);
}

.mg-locked small {
  display: block;
  color: var(--text-3);
  font-size: 12.5px;
}

.mg-locked strong {
  font-family: var(--mono);
  font-size: 22px;
}

.mg-reveal-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  padding: 20px;
  border-radius: var(--r-lg);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.mg-reveal-hero small {
  display: block;
  color: var(--text-3);
  font-size: 12.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mg-reveal-hero strong {
  display: block;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
}

.mg-reveal-hero span:not(.mg-avatar):not(.mg-vend-icon) {
  display: block;
  margin-top: 2px;
  color: var(--text-2);
  font-size: 14px;
}

.mg-reveal-hero.is-good {
  background: var(--success-soft);
  border-color: transparent;
}

.mg-reveal-hero.is-bad {
  background: var(--danger-soft);
  border-color: transparent;
}

.mg-lobby-btn {
  margin-top: 20px;
}

/* Inline answer forms */
.mg-inline-form {
  margin: 16px 0 4px;
}

.mg-inline-form > label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
}

.mg-inline-row {
  display: flex;
  gap: 8px;
}

.mg-send-btn {
  height: 48px;
  padding: 0 20px;
  flex: none;
}

form > .mg-send-btn {
  margin-top: 4px;
}

/* Question card */
.mg-question {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.45;
}

.mg-q-mark {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  background: var(--game-accent);
  color: #fff;
  font-size: 17px;
  font-weight: 800;
}

.mg-q-mark .mg-ico {
  width: 17px;
  height: 17px;
}

.mg-blank {
  display: inline-block;
  min-width: 70px;
  border-bottom: 2px solid var(--text-3);
  color: transparent;
  line-height: 1.1;
}

.mg-answer-reveal {
  margin-bottom: 16px;
  padding: 16px;
  border-radius: var(--r);
  background: var(--success-soft);
  text-align: center;
}

.mg-answer-reveal small {
  display: block;
  color: var(--success);
  font-size: 12.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mg-answer-reveal strong {
  font-family: var(--mono);
  font-size: 30px;
}

/* Ranked results */
.mg-rank-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mg-rank-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
}

.mg-rank-list li.is-you {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.mg-rank-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-weight: 500;
}

.mg-rank-main {
  font-family: var(--mono);
  font-weight: 600;
}

.mg-rank-sub {
  min-width: 90px;
  text-align: right;
  color: var(--text-3);
  font-size: 12.5px;
}

.mg-rank-pts {
  min-width: 52px;
  text-align: right;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--success);
}

.mg-rank-pts.is-zero {
  color: var(--text-3);
  font-weight: 500;
}

.mg-pts-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
}

.mg-pts-row .mg-label {
  width: 100%;
  margin-bottom: 2px;
}

.mg-pts-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px 0 4px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  font-size: 13px;
}

.mg-pts-chip .mg-avatar {
  width: 22px;
  height: 22px;
  font-size: 10.5px;
}

.mg-pts-chip.is-ok b {
  color: var(--success);
}

.mg-pts-chip.is-miss {
  color: var(--text-3);
}

/* ----------------------------------------------------------------------------
   6. LOBBY (inside a room)
   ---------------------------------------------------------------------------- */
.mg-invite {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 14px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px dashed color-mix(in srgb, var(--accent) 50%, var(--border));
  border-radius: var(--r);
  background: var(--accent-soft);
}

.mg-invite > div {
  flex: 1;
  min-width: 180px;
}

.mg-invite-icon {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
}

.mg-invite strong {
  font-size: 15px;
}

.mg-invite p {
  color: var(--text-2);
  font-size: 13.5px;
}

.mg-lobby-title {
  margin-top: 0;
}

.mg-stage.is-lobby .mg-group-head:first-of-type {
  margin-top: 8px;
}

.mg-result {
  --game-accent: var(--accent);
  margin-bottom: 20px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
}

.mg-result-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mg-result-icon {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  background: var(--warning-soft);
  color: var(--warning);
}

.mg-result-head small {
  display: block;
  color: var(--text-3);
  font-size: 12.5px;
}

.mg-result-head strong {
  font-size: 16.5px;
}

.mg-podium {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 10px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.mg-podium li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 14px 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  text-align: center;
}

.mg-podium li.p1 {
  order: 2;
  padding-top: 22px;
  border-color: color-mix(in srgb, #ca8a04 45%, var(--border));
}

.mg-podium li.p2 {
  order: 1;
}

.mg-podium li.p3 {
  order: 3;
}

.mg-podium-medal {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-3);
  font-size: 12px;
  font-weight: 700;
}

.p1 .mg-podium-medal {
  background: #ca8a04;
  color: #fff;
}

.p1 .mg-podium-medal .mg-ico {
  width: 14px;
  height: 14px;
}

.mg-podium strong {
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 14px;
}

.mg-podium li > span:last-child {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-2);
}

/* ----------------------------------------------------------------------------
   7. GAMES
   ---------------------------------------------------------------------------- */

/* Reflex Duel */
.mg-reflex-pad {
  width: 100%;
  min-height: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  border: 0;
  border-radius: var(--r-lg);
  color: #fff;
  text-align: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  transition: background 0.08s linear;
}

.mg-reflex-pad.is-wait {
  background: #b91c1c;
}

.mg-reflex-pad.is-go {
  background: #16a34a;
}

.mg-reflex-pad.is-early {
  background: #7f1d1d;
  animation: mg-shake 0.35s;
}

.mg-reflex-pad.is-clicked {
  background: #1d4ed8;
}

.mg-reflex-pad.is-done {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  cursor: default;
}

.mg-reflex-icon .mg-ico {
  width: 46px;
  height: 46px;
}

.mg-reflex-big {
  font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.mg-reflex-sub {
  font-size: 15px;
  opacity: 0.85;
}

@keyframes mg-shake {
  0%,
  100% {
    transform: none;
  }
  25% {
    transform: translateX(-6px);
  }
  75% {
    transform: translateX(6px);
  }
}

.mg-reaction {
  margin-top: 18px;
}

.mg-rt-list,
.mg-vote-bars {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mg-rt-list li,
.mg-vote-bars li {
  display: grid;
  grid-template-columns: 30px minmax(80px, 160px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-size: 14px;
}

.mg-rt-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-weight: 500;
}

.mg-rt-bar {
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  overflow: hidden;
}

.mg-rt-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--game-accent);
}

.mg-rt-list b,
.mg-vote-bars b {
  min-width: 64px;
  text-align: right;
  font-family: var(--mono);
  font-size: 13px;
}

.mg-rt-list li.is-win {
  background: var(--success-soft);
}

.mg-rt-list li.is-win b {
  color: var(--success);
}

.mg-rt-list li.is-bad b {
  color: var(--danger);
}

/* Draw & Guess + Telephone canvas */
.mg-choose {
  margin-bottom: 14px;
}

.mg-choose-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.mg-choice {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 20px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  transition: border-color var(--t-fast), background var(--t-fast);
}

.mg-choice:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.mg-choice .mg-ico {
  width: 16px;
  height: 16px;
  color: var(--game-accent);
}

.mg-draw-word {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 14px;
  min-height: 62px;
  margin-bottom: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
  text-align: center;
}

.mg-draw-word.is-waiting {
  color: var(--text-2);
}

.mg-draw-word small {
  display: block;
  width: 100%;
  margin-bottom: -6px;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mg-draw-word strong {
  font-size: 22px;
  font-weight: 750;
  letter-spacing: 0.02em;
}

.mg-draw-word.is-reveal {
  background: var(--success-soft);
  border-color: transparent;
}

.mg-letters {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.mg-letters i {
  width: 22px;
  height: 32px;
  display: grid;
  place-items: center;
  border-bottom: 3px solid var(--text);
  font-family: var(--mono);
  font-size: 20px;
  font-style: normal;
  font-weight: 700;
}

.mg-letters i.is-gap {
  width: 10px;
  border-bottom: 0;
}

.mg-letter-count {
  color: var(--text-3);
  font-size: 12.5px;
}

.mg-draw-area {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 12px;
  align-items: stretch;
}

.mg-canvas-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.mg-canvas-slot {
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  background: #fff;
}

.mg-canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 800 / 560;
  touch-action: none;
  cursor: default;
}

.mg-canvas.is-drawer {
  cursor: crosshair;
}

.mg-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
}

.mg-tool-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}

.mg-swatch {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--sw);
  box-shadow: 0 0 0 1px var(--border-strong);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}

.mg-swatch:hover {
  transform: scale(1.08);
}

.mg-swatch.is-active {
  box-shadow: 0 0 0 2px var(--accent);
  transform: scale(1.1);
}

.mg-swatch.is-eraser {
  background:
    linear-gradient(135deg, transparent 45%, var(--danger) 45%, var(--danger) 55%, transparent 55%),
    #fff;
}

.mg-size {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
}

.mg-size i {
  display: block;
  border-radius: 50%;
  background: var(--text);
}

.mg-size.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.mg-tools > .btn {
  margin-left: auto;
}

.mg-tel-send {
  margin-left: auto;
}

/* Chat */
.mg-chat {
  display: flex;
  flex-direction: column;
  min-height: 300px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
  overflow: hidden;
}

.mg-draw-area .mg-chat {
  max-height: 560px;
}

.mg-chat > .mg-label {
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.mg-chat-log {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 0;
  margin: 0;
  padding: 10px;
  overflow-y: auto;
  list-style: none;
  font-size: 14px;
  line-height: 1.45;
}

.mg-chat-log li {
  padding: 4px 8px;
  border-radius: 6px;
  overflow-wrap: anywhere;
}

.mg-chat-log li.is-correct {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--success-soft);
  color: var(--success);
  font-weight: 600;
}

.mg-chat-log li.is-sys {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-3);
  font-size: 13px;
}

.mg-chat-log .mg-ico {
  width: 14px;
  height: 14px;
}

.mg-chat-form {
  padding: 8px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* Impostor */
.mg-role-card {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
}

.mg-role-icon {
  width: 48px;
  height: 48px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--r);
  background: var(--accent-soft);
  color: var(--accent-text);
}

.mg-role-icon .mg-ico {
  width: 24px;
  height: 24px;
}

.mg-role-card small {
  display: block;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mg-role-card strong {
  display: block;
  font-size: 21px;
  font-weight: 750;
  line-height: 1.25;
}

.mg-role-card p {
  color: var(--text-2);
  font-size: 13.5px;
}

.mg-role-card.is-impostor {
  background: var(--danger-soft);
  border-color: transparent;
}

.mg-role-card.is-impostor .mg-role-icon {
  background: var(--danger);
  color: #fff;
}

.mg-turn-order {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.mg-turn-order li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px 0 4px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
}

.mg-turn-order .mg-avatar {
  width: 24px;
  height: 24px;
  font-size: 11px;
}

.mg-turn-order li.is-turn {
  border-color: var(--accent);
  background: var(--accent-soft);
  font-weight: 650;
}

.mg-turn-order li.is-past {
  opacity: 0.55;
}

.mg-clues {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.mg-clue-round ul {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mg-clue-round li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.mg-clue-round li b {
  min-width: 70px;
  font-size: 13.5px;
  font-weight: 600;
}

.mg-bubble {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 12px 12px 12px 4px;
  background: var(--surface-2);
  font-weight: 500;
}

.mg-clue-round li.is-skip {
  opacity: 0.6;
}

.mg-clue-round li.is-skip .mg-bubble {
  font-style: italic;
}

.mg-vote-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.mg-vote-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast);
}

.mg-vote-card:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.mg-vote-card span:last-child {
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.mg-vote-bars {
  margin-top: 0;
}

.mg-vote-bars li > span:nth-child(2) {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-weight: 500;
}

.mg-vote-bars li > span:nth-child(2) .mg-ico {
  width: 15px;
  height: 15px;
  color: var(--danger);
}

.mg-vote-bars li.is-impostor {
  background: var(--danger-soft);
}

.mg-vote-bars li.is-impostor .mg-rt-bar i {
  background: var(--danger);
}

/* Mini Football */
.mg-ball-score {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.mg-ball-team strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mg-ball-team.is-red strong {
  color: #e11d48;
}

.mg-ball-team.is-blue strong {
  color: #2563eb;
}

html[data-theme="dark"] .mg-ball-team.is-red strong {
  color: #fb7185;
}

html[data-theme="dark"] .mg-ball-team.is-blue strong {
  color: #60a5fa;
}

.mg-ball-team ul {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  color: var(--text-2);
}

.mg-ball-team.is-blue {
  text-align: right;
}

.mg-ball-team.is-blue ul {
  justify-content: flex-end;
}

.mg-ball-team li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mg-ball-team li.is-you {
  color: var(--text);
  font-weight: 700;
}

.mg-ball-dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: currentColor;
}

.mg-ball-team.is-red .mg-ball-dot,
.mg-ball-goals li.is-red .mg-ball-dot {
  background: #e11d48;
}

.mg-ball-team.is-blue .mg-ball-dot,
.mg-ball-goals li.is-blue .mg-ball-dot {
  background: #2563eb;
}

.mg-ball-nums {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 34px;
  font-weight: 800;
  line-height: 1.1;
}

.mg-ball-nums span {
  color: var(--text-3);
  font-size: 26px;
}

.mg-ball-nums .is-red {
  color: #e11d48;
}

.mg-ball-nums .is-blue {
  color: #2563eb;
}

html[data-theme="dark"] .mg-ball-nums .is-red {
  color: #fb7185;
}

html[data-theme="dark"] .mg-ball-nums .is-blue {
  color: #60a5fa;
}

.mg-ball-wrap {
  overflow: hidden;
  border-radius: var(--r);
  background: #2f6b3f;
}

.mg-ball-canvas {
  width: 100%;
  height: auto;
  touch-action: none;
}

.mg-ball-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: var(--text-2);
  font-size: 13.5px;
}

.mg-ball-hint .mg-ico {
  width: 16px;
  height: 16px;
  color: var(--text-3);
}

.mg-ball-hint.is-host {
  margin-top: 4px;
  color: var(--text-3);
}

.mg-ball-goals {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mg-ball-goals li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  font-size: 13px;
}

.mg-ball-goals em {
  color: var(--danger);
  font-style: normal;
  font-size: 12px;
}

.mg-ball-goals small {
  color: var(--text-3);
  font-family: var(--mono);
}

.mg-stage-ball .mg-label {
  margin-top: 16px;
}

.mg-ball-ot {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: transparent;
}

/* Touch pad — only on touch screens */
.mg-ball-touch {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
  -webkit-user-select: none;
  user-select: none;
}

@media (any-pointer: coarse) {
  .mg-ball-touch {
    display: flex;
  }
}

@media (max-width: 440px) {
  .mg-ball-touch {
    gap: 10px;
  }
  .mg-dpad {
    grid-template-columns: repeat(3, 46px);
    grid-template-rows: repeat(3, 46px);
    gap: 3px;
  }
  .mg-kick-btn {
    width: 74px;
    height: 74px;
  }
  .mg-sprint-btn {
    width: 54px;
    height: 54px;
    font-size: 0.72rem;
  }
  .mg-ball-acts {
    gap: 10px;
  }
}

.mg-dpad {
  display: grid;
  grid-template-columns: repeat(3, 58px);
  grid-template-rows: repeat(3, 58px);
  gap: 4px;
}

.mg-dpad-btn,
.mg-kick-btn {
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.mg-dpad-btn {
  border-radius: var(--r);
}

.mg-dpad-btn svg {
  width: 26px;
  height: 26px;
}

.mg-dpad-btn.is-u {
  grid-area: 1 / 2;
}

.mg-dpad-btn.is-l {
  grid-area: 2 / 1;
}

.mg-dpad-btn.is-l svg {
  transform: rotate(-90deg);
}

.mg-dpad-btn.is-r {
  grid-area: 2 / 3;
}

.mg-dpad-btn.is-r svg {
  transform: rotate(90deg);
}

.mg-dpad-btn.is-d {
  grid-area: 3 / 2;
}

.mg-dpad-btn.is-d svg {
  transform: rotate(180deg);
}

.mg-kick-btn {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.mg-kick-btn .mg-ico {
  width: 34px;
  height: 34px;
}

.mg-dpad-btn.is-down {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.mg-kick-btn.is-down {
  background: var(--accent-hover);
  transform: scale(0.96);
}

.mg-ball-acts {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mg-sprint-btn {
  width: 68px;
  height: 68px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 750;
  font-size: 0.8rem;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.mg-sprint-btn.is-down {
  background: var(--accent-soft);
  border-color: var(--accent);
}

/* Vampire Village */
.mg-vrole.is-vampire {
  background: var(--danger-soft);
  border-color: transparent;
}

.mg-vrole.is-vampire .mg-role-icon {
  background: var(--danger);
  color: #fff;
}

.mg-vrole.is-doctor .mg-role-icon {
  background: var(--success-soft);
  color: var(--success);
}

.mg-vrole.is-detective .mg-role-icon {
  background: var(--accent-soft);
  color: var(--accent-text);
}

.mg-vrole.is-hunter .mg-role-icon {
  background: var(--warning-soft);
  color: var(--warning);
}

.mg-vrole.is-villager .mg-role-icon {
  background: var(--surface-3);
  color: var(--text-2);
}

.mg-vmates {
  margin-top: 4px;
  color: var(--danger) !important;
  font-weight: 600;
}

.mg-vphase.is-night {
  color: #6366f1;
  background: color-mix(in srgb, #6366f1 14%, transparent);
  border-color: transparent;
}

html[data-theme="dark"] .mg-vphase.is-night {
  color: #a5b4fc;
}

.mg-vphase.is-day {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: transparent;
}

.mg-vgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin: 4px 0 12px;
}

.mg-vcard {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 14px 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--text);
  cursor: default;
  transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast);
}

.mg-vcard:disabled {
  opacity: 1;
}

.mg-vcard.is-pickable {
  cursor: pointer;
}

.mg-vcard.is-pickable:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.mg-vcard.is-picked {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent);
}

.mg-vcard.is-you {
  border-style: dashed;
}

.mg-vcard.is-dead {
  opacity: 0.45;
  filter: grayscale(1);
}

.mg-vcard-name {
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 13.5px;
  font-weight: 600;
}

.mg-vtag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.mg-vtag .mg-ico {
  width: 12px;
  height: 12px;
}

.mg-vtag.is-vampire {
  background: var(--danger-soft);
  color: var(--danger);
}

.mg-vtag.is-doctor {
  background: var(--success-soft);
  color: var(--success);
}

.mg-vtag.is-detective {
  background: var(--accent-soft);
  color: var(--accent-text);
}

.mg-vtag.is-hunter {
  background: var(--warning-soft);
  color: var(--warning);
}

.mg-vcount {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  border-radius: var(--r-pill);
  background: var(--danger);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.mg-vvoters {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2px;
}

.mg-vvoters.is-team .mg-avatar {
  box-shadow: 0 0 0 2px var(--danger);
}

.mg-vskip {
  border: 1px solid var(--border);
}

.mg-vskip.is-picked {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-text);
}

.mg-vpicked {
  margin: -4px 0 12px;
  color: var(--text-2);
  font-size: 13.5px;
}

.mg-vchat {
  margin-top: 16px;
  height: 300px;
  min-height: 0;
}

.mg-vchat.is-night {
  border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
}

.mg-vchat.is-night > .mg-label {
  color: var(--danger);
}

.mg-vinspect,
.mg-vlog,
.mg-vroles {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.mg-stage-vampire > .mg-label {
  margin-top: 18px;
}

.mg-vinspect li,
.mg-vroles li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 14px;
}

.mg-vinspect small {
  min-width: 56px;
  color: var(--text-3);
  font-size: 12px;
}

.mg-vinspect li > span:not(.mg-avatar),
.mg-vroles li > span:nth-child(2) {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-weight: 500;
}

.mg-vinspect b {
  color: var(--success);
  font-size: 13px;
}

.mg-vinspect li.is-vamp {
  background: var(--danger-soft);
  border-color: transparent;
}

.mg-vinspect li.is-vamp b {
  color: var(--danger);
}

.mg-vroles li.is-you {
  border-color: var(--accent);
}

.mg-vroles li.is-dead {
  opacity: 0.6;
}

.mg-vroles em {
  color: var(--danger);
  font-size: 12px;
  font-style: normal;
}

.mg-vlog li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--text-2);
}

.mg-vlog li:last-child {
  border-bottom: 0;
}

.mg-vlog li > span:nth-child(2) {
  flex: 1;
  min-width: 0;
}

.mg-vlog b {
  color: var(--text);
}

.mg-vend-icon {
  width: 60px;
  height: 60px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--r-lg);
  background: var(--surface);
}

.mg-vend-icon .mg-ico {
  width: 30px;
  height: 30px;
}

.is-bad > .mg-vend-icon {
  color: var(--danger);
}

.is-good > .mg-vend-icon {
  color: var(--warning);
}

/* Speed Typing */
.mg-typing-text {
  margin-bottom: 12px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
  font-size: 20px;
  line-height: 1.65;
  color: var(--text-2);
  -webkit-user-select: none;
  user-select: none;
}

.mg-typing-text .is-ok {
  color: var(--success);
}

.mg-typing-text .is-bad {
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: 3px;
}

.mg-typing-text .is-next {
  border-radius: 3px;
  background: var(--accent-soft);
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.mg-typing-text.is-done {
  color: var(--text-3);
  font-size: 16px;
}

.mg-type-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.mg-type-bar {
  flex: 1;
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  overflow: hidden;
}

.mg-type-bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--game-accent);
  transition: width 0.15s var(--ease);
}

.mg-type-progress b {
  min-width: 4ch;
  text-align: right;
  font-family: var(--mono);
  font-size: 13px;
}

.mg-typing-input {
  height: 54px;
  font-size: 18px;
}

/* Who Said It? */
.mg-ws-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}

.mg-ws-card {
  --pc: var(--accent);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
}

.mg-ws-card.is-mine {
  background: var(--surface-2);
  border-style: dashed;
}

.mg-ws-card.is-revealed {
  border-left: 3px solid var(--pc);
}

.mg-ws-quote {
  color: var(--text-3);
}

.mg-ws-quote .mg-ico {
  width: 18px;
  height: 18px;
}

.mg-ws-card p {
  flex: 1;
  font-size: 16px;
  font-weight: 550;
  overflow-wrap: anywhere;
}

.mg-ws-card small {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-3);
  font-size: 12.5px;
}

.mg-ws-card small .mg-ico {
  width: 14px;
  height: 14px;
}

.mg-ws-author {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mg-ws-author strong {
  font-size: 14px;
}

.mg-ws-author em {
  margin-left: auto;
  color: var(--text-3);
  font-size: 12.5px;
  font-style: normal;
}

/* Trivia */
.mg-trivia-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.mg-trivia-opt {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 66px;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  font-size: 15.5px;
  font-weight: 550;
  transition: border-color var(--t-fast), background var(--t-fast), opacity var(--t-fast);
}

.mg-trivia-opt:not(:disabled):hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.mg-trivia-opt:disabled {
  cursor: default;
}

.mg-trivia-letter {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
}

.mg-trivia-text {
  flex: 1;
  min-width: 0;
}

.mg-trivia-mark {
  width: 22px;
  height: 22px;
}

.mg-trivia-who {
  display: flex;
  gap: 2px;
}

.mg-trivia-grid.has-pick .mg-trivia-opt:not(.is-picked) {
  opacity: 0.5;
}

.mg-trivia-opt.is-picked {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.mg-trivia-opt.is-picked .mg-trivia-letter {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.mg-trivia-opt.is-correct {
  border-color: var(--success);
  background: var(--success-soft);
}

.mg-trivia-opt.is-correct .mg-trivia-letter,
.mg-trivia-opt.is-correct .mg-trivia-mark {
  color: var(--success);
}

.mg-trivia-opt.is-correct .mg-trivia-letter {
  border-color: var(--success);
}

.mg-trivia-opt.is-wrong {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.mg-trivia-opt.is-wrong .mg-trivia-mark {
  color: var(--danger);
}

.mg-trivia-opt.is-dim {
  opacity: 0.5;
}

/* Funny Answers */
.mg-funny-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.mg-funny-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 110px;
  padding: 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  font-size: 16px;
  font-weight: 550;
  transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast);
}

button.mg-funny-card:not(:disabled):hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.mg-funny-card:disabled {
  cursor: default;
}

.mg-funny-card > span:first-child,
.mg-funny-card > span:not(.mg-funny-crown) {
  flex: 1;
  overflow-wrap: anywhere;
}

.mg-funny-card small {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-3);
  font-size: 12.5px;
  font-weight: 500;
}

.mg-funny-card small .mg-ico {
  width: 14px;
  height: 14px;
}

.mg-funny-card.is-mine {
  border-style: dashed;
  background: var(--surface-2);
}

.mg-funny-card.is-voted {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.mg-funny-card.is-voted small {
  color: var(--accent-text);
}

.mg-funny-card.is-winner {
  border-color: #ca8a04;
  background: var(--warning-soft);
}

.mg-funny-crown {
  position: absolute;
  top: -11px;
  right: 12px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #ca8a04;
  color: #fff;
}

.mg-funny-crown .mg-ico {
  width: 14px;
  height: 14px;
}

/* Write → Draw → Guess */
.mg-tel-prompt {
  margin-bottom: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
}

.mg-tel-prompt small {
  display: block;
  color: var(--text-3);
  font-size: 12.5px;
  font-weight: 600;
}

.mg-tel-prompt strong {
  font-size: 19px;
  font-weight: 700;
}

.mg-tel-prev {
  max-width: 560px;
  margin-bottom: 4px;
}

.mg-thumb {
  width: 100%;
  height: auto;
  aspect-ratio: 400 / 280;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: #fff;
}

.mg-albums {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.mg-album {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
}

.mg-album h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 14.5px;
}

.mg-album ol {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mg-album li {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mg-album li.is-text p {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 15px;
  font-weight: 550;
  overflow-wrap: anywhere;
}

.mg-album-by {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-3);
  font-size: 12px;
}

.mg-album-arrow {
  display: grid;
  place-items: center;
  color: var(--text-3);
}

.mg-album-arrow .mg-ico {
  width: 16px;
  height: 16px;
  transform: rotate(90deg);
}

/* ----------------------------------------------------------------------------
   8. ENTRANCE ANIMATION (plays once; re-renders add .mg-still)
   ---------------------------------------------------------------------------- */
.mg-result,
.mg-role-card,
.mg-reveal-hero,
.mg-answer-reveal,
.mg-rank-list li,
.mg-ws-card,
.mg-funny-card,
.mg-album,
.mg-trivia-opt,
.mg-chat-log li,
.mg-clue-round li {
  animation: mg-in 0.28s var(--ease) both;
}

.mg-rt-bar i {
  animation: mg-grow 0.5s var(--ease) both;
  transform-origin: left center;
}

.mg-still {
  animation: none !important;
}

.mg-still .mg-rt-bar i,
.mg-rt-bar.mg-still i {
  animation: none !important;
}

@keyframes mg-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes mg-grow {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .mg-section *,
  .mg-section *::before,
  .mg-section *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ----------------------------------------------------------------------------
   8b. PLAY MODE (.mg-section.is-playing, set by games.js while a game runs)
   Wider page, no big header, slimmer side panel, play area sized to the screen.
   ---------------------------------------------------------------------------- */
.mg-section.is-playing {
  padding-top: 16px;
}

.mg-section.is-playing > .container {
  max-width: 1600px;
}

.mg-section.is-playing .mg-header {
  display: none;
}

.mg-section.is-playing .mg-layout {
  grid-template-columns: minmax(0, 1fr) 248px;
  gap: 14px;
}

.mg-section.is-playing .mg-stage {
  min-height: calc(100vh - var(--header-h) - 48px);
}

/* Compact room code + actions in the side panel */
.mg-section.is-playing .mg-side {
  gap: 12px;
  padding: 12px;
}

.mg-section.is-playing .mg-code-tiles span {
  height: 36px;
  font-size: 18px;
}

.mg-section.is-playing .mg-side-actions .mg-sound-btn {
  width: 100%;
  justify-content: flex-start;
  border-color: var(--border);
  background: transparent;
}

/* Mini Football: the pitch fills the width, capped by the screen height */
.mg-section.is-playing .mg-ball-wrap {
  display: flex;
  justify-content: center;
}

.mg-section.is-playing .mg-ball-slot {
  width: 100%;
  max-width: max(320px, calc((100vh - var(--header-h) - 190px) * 1.847));
}

/* Draw & Guess and Telephone canvases: as large as the screen height allows */
.mg-section.is-playing .mg-canvas {
  max-width: max(280px, calc((100vh - var(--header-h) - 230px) * 1.4286));
  margin: 0 auto;
}

@media (max-height: 600px) {
  .mg-section.is-playing .mg-ball-slot,
  .mg-section.is-playing .mg-canvas {
    max-width: 100%;
  }
}

/* ----------------------------------------------------------------------------
   9. RESPONSIVE
   ---------------------------------------------------------------------------- */
@media (max-width: 1080px) {
  .mg-layout {
    grid-template-columns: minmax(0, 1fr) 260px;
  }
  .mg-draw-area {
    grid-template-columns: 1fr;
  }
  .mg-draw-area .mg-chat {
    min-height: 0;
    height: 260px;
  }
}

@media (max-width: 900px) {
  .mg-entry-grid {
    grid-template-columns: 1fr;
  }
  .mg-av-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }
  .mg-layout {
    grid-template-columns: 1fr;
  }
  .mg-side {
    position: static;
    max-height: none;
    overflow: visible;
  }
  /* While a game runs, the play area comes first and the scoreboard below it */
  .mg-layout.is-playing .mg-side {
    order: 2;
  }
  .mg-section.is-playing .mg-layout {
    grid-template-columns: 1fr;
  }
  .mg-section.is-playing .mg-stage {
    min-height: 0;
  }
  .mg-section.is-playing .mg-ball-slot,
  .mg-section.is-playing .mg-canvas {
    max-width: 100%;
  }
  .mg-score-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 4px;
  }
  .mg-side-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .mg-side-actions .btn {
    width: auto;
    flex: 1 1 auto;
    justify-content: center;
    border: 1px solid var(--border);
  }
}

@media (max-width: 640px) {
  .mg-section {
    padding-top: 20px;
  }
  .mg-act-grid {
    grid-template-columns: 1fr;
  }
  .mg-profile {
    gap: 14px;
  }
  .mg-profile .mg-avatar.is-xxl {
    width: 72px;
    height: 72px;
    font-size: 38px;
  }
  .mg-av-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  .mg-header {
    align-items: flex-start;
  }
  .mg-header:not(.is-compact) {
    flex-direction: column;
    align-items: stretch;
  }
  .mg-header:not(.is-compact) .mg-sound-btn {
    align-self: flex-start;
  }
  .mg-sound-btn span {
    display: none;
  }
  .mg-sound-btn {
    width: 36px;
    padding: 0;
    justify-content: center;
  }
  .mg-entry,
  .mg-how {
    padding: 18px;
  }
  .mg-stage {
    min-height: 0;
    padding: 14px;
  }
  .mg-question {
    padding: 14px;
    font-size: 16.5px;
  }
  .mg-trivia-grid {
    grid-template-columns: 1fr;
  }
  .mg-trivia-opt {
    min-height: 56px;
  }
  .mg-reflex-pad {
    min-height: 56vh;
  }
  .mg-inline-row {
    flex-direction: column;
  }
  .mg-send-btn {
    width: 100%;
  }
  .mg-rt-list li,
  .mg-vote-bars li {
    grid-template-columns: 30px minmax(0, 1fr) auto;
  }
  .mg-rt-list .mg-rt-bar,
  .mg-vote-bars .mg-rt-bar {
    display: none;
  }
  .mg-rank-sub {
    display: none;
  }
  .mg-ball-score {
    gap: 8px;
  }
  .mg-ball-nums {
    font-size: 26px;
    padding: 4px 10px;
  }
  .mg-podium {
    gap: 6px;
  }
  .mg-podium li {
    padding: 10px 6px;
  }
  .mg-typing-text {
    font-size: 17px;
    padding: 14px;
  }
  .mg-tools {
    gap: 6px;
  }
  .mg-swatch {
    width: 26px;
    height: 26px;
  }
}

/* ----------------------------------------------------------------------------
   SECRET COUNCIL
   ---------------------------------------------------------------------------- */
.mg-crole.is-loyal .mg-role-icon {
  background: #2563eb;
  color: #fff;
}

.mg-crole.is-traitor,
.mg-crole.is-shadow {
  background: var(--danger-soft);
  border-color: transparent;
}

.mg-crole.is-traitor .mg-role-icon {
  background: var(--danger);
  color: #fff;
}

.mg-crole.is-shadow .mg-role-icon {
  background: linear-gradient(135deg, #7f1d1d, #111);
  color: #fbbf24;
  box-shadow: 0 0 0 2px var(--danger);
}

.mg-vtag.is-cloyal {
  background: rgba(37, 99, 235, 0.18);
  color: #93c5fd;
}

.mg-vtag.is-ctraitor {
  background: var(--danger-soft);
  color: var(--danger);
}

.mg-vtag.is-cshadow {
  background: var(--danger);
  color: #fff;
}

/* Board: two decree tracks + failed-vote tracker */
.mg-cboard {
  display: grid;
  grid-template-columns: 5fr 6fr;
  gap: 12px;
  margin-bottom: 14px;
}

.mg-ctrack {
  padding: 12px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.mg-ctrack.is-loyal {
  --tc: #3b82f6;
  background: linear-gradient(160deg, rgba(37, 99, 235, 0.16), var(--surface-2) 70%);
  border-color: rgba(59, 130, 246, 0.3);
}

.mg-ctrack.is-traitor {
  --tc: #ef4444;
  background: linear-gradient(160deg, rgba(220, 38, 38, 0.16), var(--surface-2) 70%);
  border-color: rgba(239, 68, 68, 0.3);
}

.mg-ctrack-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  color: var(--tc);
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mg-ctrack-label .mg-ico {
  width: 15px;
  height: 15px;
}

.mg-ctrack-label b {
  margin-left: auto;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.mg-cslots {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 6px;
}

.mg-cslot {
  aspect-ratio: 3 / 4;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1.5px dashed color-mix(in srgb, var(--tc) 40%, transparent);
  color: color-mix(in srgb, var(--tc) 55%, transparent);
}

.mg-cslot .mg-ico {
  width: 16px;
  height: 16px;
}

.mg-cslot.is-danger {
  background: color-mix(in srgb, var(--tc) 8%, transparent);
}

.mg-cslot.is-on {
  border: 0;
  background: var(--tc);
  color: #fff;
  box-shadow: 0 6px 16px -8px var(--tc);
  animation: mg-in 0.35s var(--ease) both;
}

.mg-cwarn {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  color: #fbbf24;
  font-size: 12.5px;
  font-weight: 600;
}

.mg-cwarn .mg-ico {
  width: 14px;
  height: 14px;
  flex: none;
}

.mg-cmeta {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.mg-ctracker {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.mg-ctracker small {
  margin-right: 3px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
}

.mg-ctracker i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid var(--warning);
}

.mg-ctracker i.is-on {
  background: var(--warning);
}

/* Last vote banner with yes / no voters */
.mg-cvoters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
  margin-top: 4px;
}

.mg-cvoters em {
  margin: 0 3px 0 6px;
  color: var(--text-2);
  font-size: 12px;
  font-style: normal;
  font-weight: 600;
}

.mg-cvoters em:first-child {
  margin-left: 0;
}

.mg-cenacted.is-loyal {
  background: rgba(37, 99, 235, 0.14);
  color: #93c5fd;
}

.mg-cenacted.is-traitor {
  background: var(--danger-soft);
  color: var(--danger);
}

/* Proposed government + ballot */
.mg-cgov {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin: 6px 0 4px;
}

.mg-cgov-seat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 110px;
}

.mg-cgov-seat small {
  color: var(--text-3);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mg-cgov-plus {
  color: var(--text-3);
  font-size: 22px;
  font-weight: 700;
}

.mg-cvote-q {
  justify-content: center;
  text-align: center;
}

.mg-cballot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-width: 440px;
  margin: 10px auto 6px;
}

.mg-cballot-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 12px;
  border-radius: var(--r-lg);
  border: 2px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 17px;
  font-weight: 750;
  cursor: pointer;
  transition: transform var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}

.mg-cballot-btn .mg-ico {
  width: 28px;
  height: 28px;
}

.mg-cballot-btn:hover {
  transform: translateY(-2px);
}

.mg-cballot-btn.is-yes {
  color: var(--success);
}

.mg-cballot-btn.is-no {
  color: var(--danger);
}

.mg-cballot-btn.is-yes.is-picked {
  border-color: var(--success);
  background: var(--success-soft);
}

.mg-cballot-btn.is-no.is-picked {
  border-color: var(--danger);
  background: var(--danger-soft);
}

/* Decree cards */
.mg-chand {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  margin: 10px 0 16px;
}

.mg-ccard {
  width: 118px;
  aspect-ratio: 3 / 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  border-radius: 14px;
  border: 2px solid transparent;
  font: inherit;
  color: #fff;
  cursor: default;
  animation: mg-in 0.3s var(--ease) both;
  transition: transform 0.2s var(--ease), box-shadow 0.2s;
}

.mg-ccard.is-loyal {
  background: linear-gradient(160deg, #3b82f6, #1e3a8a);
  border-color: #60a5fa;
}

.mg-ccard.is-traitor {
  background: linear-gradient(160deg, #ef4444, #7f1d1d);
  border-color: #f87171;
}

.mg-ccard.is-back {
  background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 8px, var(--surface-3) 8px, var(--surface-3) 16px);
  border-color: var(--border-strong);
  color: var(--text-3);
}

.mg-chand.is-hidden .mg-ccard {
  width: 78px;
}

.mg-ccard-icon .mg-ico,
.mg-ccard.is-back .mg-ico {
  width: 34px;
  height: 34px;
}

.mg-ccard strong {
  font-size: 15px;
  font-weight: 750;
}

.mg-ccard em {
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: rgba(0, 0, 0, 0.3);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.mg-ccard[data-mg] {
  cursor: pointer;
}

.mg-ccard[data-mg]:hover {
  transform: translateY(-6px) rotate(-1deg);
  box-shadow: 0 16px 30px -12px rgba(0, 0, 0, 0.6);
}

/* Player grid extras */
.mg-cgrid .mg-vcard {
  position: relative;
}

.mg-cseat {
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: #ca8a04;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}

.mg-cseat .mg-ico {
  width: 11px;
  height: 11px;
}

.mg-cgrid .mg-vcard.is-voted {
  border-color: color-mix(in srgb, var(--success) 50%, var(--border));
}

/* History */
.mg-chist {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 4px;
  padding: 0;
  list-style: none;
}

.mg-chist li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-size: 13px;
}

.mg-chist li .mg-ico {
  width: 15px;
  height: 15px;
  flex: none;
}

.mg-chist li span {
  flex: 1;
  min-width: 0;
}

.mg-chist li.is-loyal .mg-ico,
.mg-chist li.is-loyal b {
  color: #60a5fa;
}

.mg-chist li.is-traitor .mg-ico,
.mg-chist li.is-traitor b {
  color: var(--danger);
}

.mg-chist li.is-power {
  color: var(--text-2);
}

@media (max-width: 640px) {
  .mg-cboard {
    grid-template-columns: 1fr;
  }
  .mg-ccard {
    width: 96px;
  }
  .mg-cgov {
    gap: 8px;
  }
  .mg-cgov-seat {
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mg-ccard,
  .mg-cslot.is-on {
    animation: none;
  }
  .mg-ccard[data-mg]:hover,
  .mg-cballot-btn:hover {
    transform: none;
  }
}

/* ----------------------------------------------------------------------------
   DETECTIVE MANOR
   ---------------------------------------------------------------------------- */
.mg-mn-order li em {
  min-width: 20px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11px;
  font-style: normal;
  text-align: center;
}

.mg-mn-order li.is-out {
  opacity: 0.55;
}

.mg-mn-outtag {
  color: var(--danger);
  font-size: 11px;
}

.mg-mn-emoji {
  font-size: 1.15em;
  line-height: 1;
}

/* Card chips: blue suspects, amber tools, green rooms */
.mg-mn-card {
  --kc: #60a5fa;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 11px 0 8px;
  border-radius: 9px;
  border: 1px solid color-mix(in srgb, var(--kc) 40%, transparent);
  background: color-mix(in srgb, var(--kc) 13%, var(--surface));
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.mg-mn-card.is-t {
  --kc: #f59e0b;
}

.mg-mn-card.is-r {
  --kc: #34d399;
}

.mg-mn-card.is-big {
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  width: 128px;
  height: 150px;
  padding: 10px;
  border-width: 2px;
  border-radius: 14px;
  background: linear-gradient(165deg, color-mix(in srgb, var(--kc) 30%, var(--surface)), var(--surface) 80%);
  text-align: center;
  white-space: normal;
}

.mg-mn-card.is-big .mg-mn-emoji {
  font-size: 40px;
}

.mg-mn-card.is-reveal {
  animation: mg-mn-flip 0.5s var(--ease) both;
  box-shadow: 0 14px 34px -14px var(--kc);
}

@keyframes mg-mn-flip {
  from {
    transform: rotateY(90deg) scale(0.9);
  }
  to {
    transform: none;
  }
}

.mg-mn-card.is-pickable {
  cursor: pointer;
  transition: transform 0.2s var(--ease);
}

.mg-mn-card.is-pickable:hover {
  transform: translateY(-6px);
}

.mg-mn-hand {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.mg-mn-hand.is-choose {
  justify-content: center;
  gap: 14px;
}

.mg-mn-hand.is-public .mg-mn-card {
  opacity: 0.8;
}

.mg-mn-triple {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

/* The question just asked */
.mg-mn-ask {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
  padding: 14px;
  border-radius: var(--r);
  border: 1px solid color-mix(in srgb, var(--game-accent) 40%, var(--border));
  background: color-mix(in srgb, var(--game-accent) 10%, var(--surface-2));
}

.mg-mn-ask.is-unanswered {
  border-color: var(--warning);
  background: var(--warning-soft);
}

.mg-mn-ask-who {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
}

.mg-mn-ask-res {
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 600;
}

.mg-mn-shown,
.mg-mn-solution {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  perspective: 600px;
}

.mg-mn-solution {
  margin: 4px 0 16px;
}

/* Picker */
.mg-mn-picker {
  margin-bottom: 16px;
  padding: 16px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.mg-mn-picker.is-accuse {
  border-color: var(--danger);
  background: linear-gradient(160deg, var(--danger-soft), var(--surface-2) 60%);
}

.mg-mn-warn {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: -4px 0 10px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
}

.mg-mn-warn .mg-ico {
  width: 14px;
  height: 14px;
}

.mg-mn-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 12px;
}

.mg-mn-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px 0 9px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}

.mg-mn-chip:hover {
  transform: translateY(-1px);
}

.mg-mn-chip.is-picked {
  border-color: var(--game-accent);
  background: color-mix(in srgb, var(--game-accent) 28%, var(--surface));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--game-accent) 35%, transparent);
}

.mg-mn-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.mg-mn-actions.is-after {
  justify-content: center;
  margin: 0 0 16px;
}

.mg-mn-accuse-btn {
  background: var(--danger);
  color: #fff;
}

.mg-mn-accuse-btn:disabled {
  background: var(--surface-3);
  color: var(--text-3);
}

/* Manor map */
.mg-mn-map {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background:
    linear-gradient(var(--border) 1px, transparent 1px) 0 0 / 22px 22px,
    var(--surface);
}

.mg-mn-room {
  position: relative;
  min-height: 82px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px 22px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  text-align: center;
}

.mg-mn-room-emoji {
  font-size: 24px;
  line-height: 1;
}

.mg-mn-room-name {
  font-size: 12px;
  font-weight: 650;
  line-height: 1.2;
}

.mg-mn-room small {
  color: var(--text-3);
  font-size: 10.5px;
}

.mg-mn-room.is-pickable {
  cursor: pointer;
  transition: border-color var(--t-fast), transform var(--t-fast);
}

.mg-mn-room.is-pickable:hover {
  border-color: #34d399;
  transform: translateY(-2px);
}

.mg-mn-room.is-picked {
  border-color: #34d399;
  background: rgba(52, 211, 153, 0.16);
  box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.35);
}

.mg-mn-room.is-blocked {
  opacity: 0.45;
}

.mg-mn-tokens {
  position: absolute;
  bottom: 4px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 2px;
}

/* Map + notebook side by side */
.mg-mn-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
}

.mg-mn-split > .mg-mn-notes:only-child {
  grid-column: 1 / -1;
}

.mg-mn-notes {
  padding: 12px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.mg-mn-notes-head small {
  display: block;
  margin: -2px 0 8px;
  color: var(--text-3);
  font-size: 12px;
}

.mg-mn-ngroup h4 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0 4px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mg-mn-solved {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  border-radius: var(--r-pill);
  background: var(--success-soft);
  color: var(--success);
  font-size: 10.5px;
  font-style: normal;
}

.mg-mn-solved .mg-ico {
  width: 11px;
  height: 11px;
}

.mg-mn-ngroup ul {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mg-mn-note {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
}

.mg-mn-note:disabled {
  cursor: default;
}

.mg-mn-nname {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mg-mn-note small {
  max-width: 64px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-3);
  font-size: 10.5px;
}

.mg-mn-mark {
  width: 18px;
  height: 18px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.mg-mn-mark .mg-ico {
  width: 12px;
  height: 12px;
}

.mg-mn-note.is-mine .mg-mn-nname,
.mg-mn-note.is-public .mg-mn-nname,
.mg-mn-note.is-seen .mg-mn-nname,
.mg-mn-note.is-no .mg-mn-nname {
  color: var(--text-3);
  text-decoration: line-through;
}

.mg-mn-note.is-mine .mg-mn-mark,
.mg-mn-note.is-public .mg-mn-mark,
.mg-mn-note.is-seen .mg-mn-mark,
.mg-mn-note.is-no .mg-mn-mark {
  border-color: transparent;
  background: var(--danger-soft);
  color: var(--danger);
}

.mg-mn-note.is-maybe .mg-mn-mark {
  border-color: transparent;
  background: var(--warning-soft);
  color: var(--warning);
}

.mg-mn-note.is-yes {
  border-color: var(--success);
  background: var(--success-soft);
}

.mg-mn-note.is-yes .mg-mn-mark {
  border-color: transparent;
  background: var(--success);
  color: #fff;
}

/* Logs */
.mg-mn-log {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}

.mg-mn-log li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-size: 13px;
}

.mg-mn-log li > span:not(.mg-mn-triple):not(.mg-avatar) {
  font-weight: 650;
}

.mg-mn-log .mg-mn-card {
  height: 26px;
  font-size: 12px;
}

.mg-mn-res {
  margin-left: auto;
  color: var(--text-3);
  font-size: 12px;
}

.mg-mn-log li.is-wrong b {
  margin-left: auto;
  color: var(--danger);
}

.mg-mn-log li.is-right b {
  margin-left: auto;
  color: var(--success);
}

.mg-mn-log b .mg-ico {
  width: 15px;
  height: 15px;
}

@media (max-width: 760px) {
  .mg-mn-split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .mg-mn-map {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .mg-mn-card.is-big {
    width: 100px;
    height: 124px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mg-mn-card.is-reveal {
    animation: none;
  }
}

/* ==========================================================================
   Color Card Clash
   ========================================================================== */
.mg-ck-called {
  font-size: 10.5px;
  font-style: normal;
  font-weight: 800;
  color: #facc15;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mg-ck-catch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--r-pill);
  background: #e11d48;
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  animation: mg-ck-pulse 0.9s ease-in-out infinite;
}

.mg-ck-catch .mg-ico {
  width: 14px;
  height: 14px;
}

@keyframes mg-ck-pulse {
  50% { transform: scale(1.08); }
}

/* A card */
.mg-uc {
  --uc: #6b7280;
  position: relative;
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 66px;
  height: 98px;
  padding: 0;
  border: 4px solid #fdfdfd;
  border-radius: 10px;
  background: var(--uc);
  color: #fff;
  font: inherit;
  box-shadow: 0 6px 14px -6px rgba(0, 0, 0, 0.65);
  user-select: none;
}

.mg-uc.is-r { --uc: #e11d48; }
.mg-uc.is-y { --uc: #eab308; }
.mg-uc.is-g { --uc: #16a34a; }
.mg-uc.is-b { --uc: #2563eb; }
.mg-uc.is-w { background: conic-gradient(from 45deg, #e11d48 0 25%, #eab308 0 50%, #16a34a 0 75%, #2563eb 0); }
.mg-uc.is-back {
  border-color: #f1f5f9;
  background:
    radial-gradient(ellipse at 50% 50%, #e11d48 0 30%, transparent 31%),
    repeating-linear-gradient(135deg, #1e293b 0 6px, #0f172a 6px 12px);
}

.mg-uc::before {
  content: "";
  position: absolute;
  inset: 13px 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.24);
  transform: rotate(-26deg);
}

.mg-uc.is-back::before {
  display: none;
}

.mg-uc-face {
  position: relative;
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

.mg-uc-face .mg-ico {
  width: 24px;
  height: 24px;
  color: #fde68a;
}

.mg-uc-corner {
  position: absolute;
  top: 3px;
  left: 6px;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.mg-uc-corner.is-bottom {
  top: auto;
  right: 6px;
  bottom: 3px;
  left: auto;
  transform: rotate(180deg);
}

.mg-uc.is-xs {
  width: 22px;
  height: 32px;
  border-width: 2px;
  border-radius: 4px;
  vertical-align: middle;
}

.mg-uc.is-xs::before,
.mg-uc.is-xs .mg-uc-corner {
  display: none;
}

.mg-uc.is-xs .mg-uc-face {
  font-size: 11px;
}

button.mg-uc {
  cursor: pointer;
}

button.mg-uc:disabled {
  cursor: default;
}

/* The table */
.mg-ck-felt {
  position: relative;
  height: 400px;
  margin: 4px 0 0;
  border-radius: 200px / 150px;
  background:
    radial-gradient(ellipse at 50% 45%, #2b8a57 0%, #1d6b42 55%, #134a2e 100%);
  box-shadow:
    inset 0 0 0 10px #4a3220,
    inset 0 0 0 13px #2e1f14,
    inset 0 10px 40px rgba(0, 0, 0, 0.45),
    0 14px 30px -18px rgba(0, 0, 0, 0.8);
}

.mg-ck-rim {
  position: absolute;
  inset: 22px;
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 180px / 130px;
  pointer-events: none;
}

.mg-ck-seat {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transform: translate(-50%, -50%);
  z-index: 2;
}

.mg-ck-backs {
  position: relative;
  display: block;
  width: 60px;
  height: 42px;
}

.mg-ck-backs i {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 26px;
  height: 38px;
  margin-left: -13px;
  border: 2px solid #f1f5f9;
  border-radius: 4px;
  background:
    radial-gradient(ellipse at 50% 50%, #e11d48 0 28%, transparent 29%),
    repeating-linear-gradient(135deg, #1e293b 0 4px, #0f172a 4px 8px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  transform: rotate(var(--r));
  transform-origin: 50% 120%;
}

.mg-ck-who,
.mg-ck-me {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 8px 0 3px;
  border: 2px solid transparent;
  border-radius: var(--r-pill);
  background: rgba(8, 20, 14, 0.78);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.mg-ck-who .mg-avatar,
.mg-ck-me .mg-avatar {
  width: 20px;
  height: 20px;
  font-size: 11px;
}

.mg-ck-who b,
.mg-ck-me b {
  min-width: 18px;
  padding: 0 5px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.16);
  font-size: 11.5px;
  text-align: center;
}

.mg-ck-seat.is-turn .mg-ck-who,
.mg-ck-me.is-turn {
  border-color: #facc15;
}

.mg-ck-seat.is-last .mg-ck-who b {
  background: #e11d48;
}

.mg-ck-me {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
}

.mg-ck-center {
  position: absolute;
  top: 54%;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 22px;
  transform: translate(-50%, -50%);
}

.mg-ck-dirring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 250px;
  height: 250px;
  margin: -125px 0 0 -125px;
  fill: none;
  stroke: rgba(255, 255, 255, 0.13);
  stroke-width: 5;
  stroke-linecap: round;
  pointer-events: none;
  animation: mg-ck-spin 14s linear infinite;
}

.mg-ck-dirring .mg-ck-dirhead {
  fill: rgba(255, 255, 255, 0.13);
  stroke: none;
}

.mg-ck-dirring.is-rev {
  transform: scaleX(-1);
  animation-name: mg-ck-spin-rev;
}

@keyframes mg-ck-spin {
  to { transform: rotate(360deg); }
}

@keyframes mg-ck-spin-rev {
  from { transform: scaleX(-1) rotate(0deg); }
  to { transform: scaleX(-1) rotate(-360deg); }
}

.mg-ck-pile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: rgba(255, 255, 255, 0.75);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: default;
}

.mg-ck-pile .mg-uc {
  z-index: 2;
}

.mg-ck-pile .mg-uc.is-stack,
.mg-ck-pile .mg-uc.is-stack2 {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  transform: translate(3px, 3px);
}

.mg-ck-pile .mg-uc.is-stack2 {
  z-index: 0;
  transform: translate(6px, 6px);
}

.mg-ck-pile.is-live {
  cursor: pointer;
}

.mg-ck-pile.is-live .mg-uc:not(.is-stack):not(.is-stack2) {
  box-shadow: 0 0 0 3px #facc15, 0 8px 18px -6px rgba(0, 0, 0, 0.6);
}

.mg-ck-pile.is-live:hover .mg-uc:not(.is-stack):not(.is-stack2) {
  transform: translateY(-4px);
}

.mg-ck-discard {
  position: relative;
  width: 100px;
  height: 130px;
}

.mg-ck-discard .mg-uc {
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -49px 0 0 -33px;
  transform: rotate(var(--rot, 0deg));
}

.mg-ck-discard .mg-uc.is-top {
  width: 82px;
  height: 122px;
  margin: -61px 0 0 -41px;
  box-shadow: 0 0 0 4px var(--ck-color), 0 12px 24px -8px rgba(0, 0, 0, 0.7);
  animation: mg-ck-land 0.3s ease-out;
}

.mg-ck-discard .mg-uc.is-top .mg-uc-face {
  font-size: 38px;
}

@keyframes mg-ck-land {
  from { transform: translateY(-24px) scale(1.12) rotate(-10deg); }
}

.mg-ck-status {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.mg-ck-color {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 4px 5px;
  border-radius: var(--r-pill);
  background: rgba(8, 20, 14, 0.7);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.mg-ck-color i {
  width: 16px;
  height: 16px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--ck-color);
}

.mg-ck-pending {
  padding: 4px 12px;
  border-radius: var(--r-pill);
  background: #e11d48;
  color: #fff;
  font-size: 20px;
  font-weight: 900;
  animation: mg-ck-pulse 0.9s ease-in-out infinite;
}

.mg-ck-note {
  position: absolute;
  bottom: 62px;
  left: 50%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  background: rgba(8, 20, 14, 0.6);
  color: rgba(255, 255, 255, 0.85);
  font-size: 12.5px;
  white-space: nowrap;
  transform: translateX(-50%);
}

.mg-ck-note.is-caught {
  background: #be123c;
  color: #fff;
  font-weight: 700;
}

.mg-ck-note .mg-ico {
  width: 15px;
  height: 15px;
}

.mg-ck-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0 0;
}

.mg-ck-info {
  margin: 0;
  color: var(--text-2);
  font-size: 14px;
}

.mg-ck-btns {
  display: flex;
  gap: 8px;
}

.mg-ck-call {
  background: #facc15;
  color: #111827;
  font-weight: 800;
}

.mg-ck-call.is-urgent {
  animation: mg-ck-pulse 0.8s ease-in-out infinite;
}

.mg-ck-wild {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
}

.mg-ck-wild > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.mg-ck-swatch {
  flex: 1 1 90px;
  height: 44px;
  border: 0;
  border-radius: var(--r);
  background: var(--sw);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

.mg-ck-swatch:hover {
  filter: brightness(1.12);
}

/* Your hand: a fan */
.mg-ck-hand {
  display: flex;
  justify-content: center;
  min-height: 140px;
  padding: 26px 10px 8px;
}

.mg-ck-hand .mg-uc {
  margin: 0 -10px;
  transform: translateY(var(--y, 0)) rotate(var(--r, 0deg));
  transform-origin: 50% 130%;
  transition: transform 0.15s ease, opacity 0.15s ease, filter 0.15s ease;
}

.mg-ck-hand.is-tight .mg-uc {
  margin: 0 -20px;
}

.mg-ck-hand .mg-uc.is-ok:hover,
.mg-ck-hand .mg-uc.is-ok:focus-visible {
  z-index: 3;
  transform: translateY(calc(var(--y, 0) - 22px)) rotate(var(--r, 0deg));
}

.mg-ck-hand .mg-uc.is-dim {
  filter: brightness(0.55) saturate(0.7);
}

.mg-ck-hand .mg-uc.is-picked {
  z-index: 3;
  transform: translateY(calc(var(--y, 0) - 26px)) rotate(var(--r, 0deg));
  outline: 3px solid #facc15;
  outline-offset: 2px;
}

.mg-ck-hand .mg-uc.is-drawn {
  outline: 2px dashed #facc15;
  outline-offset: 3px;
}

.mg-ck-mini {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
}

/* ==========================================================================
   Quick Estate
   ========================================================================== */
.mg-es-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-template-rows: repeat(6, minmax(86px, auto));
  margin: 6px 0 12px;
  padding: 10px;
  border-radius: 14px;
  background: linear-gradient(135deg, #3b2a1a, #24180e);
  box-shadow: 0 16px 34px -20px rgba(0, 0, 0, 0.9), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.mg-es-sq {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
  min-width: 0;
  padding: 0 3px 8px;
  overflow: hidden;
  border: 1px solid #4a3f30;
  border-radius: 0;
  background: #f1ead6;
  color: #1c1917;
  font: inherit;
  text-align: center;
  cursor: pointer;
}

.mg-es-sq:hover {
  background: #faf5e6;
}

.mg-es-sq.is-corner {
  background: #e3d8b8;
  justify-content: center;
}

.mg-es-sq.is-corner .mg-es-kind {
  height: 28px;
}

.mg-es-sq.is-corner .mg-es-kind .mg-ico {
  width: 24px;
  height: 24px;
}

.mg-es-sq.is-owned {
  background: color-mix(in srgb, var(--own) 16%, #f1ead6);
}

.mg-es-own {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 6px;
  background: var(--own);
}

.mg-es-sq.is-sel {
  z-index: 1;
  box-shadow: inset 0 0 0 3px #f59e0b;
}

.mg-es-band {
  display: block;
  align-self: stretch;
  height: 16px;
  margin: 0 -3px 3px;
  border-bottom: 1px solid #4a3f30;
  background: var(--grp);
}

.mg-es-kind {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  margin-top: 4px;
  color: #92400e;
  font-size: 20px;
  font-weight: 900;
}

.mg-es-sq.is-chance .mg-es-kind {
  color: #c2410c;
}

.mg-es-sq.is-tax .mg-es-kind {
  color: #57534e;
}

.mg-es-sq.is-start .mg-es-kind {
  color: #b91c1c;
}

.mg-es-sq.is-park .mg-es-kind {
  color: #15803d;
}

.mg-es-kind .mg-ico {
  width: 18px;
  height: 18px;
}

.mg-es-name {
  max-width: 100%;
  font-size: 11.5px;
  font-weight: 800;
  line-height: 1.15;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  overflow-wrap: anywhere;
}

.mg-es-sq small {
  color: #57534e;
  font-size: 11px;
  font-weight: 600;
}

.mg-es-lvl {
  display: flex;
  gap: 2px;
}

.mg-es-lvl svg {
  width: 12px;
  height: 12px;
  fill: #15803d;
  stroke: #14532d;
  stroke-width: 1;
}

.mg-es-tokens {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: auto;
}

.mg-es-pawn {
  display: inline-flex;
  margin: 0 -3px;
  border: 2px solid var(--pc);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.mg-es-pawn .mg-avatar {
  width: 20px;
  height: 20px;
  font-size: 11px;
}

.mg-es-center {
  position: relative;
  grid-row: 2 / 6;
  grid-column: 2 / 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 8px;
  padding: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: radial-gradient(circle at 50% 40%, #183a2a, #0f2219 75%);
  text-align: center;
}

.mg-es-center > * {
  position: relative;
}

.mg-es-logo {
  position: absolute !important;
  top: 50%;
  left: 50%;
  color: rgba(255, 255, 255, 0.05);
  font-size: 54px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  transform: translate(-50%, -50%) rotate(-24deg);
  pointer-events: none;
}

.mg-es-dice {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mg-es-dice small {
  margin-left: 6px;
  color: var(--text-2);
}

.mg-es-die {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  width: 46px;
  height: 46px;
  padding: 7px;
  border-radius: 10px;
  background: #f8fafc;
  box-shadow: 0 4px 10px -4px rgba(0, 0, 0, 0.6), inset 0 -3px 0 rgba(0, 0, 0, 0.12);
  animation: mg-es-roll 0.4s ease-out;
}

.mg-es-die i.is-on {
  border-radius: 50%;
  background: #111827;
}

@keyframes mg-es-roll {
  0% { transform: translate(-26px, -18px) rotate(-200deg) scale(0.7); }
  45% { transform: translate(6px, 4px) rotate(30deg) scale(1.05); }
  65% { transform: translate(-2px, -6px) rotate(-12deg); }
  82% { transform: translate(1px, 0) rotate(5deg); }
  100% { transform: none; }
}

.mg-es-dice .mg-es-die {
  animation-duration: 0.75s;
}

.mg-es-dice .mg-es-die + .mg-es-die {
  animation-delay: 0.06s;
  animation-fill-mode: backwards;
}

.mg-es-dice.is-double .mg-es-die {
  box-shadow: 0 0 0 2px #facc15, 0 4px 10px -4px rgba(0, 0, 0, 0.6), inset 0 -3px 0 rgba(0, 0, 0, 0.12);
}

.mg-es-again {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: #facc15;
  font-size: 0.85rem;
  font-weight: 650;
}

.mg-es-pawn.is-hop {
  animation: mg-es-hop 0.17s ease-out;
}

@keyframes mg-es-hop {
  0% { transform: translateY(0) scale(1); }
  45% { transform: translateY(-9px) scale(1.12); }
  100% { transform: translateY(0) scale(1); }
}

.mg-es-sq.is-mort {
  background-image: repeating-linear-gradient(135deg, rgba(0, 0, 0, 0.09) 0 6px, transparent 6px 12px);
}

.mg-es-sq.is-mort .mg-es-name,
.mg-es-sq.is-mort small {
  opacity: 0.6;
}

.mg-es-sq.is-mort .mg-es-own {
  opacity: 0.45;
}

.mg-es-chip.is-mort {
  opacity: 0.55;
  text-decoration: line-through;
}

.mg-es-mortnote {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0;
  color: var(--text-2);
  font-size: 0.85rem;
}

.mg-es-bidrow {
  flex-wrap: nowrap;
}

.mg-es-bidin {
  width: 110px;
  min-height: 34px;
  padding: 4px 8px;
}

.mg-es-chance {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px dashed var(--accent);
  border-radius: var(--r);
  text-align: left;
}

.mg-es-chance b {
  font-size: 24px;
  color: var(--accent);
}

.mg-es-chance span {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: var(--text-2);
}

.mg-es-chance strong {
  color: var(--text);
  font-size: 14px;
}

.mg-es-landed,
.mg-es-wait {
  margin: 0;
  color: var(--text-2);
  font-size: 14px;
}

.mg-es-big {
  min-width: 160px;
  height: 52px;
  font-size: 17px;
}

.mg-es-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.mg-es-auction {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.mg-es-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.mg-es-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 8px 0 4px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  white-space: nowrap;
}

.mg-es-chip i {
  width: 10px;
  height: 14px;
  border-radius: 3px;
  background: var(--grp);
}

.mg-es-chip b {
  color: #16a34a;
  font-size: 11px;
}

button.mg-es-chip {
  cursor: pointer;
}

.mg-es-chip.is-on {
  border-color: var(--accent);
  background: var(--accent-soft);
  font-weight: 650;
}

.mg-es-cash {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  background: color-mix(in srgb, #16a34a 20%, var(--surface));
  font-size: 12px;
  font-weight: 700;
}

.mg-es-offer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.mg-es-swap {
  font-size: 22px;
  color: var(--accent);
}

.mg-es-compose,
.mg-es-detail {
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
}

.mg-es-who {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px 0 4px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.mg-es-who.is-on {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.mg-es-trade-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 12px 0;
}

.mg-es-side {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: var(--r);
  background: var(--surface-2);
}

.mg-es-stepper {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.mg-es-stepper b {
  min-width: 52px;
  text-align: center;
}

.mg-es-detail {
  border-top: 4px solid var(--grp, var(--accent));
}

.mg-es-detail h4 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 8px;
  font-size: 16px;
}

.mg-es-close {
  display: inline-flex;
  padding: 4px;
  border: 0;
  background: none;
  color: var(--text-2);
  cursor: pointer;
}

.mg-es-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 14px;
  margin: 0 0 8px;
  font-size: 13.5px;
}

.mg-es-facts dt {
  color: var(--text-2);
}

.mg-es-facts dd {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-weight: 600;
}

.mg-es-rents {
  margin: 0 0 10px;
  color: var(--text-2);
  font-size: 12.5px;
}

.mg-es-tip {
  margin: 0 0 12px;
  text-align: center;
}

.mg-es-players {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}

.mg-es-players li {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--pc);
  border-radius: var(--r);
  background: var(--surface);
}

.mg-es-players li.is-turn {
  box-shadow: 0 0 0 2px var(--accent);
}

.mg-es-players li.is-out {
  opacity: 0.5;
}

.mg-es-phead {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.mg-es-phead > span:not(.mg-avatar) {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mg-es-cashv {
  color: #4ade80;
}

.mg-es-worth {
  color: var(--text-2);
  font-size: 12px;
}

.mg-es-log {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  color: var(--text-2);
}

.mg-es-log li {
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--surface);
}

.mg-es-log li.is-bankrupt,
.mg-es-log li.is-out {
  color: #fca5a5;
}

/* ==========================================================================
   Region Conquest
   ========================================================================== */
.mg-cq-order em {
  font-style: normal;
  font-weight: 700;
  color: var(--pc);
}

.mg-cq-order small {
  color: var(--text-2);
  font-size: 12px;
}

.mg-cq-order li {
  border-left: 3px solid var(--pc);
}

.mg-cq-order li.is-out {
  opacity: 0.5;
}

.mg-cq-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.mg-cq-panel .mg-es-row {
  justify-content: flex-start;
}

.mg-cq-panel .mg-turn-wait {
  margin-top: 0;
}

.mg-cq-info {
  margin: 0;
  color: var(--text-2);
  font-size: 14px;
}

.mg-cq-info b {
  color: var(--text);
}

.mg-cq-selname {
  font-weight: 650;
}

.mg-cq-blitz {
  background: #7c3aed;
  color: #fff;
}

.mg-cq-wrap {
  position: relative;
  margin: 0 0 12px;
  overflow: hidden;
  border: 1px solid #1e3a52;
  border-radius: calc(var(--r) + 4px);
  background: #0a2236;
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.03);
}

.mg-cq-map {
  display: block;
  width: 100%;
  height: auto;
}

.mg-cq-shore path {
  fill: none;
  stroke: #5fa8cf;
  stroke-opacity: 0.28;
  stroke-width: 16;
  stroke-linejoin: round;
}

.mg-cq-lanes path {
  fill: none;
  stroke: #e2e8f0;
  stroke-opacity: 0.55;
  stroke-width: 2;
  stroke-dasharray: 7 6;
  stroke-linecap: round;
}

.mg-cq-lanes path.is-hot {
  stroke: #fbbf24;
  stroke-opacity: 1;
  stroke-width: 3.5;
}

.mg-cq-land {
  stroke: #0b1622;
  stroke-width: 1.6;
  stroke-linejoin: round;
  cursor: pointer;
  transition: filter 0.15s ease;
}

.mg-cq-land:hover {
  filter: brightness(1.18);
}

.mg-cq-land.is-target,
.mg-cq-land.is-pick {
  filter: brightness(1.08);
}

.mg-cq-texture {
  fill: url(#cq-land);
  pointer-events: none;
}

.mg-cq-hi {
  fill: none;
  stroke-linejoin: round;
  pointer-events: none;
}

.mg-cq-hi.is-from {
  stroke: #ffffff;
  stroke-width: 4;
}

.mg-cq-hi.is-to {
  stroke: #fbbf24;
  stroke-width: 4;
}

.mg-cq-hi.is-target {
  stroke: #fca5a5;
  stroke-width: 2.5;
  stroke-dasharray: 6 5;
  animation: mg-cq-march 1.2s linear infinite;
}

.mg-cq-hi.is-near {
  stroke: #e2e8f0;
  stroke-width: 2;
  stroke-dasharray: 3 5;
}

.mg-cq-hi.is-battle {
  stroke: #fbbf24;
  stroke-width: 2.5;
  stroke-opacity: 0.8;
}

@keyframes mg-cq-march {
  to { stroke-dashoffset: -22; }
}

/* Attack / move arrows */
.mg-cq-arrows {
  pointer-events: none;
}

.mg-cq-arrow-l {
  fill: none;
  stroke: var(--ac);
  stroke-width: 5;
  stroke-linecap: round;
  filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.6));
}

.mg-cq-arrow-o {
  fill: none;
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 8.5;
  stroke-linecap: round;
}

.mg-cq-arrow.is-move .mg-cq-arrow-o,
.mg-cq-arrow.is-plan .mg-cq-arrow-o {
  stroke-width: 7;
  stroke-opacity: 0.55;
}

.mg-cq-arrow-h {
  fill: var(--ac);
  stroke: #fff;
  stroke-width: 1.6;
  stroke-linejoin: round;
}

.mg-cq-arrow.is-move .mg-cq-arrow-l {
  stroke-dasharray: 2 9;
  stroke-width: 4.5;
}

.mg-cq-arrow.is-old {
  opacity: 0.32;
}

.mg-cq-arrow.is-live .mg-cq-arrow-l {
  stroke-dasharray: 12 8;
  animation: mg-cq-arrow 0.6s linear infinite;
}

.mg-cq-arrow.is-plan {
  opacity: 0.75;
}

.mg-cq-arrow.is-plan .mg-cq-arrow-l {
  stroke-dasharray: 10 7;
  stroke-width: 3.5;
  animation: mg-cq-arrow 0.9s linear infinite;
}

@keyframes mg-cq-arrow {
  to { stroke-dashoffset: -20; }
}

/* Cards */
.mg-cq-cards {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.mg-cq-cards .mg-label {
  margin: 0 4px 0 0;
}

.mg-cq-card {
  display: inline-grid;
  justify-items: center;
  gap: 1px;
  width: 46px;
  padding: 5px 2px 3px;
  border-radius: 7px;
  background: linear-gradient(160deg, #fdf6e3, #e9dcbc);
  border: 1px solid #b59f6e;
  color: #5b4a2a;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
}

.mg-cq-card svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.mg-cq-card small {
  font-size: 0.6rem;
  font-weight: 700;
}

.mg-cq-card.is-c0 { color: #9a3412; }
.mg-cq-card.is-c1 { color: #1d4ed8; }
.mg-cq-card.is-c2 { color: #3f3f46; }

.mg-cq-cc {
  color: #e9dcbc;
}

.mg-cq-region {
  fill: #cbd5e1;
  fill-opacity: 0.7;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  pointer-events: none;
}

.mg-cq-bonus {
  fill: #fbbf24;
}

.mg-cq-badge {
  cursor: pointer;
}

.mg-cq-badge circle {
  fill: #0f172a;
  stroke-width: 3;
}

.mg-cq-badge:hover circle {
  fill: #1e293b;
}

.mg-cq-n {
  fill: #ffffff;
  font-size: 14px;
  font-weight: 800;
  text-anchor: middle;
  pointer-events: none;
}

.mg-cq-name {
  fill: #ffffff;
  font-size: 11px;
  font-weight: 700;
  text-anchor: middle;
  paint-order: stroke;
  stroke: rgba(0, 0, 0, 0.7);
  stroke-width: 3px;
  stroke-linejoin: round;
  pointer-events: none;
}

.mg-cq-battle {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
}

.mg-cq-battle.is-captured {
  border-color: #fbbf24;
}

.mg-cq-side {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}

.mg-cq-vs {
  color: var(--text-2);
}

.mg-cq-die {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: #fff;
  font-weight: 800;
  animation: mg-es-roll 0.35s ease-out;
}

.mg-cq-die.is-att { background: #dc2626; }
.mg-cq-die.is-def { background: #2563eb; }

.mg-cq-res {
  flex-basis: 100%;
  margin: 0;
  color: var(--text-2);
  font-size: 13px;
  text-align: center;
}

.mg-cq-res b {
  color: #fbbf24;
}

@media (max-width: 640px) {
  .mg-uc { width: 52px; height: 78px; border-width: 3px; }
  .mg-uc-face { font-size: 22px; }
  .mg-ck-felt { height: 360px; border-radius: 40px; }
  .mg-ck-rim { border-radius: 30px; }
  .mg-ck-center { gap: 10px; }
  .mg-ck-dirring { width: 190px; height: 190px; margin: -95px 0 0 -95px; }
  .mg-ck-discard { width: 70px; }
  .mg-ck-discard .mg-uc.is-top { width: 64px; height: 96px; margin: -48px 0 0 -32px; }
  .mg-ck-status { position: absolute; top: -46px; left: 50%; transform: translateX(-50%); flex-direction: row; }
  .mg-ck-who > span:not(.mg-avatar) { max-width: 60px; overflow: hidden; text-overflow: ellipsis; }
  .mg-ck-hand .mg-uc { margin: 0 -14px; }
  .mg-es-board { grid-template-rows: repeat(6, minmax(60px, auto)); padding: 6px; }
  .mg-es-band { height: 9px; }
  .mg-es-logo { font-size: 30px; }
  .mg-es-name { font-size: 9.5px; }
  .mg-es-sq small { font-size: 9px; }
  .mg-es-center { padding: 6px; gap: 6px; }
  .mg-es-die { width: 36px; height: 36px; padding: 5px; gap: 2px; }
  .mg-es-trade-grid { grid-template-columns: 1fr; }
}

/* Cards: flying cards, crowded tables, jump-in */
.mg-ck-fly {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.mg-ck-fly .mg-uc {
  box-shadow: 0 14px 24px -8px rgba(0, 0, 0, 0.7);
}

.mg-ck-felt.is-many .mg-ck-backs {
  width: 48px;
  height: 34px;
}

.mg-ck-felt.is-many .mg-ck-backs i,
.mg-ck-felt.is-crowd .mg-ck-backs i {
  width: 20px;
  height: 30px;
  margin-left: -10px;
}

.mg-ck-felt.is-crowd {
  height: 440px;
}

.mg-ck-felt.is-crowd .mg-ck-backs {
  width: 36px;
  height: 28px;
}

.mg-ck-felt.is-crowd .mg-ck-who > span:not(.mg-avatar) {
  max-width: 58px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mg-ck-hand .mg-uc.is-jump {
  animation: mg-ck-jump 0.9s ease-in-out infinite alternate;
}

@keyframes mg-ck-jump {
  to { transform: translateY(calc(var(--y, 0px) - 14px)) rotate(var(--r, 0deg)); }
}

.mg-ck-info.is-jump {
  color: #facc15;
  font-weight: 650;
}

.mg-ck-note.is-swap,
.mg-ck-note.is-jump {
  border-color: #facc15;
}

.mg-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 10px 3px 3px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.mg-switch i {
  position: relative;
  width: 30px;
  height: 18px;
  border-radius: 9px;
  background: var(--border-strong);
  transition: background 0.15s;
}

.mg-switch i::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}

.mg-switch.is-on {
  border-color: var(--accent);
  color: var(--text);
}

.mg-switch.is-on i {
  background: var(--accent);
}

.mg-switch.is-on i::after {
  transform: translateX(12px);
}

@media (max-width: 640px) {
  .mg-ck-felt.is-many,
  .mg-ck-felt.is-crowd { height: 420px; }
  .mg-ck-felt.is-many .mg-ck-who > span:not(.mg-avatar),
  .mg-ck-felt.is-crowd .mg-ck-who > span:not(.mg-avatar) { display: none; }
  .mg-ck-felt.is-crowd .mg-ck-backs { display: none; }
}

/* Bots in the room list */
.mg-tag-bot {
  border-color: #7c3aed;
  color: #c4b5fd;
}

.mg-bot-x {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-left: auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--text-3);
}

.mg-bot-x:hover {
  border-color: var(--danger, #ef4444);
  color: var(--danger, #ef4444);
}

.mg-bot-x .mg-ico {
  width: 12px;
  height: 12px;
}

.mg-pstatus.is-away {
  color: #f59e0b;
}

/* How to play */
.mg-help-btn {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

.mg-help-btn:hover {
  border-color: var(--game-accent, var(--accent));
  color: var(--text);
}

.mg-help-q {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  font-size: 10px;
  line-height: 1;
}

.mg-howto {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 16px;
}

.mg-howto-back {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 12, 0.66);
  animation: mg-howto-fade 0.15s ease-out;
}

.mg-howto-card {
  position: relative;
  display: grid;
  gap: 12px;
  width: min(560px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 18px 20px 20px;
  border: 1px solid var(--border-strong);
  border-top: 3px solid var(--game-accent);
  border-radius: var(--r-lg, 14px);
  background: var(--surface);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.8);
  animation: mg-howto-pop 0.18s ease-out;
}

.mg-howto-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mg-howto-head small {
  color: var(--text-3);
  font-size: 11.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.mg-howto-head h3 {
  margin: 0;
  font-size: 1.15rem;
}

.mg-howto-x {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-left: auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--text-2);
}

.mg-howto-card ol {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: how;
}

.mg-howto-card li {
  position: relative;
  padding-left: 34px;
  color: var(--text-2);
  font-size: 0.93rem;
  line-height: 1.5;
  counter-increment: how;
}

.mg-howto-card li::before {
  content: counter(how);
  position: absolute;
  top: 1px;
  left: 0;
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--game-accent) 22%, transparent);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.mg-howto-card > .btn {
  justify-self: end;
}

@keyframes mg-howto-fade {
  from { opacity: 0; }
}

@keyframes mg-howto-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
}

/* Conquest: troop picker in the middle of the map */
.mg-cq-wrap.has-pick .mg-cq-map {
  filter: brightness(0.78) saturate(0.9);
  transition: filter 0.2s;
}

.mg-cq-picker {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 3;
  display: grid;
  gap: 10px;
  width: min(330px, 86%);
  padding: 14px 16px 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(20, 34, 52, 0.96), rgba(11, 21, 34, 0.96));
  box-shadow: 0 24px 50px -16px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: #e5edf6;
  transform: translate(-50%, -50%);
  animation: mg-cq-pk-in 0.18s ease-out;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

@keyframes mg-cq-pk-in {
  from { opacity: 0; transform: translate(-50%, -46%) scale(0.96); }
}

.mg-cq-pk-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}

.mg-cq-pk-x {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  background: transparent;
  color: #cbd5e1;
}

.mg-cq-pk-x .mg-ico { width: 13px; height: 13px; }

.mg-cq-pk-route {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.mg-cq-pk-terr {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 11px 3px 3px;
  border: 2px solid var(--tc);
  border-radius: 999px;
  background: color-mix(in srgb, var(--tc) 22%, #0b1522);
  font-weight: 700;
  font-size: 0.9rem;
}

.mg-cq-pk-terr i {
  display: grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 5px;
  border-radius: 999px;
  background: #f8fafc;
  color: #0f172a;
  font-style: normal;
  font-size: 0.85rem;
  font-weight: 800;
}

.mg-cq-pk-arrow {
  color: #fbbf24;
}

.mg-cq-pk-left {
  width: 100%;
  text-align: center;
  color: #94a3b8;
}

.mg-cq-pk-num {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.mg-cq-pk-num b {
  min-width: 70px;
  font-size: 2.9rem;
  font-weight: 850;
  line-height: 1;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.mg-cq-pk-step {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
}

.mg-cq-pk-step:hover:not(:disabled) {
  border-color: #fbbf24;
  background: rgba(251, 191, 36, 0.14);
}

.mg-cq-pk-step:disabled {
  opacity: 0.3;
}

.mg-cq-range {
  width: 100%;
  height: 22px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.mg-cq-range::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, #f59e0b var(--pct, 0%), rgba(255, 255, 255, 0.14) var(--pct, 0%));
}

.mg-cq-range::-moz-range-track {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, #f59e0b var(--pct, 0%), rgba(255, 255, 255, 0.14) var(--pct, 0%));
}

.mg-cq-range::-webkit-slider-thumb {
  width: 22px;
  height: 22px;
  margin-top: -7px;
  border: 3px solid #f59e0b;
  border-radius: 50%;
  background: #fff;
  -webkit-appearance: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.mg-cq-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 3px solid #f59e0b;
  border-radius: 50%;
  background: #fff;
}

.mg-cq-pk-quick {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.mg-cq-pk-quick button {
  padding: 6px 4px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  font-size: 0.78rem;
  font-weight: 650;
}

.mg-cq-pk-quick button:hover {
  border-color: #fbbf24;
  color: #fff;
}

.mg-cq-pk-stays {
  color: #94a3b8;
  text-align: center;
}

.mg-cq-pk-go {
  width: 100%;
  justify-content: center;
}

.mg-cq-pk-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mg-cq-pk-btns .btn {
  justify-content: center;
}

.mg-cq-pk-dice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.mg-cq-pk-dice > div {
  display: flex;
  gap: 4px;
}

.mg-cq-pk-dice > span {
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 700;
}

.mg-cq-pk-res {
  margin: 0;
  color: #94a3b8;
  font-size: 0.8rem;
  text-align: center;
}

@media (max-width: 640px) {
  .mg-cq-picker {
    position: relative;
    top: auto;
    left: auto;
    width: auto;
    margin: 8px;
    transform: none;
    animation: none;
  }
}

/* Quick Estate: board polish */
.mg-es-board {
  grid-template-columns: 1.3fr repeat(4, minmax(0, 1fr)) 1.3fr;
  grid-template-rows: 1.15fr repeat(4, minmax(0, 1fr)) 1.15fr;
  gap: 2px;
  width: 100%;
  max-width: 780px;
  aspect-ratio: 1.12;
  margin: 6px auto 14px;
  padding: 12px;
  border: 1px solid #5a4128;
  border-radius: 18px;
  background:
    repeating-linear-gradient(100deg, rgba(255, 255, 255, 0.025) 0 3px, transparent 3px 9px),
    linear-gradient(135deg, #4a3320, #2a1b0f);
  box-shadow: 0 22px 44px -24px rgba(0, 0, 0, 0.95), inset 0 0 0 4px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.mg-es-sq {
  border: 0;
  border-radius: 4px;
  background: linear-gradient(180deg, #f6f0de, #ebe2c8);
  box-shadow: inset 0 0 0 1px rgba(74, 63, 48, 0.35);
  transition: transform 0.12s, box-shadow 0.12s;
}

.mg-es-sq:hover {
  z-index: 2;
  background: linear-gradient(180deg, #fffaf0, #f1e8cf);
  transform: translateY(-2px);
  box-shadow: inset 0 0 0 1px rgba(74, 63, 48, 0.35), 0 6px 14px -6px rgba(0, 0, 0, 0.6);
}

.mg-es-sq.is-corner {
  background: linear-gradient(160deg, #eadfbf, #d9cba3);
}

.mg-es-sq.is-owned {
  background: linear-gradient(180deg, color-mix(in srgb, var(--own) 14%, #f6f0de), color-mix(in srgb, var(--own) 22%, #ebe2c8));
}

.mg-es-band {
  height: 18px;
  margin: 0 -3px 4px;
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--grp) 85%, #fff), var(--grp));
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18);
}

.mg-es-sq small {
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(68, 50, 30, 0.08);
  color: #44403c;
  font-variant-numeric: tabular-nums;
}

.mg-es-own {
  height: 5px;
  border-radius: 0 0 4px 4px;
}

.mg-es-sq.is-sel {
  box-shadow: inset 0 0 0 3px #f59e0b, 0 0 0 2px rgba(245, 158, 11, 0.35);
}

.mg-es-pawn {
  margin: 0 -4px;
  border-width: 2.5px;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.45), 0 0 0 1.5px #fff;
}

.mg-es-pawn .mg-avatar {
  width: 24px;
  height: 24px;
}

.mg-es-center {
  justify-content: space-between;
  gap: 8px;
  margin: 6px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.06), transparent 60%),
    repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.06) 0 2px, transparent 2px 6px),
    linear-gradient(160deg, #1d4a35, #10291d);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.45);
}

.mg-es-logo {
  color: rgba(255, 255, 255, 0.045);
  font-size: clamp(30px, 6vw, 58px);
}

.mg-es-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
}

.mg-es-turn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border: 1px solid color-mix(in srgb, var(--pc) 60%, transparent);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.3);
  color: #ecfdf5;
  font-size: 0.85rem;
  font-weight: 700;
}

.mg-es-turn b {
  padding-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
  color: #86efac;
  font-variant-numeric: tabular-nums;
}

.mg-es-ticker {
  display: grid;
  gap: 2px;
  width: 100%;
  max-width: 420px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.75rem;
  line-height: 1.35;
}

.mg-es-ticker li {
  overflow: hidden;
  color: rgba(236, 253, 245, 0.45);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mg-es-ticker li:first-child {
  color: rgba(236, 253, 245, 0.85);
}

.mg-es-die {
  border-radius: 11px;
  background: linear-gradient(145deg, #ffffff, #e2e8f0);
}

.mg-es-players {
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}

.mg-es-players li {
  position: relative;
  overflow: hidden;
  border-top: 3px solid var(--pc);
  background: linear-gradient(180deg, color-mix(in srgb, var(--pc) 9%, rgba(255, 255, 255, 0.02)), rgba(255, 255, 255, 0.015));
}

.mg-es-players li.is-turn::after {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pc);
  content: "";
  animation: mg-es-turnpulse 1.4s ease-in-out infinite;
}

@keyframes mg-es-turnpulse {
  50% { opacity: 0.25; }
}

.mg-es-cashv {
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

.mg-es-players li.is-turn .mg-es-cashv {
  margin-right: 14px;
}

.mg-es-sets {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 2px 0 4px;
}

.mg-es-sets span {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
}

.mg-es-sets span.is-full {
  background: color-mix(in srgb, var(--grp) 30%, transparent);
}

.mg-es-sets i {
  width: 9px;
  height: 12px;
  border: 1px solid color-mix(in srgb, var(--grp) 70%, transparent);
  border-radius: 2px;
}

.mg-es-sets i.is-on {
  background: var(--grp);
}

.mg-es-log {
  max-height: 160px;
  overflow-y: auto;
}

@media (max-width: 640px) {
  .mg-es-board { aspect-ratio: auto; grid-template-rows: repeat(6, minmax(60px, auto)); padding: 6px; gap: 1px; }
  .mg-es-ticker { display: none; }
  .mg-es-pawn .mg-avatar { width: 18px; height: 18px; }
  .mg-es-band { height: 9px; }
}

.mg-es-turn span,
.mg-es-turn b {
  white-space: nowrap;
}

/* ----------------------------------------------------------------------------
   STUDIO GAMES UI POLISH v4
   ---------------------------------------------------------------------------- */
.mg-section .glass-card {
  background: linear-gradient(180deg, rgba(24, 24, 29, 0.92) 0%, rgba(15, 15, 19, 0.96) 100%);
  border: 1px solid rgba(255, 255, 255, 0.085);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 18px 44px -24px rgba(0, 0, 0, 0.85);
}

.mg-title {
  background: linear-gradient(180deg, #ffffff 35%, #a1a1aa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Entry / Profile Card: wider profile workspace + spacious room code entry */
.mg-entry-grid {
  grid-template-columns: minmax(0, 1.85fr) minmax(270px, 0.85fr);
  gap: 20px;
}

.mg-entry {
  padding: 28px;
}

.mg-profile {
  gap: 22px;
  margin-bottom: 22px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.065);
}

.mg-profile-head h2 {
  font-size: 20px;
  letter-spacing: -0.02em;
}

.mg-name-row .mg-input {
  height: 48px;
  padding: 0 15px;
  background: rgba(9, 9, 11, 0.55);
  border-color: rgba(255, 255, 255, 0.13);
}

.mg-name-dice {
  width: 48px;
  height: 48px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(255, 255, 255, 0.12);
}

.mg-name-dice:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
}

.mg-av-picker {
  padding: 18px 20px;
  margin-bottom: 20px;
  background: rgba(9, 9, 11, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.075);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
}

.mg-av-opt {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.mg-av-colors {
  gap: 10px;
}

.mg-av-color {
  width: 28px;
  height: 28px;
}

/* Action tiles: give Join Room extra horizontal space so 4-letter code breathes */
.mg-act-grid {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.25fr);
  gap: 14px;
}

.mg-act-tile {
  padding: 18px 20px;
  gap: 16px;
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.038) 0%, rgba(255, 255, 255, 0.012) 100%);
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.045) inset;
  transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
}

.mg-act-tile:hover {
  border-color: rgba(255, 255, 255, 0.16);
}

.mg-act-tile.is-create {
  background: linear-gradient(180deg, rgba(96, 165, 250, 0.075) 0%, rgba(255, 255, 255, 0.015) 100%);
  border-color: rgba(96, 165, 250, 0.22);
}

.mg-act-tile.is-join:focus-within {
  border-color: rgba(96, 165, 250, 0.45);
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.18), 0 12px 28px -18px rgba(96, 165, 250, 0.35);
}

.mg-act-head strong {
  font-size: 15.5px;
  margin-bottom: 2px;
}

.mg-btn-create {
  height: 50px;
  font-size: 15px;
  border-radius: var(--r);
}

.mg-join {
  gap: 10px;
  align-items: stretch;
}

.mg-act-tile .mg-join .mg-code-input {
  flex: 1 1 150px;
  min-width: 148px;
  height: 50px;
  padding: 0 10px 0 16px;
  border-radius: var(--r);
  background: rgba(9, 9, 11, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.32em;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35) inset;
}

.mg-act-tile .mg-join .mg-code-input::placeholder {
  font-size: 15px;
  letter-spacing: 0.24em;
  color: var(--text-3);
}

.mg-act-tile .mg-join .mg-code-input:focus {
  background: rgba(9, 9, 11, 0.88);
  border-color: var(--accent);
}

.mg-join .btn {
  flex: none;
  height: 50px;
  padding: 0 22px;
  border-radius: var(--r);
  white-space: nowrap;
}

.mg-how {
  padding: 24px 22px;
}

.mg-steps li {
  padding: 10px 12px;
  border-radius: var(--r);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.055);
}

@media (max-width: 1020px) {
  .mg-entry-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .mg-entry {
    padding: 20px 16px;
  }
  .mg-act-grid {
    grid-template-columns: 1fr;
  }
  .mg-join {
    flex-wrap: nowrap;
  }
  .mg-act-tile .mg-join .mg-code-input {
    min-width: 0;
  }
}

/* Stage: subtle accent top edge & crisp "your move" halo */
.mg-stage {
  position: relative;
  overflow: hidden;
}

.mg-stage::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    color-mix(in srgb, var(--game-accent, var(--accent)) 70%, transparent) 50%,
    transparent 100%
  );
  opacity: 0.85;
  pointer-events: none;
}

.mg-stage.is-awaiting {
  border-color: color-mix(in srgb, var(--game-accent, var(--accent)) 55%, rgba(255, 255, 255, 0.12));
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 0 0 1px color-mix(in srgb, var(--game-accent, var(--accent)) 22%, transparent),
    0 20px 50px -24px color-mix(in srgb, var(--game-accent, var(--accent)) 25%, rgba(0, 0, 0, 0.9));
}

.mg-your-move {
  background: color-mix(in srgb, var(--game-accent, var(--accent)) 18%, rgba(255, 255, 255, 0.04));
  border: 1px solid color-mix(in srgb, var(--game-accent, var(--accent)) 45%, transparent);
  box-shadow: 0 4px 14px -6px color-mix(in srgb, var(--game-accent, var(--accent)) 50%, transparent);
}

/* Entry & Lobby game cards */
.mg-game-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035) 0%, rgba(255, 255, 255, 0.01) 100%);
  border-color: rgba(255, 255, 255, 0.085);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.045) inset;
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s;
}

.mg-game-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--game-accent, var(--accent)) 50%, rgba(255, 255, 255, 0.14));
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--game-accent, var(--accent)) 10%, rgba(255, 255, 255, 0.03)) 0%,
    rgba(255, 255, 255, 0.015) 100%
  );
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 14px 32px -18px rgba(0, 0, 0, 0.85);
}

.mg-game-icon,
.mg-stage-icon {
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12) inset;
}

/* Room code tiles: crisp monospace bevel */
.mg-code-tiles span {
  font-family: var(--mono);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.025) 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset, 0 6px 14px -8px rgba(0, 0, 0, 0.7);
}

/* Scoreboard rows & medals */
.mg-score-list li {
  transition: background var(--t-fast), border-color var(--t-fast);
}

.mg-score-list li.is-you {
  background: linear-gradient(90deg, rgba(96, 165, 250, 0.1) 0%, rgba(96, 165, 250, 0.03) 100%);
  border-color: rgba(96, 165, 250, 0.22);
}

.mg-rank.r1 {
  background: linear-gradient(135deg, #fde047 0%, #eab308 100%);
  color: #1c1917;
  box-shadow: 0 2px 10px -2px rgba(234, 179, 8, 0.5);
}

.mg-rank.r2 {
  background: linear-gradient(135deg, #e4e4e7 0%, #a1a1aa 100%);
  color: #18181b;
}

.mg-rank.r3 {
  background: linear-gradient(135deg, #fdba74 0%, #c2410c 100%);
  color: #fff;
}

/* Timer bar: subtle accent glow */
.mg-timebar i {
  box-shadow: 0 0 10px -1px color-mix(in srgb, var(--game-accent, var(--accent)) 60%, transparent);
}

/* In-game interactive cards (Trivia, Funny, WhoSaid) */
.mg-trivia-opt,
.mg-funny-card,
.mg-ws-card {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.045) inset;
  transition: transform var(--t-fast) var(--ease), border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
}

.mg-trivia-opt:not(:disabled):hover,
.mg-funny-card:not(:disabled):hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--game-accent, var(--accent)) 55%, rgba(255, 255, 255, 0.16));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset, 0 12px 26px -14px rgba(0, 0, 0, 0.8);
}

/* Canvas & How-to modal polish */
.mg-canvas {
  border-radius: var(--r);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12), 0 16px 40px -16px rgba(0, 0, 0, 0.85);
}

.mg-howto-back {
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.mg-howto-card {
  background: linear-gradient(180deg, #17171d 0%, #101014 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 28px 70px -16px rgba(0, 0, 0, 0.92);
}

@media (prefers-reduced-motion: reduce) {
  .mg-game-card:hover,
  .mg-trivia-opt:not(:disabled):hover,
  .mg-funny-card:not(:disabled):hover {
    transform: none !important;
  }
}

/* ----------------------------------------------------------------------------
   TRON (LIGHT CYCLES)
   ---------------------------------------------------------------------------- */
.mg-tron-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.mg-tron-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 11px;
  border-radius: var(--r-pill);
  border: 1px solid color-mix(in srgb, var(--tc) 38%, rgba(255, 255, 255, 0.1));
  background: color-mix(in srgb, var(--tc) 12%, rgba(9, 9, 11, 0.7));
  font-size: 13px;
  color: var(--text);
}

.mg-tron-pill.is-you {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--tc) 55%, transparent);
}

.mg-tron-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--tc);
  box-shadow: 0 0 8px var(--tc);
}

.mg-tron-pill small {
  color: #fde047;
  font-weight: 700;
  font-family: var(--mono);
}

.mg-tron-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 16px;
  margin-bottom: 12px;
  border-radius: var(--r);
  border: 1px solid rgba(34, 211, 238, 0.35);
  background: linear-gradient(90deg, rgba(6, 182, 212, 0.14), rgba(34, 211, 238, 0.06));
  color: #cffafe;
  font-size: 15px;
}

.mg-tron-banner.is-end {
  border-color: rgba(250, 204, 21, 0.45);
  background: linear-gradient(90deg, rgba(250, 204, 21, 0.16), rgba(234, 179, 8, 0.06));
  color: #fef08a;
}

.mg-tron-wrap {
  display: flex;
  justify-content: center;
}

.mg-tron-slot {
  width: 100%;
  max-width: max(320px, calc((100vh - var(--header-h) - 210px) * 1.615));
}

.mg-tron-canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--r);
  background: #080b12;
  touch-action: none;
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.2), 0 18px 44px -18px rgba(0, 0, 0, 0.9);
}

.mg-tron-boost-btn {
  background: linear-gradient(135deg, #06b6d4 0%, #0284c7 100%);
  border-color: rgba(34, 211, 238, 0.6);
}

@media (max-height: 600px) {
  .mg-tron-slot {
    max-width: 100%;
  }
}

/* ----------------------------------------------------------------------------
   PLAYABILITY, VIEWPORT FIT & ANIMATIONS v5 (all 17 games)
   Keeps every active game cleanly inside the desktop viewport so boards,
   canvases, cards, and action buttons never get pushed off-screen.
   ---------------------------------------------------------------------------- */

/* 1. Desktop Full-Viewport Play Shell */
@media (min-width: 901px) {
  body.mg-is-playing .site-footer {
    display: none;
  }

  body.mg-is-playing .site-header .nav-inner {
    height: 52px;
  }

  body.mg-is-playing {
    --header-h: 52px;
  }

  .mg-section.is-playing {
    padding: 10px 0 12px;
  }

  .mg-section.is-playing > .container {
    max-width: 1580px;
    padding: 0 18px;
  }

  .mg-section.is-playing .mg-layout {
    grid-template-columns: minmax(0, 1fr) 252px;
    gap: 12px;
    height: calc(100dvh - var(--header-h) - 22px);
    align-items: stretch;
  }

  .mg-section.is-playing .mg-stage {
    height: 100%;
    min-height: 0;
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
  }

  /* Prevent flex-column compression from squishing boards, cards, or player rows */
  .mg-section.is-playing .mg-stage > * {
    flex-shrink: 0;
  }

  .mg-section.is-playing .mg-side {
    position: static;
    height: 100%;
    max-height: none;
    padding: 12px;
    gap: 10px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .mg-section.is-playing .mg-score-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-right: 2px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
  }

  .mg-section.is-playing .mg-side-actions {
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
  }

  /* Compact stage header & timebar so the game area gets maximum height */
  .mg-section.is-playing .mg-stage-top {
    margin-bottom: 6px;
  }

  .mg-section.is-playing .mg-timebar {
    margin-bottom: 10px;
  }

  /* Real-time canvases (Mini Football, Tron, Draw & Guess, Telephone): fit cleanly inside 100dvh */
  .mg-section.is-playing .mg-ball-score {
    margin-bottom: 8px;
  }

  .mg-section.is-playing .mg-ball-slot {
    max-width: min(100%, max(320px, calc((100dvh - var(--header-h) - 255px) * 1.847)));
  }

  .mg-section.is-playing .mg-tron-bar {
    margin-bottom: 8px;
  }

  .mg-section.is-playing .mg-tron-banner {
    padding: 8px 14px;
    margin-bottom: 8px;
  }

  .mg-section.is-playing .mg-tron-slot {
    max-width: min(100%, max(320px, calc((100dvh - var(--header-h) - 260px) * 1.615)));
  }

  .mg-section.is-playing .mg-draw-area {
    min-height: 0;
    align-items: start;
  }

  .mg-section.is-playing .mg-draw-area .mg-chat {
    max-height: calc(100dvh - var(--header-h) - 200px);
    min-height: 220px;
  }

  .mg-section.is-playing .mg-canvas {
    max-width: min(100%, max(280px, calc((100dvh - var(--header-h) - 290px) * 1.4286)));
  }

  .mg-section.is-playing .mg-tel-prompt {
    margin-bottom: 8px;
    padding: 10px 14px;
  }

  .mg-section.is-playing .mg-ball-hint {
    margin-top: 6px;
    font-size: 12.5px;
  }

  /* Reflex Duel: fill available stage height without pushing key hint off-screen */
  .mg-section.is-playing .mg-reflex-pad {
    flex: 1 1 auto;
    min-height: 220px;
    max-height: calc(100dvh - var(--header-h) - 180px);
  }

  /* Quick Estate (Hızlı Emlak): board on the left, money/players/details/log on the right */
  .mg-section.is-playing .mg-es-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(240px, 310px);
    gap: 14px;
    flex: 1 1 auto;
    min-height: 0;
    align-items: stretch;
  }

  .mg-section.is-playing .mg-es-board-col {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 0;
  }

  .mg-section.is-playing .mg-es-board {
    width: 100%;
    max-width: min(100%, calc((100dvh - var(--header-h) - 120px) * 1.12));
    max-height: 100%;
    margin: 0;
    padding: 8px;
  }

  .mg-section.is-playing .mg-es-sq {
    padding: 0 2px 5px;
  }

  .mg-section.is-playing .mg-es-band {
    height: 14px;
    margin: 0 -2px 2px;
  }

  .mg-section.is-playing .mg-es-name {
    font-size: clamp(9.5px, 0.8vw, 11.5px);
  }

  .mg-section.is-playing .mg-es-sq small {
    font-size: clamp(9.5px, 0.75vw, 11px);
    padding: 0 5px;
  }

  .mg-section.is-playing .mg-es-info-col {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
  }

  .mg-section.is-playing .mg-es-info-col > * {
    flex-shrink: 0;
  }

  .mg-section.is-playing .mg-es-players {
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 0;
  }

  .mg-section.is-playing .mg-es-players li {
    padding: 8px 10px;
    gap: 4px;
  }

  .mg-section.is-playing .mg-es-detail,
  .mg-section.is-playing .mg-es-compose {
    margin-bottom: 0;
    padding: 12px;
  }

  .mg-section.is-playing .mg-es-trade-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 8px 0;
  }

  .mg-section.is-playing .mg-es-tip {
    margin: 0;
    font-size: 12.5px;
  }

  .mg-section.is-playing .mg-es-log {
    max-height: 180px;
    margin-top: 2px;
  }

  /* Region Conquest (Bölge Fethi): fit map + player strip + controls cleanly */
  .mg-section.is-playing .mg-cq-order {
    margin-bottom: 8px;
  }

  .mg-section.is-playing .mg-cq-panel {
    gap: 6px;
    margin-bottom: 8px;
  }

  .mg-section.is-playing .mg-cq-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 8px;
  }

  .mg-section.is-playing .mg-cq-map,
  .mg-section.is-playing .mg-cq-svg {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: calc(100dvh - var(--header-h) - 275px);
  }

  /* Color Card Clash (Renkli Kart Savaşı): keep felt, opponents, actions & full hand visible */
  .mg-section.is-playing .mg-ck-felt {
    height: clamp(270px, calc(100dvh - var(--header-h) - 310px), 400px);
    margin: 0;
  }

  .mg-section.is-playing .mg-ck-actions {
    margin-top: 8px;
  }

  .mg-section.is-playing .mg-ck-wild {
    margin-top: 8px;
    padding: 10px 12px;
  }

  .mg-section.is-playing .mg-ck-hand {
    min-height: 124px;
    padding: 20px 10px 6px;
    max-width: 100%;
  }

  /* Social deduction & board games (Vampire / Council / Manor / Impostor): compact headers + bounded chat */
  .mg-section.is-playing .mg-role-card,
  .mg-section.is-playing .mg-banner {
    margin-bottom: 8px;
  }

  .mg-section.is-playing .mg-cboard {
    margin-bottom: 10px;
  }

  .mg-section.is-playing .mg-chat-log {
    max-height: calc(100dvh - var(--header-h) - 340px);
    min-height: 120px;
  }
}

/* Stack Hızlı Emlak below 1040px so the board stays wide and legible */
@media (max-width: 1040px) {
  .mg-section.is-playing .mg-es-layout {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: none;
  }

  .mg-section.is-playing .mg-es-board {
    max-width: min(100%, 720px);
    max-height: none;
  }

  .mg-section.is-playing .mg-es-info-col {
    overflow: visible;
    padding-right: 0;
  }

  .mg-section.is-playing .mg-es-players {
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  }
}

/* 2. Clearer Lobby & Menus */
.mg-tabs {
  display: inline-flex;
  gap: 6px;
  padding: 5px;
  border-radius: var(--r);
  background: rgba(9, 9, 11, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 14px;
}

.mg-tab {
  border-radius: var(--r-sm);
  font-weight: 600;
  transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}

.mg-tab.is-on {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.06));
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12) inset, 0 4px 12px -4px rgba(0, 0, 0, 0.6);
}

.mg-stepper {
  background: rgba(9, 9, 11, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--r-sm);
}

.mg-stepper button {
  transition: background var(--t-fast), color var(--t-fast), transform 0.1s;
}

.mg-stepper button:active:not(:disabled) {
  transform: scale(0.92);
}

.mg-side-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-2);
}

.mg-side-title b {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
}

/* 3. Livelier, Studio-Grade Animations */
@keyframes mg-pop-in {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.975);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes mg-your-move-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--game-accent, var(--accent)) 45%, transparent);
  }
  50% {
    box-shadow: 0 0 0 6px transparent;
  }
}

.mg-stage,
.mg-result,
.mg-reveal-hero,
.mg-tron-banner {
  animation: mg-pop-in 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.mg-your-move {
  animation: mg-your-move-pulse 2.2s ease-in-out infinite;
}

/* Cards in hand: tactile fan lift */
.mg-ck-hand .mg-uc {
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.18s, filter 0.18s;
}

.mg-ck-hand .mg-uc:not(:disabled):hover {
  transform: translateY(-12px) scale(1.05);
  z-index: 6;
  box-shadow: 0 14px 28px -8px rgba(0, 0, 0, 0.75);
}

/* Reflex pad: clearer visual pop */
.mg-reflex-pad {
  transition: transform 0.12s var(--ease), background 0.15s, box-shadow 0.15s;
}

.mg-reflex-pad:active {
  transform: scale(0.985);
}

/* Trivia / Funny / WhoSaid / Manor / Council / Vampire interactive clarity */
.mg-trivia-opt {
  min-height: 58px;
  font-size: 15.5px;
}

.mg-question {
  font-size: clamp(1.05rem, 0.95rem + 0.5vw, 1.3rem);
  line-height: 1.45;
  padding: 16px 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015));
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--r);
}

@media (prefers-reduced-motion: reduce) {
  .mg-stage,
  .mg-result,
  .mg-reveal-hero,
  .mg-tron-banner,
  .mg-your-move {
    animation: none !important;
  }
  .mg-ck-hand .mg-uc:not(:disabled):hover {
    transform: none !important;
  }
}

/* ----------------------------------------------------------------------------
   4. PLAY SHELL CONTROLS, LOBBY CARDS, GAME POLISH & THEME CONSISTENCY v6
   ---------------------------------------------------------------------------- */

/* Stage quick-action icon buttons (Side panel toggle & Fullscreen) */
.mg-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
  flex: none;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}

.mg-icon-btn:hover {
  background: var(--surface-hover, rgba(255, 255, 255, 0.08));
  color: var(--text);
  border-color: var(--border-strong);
}

.mg-icon-btn[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent-text);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}

.mg-icon-btn .mg-ico {
  width: 15px;
  height: 15px;
}

/* Collapsible side panel on desktop during active play */
@media (min-width: 901px) {
  .mg-section.is-playing .mg-layout.is-side-collapsed {
    grid-template-columns: minmax(0, 1fr);
  }

  .mg-section.is-playing .mg-layout.is-side-collapsed .mg-side {
    display: none;
  }
}

@media (max-width: 900px) {
  .mg-stage-ctl[data-mg="toggle_side"] {
    display: none;
  }
}

/* Fullscreen mode: clean edge-to-edge workspace */
#mg-root:fullscreen,
#mg-root:-webkit-full-screen {
  background: var(--bg);
  padding: 12px 16px;
  overflow: hidden;
  --header-h: 0px;
}

#mg-root:fullscreen .mg-layout.is-playing,
#mg-root:-webkit-full-screen .mg-layout.is-playing {
  height: calc(100dvh - 24px);
}

/* Compact room code strip inside side panel while a game is running */
.mg-room-compact {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: var(--r);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}

.mg-room-badge {
  flex: 1;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--text);
  padding-left: 4px;
}

/* Lobby cards: Bot badge, collapsible settings, quick bot-start button */
.mg-bot-chip {
  background: color-mix(in srgb, #38bdf8 14%, var(--surface-2));
  border-color: color-mix(in srgb, #38bdf8 32%, transparent);
  color: #7dd3fc;
}

.mg-cfg-fold {
  margin: 8px 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.02);
}

.mg-cfg-fold summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  list-style: none;
  -webkit-user-select: none;
  user-select: none;
}

.mg-cfg-fold summary::-webkit-details-marker {
  display: none;
}

.mg-cfg-fold summary::after {
  content: "▾";
  margin-left: auto;
  font-size: 11px;
  opacity: 0.65;
  transition: transform var(--t-fast);
}

.mg-cfg-fold[open] summary::after {
  transform: rotate(180deg);
}

.mg-cfg-fold summary .mg-ico {
  width: 14px;
  height: 14px;
}

.mg-cfg-fold .mg-cfg {
  margin: 0;
  padding: 6px 10px 10px;
  border-top: 1px solid var(--border);
}

.mg-bot-start-btn {
  background: linear-gradient(135deg, color-mix(in srgb, var(--game-accent, var(--accent)) 85%, #0ea5e9), var(--game-accent, var(--accent)));
  color: #fff;
  border-color: transparent;
}

/* Secret role card Hide / Show toggle (Vampire, Council, Impostor) */
.mg-role-card {
  position: relative;
}

.mg-role-card > div {
  flex: 1;
  min-width: 0;
}

.mg-role-toggle {
  margin-left: auto;
  align-self: flex-start;
  flex: none;
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
  border: 1px solid var(--border);
}

.mg-role-card.is-hidden {
  padding: 8px 12px;
  align-items: center;
  background: var(--surface-2);
  border-style: dashed;
}

.mg-role-card.is-hidden .mg-role-icon {
  width: 30px;
  height: 30px;
}

.mg-role-card.is-hidden strong {
  font-size: 13.5px;
  color: var(--text-2);
}

/* Hızlı Emlak: floating +/- cash change badge */
.mg-es-cashv {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.mg-es-delta {
  position: absolute;
  right: 0;
  top: -16px;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  pointer-events: none;
  animation: mg-es-float 2.2s ease-out forwards;
}

.mg-es-delta.is-pos {
  background: rgba(22, 163, 74, 0.2);
  color: #4ade80;
}

.mg-es-delta.is-neg {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

@keyframes mg-es-float {
  0% { opacity: 0; transform: translateY(6px) scale(0.9); }
  15% { opacity: 1; transform: translateY(0) scale(1); }
  75% { opacity: 1; transform: translateY(-6px); }
  100% { opacity: 0; transform: translateY(-14px); }
}

/* Bölge Fethi: Region Bonus legend strip */
.mg-cq-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 0 0 8px;
}

.mg-cq-leg {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 12px;
  color: var(--text-2);
}

.mg-cq-leg b {
  color: var(--text);
  font-family: var(--mono);
}

.mg-cq-leg.is-held {
  border-color: color-mix(in srgb, var(--pc) 60%, transparent);
  background: color-mix(in srgb, var(--pc) 16%, var(--surface-2));
  color: var(--text);
}

.mg-cq-leg em {
  font-style: normal;
  font-size: 11px;
  color: var(--pc);
  font-weight: 700;
}

/* Renkli Kart Savaşı: smooth overflow for large hands + clearer playable glow */
.mg-ck-hand {
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.mg-ck-hand .mg-uc.is-ok {
  box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.55), 0 6px 16px -6px rgba(0, 0, 0, 0.7);
}

/* Light theme compatibility for v4/v5 polish blocks */
html[data-theme="light"] .mg-section .glass-card {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

html[data-theme="light"] .mg-title {
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
  color: var(--text);
}

html[data-theme="light"] .mg-tabs,
html[data-theme="light"] .mg-stepper,
html[data-theme="light"] .mg-av-picker,
html[data-theme="light"] .mg-room-compact {
  background: var(--surface-2);
  border-color: var(--border);
}

html[data-theme="light"] .mg-tab.is-on {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

html[data-theme="light"] .mg-howto-card {
  background: var(--surface);
  border-color: var(--border-strong);
}

html[data-theme="light"] .mg-bot-chip {
  color: #0369a1;
}

/* ----------------------------------------------------------------------------
   5. PARTY JUICE, REACTIONS, CONFETTI, ROOM CHAT, FILTERS, PACKS & FX v7
   ---------------------------------------------------------------------------- */

/* Live Emoji Reactions bar & floating layer */
.mg-react-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.mg-react-btn {
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: transform var(--t-fast), background var(--t-fast);
}

.mg-react-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: scale(1.16);
}

.mg-react-btn:active {
  transform: scale(0.92);
}

.mg-react-layer,
.mg-confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 950;
  overflow: hidden;
}

.mg-react-pop {
  position: absolute;
  bottom: 24px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  animation: mg-react-rise 2.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.mg-react-em {
  font-size: 34px;
  line-height: 1;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.45));
}

.mg-react-pop small {
  padding: 1px 7px;
  border-radius: var(--r-pill);
  background: rgba(9, 9, 11, 0.78);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

@keyframes mg-react-rise {
  0% { opacity: 0; transform: translate(-50%, 16px) scale(0.6); }
  12% { opacity: 1; transform: translate(-50%, -18px) scale(1.15); }
  25% { transform: translate(-50%, -44px) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -260px) scale(0.95); }
}

/* Confetti celebration */
.mg-conf {
  position: absolute;
  top: -14px;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  animation: mg-conf-fall 2s ease-in forwards;
}

@keyframes mg-conf-fall {
  0% { opacity: 1; transform: translate(0, 0) rotate(0deg); }
  85% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx, 0px), 102vh) rotate(var(--rot, 360deg)); }
}

/* Win streak badge */
.mg-tag-streak {
  background: rgba(249, 115, 22, 0.18);
  color: #fb923c;
  border: 1px solid rgba(249, 115, 22, 0.35);
}

/* Collapsible Room Chat in side panel */
.mg-rchat {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
  overflow: hidden;
  flex: none;
}

.mg-rchat-head {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.mg-rchat-head:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.mg-rchat-head .mg-ico {
  width: 14px;
  height: 14px;
}

.mg-rchat-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  display: inline-grid;
  place-items: center;
}

.mg-rchat-log {
  margin: 0;
  padding: 6px 8px;
  list-style: none;
  max-height: 130px;
  overflow-y: auto;
  border-top: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.4;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scrollbar-width: thin;
}

.mg-rchat-log li {
  word-break: break-word;
  color: var(--text-2);
}

.mg-rchat .mg-chat-form {
  padding: 6px;
  border-top: 1px solid var(--border);
}

.mg-rchat .mg-input {
  height: 32px;
  font-size: 12.5px;
  padding: 0 8px;
}

/* Volume slider beside mute button */
.mg-sound-ctl {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
}

.mg-side-actions .mg-sound-ctl {
  width: 100%;
}

.mg-side-actions .mg-sound-ctl .mg-sound-btn {
  width: auto;
  flex: none;
}

.mg-vol-range {
  width: 78px;
  flex: 1 1 64px;
  min-width: 48px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Lobby quick filter pills */
.mg-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.mg-filter-btn {
  height: 28px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}

.mg-filter-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.mg-filter-btn.is-on {
  background: var(--accent-soft);
  color: var(--accent-text);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}

.mg-filter-empty {
  padding: 20px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--r);
}

/* Custom Question Pack button & modal */
.mg-pack-btn {
  width: 100%;
  margin-bottom: 8px;
  justify-content: center;
  border: 1px dashed var(--border-strong);
}

.mg-pack-card {
  max-width: 560px;
}

.mg-pack-ta {
  height: auto;
  min-height: 170px;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
}

.mg-pack-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

/* Drawing tool buttons (Brush / Bucket) */
.mg-tool-btn {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}

.mg-tool-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.mg-tool-btn.is-active {
  background: var(--accent-soft);
  color: var(--accent-text);
  border-color: var(--accent);
}

.mg-tool-btn .mg-ico {
  width: 16px;
  height: 16px;
}

.mg-tools-reveal {
  justify-content: flex-end;
}

/* Mini Football & Tron GOAL / WIN overlay + screen shake */
.mg-ball-slot,
.mg-tron-slot {
  position: relative;
}

.mg-fx-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: var(--r);
  background: radial-gradient(circle, rgba(0, 0, 0, 0.52), rgba(0, 0, 0, 0.18));
  pointer-events: none;
  z-index: 5;
  animation: mg-fx-pop 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.mg-fx-overlay span {
  font-size: clamp(2rem, 5vw, 3.6rem);
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #fde047;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.8), 0 0 28px rgba(250, 204, 21, 0.5);
}

.mg-fx-overlay.is-goal span {
  color: #4ade80;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.8), 0 0 28px rgba(74, 222, 128, 0.55);
}

.mg-fx-overlay small {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  padding: 2px 12px;
  border-radius: var(--r-pill);
  background: rgba(0, 0, 0, 0.55);
}

.mg-ball-slot.is-shake,
.mg-tron-slot.is-shake {
  animation: mg-screen-shake 0.38s ease-out;
}

@keyframes mg-fx-pop {
  0% { opacity: 0; transform: scale(0.72); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes mg-screen-shake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-5px, 3px); }
  40% { transform: translate(5px, -3px); }
  60% { transform: translate(-3px, -2px); }
  80% { transform: translate(3px, 2px); }
}

@media (prefers-reduced-motion: reduce) {
  .mg-react-pop,
  .mg-conf,
  .mg-fx-overlay,
  .mg-ball-slot.is-shake,
  .mg-tron-slot.is-shake {
    animation: none !important;
  }
}

/* ----------------------------------------------------------------------------
   6. SECRET AGENTS (CODENAMES 5x5), REMATCH, LOBBY VOTING & WEALTH BAR v8
   ---------------------------------------------------------------------------- */

/* Lobby Game Vote pill & Most Wanted highlight */
.mg-vote-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 26px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}

.mg-vote-pill:hover {
  color: var(--text);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.mg-vote-pill.is-on {
  background: var(--accent-soft);
  color: var(--accent-text);
  border-color: var(--accent);
}

.mg-top-vote-chip {
  background: rgba(250, 204, 21, 0.16);
  border-color: rgba(250, 204, 21, 0.42);
  color: #fde047;
}

.mg-game-card.is-top-voted {
  border-color: rgba(250, 204, 21, 0.45);
  box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.2), 0 14px 30px -18px rgba(250, 204, 21, 0.35);
}

/* Rematch & end-screen action row */
.mg-end-actions,
.mg-result-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
}

.mg-end-actions .mg-lobby-btn {
  margin-top: 0;
}

/* Hızlı Emlak: proportional net-worth leader bar */
.mg-es-wealth {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
}

.mg-es-whead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.mg-es-whead .mg-label {
  margin: 0;
}

.mg-es-whead small {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: #fde047;
  font-variant-numeric: tabular-nums;
}

.mg-es-whead small .mg-ico {
  width: 13px;
  height: 13px;
}

.mg-es-wbar {
  display: flex;
  height: 9px;
  border-radius: var(--r-pill);
  overflow: hidden;
  background: var(--surface-2);
  gap: 2px;
}

.mg-es-wbar i {
  display: block;
  height: 100%;
  border-radius: 2px;
  transition: width 0.35s var(--ease);
}

/* Secret Agents (Gizli Ajanlar — 5x5 Codenames board) */
.mg-ag-teams {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.mg-ag-team {
  padding: 8px 12px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--surface-2);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.mg-ag-team.is-red {
  border-left: 4px solid #ef4444;
}

.mg-ag-team.is-blue {
  border-left: 4px solid #3b82f6;
}

.mg-ag-team.is-red.is-turn {
  border-color: rgba(239, 68, 68, 0.65);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.25);
}

.mg-ag-team.is-blue.is-turn {
  border-color: rgba(59, 130, 246, 0.65);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.25);
}

.mg-ag-thead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.mg-ag-thead strong {
  font-size: 13.5px;
}

.mg-ag-left {
  min-width: 26px;
  height: 24px;
  padding: 0 8px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--r-pill);
  font-family: var(--mono);
  font-size: 13px;
  color: #fff;
}

.mg-ag-team.is-red .mg-ag-left {
  background: #dc2626;
}

.mg-ag-team.is-blue .mg-ag-left {
  background: #2563eb;
}

.mg-ag-members {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mg-ag-mem {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-2);
}

.mg-ag-mem.is-you {
  color: var(--text);
  font-weight: 700;
}

.mg-ag-mem em {
  font-style: normal;
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  background: rgba(250, 204, 21, 0.16);
  color: #fde047;
  font-weight: 700;
}

.mg-ag-clue-form {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.mg-ag-clue-form .mg-input {
  flex: 1;
}

.mg-ag-clue-form .mg-ag-cnt {
  flex: none;
  width: 72px;
  height: 42px;
}

.mg-ag-cluebar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  margin-bottom: 8px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.mg-ag-cluebar.is-red {
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.1);
}

.mg-ag-cluebar.is-blue {
  border-color: rgba(59, 130, 246, 0.45);
  background: rgba(59, 130, 246, 0.1);
}

.mg-ag-clueword {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mg-ag-clueword b {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--surface);
  font-family: var(--mono);
  font-size: 14px;
}

.mg-ag-cluebar small {
  color: var(--text-2);
  font-size: 13px;
  margin-right: auto;
}

.mg-ag-rolehint {
  margin: 0 0 8px;
  font-size: 12.5px;
  text-align: center;
}

.mg-ag-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.mg-ag-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 68px;
  padding: 8px 6px;
  border-radius: var(--r);
  border: 2px solid var(--border-strong);
  background: linear-gradient(180deg, #f3ead8, #e6d9be);
  color: #1c1917;
  font: inherit;
  font-size: clamp(11.5px, 1vw, 14px);
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-align: center;
  cursor: default;
  transition: transform var(--t-fast), box-shadow var(--t-fast), border-color var(--t-fast);
}

.mg-ag-card.is-pickable {
  cursor: pointer;
}

.mg-ag-card.is-pickable:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 10px 22px -10px rgba(0, 0, 0, 0.7);
}

/* Spymaster key view (subtle color hints on unrevealed cards) */
.mg-ag-board.is-key .mg-ag-card:not(.is-open).is-red {
  border-color: #ef4444;
  background: linear-gradient(180deg, #fee2e2, #fecaca);
}

.mg-ag-board.is-key .mg-ag-card:not(.is-open).is-blue {
  border-color: #3b82f6;
  background: linear-gradient(180deg, #dbeafe, #bfdbfe);
}

.mg-ag-board.is-key .mg-ag-card:not(.is-open).is-assassin {
  border-color: #18181b;
  background: linear-gradient(180deg, #3f3f46, #18181b);
  color: #f4f4f5;
}

/* Revealed cards */
.mg-ag-card.is-open {
  opacity: 0.94;
}

.mg-ag-card.is-open.is-red {
  background: linear-gradient(145deg, #ef4444, #b91c1c);
  border-color: #fca5a5;
  color: #fff;
}

.mg-ag-card.is-open.is-blue {
  background: linear-gradient(145deg, #3b82f6, #1d4ed8);
  border-color: #93c5fd;
  color: #fff;
}

.mg-ag-card.is-open.is-neutral {
  background: linear-gradient(145deg, #a8a29e, #78716c);
  border-color: #d6d3d1;
  color: #fafaf9;
  opacity: 0.72;
}

.mg-ag-card.is-open.is-assassin {
  background: linear-gradient(145deg, #27272a, #09090b);
  border-color: #ef4444;
  color: #fca5a5;
}

.mg-ag-ico .mg-ico {
  width: 16px;
  height: 16px;
}

.mg-ag-log {
  max-height: 110px;
}

@media (max-width: 640px) {
  .mg-ag-teams {
    grid-template-columns: 1fr;
  }
  .mg-ag-board {
    gap: 5px;
  }
  .mg-ag-card {
    min-height: 54px;
    padding: 5px 3px;
    font-size: 10.5px;
  }
}

/* ----------------------------------------------------------------------------
   7. SPECTATOR TAG, CONNECT 4, BATTLESHIP & LIAR'S DICE v9
   ---------------------------------------------------------------------------- */

.mg-tag-spec {
  background: rgba(148, 163, 184, 0.16);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

/* Connect 4 (Dörtlü Sıra) */
.mg-c4-players {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 10px;
}

.mg-c4-p {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 13.5px;
  font-weight: 600;
}

.mg-c4-p.is-turn {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 28%, transparent);
}

.mg-c4-disc {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.mg-c4-p.is-p0 .mg-c4-disc {
  background: radial-gradient(circle at 35% 35%, #fca5a5, #dc2626);
}

.mg-c4-p.is-p1 .mg-c4-disc {
  background: radial-gradient(circle at 35% 35%, #fef08a, #eab308);
}

.mg-c4-hint {
  margin: 0 0 8px;
  text-align: center;
}

.mg-c4-board {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
  max-width: min(520px, calc((100dvh - var(--header-h) - 240px) * 1.16));
  margin: 0 auto 10px;
  padding: 12px;
  border-radius: 16px;
  background: linear-gradient(160deg, #1d4ed8, #1e3a8a);
  border: 2px solid rgba(96, 165, 250, 0.35);
  box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.9), inset 0 2px 0 rgba(255, 255, 255, 0.14);
}

.mg-c4-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: default;
  transition: background var(--t-fast);
}

.mg-c4-col.is-open {
  cursor: pointer;
}

.mg-c4-col.is-open:hover {
  background: rgba(255, 255, 255, 0.12);
}

.mg-c4-cell {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(9, 13, 28, 0.82);
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.65);
}

.mg-c4-cell i {
  width: 86%;
  height: 86%;
  border-radius: 50%;
  display: block;
}

.mg-c4-cell.is-p0 i {
  background: radial-gradient(circle at 32% 32%, #fca5a5, #ef4444 45%, #991b1b);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.mg-c4-cell.is-p1 i {
  background: radial-gradient(circle at 32% 32%, #fef08a, #facc15 45%, #ca8a04);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.mg-c4-cell.is-last i {
  animation: mg-c4-drop 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.mg-c4-cell.is-win {
  box-shadow: 0 0 0 3px #fff, 0 0 18px rgba(250, 204, 21, 0.85);
}

@keyframes mg-c4-drop {
  0% { transform: translateY(-120%); opacity: 0.7; }
  100% { transform: translateY(0); opacity: 1; }
}

/* Battleship (Amiral Battı — 8x8) */
.mg-bs-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 10px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.mg-bs-bar p {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-2);
}

.mg-bs-boards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
  max-width: 820px;
  margin: 0 auto 10px;
}

.mg-bs-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.mg-bs-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 3px;
  width: 100%;
  max-width: min(370px, calc(100dvh - var(--header-h) - 250px));
  aspect-ratio: 1;
  padding: 8px;
  border-radius: 12px;
  background: linear-gradient(160deg, #0c4a6e, #082f49);
  border: 1px solid rgba(56, 189, 248, 0.32);
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.45);
}

.mg-bs-cell {
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(125, 211, 252, 0.16);
  border-radius: 4px;
  background: rgba(14, 116, 144, 0.32);
  color: #e0f2fe;
  font-size: 14px;
  line-height: 1;
  cursor: default;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}

.mg-bs-cell.is-ship {
  background: linear-gradient(135deg, #64748b, #334155);
  border-color: rgba(226, 232, 240, 0.45);
}

.mg-bs-cell.is-fire {
  cursor: crosshair;
}

.mg-bs-cell.is-fire:hover {
  background: rgba(56, 189, 248, 0.35);
  border-color: #38bdf8;
  transform: scale(1.06);
}

.mg-bs-cell.is-miss {
  background: rgba(15, 23, 42, 0.55);
  color: rgba(186, 230, 253, 0.65);
}

.mg-bs-cell.is-hit {
  background: linear-gradient(135deg, #dc2626, #991b1b);
  border-color: #fca5a5;
}

.mg-bs-cell.is-last {
  box-shadow: 0 0 0 2px #fde047;
}

@media (max-width: 780px) {
  .mg-bs-boards {
    grid-template-columns: 1fr;
  }
}

/* Liar's Dice (Yalancı Zar) */
.mg-ld-players {
  margin-bottom: 10px;
}

.mg-ld-table {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px;
  margin-bottom: 10px;
  border-radius: var(--r-lg);
  border: 1px solid rgba(251, 191, 36, 0.25);
  background: radial-gradient(circle at 50% 40%, rgba(180, 83, 9, 0.22), rgba(24, 24, 27, 0.7));
  text-align: center;
}

.mg-ld-bid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.mg-ld-bid strong {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  color: #fde047;
  line-height: 1.1;
}

.mg-ld-bid small {
  color: var(--text-2);
  font-size: 13px;
}

.mg-ld-mine {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px;
  margin-bottom: 10px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.mg-ld-dice {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.mg-ld-die {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  font-size: 24px;
  line-height: 1;
}

.mg-ld-die.is-lg {
  width: 48px;
  height: 48px;
  font-size: 34px;
}

.mg-ld-die.is-wild {
  border-color: #facc15;
  background: rgba(250, 204, 21, 0.16);
  color: #fde047;
}

.mg-ld-die.is-match {
  box-shadow: 0 0 0 2px #4ade80;
}

.mg-ld-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.mg-ld-faces {
  display: inline-flex;
  gap: 4px;
}

.mg-ld-fbtn {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: transform var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}

.mg-ld-fbtn:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
}

.mg-ld-fbtn.is-on {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.mg-ld-all {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.mg-ld-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.mg-ld-row > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 13.5px;
}

/* ----------------------------------------------------------------------------
   8. STUDIO VISUAL POLISH: SIDE TOOLBAR, CARD META, ATMOSPHERES & MOBILE v10
   ---------------------------------------------------------------------------- */

/* Clean side panel toolbar + primary actions */
.mg-side-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 6px;
  margin-bottom: 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.mg-side-toolbar .mg-icon-btn.is-on {
  background: var(--accent-soft);
  color: var(--accent-text);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}

.mg-side-primary {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mg-side-primary .btn {
  width: 100%;
  justify-content: flex-start;
}

/* Cleaner game card meta row (Vote + Bot badge + Top Wanted) & entry showcase toggle */
.mg-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 4px 0 10px;
}

.mg-card-meta .mg-vote-pill {
  margin-left: auto;
}

.mg-catalog-more {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

.mg-game-card-top {
  background-image:
    radial-gradient(circle at 85% 20%, color-mix(in srgb, var(--game-accent, var(--accent)) 22%, transparent), transparent 60%),
    linear-gradient(135deg, color-mix(in srgb, var(--game-accent, var(--accent)) 14%, transparent), transparent 70%);
}

/* Atmospheric game stage backgrounds */
.mg-stage-vampire.is-vamp-night {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(59, 130, 246, 0.16), transparent 62%),
    linear-gradient(180deg, #0d1326 0%, #0b0e18 100%);
  transition: background 0.5s ease;
}

.mg-stage-vampire.is-vamp-day {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(245, 158, 11, 0.14), transparent 60%),
    linear-gradient(180deg, #1f1912 0%, #121114 100%);
  transition: background 0.5s ease;
}

.mg-stage-battleship {
  background:
    radial-gradient(circle at 50% 45%, rgba(14, 165, 233, 0.11), transparent 58%),
    repeating-radial-gradient(circle at 50% 50%, rgba(56, 189, 248, 0.04) 0 1px, transparent 1px 44px),
    linear-gradient(180deg, #0b1826 0%, #090e16 100%);
}

.mg-stage-tron {
  background:
    linear-gradient(rgba(34, 211, 238, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 211, 238, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, #09121c 0%, #080a10 100%);
  background-size: 36px 36px, 36px 36px, 100% 100%;
}

.mg-stage-liars,
.mg-stage-cards {
  background:
    radial-gradient(ellipse at 50% 10%, rgba(234, 179, 8, 0.09), transparent 55%),
    linear-gradient(180deg, #191512 0%, #101014 100%);
}

.mg-stage-agents {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(20, 184, 166, 0.12), transparent 55%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.014) 0 2px, transparent 2px 14px),
    linear-gradient(180deg, #11181c 0%, #0d1014 100%);
}

/* Active turn breathing top edge & urgent timer red pulse */
.mg-stage.is-awaiting::before {
  height: 3px;
  opacity: 1;
  animation: mg-turn-glow 2s ease-in-out infinite;
}

@keyframes mg-turn-glow {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.mg-timebar.is-urgent i {
  background: linear-gradient(90deg, #ef4444, #f97316);
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.75);
  animation: mg-urgent-pulse 0.75s ease-in-out infinite;
}

@keyframes mg-urgent-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.35); }
}

/* Light theme safeguard for atmospheric stages */
html[data-theme="light"] .mg-stage-vampire.is-vamp-night,
html[data-theme="light"] .mg-stage-vampire.is-vamp-day,
html[data-theme="light"] .mg-stage-battleship,
html[data-theme="light"] .mg-stage-tron,
html[data-theme="light"] .mg-stage-liars,
html[data-theme="light"] .mg-stage-cards,
html[data-theme="light"] .mg-stage-agents {
  background: linear-gradient(180deg, color-mix(in srgb, var(--game-accent) 7%, var(--surface)), var(--surface) 220px);
}

/* Mobile & tablet polish */
@media (max-width: 900px) {
  .mg-side-primary {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .mg-side-primary .btn {
    width: auto;
    flex: 1 1 auto;
    justify-content: center;
  }
  .mg-side-toolbar {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .mg-react-bar {
    max-width: 320px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mg-stage.is-awaiting::before,
  .mg-timebar.is-urgent i {
    animation: none !important;
  }
}

/* ----------------------------------------------------------------------------
   9. PER-GAME PLAYABILITY POLISH v11 (ALL 21 GAMES)
   ---------------------------------------------------------------------------- */

/* Agents: card suggestion pin & teammate marks */
.mg-ag-slot {
  position: relative;
}

.mg-ag-slot .mg-ag-card {
  width: 100%;
  height: 100%;
}

.mg-ag-pin {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: rgba(9, 9, 11, 0.35);
  font-size: 11px;
  opacity: 0.45;
  cursor: pointer;
  transition: opacity var(--t-fast), background var(--t-fast), transform var(--t-fast);
}

.mg-ag-slot:hover .mg-ag-pin,
.mg-ag-pin.is-on {
  opacity: 1;
}

.mg-ag-pin.is-on {
  background: #f59e0b;
  transform: scale(1.08);
}

.mg-ag-marks {
  display: inline-flex;
  gap: 2px;
  margin-top: 2px;
}

.mg-ag-card.has-mark {
  box-shadow: inset 0 0 0 2px #f59e0b;
}

/* Cards: stack danger pill */
.mg-ck-danger {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: #fff;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.03em;
  animation: mg-urgent-pulse 0.9s ease-in-out infinite;
}

/* Quick Estate: buildable gold glow & quick build strip */
.mg-es-sq.is-buildable {
  box-shadow: inset 0 0 0 2px #facc15, 0 0 12px -2px rgba(250, 204, 21, 0.55);
}

.mg-es-qbuild {
  padding: 8px 10px;
  border: 1px solid rgba(250, 204, 21, 0.32);
  border-radius: var(--r);
  background: rgba(250, 204, 21, 0.07);
}

.mg-es-qbuild .mg-label {
  margin-bottom: 6px;
  color: #fde047;
}

/* Battleship: remaining enemy ship pills */
.mg-bs-ships {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--text-2);
}

.mg-bs-sp {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 20px;
  padding: 0 5px;
  border-radius: 5px;
  border: 1px solid rgba(56, 189, 248, 0.4);
  background: rgba(14, 165, 233, 0.16);
  color: #bae6fd;
  font-family: var(--mono);
  font-weight: 700;
}

.mg-bs-sp.is-sunk {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  text-decoration: line-through;
  opacity: 0.7;
}

/* Connect 4: column hover ghost disc */
.mg-c4-ghost {
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.45);
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
}

.mg-c4-board.is-p0 .mg-c4-col.is-open:hover .mg-c4-ghost {
  background: rgba(239, 68, 68, 0.85);
  color: #fff;
  transform: translateY(2px);
}

.mg-c4-board.is-p1 .mg-c4-col.is-open:hover .mg-c4-ghost {
  background: rgba(250, 204, 21, 0.9);
  color: #1c1917;
  transform: translateY(2px);
}

/* Liar's Dice: live hold counter */
.mg-ld-hold {
  width: 100%;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-2);
}

/* Manor: remaining possibilities pill */
.mg-mn-rem {
  display: inline-block;
  padding: 4px 10px;
  margin-bottom: 8px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 700;
}

/* Impostor: clue summary grid during vote */
.mg-imp-summary {
  padding: 10px 12px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
}

.mg-imp-summary ul {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 6px;
}

.mg-imp-summary li {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 12.5px;
}

.mg-imp-summary em {
  font-style: normal;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text-2);
}

/* Reflex stats header */
.mg-rt-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.mg-rt-head .mg-label {
  margin: 0;
}

.mg-rt-stats {
  display: inline-flex;
  gap: 6px;
}

/* Speed Typing live WPM */
.mg-type-wpm {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-text);
  white-space: nowrap;
}

/* Trivia combo tag */
.mg-combo-tag {
  font-style: normal;
  padding: 1px 6px;
  margin-left: 4px;
  border-radius: var(--r-pill);
  background: rgba(249, 115, 22, 0.22);
  color: #fb923c;
  font-size: 11px;
  font-weight: 800;
}

/* Estimate number-line scale */
.mg-est-scale {
  padding: 18px 14px 10px;
  margin: 10px 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
}

.mg-est-track {
  position: relative;
  height: 8px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.1);
  margin: 14px 0 8px;
}

.mg-est-ans {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
}

.mg-est-ans i {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #4ade80;
  border: 2px solid #fff;
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.8);
}

.mg-est-ans b {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  padding: 1px 6px;
  border-radius: 4px;
  background: #16a34a;
  color: #fff;
  font-family: var(--mono);
  font-size: 11px;
  white-space: nowrap;
}

.mg-est-dot {
  position: absolute;
  top: 50%;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--pc, var(--accent));
  border: 2px solid var(--surface);
  transform: translate(-50%, -50%);
  z-index: 2;
}

.mg-est-ends {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
}

/* Funny Answers winning filled hero card */
.mg-funny-hero {
  padding: 14px 18px;
  margin-bottom: 12px;
  border-radius: var(--r-lg);
  border: 1px solid rgba(250, 204, 21, 0.42);
  background: linear-gradient(135deg, rgba(250, 204, 21, 0.12), rgba(234, 88, 12, 0.08));
}

.mg-funny-hero small {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #fde047;
  font-weight: 700;
  font-size: 12px;
  margin-bottom: 6px;
}

.mg-funny-hero small .mg-ico {
  width: 14px;
  height: 14px;
}

.mg-funny-hero p {
  margin: 0;
  font-size: clamp(1rem, 0.9rem + 0.5vw, 1.25rem);
  font-weight: 700;
  line-height: 1.45;
}

.mg-funny-fill {
  padding: 1px 8px;
  border-radius: 6px;
  background: rgba(250, 204, 21, 0.25);
  color: #fef08a;
}

/* Telephone step-by-step reveal controls */
.mg-tel-reveal-bar {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

/* Stickman Fight canvas & viewport fit */
.mg-stick-wrap {
  display: flex;
  justify-content: center;
}

.mg-stick-slot {
  position: relative;
  width: 100%;
  max-width: min(100%, max(320px, calc((100dvh - var(--header-h) - 235px) * 1.73)));
}

.mg-stick-canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--r);
  background: #0b1020;
  touch-action: none;
  box-shadow: 0 0 0 1px rgba(249, 115, 22, 0.28), 0 18px 44px -18px rgba(0, 0, 0, 0.92);
}

.mg-stick-slot.is-shake,
.mg-tank-slot.is-shake,
.mg-bomber-slot.is-shake {
  animation: mg-screen-shake 0.38s ease-out;
}

.mg-tank-slot {
  position: relative;
  width: 100%;
  max-width: min(100%, max(320px, calc((100dvh - var(--header-h) - 235px) * 1.5)));
}

.mg-bomber-slot {
  position: relative;
  width: 100%;
  max-width: min(100%, max(300px, calc((100dvh - var(--header-h) - 235px) * 1.18)));
}


/* ============================================================================
   9. ARCADE & TABLETOP GAME-FEEL OVERHAUL v11
   ============================================================================ */

/* --- 9.1 Arcade Stage Frame & HUD Polish --- */
.mg-stage:not(.is-lobby) {
  border-color: color-mix(in srgb, var(--game-accent, var(--accent)) 28%, var(--border));
  box-shadow:
    0 26px 60px -28px rgba(0, 0, 0, 0.92),
    0 0 0 1px color-mix(in srgb, var(--game-accent, var(--accent)) 14%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.mg-stage-top {
  padding: 8px 12px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(0, 0, 0, 0.22));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.mg-stage-icon {
  box-shadow:
    0 6px 16px -6px color-mix(in srgb, var(--game-accent, var(--accent)) 70%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.mg-stage-id strong {
  letter-spacing: 0.01em;
  text-shadow: 0 1px 10px color-mix(in srgb, var(--game-accent, var(--accent)) 35%, transparent);
}

.mg-timebar {
  height: 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.42);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

.mg-timebar i {
  border-radius: 999px;
  box-shadow: 0 0 12px color-mix(in srgb, var(--game-accent, var(--accent)) 70%, transparent);
}

/* --- 9.2 Tactile 3D Pressable Game Buttons --- */
.mg-stage .btn-primary,
.mg-btn-create {
  box-shadow:
    0 4px 0 color-mix(in srgb, var(--game-accent, var(--accent)) 55%, #000),
    0 10px 22px -10px color-mix(in srgb, var(--game-accent, var(--accent)) 75%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.15s ease;
}

.mg-stage .btn-primary:hover:not(:disabled),
.mg-btn-create:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow:
    0 5px 0 color-mix(in srgb, var(--game-accent, var(--accent)) 55%, #000),
    0 14px 26px -10px color-mix(in srgb, var(--game-accent, var(--accent)) 85%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.38);
}

.mg-stage .btn-primary:active:not(:disabled),
.mg-btn-create:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow:
    0 1px 0 color-mix(in srgb, var(--game-accent, var(--accent)) 55%, #000),
    0 4px 10px -6px color-mix(in srgb, var(--game-accent, var(--accent)) 65%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.mg-stage:not(.is-lobby) .btn-ghost:not(.mg-icon-btn) {
  box-shadow:
    0 3px 0 rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform 0.1s ease, box-shadow 0.1s ease, border-color 0.15s ease, background 0.15s ease;
}

.mg-stage:not(.is-lobby) .btn-ghost:not(.mg-icon-btn):hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow:
    0 4px 0 rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.mg-stage:not(.is-lobby) .btn-ghost:not(.mg-icon-btn):active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.42);
}

/* Tactile mobile D-pad & action buttons */
.mg-dpad-btn,
.mg-kick-btn {
  box-shadow:
    0 4px 0 rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.mg-dpad-btn.is-down,
.mg-dpad-btn:active,
.mg-kick-btn.is-down,
.mg-kick-btn:active {
  transform: translateY(3px) scale(0.97);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.55);
}

/* --- 9.3 Game Cartridge Lobby Cards --- */
.mg-game-card {
  position: relative;
  overflow: hidden;
  box-shadow:
    0 5px 0 rgba(0, 0, 0, 0.35),
    0 12px 26px -18px rgba(0, 0, 0, 0.85),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.18s ease, border-color 0.18s ease;
}

.mg-game-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 32%, rgba(255, 255, 255, 0.08) 48%, transparent 64%);
  transform: translateX(-115%);
  transition: transform 0.55s ease;
}

.mg-game-card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--game-accent, var(--accent)) 60%, transparent);
  box-shadow:
    0 8px 0 color-mix(in srgb, var(--game-accent, var(--accent)) 28%, rgba(0, 0, 0, 0.5)),
    0 20px 36px -18px color-mix(in srgb, var(--game-accent, var(--accent)) 55%, rgba(0, 0, 0, 0.9)),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.mg-game-card:hover::after {
  transform: translateX(115%);
}

/* --- 9.4 Atmospheric Stage Themes for Every Game --- */
.mg-stage-stick {
  background:
    radial-gradient(ellipse at 50% 100%, rgba(249, 115, 22, 0.2), transparent 58%),
    radial-gradient(ellipse at 50% 0%, rgba(124, 58, 237, 0.14), transparent 55%),
    linear-gradient(180deg, #101322 0%, #150e18 100%);
}

.mg-stage-tank {
  background:
    linear-gradient(rgba(132, 204, 22, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(132, 204, 22, 0.04) 1px, transparent 1px),
    radial-gradient(ellipse at 50% 0%, rgba(101, 163, 13, 0.16), transparent 60%),
    linear-gradient(180deg, #101812 0%, #0b1014 100%);
  background-size: 32px 32px, 32px 32px, 100% 100%, 100% 100%;
}

.mg-stage-bomber {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(225, 29, 72, 0.16), transparent 58%),
    radial-gradient(ellipse at 50% 100%, rgba(249, 115, 22, 0.12), transparent 55%),
    linear-gradient(180deg, #181116 0%, #0e1214 100%);
}

.mg-stage-connect4 {
  background:
    radial-gradient(ellipse at 50% 15%, rgba(59, 130, 246, 0.18), transparent 60%),
    radial-gradient(ellipse at 50% 95%, rgba(250, 204, 21, 0.09), transparent 55%),
    linear-gradient(180deg, #0d1528 0%, #0a0d16 100%);
}

.mg-stage-ball {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(34, 197, 94, 0.18), transparent 58%),
    linear-gradient(180deg, #0c1d15 0%, #09110e 100%);
}

.mg-stage-estate,
.mg-stage-conquest,
.mg-stage-manor,
.mg-stage-council {
  background:
    radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--game-accent, var(--accent)) 14%, transparent), transparent 60%),
    linear-gradient(180deg, #17151b 0%, #0f1015 100%);
}

.mg-stage-trivia,
.mg-stage-reflex,
.mg-stage-typing,
.mg-stage-estimate,
.mg-stage-funny,
.mg-stage-draw,
.mg-stage-telephone,
.mg-stage-impostor,
.mg-stage-whosaid {
  background:
    radial-gradient(ellipse at 50% -10%, color-mix(in srgb, var(--game-accent, var(--accent)) 18%, transparent), transparent 62%),
    linear-gradient(180deg, #14131c 0%, #0d0e14 100%);
}

html[data-theme="light"] .mg-stage-stick,
html[data-theme="light"] .mg-stage-tank,
html[data-theme="light"] .mg-stage-bomber,
html[data-theme="light"] .mg-stage-connect4,
html[data-theme="light"] .mg-stage-ball,
html[data-theme="light"] .mg-stage-estate,
html[data-theme="light"] .mg-stage-conquest,
html[data-theme="light"] .mg-stage-manor,
html[data-theme="light"] .mg-stage-council,
html[data-theme="light"] .mg-stage-trivia,
html[data-theme="light"] .mg-stage-reflex,
html[data-theme="light"] .mg-stage-typing,
html[data-theme="light"] .mg-stage-estimate,
html[data-theme="light"] .mg-stage-funny,
html[data-theme="light"] .mg-stage-draw,
html[data-theme="light"] .mg-stage-telephone,
html[data-theme="light"] .mg-stage-impostor,
html[data-theme="light"] .mg-stage-whosaid {
  background: linear-gradient(180deg, color-mix(in srgb, var(--game-accent, var(--accent)) 8%, var(--surface)), var(--surface) 240px);
}

/* --- 9.5 Arcade Canvas Bezel --- */
.mg-stick-canvas,
.mg-tron-canvas,
.mg-ball-canvas {
  border: 2px solid color-mix(in srgb, var(--game-accent, var(--accent)) 45%, rgba(255, 255, 255, 0.14));
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.65),
    0 0 36px -12px color-mix(in srgb, var(--game-accent, var(--accent)) 55%, transparent),
    0 22px 48px -20px rgba(0, 0, 0, 0.95);
}

/* --- 9.6 Dramatic Arcade Overlays & Victory Podium --- */
.mg-fx-overlay {
  animation: mg-slam-in 0.32s cubic-bezier(0.22, 1.28, 0.36, 1);
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.85);
}

@keyframes mg-slam-in {
  0% { opacity: 0; transform: scale(1.38); }
  100% { opacity: 1; transform: scale(1); }
}

.mg-podium-slot.is-1st {
  box-shadow:
    0 0 28px -8px rgba(250, 204, 21, 0.55),
    inset 0 1px 0 rgba(254, 240, 138, 0.5);
}

/* --- 9.7 Board & Tabletop Game Beautification --- */

/* Connect 4: 3D Molded Arcade Cabinet + Specular Discs */
.mg-c4-board {
  background: linear-gradient(170deg, #2563eb 0%, #1d4ed8 45%, #1e3a8a 100%);
  border: 3px solid #60a5fa;
  box-shadow:
    0 10px 0 #172554,
    0 24px 48px -16px rgba(0, 0, 0, 0.92),
    inset 0 2px 0 rgba(255, 255, 255, 0.35),
    inset 0 -4px 10px rgba(15, 23, 42, 0.55);
}

.mg-c4-col.is-open:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.mg-c4-cell {
  background: radial-gradient(circle at 50% 60%, #090e1f, #040711);
  box-shadow:
    inset 0 4px 8px rgba(0, 0, 0, 0.85),
    0 1px 0 rgba(255, 255, 255, 0.22);
}

.mg-c4-cell.is-p0 i {
  background: radial-gradient(circle at 30% 28%, #fecaca 0%, #ef4444 38%, #b91c1c 82%, #7f1d1d 100%);
  box-shadow: inset 0 -3px 6px rgba(0, 0, 0, 0.45), inset 0 2px 3px rgba(255, 255, 255, 0.45), 0 3px 8px rgba(0, 0, 0, 0.55);
}

.mg-c4-cell.is-p1 i {
  background: radial-gradient(circle at 30% 28%, #fef9c3 0%, #facc15 40%, #ca8a04 82%, #854d0e 100%);
  box-shadow: inset 0 -3px 6px rgba(0, 0, 0, 0.4), inset 0 2px 3px rgba(255, 255, 255, 0.55), 0 3px 8px rgba(0, 0, 0, 0.55);
}

.mg-c4-cell.is-win {
  animation: mg-c4-win-pulse 0.85s ease-in-out infinite;
}

@keyframes mg-c4-win-pulse {
  0%, 100% { box-shadow: 0 0 0 3px #fff, 0 0 16px rgba(250, 204, 21, 0.75); }
  50% { box-shadow: 0 0 0 4px #fef08a, 0 0 28px rgba(250, 204, 21, 1); }
}

/* Battleship: Naval Sonar Radar Grid + Steel Hulls + Blast Craters */
.mg-bs-grid {
  position: relative;
  overflow: hidden;
  border: 2px solid rgba(56, 189, 248, 0.5);
  box-shadow:
    0 8px 0 #082f49,
    0 18px 36px -14px rgba(0, 0, 0, 0.9),
    inset 0 0 32px rgba(0, 0, 0, 0.55);
}

.mg-bs-grid::after {
  content: "";
  position: absolute;
  inset: -40%;
  pointer-events: none;
  background: conic-gradient(from 0deg, transparent 0deg, rgba(56, 189, 248, 0.16) 28deg, transparent 52deg);
  animation: mg-sonar-sweep 5.5s linear infinite;
}

@keyframes mg-sonar-sweep {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.mg-bs-cell {
  position: relative;
  z-index: 1;
}

.mg-bs-cell.is-ship {
  background: linear-gradient(145deg, #94a3b8 0%, #475569 52%, #1e293b 100%);
  border-color: rgba(226, 232, 240, 0.65);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 -2px 3px rgba(0, 0, 0, 0.55);
}

.mg-bs-cell.is-hit {
  background: radial-gradient(circle at 45% 45%, #fde047 0%, #ef4444 45%, #7f1d1d 100%);
  border-color: #fca5a5;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.7), inset 0 0 6px rgba(0, 0, 0, 0.45);
}

.mg-bs-cell.is-miss {
  background: radial-gradient(circle, rgba(125, 211, 252, 0.25) 0%, rgba(15, 23, 42, 0.65) 70%);
}

/* Liar's Dice: Casino Felt Table + Sculpted 3D Ivory Dice */
.mg-ld-table {
  border: 3px solid #92400e;
  background:
    radial-gradient(circle at 50% 42%, rgba(22, 101, 52, 0.55), rgba(6, 78, 59, 0.72) 55%, rgba(15, 23, 42, 0.92) 100%);
  box-shadow:
    0 8px 0 #451a03,
    0 20px 42px -18px rgba(0, 0, 0, 0.9),
    inset 0 0 30px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(251, 191, 36, 0.35);
}

.mg-ld-bid strong {
  text-shadow: 0 3px 14px rgba(250, 204, 21, 0.5);
}

.mg-ld-die {
  background: linear-gradient(155deg, #fffbeb 0%, #f5f5f4 60%, #d6d3d1 100%);
  color: #1c1917;
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow:
    0 4px 0 #78716c,
    0 8px 14px -6px rgba(0, 0, 0, 0.75),
    inset 0 1px 0 #fff;
}

.mg-ld-die.is-wild {
  background: linear-gradient(155deg, #fef08a 0%, #facc15 55%, #ca8a04 100%);
  color: #422006;
  border-color: #fef9c3;
  box-shadow:
    0 4px 0 #854d0e,
    0 0 16px rgba(250, 204, 21, 0.65),
    inset 0 1px 0 #fff;
}

/* Secret Agents (Codenames): Classified Dossier Cards */
.mg-ag-card {
  border-bottom: 3px solid rgba(0, 0, 0, 0.48);
  box-shadow:
    0 6px 14px -10px rgba(0, 0, 0, 0.8),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-weight: 800;
  transition: transform 0.16s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.16s ease, border-color 0.16s ease;
}

.mg-ag-card.is-pickable:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow:
    0 10px 20px -10px rgba(0, 0, 0, 0.9),
    0 0 0 2px color-mix(in srgb, var(--game-accent, var(--accent)) 65%, transparent);
}

.mg-ag-card.is-open {
  animation: mg-card-pop 0.26s cubic-bezier(0.22, 1.25, 0.36, 1);
}

@keyframes mg-card-pop {
  0% { transform: scale(0.86) rotateX(22deg); }
  100% { transform: scale(1) rotateX(0deg); }
}

/* Game-Show Quiz / Trivia / Funny Options */
.mg-opt {
  box-shadow:
    0 4px 0 rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.09);
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.15s ease, background 0.15s ease;
}

.mg-opt:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow:
    0 6px 0 rgba(0, 0, 0, 0.46),
    0 12px 22px -12px color-mix(in srgb, var(--game-accent, var(--accent)) 55%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.mg-opt:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.42);
}

/* Color Card Clash (UNO): Glossy Tactile Cards */
.mg-cards-hand .mg-card-tile,
.mg-uno-card {
  box-shadow:
    0 6px 0 rgba(0, 0, 0, 0.45),
    0 14px 24px -14px rgba(0, 0, 0, 0.85),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

@media (prefers-reduced-motion: reduce) {
  .mg-bs-grid::after,
  .mg-c4-cell.is-win,
  .mg-fx-overlay,
  .mg-ag-card.is-open {
    animation: none !important;
  }
}
