/* Meta Game Maker — split coach + preview + community */

:root {
  --mg-bg: #08070f;
  --mg-panel: rgba(18, 16, 32, 0.95);
  --mg-accent: #a78bfa;
  --mg-teal: #2dd4bf;
  --mg-coral: #fb7185;
  --mg-text: #f1f5f9;
  --mg-muted: #94a3b8;
  --mg-border: rgba(255, 255, 255, 0.1);
}

body.meta-game-maker {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse 90% 70% at 0% 0%, #312e81 0%, var(--mg-bg) 50%),
    radial-gradient(ellipse 80% 60% at 100% 100%, #134e4a 0%, var(--mg-bg) 45%);
  color: var(--mg-text);
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  box-sizing: border-box;
}

body.meta-game-maker *,
body.meta-game-maker *::before,
body.meta-game-maker *::after {
  box-sizing: inherit;
}

.mg-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--mg-border);
  background: rgba(0, 0, 0, 0.35);
}

.mg-topbar a {
  color: var(--mg-teal);
  text-decoration: none;
  font-weight: 600;
}

.mg-topbar a:hover {
  text-decoration: underline;
}

.mg-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-start;
}

.mg-topbar h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #c4b5fd, #5eead4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.mg-domain-brand {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--mg-muted);
  letter-spacing: 0.02em;
}

.mg-domain-brand strong {
  color: var(--mg-teal);
  font-weight: 800;
}

.mg-domain-dot {
  opacity: 0.65;
  font-weight: 400;
}

.mg-tabs {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

.mg-tab {
  appearance: none;
  border: 1px solid var(--mg-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--mg-muted);
  padding: 8px 16px;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.mg-tab:hover {
  color: var(--mg-text);
  border-color: rgba(167, 139, 250, 0.4);
}

.mg-tab[aria-selected="true"] {
  background: linear-gradient(135deg, #6d28d9, #4f46e5);
  color: #fff;
  border-color: transparent;
}

.mg-layout {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(320px, 1.1fr);
  gap: 0;
  min-height: calc(100vh - 56px);
}

@media (max-width: 900px) {
  .mg-layout {
    grid-template-columns: 1fr;
  }
}

.mg-coach {
  padding: 18px 20px 28px;
  border-right: 1px solid var(--mg-border);
  overflow-y: auto;
  max-height: calc(100vh - 56px);
}

@media (max-width: 900px) {
  .mg-coach {
    border-right: none;
    border-bottom: 1px solid var(--mg-border);
    max-height: none;
  }
}

.mg-preview {
  padding: 18px 20px 28px;
  background: rgba(0, 0, 0, 0.2);
  overflow-y: auto;
  max-height: calc(100vh - 56px);
}

.mg-stepper {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.mg-step {
  flex: 1;
  min-width: 72px;
  text-align: center;
  padding: 8px 6px;
  border-radius: 10px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--mg-border);
  color: var(--mg-muted);
}

.mg-step--done {
  border-color: rgba(45, 212, 191, 0.45);
  color: var(--mg-teal);
}

.mg-step--active {
  border-color: rgba(167, 139, 250, 0.6);
  color: var(--mg-text);
  background: rgba(109, 40, 217, 0.2);
}

.mg-coach-panel {
  background: var(--mg-panel);
  border: 1px solid var(--mg-border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
}

.mg-coach-panel h2 {
  margin: 0 0 10px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--mg-accent);
}

.mg-ai-bubble {
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(45, 212, 191, 0.08);
  border: 1px solid rgba(45, 212, 191, 0.22);
  font-size: 0.95rem;
  line-height: 1.55;
  min-height: 4.5em;
}

.mg-ai-bubble strong {
  color: var(--mg-teal);
}

.mg-mode-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
}

.mg-toggle-blocks {
  appearance: none;
  border: 2px solid rgba(251, 113, 133, 0.5);
  background: rgba(251, 113, 133, 0.12);
  color: #fda4af;
  font: inherit;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mg-toggle-blocks:hover {
  background: rgba(251, 113, 133, 0.22);
}

.mg-toggle-blocks[aria-pressed="true"] {
  background: linear-gradient(135deg, #db2777, #e11d48);
  border-color: transparent;
  color: #fff;
}

.mg-blocks {
  display: none;
  margin-top: 14px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px dashed rgba(255, 255, 255, 0.15);
}

.mg-blocks.is-open {
  display: block;
}

.mg-block-group {
  margin-bottom: 12px;
}

.mg-block-group:last-child {
  margin-bottom: 0;
}

.mg-block-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--mg-muted);
  margin-bottom: 8px;
}

.mg-block-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mg-block {
  appearance: none;
  border: none;
  padding: 10px 14px;
  border-radius: 8px;
  font: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  color: #0f172a;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}

.mg-block:active {
  transform: translateY(1px);
  box-shadow: none;
}

.mg-block--motion {
  background: #4c97ff;
}
.mg-block--looks {
  background: #9966ff;
  color: #fff;
}
.mg-block--events {
  background: #ffbf00;
}
.mg-block--control {
  background: #ffab19;
}

.mg-prompt {
  width: 100%;
  min-height: 88px;
  margin-top: 12px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--mg-border);
  background: rgba(0, 0, 0, 0.4);
  color: var(--mg-text);
  font: inherit;
  resize: vertical;
}

.mg-prompt:focus {
  outline: 2px solid rgba(167, 139, 250, 0.45);
}

.mg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.mg-btn {
  appearance: none;
  border: none;
  padding: 12px 20px;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, #7c3aed, #6366f1);
  color: #fff;
}

.mg-btn:hover {
  filter: brightness(1.08);
}

.mg-btn--ghost {
  background: rgba(255, 255, 255, 0.08);
  color: var(--mg-text);
  border: 1px solid var(--mg-border);
}

.mg-btn--publish {
  background: linear-gradient(135deg, #0d9488, #059669);
}

.mg-btn--ai {
  background: linear-gradient(135deg, #c026d3, #7c3aed);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.mg-btn--ai:hover {
  filter: brightness(1.1);
}

.mg-gallery {
  padding: 18px 20px 40px;
  max-width: 960px;
  margin: 0 auto;
}

.mg-gallery h2 {
  font-size: 1.1rem;
  margin: 0 0 16px;
}

.mg-game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.mg-game-card {
  background: var(--mg-panel);
  border: 1px solid var(--mg-border);
  border-radius: 14px;
  padding: 14px 16px;
  text-align: left;
}

.mg-game-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.mg-game-card p {
  margin: 0 0 12px;
  font-size: 0.82rem;
  color: var(--mg-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mg-game-card button {
  appearance: none;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: var(--mg-teal);
  color: #042f2e;
}

.mg-game-card button:hover {
  filter: brightness(1.05);
}

.mg-empty {
  color: var(--mg-muted);
  font-size: 0.95rem;
}

.mg-preview h2 {
  margin: 0 0 8px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--mg-accent);
}

.mg-stage-wrap {
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid rgba(167, 139, 250, 0.35);
  max-width: 440px;
  margin: 0 auto 12px;
  background: #0f0d18;
}

.mg-stage-wrap .game-lab-stage {
  max-width: none;
  border: none;
  box-shadow: none;
}

.mg-hud {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  font-size: 0.88rem;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 0 0 12px 12px;
  margin: -12px auto 0;
  max-width: 440px;
}

.mg-hint {
  text-align: center;
  font-size: 0.8rem;
  color: var(--mg-muted);
  margin: 0;
}

.mg-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 12px 20px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--mg-teal);
  color: var(--mg-text);
  font-weight: 600;
  opacity: 0;
  transition: transform 0.25s, opacity 0.25s;
  z-index: 50;
  pointer-events: none;
}

.mg-toast.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.mg-hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
