/* ================= มินิเกม / ตราสะสม / ลดราคา ================= */
.tool[data-a=brain] { --c: #ffd6f0; --d: #e9a5cf; }
.tool[data-a=badges] { --c: #fff3b0; --d: #e2c35a; }

.brain-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; padding: 4px 2px 10px; }
.brain-card { background: linear-gradient(180deg, #fff, var(--c)); border: 4px solid #fff; border-radius: 26px; padding: 14px 12px; box-shadow: 0 6px 0 rgba(0,0,0,.1), 0 10px 18px rgba(0,0,0,.06); display: flex; flex-direction: column; align-items: center; gap: 4px; color: #5a4640; transition: transform .15s; }
.brain-card:hover { transform: translateY(-4px) rotate(-1deg); }
.brain-card:active { transform: translateY(3px); }
.brain-card .bi { font-size: 56px; animation: bob 2s ease-in-out infinite; }
.brain-card .bn { font-size: 24px; font-weight: 800; color: #ff5d8f; }
.brain-card .bd { font-size: 15px; opacity: .8; text-align: center; }
.lv { display: flex; gap: 5px; margin: 4px 0; }
.lv i { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid #e9d5dc; }
.lv i.on { background: linear-gradient(180deg, #ffe066, #ffb400); border-color: #fff; box-shadow: 0 2px 0 #d39a00; }

.mg { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; background: radial-gradient(circle, rgba(255,255,255,.6) 2px, transparent 2.5px) 0 0 / 30px 30px, linear-gradient(180deg, var(--c), #fff7ee); animation: fade .2s; }
.mg-top { display: flex; align-items: center; gap: 12px; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); }
.mg-title { font-size: 24px; font-weight: 800; color: #ff5d8f; flex: 1; }
.mg-title small { font-size: 16px; color: #8a6a63; margin-left: 6px; }
.dots { display: flex; gap: 8px; }
.dots i { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 3px solid #fff; box-shadow: 0 2px 0 rgba(0,0,0,.1); }
.dots i.now { background: #ffe066; animation: bob 1s infinite; }
.dots i.ok { background: #4fcf9f; } .dots i.bad { background: #ffb3a7; }
.mg-body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 10px 16px 120px; }
.mg-q { display: flex; align-items: center; gap: 12px; font-size: clamp(22px, 4vw, 32px); font-weight: 800; color: #5a4640; background: #fff; padding: 10px 20px 10px 10px; border-radius: 999px; box-shadow: 0 5px 0 rgba(0,0,0,.08); text-align: center; }
.mg-show { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; max-width: 900px; }
.bigpic { font-size: clamp(110px, 22vw, 170px); line-height: 1.1; filter: drop-shadow(0 6px 0 rgba(0,0,0,.08)); animation: pop-in2 .35s; }
.bigtext { font-size: clamp(56px, 12vw, 96px); font-weight: 800; background: #fff; border-radius: 30px; padding: 10px 40px; border: 5px solid #fff; box-shadow: 0 6px 0 rgba(0,0,0,.1); color: #4a3a35; animation: pop-in2 .35s; }
@keyframes pop-in2 { from { transform: scale(.4); opacity: 0; } }
.objs { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: 420px; background: rgba(255,255,255,.75); border-radius: 24px; padding: 10px 14px; font-size: clamp(36px, 7vw, 52px); }
.objs .gone { opacity: .3; position: relative; }
.objs .gone::after { content: '✖'; position: absolute; inset: 0; display: grid; place-items: center; color: #e8505b; font-size: .8em; opacity: 1; }
.op { font-size: 56px; font-weight: 900; color: #ff8a5b; }
.shopq { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.shopq .tag { background: #fff; border-radius: 22px; padding: 10px 18px; display: flex; flex-direction: column; align-items: center; font-size: 46px; box-shadow: 0 5px 0 rgba(0,0,0,.08); min-width: 130px; }
.shopq b { font-size: 26px; } .shopq small { font-size: 16px; opacity: .7; }
.seq { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.seq span { min-width: 72px; height: 80px; padding: 0 8px; border-radius: 20px; background: #fff; display: grid; place-items: center; font-size: 46px; font-weight: 800; box-shadow: 0 5px 0 rgba(0,0,0,.08); }
.seq .q { background: #fff3c4; color: #ff8a5b; border: 4px dashed #ffb400; animation: bob 1.2s infinite; }
.mg-ans.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; width: min(720px, 100%); }
.choice { background: #fff; border: 4px solid #fff; border-radius: 24px; min-height: 84px; font-size: clamp(28px, 5vw, 40px); font-weight: 800; color: #4a3a35; box-shadow: 0 6px 0 #e7d6cf, 0 10px 16px rgba(0,0,0,.06); }
.mg-ans.big .choice { font-size: clamp(48px, 9vw, 64px); min-height: 104px; }
.choice:active { transform: translateY(4px); }
.choice:disabled { opacity: .4; }
.choice.right, .train.right { background: #c9f5df; box-shadow: 0 6px 0 #4fcf9f; animation: pop-in2 .3s; }
.train { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; justify-content: center; min-height: 86px; background: rgba(255,255,255,.7); border-radius: 24px; padding: 12px; border-bottom: 8px solid #b9875c; }
.train .loco { font-size: 58px; line-height: 1; }
.slot { width: 96px; height: 62px; border-radius: 16px; border: 4px dashed #d9c3b8; background: #fffaf6; }
.bank { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 16px; }
.tile { background: #fff; border: 4px solid #fff; border-radius: 18px; padding: 10px 18px; min-width: 96px; font-size: clamp(26px, 5vw, 34px); font-weight: 800; color: #4a3a35; box-shadow: 0 6px 0 #e7d6cf; }
.tile.car { background: linear-gradient(180deg, #ffd6e4, #ffb3cd); box-shadow: 0 6px 0 #e58fb0; position: relative; }
.tile.car::after { content: '● ●'; position: absolute; left: 0; right: 0; bottom: -18px; font-size: 14px; color: #4a3a35; letter-spacing: 30px; text-align: center; }
.tile:disabled { visibility: hidden; }
.mg-cat { position: fixed; right: 10px; bottom: 6px; width: min(170px, 30vw); aspect-ratio: 260/232; pointer-events: none; }
.mg-cat svg { width: 100%; height: 100%; overflow: visible; }
.result { display: flex; flex-direction: column; align-items: center; background: #fff; border: 5px solid #fff; border-radius: 34px; padding: 20px 34px; box-shadow: 0 8px 0 rgba(0,0,0,.08); }
.stars { display: flex; gap: 10px; font-size: 80px; line-height: 1; }
.stars span { color: #eadfd8; animation: starpop .5s backwards; }
.stars span.on { color: #ffc400; text-shadow: 0 4px 0 #d39a00; }
@keyframes starpop { from { transform: scale(0) rotate(-60deg); } 70% { transform: scale(1.3); } }
.big-coin { font-size: 30px; margin: 6px 0; }
.lvup { background: linear-gradient(90deg, #ff9fc0, #b39cff); color: #fff; font-size: 22px; font-weight: 800; padding: 8px 20px; border-radius: 999px; margin: 6px 0; animation: bob 1s infinite; }

.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.badge-card { background: #fff; border: 3px solid #fff; border-radius: 22px; box-shadow: 0 5px 0 #f3d9e3; padding: 12px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; color: #5a4640; }
.badge-card small { opacity: .75; }
.badge-card .bar { width: 100%; }
.badge-big { width: 86px; height: 86px; border-radius: 50%; display: grid; place-items: center; font-size: 46px; background: #eee6e2; filter: grayscale(.9); opacity: .7; border: 5px solid #fff; box-shadow: 0 4px 0 rgba(0,0,0,.12); margin: 0 auto; }
.badge-big.t1 { background: radial-gradient(circle at 35% 30%, #ffd2b0, #d98a4e); filter: none; opacity: 1; }
.badge-big.t2 { background: radial-gradient(circle at 35% 30%, #ffffff, #b9c3cf); filter: none; opacity: 1; }
.badge-big.t3 { background: radial-gradient(circle at 35% 30%, #fff6b8, #f0b400); filter: none; opacity: 1; box-shadow: 0 0 18px #ffd84d, 0 4px 0 #c99300; }
.dialog .badge-big { width: 130px; height: 130px; font-size: 70px; animation: pop-in2 .5s; }
.tiers { display: flex; gap: 6px; }
.tiers i { width: 16px; height: 16px; border-radius: 50%; background: #eee6e2; }
.tiers i.t1 { background: #d98a4e; } .tiers i.t2 { background: #b9c3cf; } .tiers i.t3 { background: #f0b400; }
.card .sale { position: absolute; top: -8px; left: -6px; background: #ff5a5a; color: #fff; font-size: 13px; font-weight: 800; padding: 3px 9px; border-radius: 999px; border: 2px solid #fff; transform: rotate(-8deg); z-index: 1; animation: bob 1.4s infinite; }
.price s { opacity: .5; font-size: .85em; }
@media (max-width: 700px) { .mg-cat { width: 110px; } .slot { width: 70px; height: 52px; } .tile { min-width: 70px; padding: 8px 12px; } }

/* ================= เทศกาล / ภารกิจทั้งห้อง ================= */
.evfx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 4; }
.evfx span { position: absolute; top: -10%; font-size: clamp(16px, 2.6vw, 30px); opacity: .85; animation: evfall linear infinite; }
@keyframes evfall { 0% { transform: translateY(0) rotate(0); opacity: 0; } 10% { opacity: .9; } 90% { opacity: .9; } 100% { transform: translateY(115vh) rotate(160deg); opacity: 0; } }
.evbanner { position: absolute; left: 50%; top: 3%; transform: translateX(-50%); z-index: 6; border: 3px solid #fff; border-radius: 999px; padding: 4px 16px; font-size: clamp(13px, 2vw, 19px); font-weight: 800; color: #b0567a; box-shadow: 0 4px 0 rgba(0,0,0,.1); white-space: nowrap; animation: bob 2s ease-in-out infinite; cursor: pointer; }
.goalpill { color: #8a5a00; background: linear-gradient(180deg, #fff, #fff3c4); border: 3px solid #fff; box-shadow: 0 4px 0 #e2c35a; font-size: 18px; cursor: pointer; }
.goalpill.done { background: linear-gradient(180deg, #d9fbe9, #8fe3bd); color: #1d7a52; box-shadow: 0 4px 0 #4fcf9f; }
.classgoal { display: flex; gap: 12px; align-items: center; background: linear-gradient(180deg, #fffbe6, #fff1b8); border: 3px solid #fff; border-radius: 22px; padding: 12px 14px; box-shadow: 0 5px 0 #ecd27a; margin-bottom: 14px; color: #6b524b; }
.classgoal.done { background: linear-gradient(180deg, #effff6, #c9f5df); box-shadow: 0 5px 0 #4fcf9f; }
.classgoal .ic { font-size: 44px; }
.classgoal .tx { flex: 1; font-size: 17px; }
.classgoal b { font-size: 20px; color: #c47f00; }
.bar.big { height: 26px; position: relative; margin: 6px 0 4px; }
.bar.big i { background: repeating-linear-gradient(-45deg, #ffc400 0 12px, #ffd84d 12px 24px); }
.bar.big span { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: 15px; color: #6b4a00; }
.tab.evtab { background: linear-gradient(180deg, #fff3c4, #ffd84d); color: #8a5a00; }
.tab.evtab.on { background: linear-gradient(180deg, #ffb400, #ff9f43); color: #fff; }
@media (max-width: 560px) { .goalpill { display: none; } }

/* ================= คู่หู ================= */
.partnerpill { background: linear-gradient(180deg, #fff, #ffe9f2); border: 3px solid #fff; box-shadow: 0 4px 0 #f3c6d8; color: #ff5d8f; font-size: 17px; cursor: pointer; max-width: 210px; overflow: hidden; text-overflow: ellipsis; }
.pface { width: 30px; height: 30px; display: inline-grid; place-items: center; border-radius: 50%; background: #fff; overflow: hidden; vertical-align: middle; }
.pface svg { width: 100%; height: 100%; }
.catbox.partnercat { width: 20%; pointer-events: none; z-index: 4; }
.partnercat .ptag { position: absolute; left: 50%; top: 100%; transform: translate(-50%, 2px); background: #ff8fb6; color: #fff; border-radius: 999px; padding: 1px 10px; font-size: clamp(11px, 1.6vw, 16px); font-weight: 800; white-space: nowrap; border: 2px solid #fff; }
.partnercat .nocat { font-size: clamp(40px, 7vw, 80px); text-align: center; }
.pairgrid .card.solo { background: linear-gradient(180deg, #fff, #fff6d6); }
@media (max-width: 560px) { .partnerpill { font-size: 14px; max-width: 120px; } }
