/* MFC Үг таа — dark/light хоёуланд (template-ийн --bg, --accent … хувьсагч) */
.mfc-ut {
  --ut-g: #4f8f55; --ut-y: #b39a3e; --ut-x: #3a3a3c; --ut-ink: #fff;
  --ut-tile: transparent; --ut-line: #3d3d3d; --ut-fill: #6b6b6b; --ut-key: #4a4a4c; --ut-key-ink: #eee;
  max-width: 500px; margin: 0 auto;
}
[data-theme="light"] .mfc-ut {
  --ut-g: #6aa864; --ut-y: #c6ae55; --ut-x: #8a8d8f; --ut-ink: #fff;
  --ut-line: #d6d2ca; --ut-fill: #8d897f; --ut-key: #e2ddd5; --ut-key-ink: #1c1a17;
}
.mfc-ut-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.mfc-ut-no { color: var(--text-faint2, #888); font-weight: 700; font-size: 15px; }
.mfc-ut-meta { font-size: 12px; color: var(--text-faint2, #888); margin-top: 2px; font-variant-numeric: tabular-nums; }
.mfc-ut-link { background: none !important; border: 0; padding: 0; color: var(--text-muted, #999); text-decoration: underline; cursor: pointer; font-size: 12px !important; }
.mfc-ut-link:hover { color: var(--accent, #e63946); }
.mfc-ut-icons { display: flex; gap: 6px; }
.mfc-ut-ic { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border-2, #333); background: var(--bg-elevated, #222); color: var(--text-muted, #999); cursor: pointer; font-size: 14px !important; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0; }
.mfc-ut-ic:hover { color: var(--accent, #e63946); border-color: var(--accent, #e63946); }

/* Мэдэгдэл */
.mfc-ut-toast { position: absolute; left: 50%; top: 58px; transform: translateX(-50%); z-index: 6; opacity: 0; pointer-events: none; transition: opacity .2s; background: var(--text-strong, #fff); color: var(--bg-deep, #111); font-size: 13px; font-weight: 700; padding: 8px 14px; border-radius: 8px; box-shadow: 0 6px 18px rgba(0, 0, 0, .3); white-space: nowrap; max-width: 92%; overflow: hidden; text-overflow: ellipsis; }
.mfc-ut-toast.on { opacity: 1; }

/* Самбар */
.mfc-ut-board { display: grid; grid-template-rows: repeat(6, 1fr); gap: 6px; width: min(320px, 100%); margin: 6px auto 12px; }
.mfc-ut-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.mfc-ut-tile { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border: 2px solid var(--ut-line); background: var(--ut-tile); color: var(--text-strong, #fff); font-size: clamp(22px, 7vw, 30px); font-weight: 800; text-transform: uppercase; user-select: none; box-sizing: border-box; border-radius: 4px; }
.mfc-ut-tile.filled { border-color: var(--ut-fill); animation: mfcUtPop .1s ease; }
.mfc-ut-tile.caret { border-color: var(--ut-fill); border-bottom-width: 3px; }
.mfc-ut.is-done .mfc-ut-tile.caret { border-color: var(--ut-line); }
.mfc-ut-tile.g, .mfc-ut-tile.y, .mfc-ut-tile.x { color: var(--ut-ink); }
.mfc-ut-tile.g { background: var(--ut-g); border-color: var(--ut-g); }
.mfc-ut-tile.y { background: var(--ut-y); border-color: var(--ut-y); }
.mfc-ut-tile.x { background: var(--ut-x); border-color: var(--ut-x); }
.mfc-ut-tile.flip { animation: mfcUtFlip .34s ease; }
.mfc-ut-row.shake { animation: mfcUtShake .4s; }
.mfc-ut-row.win .mfc-ut-tile { animation: mfcUtJump .5s ease; }
.mfc-ut-row.win .mfc-ut-tile:nth-child(2) { animation-delay: .08s; } .mfc-ut-row.win .mfc-ut-tile:nth-child(3) { animation-delay: .16s; }
.mfc-ut-row.win .mfc-ut-tile:nth-child(4) { animation-delay: .24s; } .mfc-ut-row.win .mfc-ut-tile:nth-child(5) { animation-delay: .32s; }
@keyframes mfcUtPop { 50% { transform: scale(1.08); } }
@keyframes mfcUtFlip { 0% { transform: rotateX(0); } 50% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }
@keyframes mfcUtShake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-6px); } 40%, 60% { transform: translateX(6px); } }
@keyframes mfcUtJump { 30% { transform: translateY(-10px); } 60% { transform: translateY(2px); } }
@media (prefers-reduced-motion: reduce) { .mfc-ut-tile, .mfc-ut-row { animation: none !important; } }

/* Гар */
.mfc-ut-kb { display: flex; flex-direction: column; gap: 6px; user-select: none; padding: 6px 0 4px; background: var(--bg, #1a1a1a); }
.mfc-ut.is-done .mfc-ut-kb { display: none; }
.mfc-ut-kbrow { display: flex; gap: 4px; justify-content: center; }
.mfc-ut-key { flex: 1 1 0; min-width: 0; max-width: 42px; height: 52px; padding: 0 !important; border: 0 !important; border-radius: 6px !important; background: var(--ut-key) !important; color: var(--ut-key-ink) !important; font-size: 15px !important; font-weight: 700 !important; cursor: pointer; touch-action: manipulation; transition: background .15s; }
.mfc-ut-key.wide { flex: 1.6 1 0; max-width: 68px; font-size: 12px !important; }
.mfc-ut-key[data-k="BACK"] { font-size: 18px !important; }
.mfc-ut-key .i { display: none; font-size: 20px; }
@media (max-width: 520px) { .mfc-ut-key .t { display: none; } .mfc-ut-key .i { display: inline; } }
.mfc-ut-key:active { filter: brightness(1.25); }
.mfc-ut-key.g { background: var(--ut-g) !important; color: #fff !important; }
.mfc-ut-key.y { background: var(--ut-y) !important; color: #fff !important; }
.mfc-ut-key.x { background: var(--ut-x) !important; color: #fff !important; opacity: .4; }
[data-theme="light"] .mfc-ut-key.x { opacity: .85; }
@media (max-width: 700px) {
  .mfc-ut-kb { position: sticky; bottom: 0; z-index: 4; padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
  .mfc-ut-key { height: 48px; font-size: 14px !important; }
  .mfc-ut-kbrow { gap: 3px; }
}
@media (max-width: 360px) { .mfc-ut-key { height: 44px; font-size: 13px !important; } .mfc-ut-key.wide { font-size: 10.5px !important; } }

/* Дууссаны дараа */
.mfc-ut-done:empty { display: none; }
.mfc-ut-done { text-align: center; padding: 4px 0 8px; }
.mfc-ut-res > b { display: block; font-size: 16px; color: var(--text-strong, #fff); }
.mfc-ut-res > span b { color: var(--text-strong, #fff); }
.mfc-ut-res > span { display: block; font-size: 12.5px; color: var(--text-muted, #999); margin-top: 2px; }
.mfc-ut-answer { display: inline-flex; gap: 4px; margin: 10px 0 4px; }
.mfc-ut-answer i { font-style: normal; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; border-radius: 4px; font-weight: 800; font-size: 17px; color: #fff; background: var(--ut-g); }
.mfc-ut-res.no .mfc-ut-answer i { background: transparent; color: var(--text-strong, #fff); border: 2px solid var(--ut-fill); }
.mfc-ut-acts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }
.mfc-ut-next { font-size: 12.5px; color: var(--text-muted, #999); margin-top: 10px; }
.mfc-ut-next b { font-variant-numeric: tabular-nums; color: var(--text-secondary, #ccc); }

/* Шилдэг 10 */
.mfc-ut-lbn { font-size: 11.5px; font-weight: 700; color: var(--text-muted, #999); font-variant-numeric: tabular-nums; }

/* Цонх */
.mfc-ut-modal .mfc-cw-modal-box { position: relative; width: min(400px, 100%); max-height: 88vh; overflow: auto; font-size: 13.5px; line-height: 1.55; }
.mfc-ut-modal p { margin: 0 0 8px; }
.mfc-ut-x { position: absolute; top: 8px; right: 10px; background: none; border: 0; color: var(--text-muted, #999); font-size: 16px; cursor: pointer; padding: 4px; }
.mfc-ut-h { font-size: 16px; font-weight: 800; color: var(--text-strong, #fff); margin-bottom: 10px; padding-right: 24px; }
.mfc-ut-ex { display: flex; gap: 4px; margin: 10px 0 4px; }
.mfc-ut-ex i { font-style: normal; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; border: 2px solid var(--border-2, #444); font-weight: 800; color: var(--text-strong, #fff); border-radius: 4px; box-sizing: border-box; }
.mfc-ut-ex i.g { background: #4f8f55; border-color: #4f8f55; color: #fff; }
.mfc-ut-ex i.y { background: #b39a3e; border-color: #b39a3e; color: #fff; }
.mfc-ut-ex i.x { background: #6b6e70; border-color: #6b6e70; color: #fff; }
.mfc-ut-exp { font-size: 12.5px; color: var(--text-secondary, #ccc); }
.mfc-ut-small { font-size: 12px; color: var(--text-muted, #999); }
.mfc-ut-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; margin: 6px 0 14px; }
.mfc-ut-stats b { display: block; font-size: 24px; font-weight: 800; color: var(--text-strong, #fff); }
.mfc-ut-stats span { font-size: 11px; color: var(--text-muted, #999); }
.mfc-ut-sub-h { font-size: 12px; font-weight: 700; color: var(--text-secondary, #ccc); margin-bottom: 6px; }
.mfc-ut-dist div { display: flex; align-items: center; gap: 6px; margin: 3px 0; font-size: 12px; }
.mfc-ut-dist span { width: 12px; text-align: right; color: var(--text-muted, #999); }
.mfc-ut-dist i { font-style: normal; display: block; text-align: right; padding: 1px 6px; background: var(--text-dim, #555); color: #fff; font-weight: 700; border-radius: 3px; box-sizing: border-box; }
.mfc-ut-dist i.cur { background: #4f8f55; }

/* Нүүр хуудасны "Тоглоом, таавар" сонголтууд */
.mfc-games-ic { width: 34px; height: 34px; flex-shrink: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.mfc-games-ic i { border-radius: 2px; background: var(--text-faint2, #888); opacity: .35; }
.mfc-games-ic i.g { background: #4f8f55; opacity: 1; } .mfc-games-ic i.y { background: #b39a3e; opacity: 1; } .mfc-games-ic i.r { background: var(--accent, #e63946); opacity: 1; }
