/* Mario Maker — standalone subsystem styles. Uses site theme variables only. */

/* ── home ─────────────────────────────────────────────────────────────────── */
.mm-home, .mm-my-courses, .mm-settings { max-width: 1100px; margin: 0 auto; }
.mm-hero { text-align: center; padding: 48px 16px 24px; }
.mm-hero h1 { font-size: 2.2rem; margin-bottom: 8px; }
.mm-hero-actions { display: flex; gap: 12px; justify-content: center; margin-top: 16px; }
.mm-btn-primary {
  background: var(--accent, #e8b23a); color: #1a1408; font-weight: 700;
  border: none; padding: 10px 22px; border-radius: 8px; cursor: pointer;
  text-decoration: none; display: inline-block;
}
.mm-btn-primary:hover { filter: brightness(1.1); }
.mm-section { margin: 28px 0; }
.mm-section-head { display: flex; align-items: center; justify-content: space-between; margin: 20px 0; }
.mm-muted { color: var(--text-dim, #9aa); font-size: 0.9rem; }
.mm-course-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px; margin-top: 12px;
}
.mm-course-tile {
  background: var(--panel, #1c1c26); border: 1px solid var(--border, #333);
  border-radius: 10px; overflow: hidden; cursor: pointer; position: relative;
}
.mm-course-tile:hover { border-color: var(--accent, #e8b23a); }
.mm-course-thumb { width: 100%; aspect-ratio: 16/6; display: block; background: #101018; object-fit: cover; }
.mm-course-thumb-placeholder { width: 100%; aspect-ratio: 16/6; background: #101018;
  display: flex; align-items: center; justify-content: center; color: #556; font-size: 1.6rem; }
.mm-course-tile-body { padding: 8px 10px; }
.mm-course-tile-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mm-course-tile-meta { font-size: 0.78rem; color: var(--text-dim, #9aa); }
.mm-course-tile-actions { display: flex; gap: 6px; padding: 0 10px 10px; }
.mm-badge { font-size: 0.7rem; padding: 2px 6px; border-radius: 6px; background: #333; }
.mm-badge.published { background: #2c5c2c; color: #bfe8bf; }
.mm-tabs { display: flex; gap: 8px; margin-top: 8px; }
.mm-tab { background: none; border: 1px solid var(--border, #333); color: inherit;
  padding: 6px 14px; border-radius: 8px; cursor: pointer; }
.mm-tab.active { border-color: var(--accent, #e8b23a); color: var(--accent, #e8b23a); }

/* ── editor layout ────────────────────────────────────────────────────────── */
.mm-editor {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  background: var(--bg, #12121a); z-index: 300;
}
.mm-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 10px; background: var(--panel, #1c1c26);
  border-bottom: 1px solid var(--border, #333);
}
.mm-toolbar-group { display: flex; align-items: center; gap: 6px; }
.mm-toolbar-btn {
  background: var(--panel-2, #26262f); color: inherit; border: 1px solid var(--border, #3a3a46);
  border-radius: 6px; padding: 5px 10px; cursor: pointer; font-size: 0.9rem;
  text-decoration: none; display: inline-block;
}
.mm-toolbar-btn:hover { border-color: var(--accent, #e8b23a); }
.mm-toolbar-btn:focus-visible { outline: 2px solid var(--accent, #e8b23a); outline-offset: 1px; }
.mm-play-btn { background: #2c5c2c; border-color: #3f7f3f; font-weight: 700; }
.mm-stop-btn { background: #7f2c2c; border-color: #a34; font-weight: 700; }
.mm-course-name {
  background: transparent; border: 1px solid transparent; color: inherit;
  font-size: 1rem; padding: 4px 6px; width: 200px; border-radius: 6px;
}
.mm-course-name:hover, .mm-course-name:focus { border-color: var(--border, #3a3a46); outline: none; }
.mm-save-status { font-size: 0.8rem; color: var(--text-dim, #9aa); min-width: 70px; }
.mm-select {
  background: var(--panel-2, #26262f); color: inherit;
  border: 1px solid var(--border, #3a3a46); border-radius: 6px;
  padding: 4px 6px; font-size: 0.85rem; cursor: pointer;
}
/* ghost preview cursor (spec §17/§80) */
#mmGhostCanvas {
  position: absolute; pointer-events: none; z-index: 8;
  image-rendering: pixelated; opacity: 0.65;
  transform: translate(-50%, -50%);
}
#mmGhostCanvas.invalid { opacity: 0.5; filter: hue-rotate(-60deg) saturate(2) brightness(0.8); }
/* placement pop animation */
@keyframes mm-pop {
  0% { transform: scale(0.4); opacity: 0.4; }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}
.mm-save-status.dirty { color: var(--accent, #e8b23a); }
.mm-save-status.error { color: #e66; }

.mm-editor-main { flex: 1; display: flex; min-height: 0; }

/* palette */
.mm-palette {
  width: 230px; background: var(--panel, #1c1c26); border-right: 1px solid var(--border, #333);
  display: flex; flex-direction: column; min-height: 0;
}
.mm-palette-search {
  margin: 8px; padding: 6px 8px; background: var(--panel-2, #26262f);
  border: 1px solid var(--border, #3a3a46); border-radius: 6px; color: inherit;
}
.mm-palette-cats { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 8px 6px; }
.mm-palette-cat {
  background: var(--panel-2, #26262f); border: 1px solid var(--border, #3a3a46);
  border-radius: 6px; padding: 3px 8px; font-size: 0.75rem; cursor: pointer; color: inherit;
}
.mm-palette-cat.active { border-color: var(--accent, #e8b23a); color: var(--accent, #e8b23a); }
.mm-palette-items { flex: 1; overflow-y: auto; padding: 4px 8px 12px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; align-content: start; }
.mm-palette-item {
  background: var(--panel-2, #26262f); border: 1px solid var(--border, #3a3a46);
  border-radius: 8px; padding: 4px; cursor: grab; text-align: center;
}
.mm-palette-item.active { border-color: var(--accent, #e8b23a); box-shadow: 0 0 0 1px var(--accent, #e8b23a); }
.mm-palette-item canvas { width: 100%; image-rendering: pixelated; display: block; }
.mm-palette-item-label { font-size: 0.62rem; color: var(--text-dim, #9aa);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* world */
.mm-world-wrap { flex: 1; position: relative; min-width: 0; background: #0c0c14; overflow: hidden; }
#mmEditorCanvas, #mmPlayCanvas { display: block; width: 100%; height: 100%; outline: none; touch-action: none; }

/* inspector */
.mm-inspector {
  width: 250px; background: var(--panel, #1c1c26); border-left: 1px solid var(--border, #333);
  padding: 10px; overflow-y: auto;
}
.mm-inspector h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-dim, #9aa); margin: 8px 0 6px; }
.mm-inspector-body label { display: block; font-size: 0.8rem; margin: 8px 0 2px; }
.mm-inspector-body input[type="number"], .mm-inspector-body input[type="text"],
.mm-inspector-body select {
  width: 100%; padding: 5px; background: var(--panel-2, #26262f);
  border: 1px solid var(--border, #3a3a46); border-radius: 6px; color: inherit;
}
.mm-validation-panel { font-size: 0.8rem; }
.mm-validation-item { padding: 4px 6px; border-radius: 6px; cursor: pointer; margin: 2px 0; }
.mm-validation-item.error { background: #4a1f1f; color: #f99; }
.mm-validation-item.warning { background: #4a3a1f; color: #fc6; }
.mm-validation-item:hover { filter: brightness(1.2); }

/* status bar */
.mm-statusbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 4px 10px; background: var(--panel, #1c1c26); border-top: 1px solid var(--border, #333);
}
.mm-statusbar-group { display: flex; align-items: center; gap: 8px; }
.mm-statusbar-item { font-size: 0.8rem; color: var(--text-dim, #9aa); }
.mm-active-toggle { border-color: var(--accent, #e8b23a); color: var(--accent, #e8b23a); }
#mmMinimap { background: #101018; border: 1px solid var(--border, #333); border-radius: 4px; cursor: pointer; }

/* playtest overlay + HUD */
.mm-play-hud {
  position: absolute; top: 8px; left: 0; right: 0; display: flex; align-items: center;
  justify-content: center; gap: 18px; pointer-events: none; font-weight: 700;
  text-shadow: 0 1px 2px #000; z-index: 5;
}
.mm-play-hud[hidden], .mm-play-overlay[hidden] { display: none; }
.mm-play-hud .mm-stop-btn { pointer-events: auto; position: absolute; right: 10px; }
.mm-play-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(8, 8, 14, 0.72); z-index: 6;
}
.mm-play-overlay-inner { text-align: center; display: flex; flex-direction: column; gap: 12px; }
.mm-play-result { font-size: 1.6rem; font-weight: 800; text-shadow: 0 2px 4px #000; }

/* dialogs */
.mm-dialog-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex;
  align-items: center; justify-content: center; z-index: 100;
}
.mm-dialog {
  background: var(--panel, #1c1c26); border: 1px solid var(--border, #3a3a46);
  border-radius: 12px; padding: 18px; min-width: 320px; max-width: 560px; max-height: 80vh;
  overflow-y: auto;
}
.mm-dialog h2 { margin: 0 0 10px; font-size: 1.1rem; }
.mm-dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.mm-dialog-list { display: flex; flex-direction: column; gap: 6px; max-height: 40vh; overflow-y: auto; }
.mm-dialog-list button { text-align: left; }

/* ── play page ────────────────────────────────────────────────────────────── */
.mm-play-page { max-width: 1100px; margin: 0 auto; padding: 12px; }
.mm-play-frame { border: 1px solid var(--border, #333); border-radius: 12px; overflow: hidden; }
.mm-world-wrap-play { height: 62vh; }
.mm-play-hint { text-align: center; margin-top: 8px; }
.mm-touch-controls {
  position: absolute; inset: auto 0 0 0; display: flex; justify-content: space-between;
  padding: 12px; pointer-events: none;
}
.mm-touch-controls > div { display: flex; gap: 10px; pointer-events: auto; }
.mm-touch-controls button {
  width: 58px; height: 58px; border-radius: 50%; border: 1px solid var(--border, #3a3a46);
  background: rgba(30,30,40,0.6); color: inherit; font-size: 1.1rem; touch-action: none;
}

/* course page */
.mm-course-card {
  background: var(--panel, #1c1c26); border: 1px solid var(--border, #333);
  border-radius: 12px; padding: 22px; max-width: 640px; margin: 30px auto;
}
.mm-course-stats { display: flex; gap: 16px; margin: 12px 0; font-size: 0.9rem; color: var(--text-dim, #9aa); }

/* settings */
.mm-settings form { display: flex; flex-direction: column; gap: 12px; }
.mm-settings label { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.mm-settings select, .mm-settings input[type="number"] {
  background: var(--panel-2, #26262f); border: 1px solid var(--border, #3a3a46);
  border-radius: 6px; color: inherit; padding: 6px;
}

/* responsive */
@media (max-width: 900px) {
  .mm-palette { width: 170px; }
  .mm-inspector { width: 190px; }
}
@media (max-width: 700px) {
  .mm-inspector { display: none; }
  .mm-palette { width: 140px; }
  .mm-course-name { width: 120px; }
}

/* ── extras styles ──────────────────────────────────────────────────────── */
.mm-help-overlay { z-index: 200; }
.mm-help-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 0.85rem; }
.mm-help-grid span:nth-child(odd) { font-family: monospace; color: var(--accent, #e8b23a); }
.mm-fav-star {
  position: absolute; top: 2px; right: 4px; cursor: pointer;
  color: var(--accent, #e8b23a); font-size: 0.8rem; z-index: 2;
}
.mm-palette-item { position: relative; }
.mm-toolbar-btn:disabled { opacity: 0.4; cursor: default; }
.mm-toolbar-btn:disabled:hover { border-color: var(--border, #3a3a46); }
.mm-perf-hud {
  position: absolute; top: 8px; left: 8px; z-index: 7;
  background: rgba(0,0,0,0.6); color: #0f0; font: 11px monospace;
  padding: 4px 6px; border-radius: 4px; pointer-events: none;
}
.mm-toast {
  position: fixed; bottom: 60px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--panel, #1c1c26); color: inherit; border: 1px solid var(--border, #3a3a46);
  padding: 8px 16px; border-radius: 8px; opacity: 0; transition: all 0.25s; z-index: 300;
  font-size: 0.9rem;
}
.mm-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.mm-toast.error { border-color: #e05858; color: #f99; }
