/* Shared retro theme for the 4 new mini-games: Anagram / Timeline /
   Tifinagh / Lyrics. Same purple backdrop + white cards as Box2Box /
   Guess-Club for consistency. Axiforma is the page-wide font here. */

.mg-body {
  background: #1d1a47;
  color: #fff;
  font-family: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
}
.mg-body, .mg-body * {
  font-family: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
}

.mg-wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
}
.mg-title {
  text-align: center;
  font-size: 22px;
  letter-spacing: 4px;
  font-weight: 800;
  padding: 14px 0 6px;
}
.mg-sub {
  text-align: center;
  color: #c4c4d6;
  font-size: 13px;
  margin-bottom: 14px;
}

.mg-board {
  background: #fff;
  color: #111;
  border-radius: 12px;
  padding: 22px 18px;
}

.mg-tag {
  display: inline-block;
  background: #4538e0;
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 3px;
  padding: 4px 10px;
  border-radius: 4px;
  margin-bottom: 16px;
}

/* ---- Anagram / Tifinagh shared tiles ---- */
.mg-tiles, .mg-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 12px 0;
}
.mg-tile {
  width: 44px; height: 52px;
  background: #eceafe;
  color: #1d1a47;
  border: 2px solid #1d1a47;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800;
  cursor: pointer;
  user-select: none;
  transition: transform .1s ease, background .15s;
}
.mg-tile:active { transform: translateY(1px); }
.mg-tile.used  { opacity: .25; cursor: not-allowed; }
.mg-slot {
  width: 44px; height: 52px;
  background: #fff;
  border: 2px dashed #999;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800;
  color: #1d1a47;
}
.mg-slot.filled { border-style: solid; background: #f7f3ff; }

.mg-hint {
  text-align: center;
  color: #555;
  font-size: 13px;
  min-height: 20px;
  margin: 8px 0 14px;
}

.mg-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 10px;
}
.mg-btn {
  background: #f0efff;
  color: #1d1a47;
  border: 2px solid #1d1a47;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  padding: 10px 14px;
  cursor: pointer;
  font-family: inherit;
}
.mg-btn:hover { background: #e4e1ff; }
.mg-btn.primary { background: #4538e0; color: #fff; border-color: #4538e0; }
.mg-btn.primary:hover { background: #5a4bff; }
.mg-btn:disabled { opacity: .45; cursor: not-allowed; }

.mg-guesses {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mg-guess {
  font-family: "Courier New", monospace;
  font-weight: 700;
  letter-spacing: 4px;
  text-align: center;
  padding: 6px;
  border-radius: 4px;
}
.mg-guess.wrong { background: #ffe1e1; color: #8b0000; }
.mg-guess.right { background: #d7ffd7; color: #005d00; }

/* ---- Timeline (drag cards) ---- */
.mg-timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0;
}
.mg-tcard {
  background: #f0efff;
  border: 2px solid #1d1a47;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: grab;
  user-select: none;
}
.mg-tcard.dragging { opacity: .5; }
.mg-tcard .grip  { color: #888; font-size: 18px; }
.mg-tcard .body  { flex: 1; color: #111; }
.mg-tcard .title { font-weight: 700; font-size: 15px; }
.mg-tcard .sub   { font-size: 12px; color: #555; }
.mg-tcard .cat   {
  font-size: 10px; letter-spacing: 2px;
  padding: 2px 6px; border-radius: 3px;
  background: #1d1a47; color: #fff;
}
.mg-tcard.correct   { background: #d7ffd7; border-color: #3a8c3a; }
.mg-tcard.incorrect { background: #ffe1e1; border-color: #8b3030; }
.mg-tcard .year    { font-weight: 700; color: #4538e0; margin-left: auto; font-variant-numeric: tabular-nums; }

/* Up/down buttons as the touch-friendly alternative to drag */
.mg-tcard .moves {
  display: flex; flex-direction: column; gap: 2px;
}
.mg-tcard .moves button {
  width: 26px; height: 20px;
  border: 1px solid #1d1a47;
  background: #fff;
  color: #1d1a47;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  padding: 0;
}

/* ---- Tifinagh ---- */
.mg-cipher {
  text-align: center;
  font-size: 44px;
  letter-spacing: 6px;
  margin: 12px 0 20px;
  color: #1d1a47;
  font-weight: 700;
}
.mg-wordle-grid {
  display: grid;
  gap: 6px;
  margin: 0 auto 14px;
  justify-content: center;
}
.mg-wcell {
  width: 44px; height: 44px;
  border: 2px solid #ddd;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800;
  color: #1d1a47;
  text-transform: uppercase;
}
.mg-wcell.filled { border-color: #888; }
.mg-wcell.correct { background: #3ece5b; color: #fff; border-color: #3ece5b; }
.mg-wcell.present { background: #efb744; color: #fff; border-color: #efb744; }
.mg-wcell.absent  { background: #9b9ba8; color: #fff; border-color: #9b9ba8; }

.mg-kb {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 10px auto 0;
  max-width: 420px;
}
.mg-kb-row { display: flex; gap: 5px; justify-content: center; }
.mg-key {
  min-width: 28px;
  height: 44px;
  background: #eceafe;
  color: #1d1a47;
  border: none;
  border-radius: 4px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  padding: 0 8px;
  font-family: inherit;
}
.mg-key.wide { min-width: 58px; font-size: 11px; }
.mg-key.correct { background: #3ece5b; color: #fff; }
.mg-key.present { background: #efb744; color: #fff; }
.mg-key.absent  { background: #9b9ba8; color: #fff; }

/* ---- Lyrics Fill ---- */
.mg-lyr {
  font-size: 17px;
  line-height: 1.8;
  color: #111;
  margin: 8px 0 14px;
  text-align: center;
  white-space: pre-line;
}
.mg-lyr .blank {
  display: inline-block;
  min-width: 90px;
  border-bottom: 2px solid #1d1a47;
  text-align: center;
  padding: 0 4px;
  margin: 0 2px;
}
.mg-lyr .blank.correct { background: #d7ffd7; color: #005d00; border-color: #005d00; }
.mg-lyr .blank.wrong   { background: #ffe1e1; color: #8b0000; border-color: #8b0000; }
.mg-lyr input {
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  width: 110px;
  text-align: center;
  border: none;
  border-bottom: 2px solid #1d1a47;
  outline: none;
  background: transparent;
}
.mg-song {
  text-align: center;
  margin-top: 14px;
  color: #555;
  font-size: 14px;
}
.mg-song strong { color: #1d1a47; font-weight: 800; }

/* ---- Result ---- */
#ana-result:not(:empty),
#tml-result:not(:empty),
#tif-result:not(:empty),
#lyr-result:not(:empty) {
  margin-top: 18px;
  padding: 16px;
  background: #12224a;
  color: #fff;
  border-radius: 8px;
  text-align: center;
}
.mg-body h3 { letter-spacing: 3px; margin: 0 0 10px; }
.mg-streak { display: flex; justify-content: space-around; margin: 12px 0; }
.mg-streak .num { font-size: 20px; font-weight: 800; }
.mg-streak .lbl { font-size: 10px; letter-spacing: 2px; color: #c4c4d6; }
