/* TTC Merge (ttc-merge.js) */
:is(.tmg-tile,.tmg-mini){--tb:#1E3A44;--tf:#CFE9EE;--tg:transparent}
:is(.tmg-tile,.tmg-mini).v4{--tb:#22505C;--tf:#DDF3F7}
:is(.tmg-tile,.tmg-mini).v8{--tb:#2A6B78;--tf:#E8F8FA}
:is(.tmg-tile,.tmg-mini).v16{--tb:#2E8A96;--tf:#fff}
:is(.tmg-tile,.tmg-mini).v32{--tb:#33A6B6;--tf:#fff}
:is(.tmg-tile,.tmg-mini).v64{--tb:#3FD2E8;--tf:#052A31}
:is(.tmg-tile,.tmg-mini).v128{--tb:#F5C97F;--tf:#2A1A00;--tg:#F5C97F55}
:is(.tmg-tile,.tmg-mini).v256{--tb:#F2B35C;--tf:#2A1500;--tg:#F2B35C66}
:is(.tmg-tile,.tmg-mini).v512{--tb:#F2994A;--tf:#2A0E00;--tg:#F2994A77}
:is(.tmg-tile,.tmg-mini).v1024{--tb:#E8684A;--tf:#fff;--tg:#E8684A88}
:is(.tmg-tile,.tmg-mini).v2048{--tb:linear-gradient(135deg,#FFE08A,#F5B83D);--tf:#3A2200;--tg:#FFD86B}
:is(.tmg-tile,.tmg-mini).v4096{--tb:linear-gradient(135deg,#C9A6F5,#7F5AD6);--tf:#fff;--tg:#C9A6F5}
:is(.tmg-tile,.tmg-mini).v8192{--tb:linear-gradient(135deg,#F5A6C0,#D65A8A);--tf:#fff;--tg:#F5A6C0}

.tmg-layout{display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:16px;align-items:start}
.tmg-main{padding:18px;display:flex;flex-direction:column;align-items:center;gap:14px}
.tmg-modes{display:flex;gap:6px;background:#0B1418;border-radius:999px;padding:4px;align-self:center}
.tmg-modes a{padding:7px 16px;border-radius:999px;color:#8FA6AD!important;font-weight:600;font-size:14px;text-decoration:none}
.tmg-modes a[aria-current]{background:#3FD2E8;color:#052A31!important}
.tmg-boxes{display:flex;gap:10px;width:100%;max-width:480px}
.tmg-box{position:relative;flex:1;background:#0B1418;border-radius:12px;padding:8px 12px;display:flex;flex-direction:column;align-items:center;min-width:0}
.tmg-box small{font-size:12px;color:#8FA6AD;text-transform:uppercase;letter-spacing:.06em}
.tmg-box strong{font:700 22px 'Space Grotesk',Inter,sans-serif;white-space:nowrap}
.tmg-box.top strong{font-size:18px;line-height:29px}
.tmg-plus{position:absolute;top:4px;right:10px;font:700 15px 'Space Grotesk',Inter,sans-serif;color:#A6E3B5;pointer-events:none;animation:tmg-plus .7s ease-out forwards}
@keyframes tmg-plus{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-22px)}}

.tmg-wrap{position:relative;width:100%;max-width:480px}
.tmg-board{position:relative;width:100%;aspect-ratio:1;border-radius:16px;background:#0A1317;box-shadow:inset 0 0 0 1px #1C2C33;container-type:inline-size;
  touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;outline:none;overflow:hidden;isolation:isolate}
.tmg-board:focus-visible{box-shadow:inset 0 0 0 1px #1C2C33,0 0 0 3px #3FD2E866}
.tmg-board.bump{animation:tmg-bump .18s ease-out}
@keyframes tmg-bump{30%{transform:translateX(-3px)}60%{transform:translateX(3px)}}
.tmg-grid,.tmg-tiles{position:absolute;inset:0}
.tmg-grid span,.tmg-tile{position:absolute;left:2.4%;top:2.4%;width:22%;height:22%;transform:translate(calc(var(--c,0) * 110.909%),calc(var(--r,0) * 110.909%))}
.tmg-grid span{border-radius:10%;background:#13222A}
.tmg-tile{z-index:1;transition:transform .11s ease-in-out}
.tmg-tile.under{z-index:0}
.tmg-tile.merged{z-index:2}
.tmg-face{width:100%;height:100%;border-radius:10%;background:var(--tb);color:var(--tf);box-shadow:0 0 14px var(--tg);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1cqw}
.tmg-em{font-size:9.5cqw;line-height:1}
.tmg-face b{font:700 3.6cqw 'Space Grotesk',Inter,sans-serif;line-height:1}
.tmg-tile.d4 .tmg-face b{font-size:3.2cqw}
.tmg-tile.born .tmg-face{animation:tmg-born .18s ease-out}
.tmg-tile.merged .tmg-face{animation:tmg-pop .2s ease-out}
@keyframes tmg-born{from{transform:scale(0);opacity:0}to{transform:scale(1);opacity:1}}
@keyframes tmg-pop{0%{transform:scale(.8)}55%{transform:scale(1.14)}100%{transform:scale(1)}}

.tmg-over{position:absolute;inset:0;z-index:5;display:flex;align-items:center;justify-content:center;padding:6%;background:#060C10C7;backdrop-filter:blur(3px);-webkit-backdrop-filter:blur(3px);border-radius:16px;animation:tmg-fade .25s ease-out}
.tmg-over[hidden]{display:none}
@keyframes tmg-fade{from{opacity:0}}
.tmg-over-card{display:flex;flex-direction:column;align-items:center;text-align:center;gap:8px;max-width:340px}
#ttc-feed-app .tmg-over-card h2{margin:0;font:700 22px 'Space Grotesk',Inter,sans-serif}
.tmg-over-card p{margin:0;font-size:15px;line-height:1.45;color:#C9D7DB}
.tmg-over-card .tg-btns{justify-content:center;margin-top:6px}
.tmg-big-em{font-size:46px;line-height:1}
.tmg-over.win .tmg-big-em{animation:tmg-pop .5s ease-out}
.tmg-final{display:flex;flex-direction:column;align-items:center}
.tmg-final strong{font:700 40px 'Space Grotesk',Inter,sans-serif;line-height:1.1}
.tmg-final small{color:#8FA6AD;font-size:13px}
.tmg-over-card .tmg-record{color:#F5C97F;font-weight:700}
.tmg-over-card .tmg-rank{color:#3FD2E8;font-weight:700}
.tmg-over-card .tmg-earned{color:#A6E3B5;font-weight:700}
.tmg-next{color:#8FA6AD;font-size:13px}
.tmg-foot{display:flex;align-items:center;justify-content:space-between;gap:10px;width:100%;max-width:480px;flex-wrap:wrap}
.tmg-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

.tmg-side{display:flex;flex-direction:column;gap:14px;min-width:0}
.tmg-card{padding:16px 18px;display:flex;flex-direction:column;gap:10px}
#ttc-feed-app .tmg-card h2{margin:0;font-size:17px}
.tmg-seg{display:flex;gap:4px;background:#0B1418;border-radius:10px;padding:3px}
.tmg-seg button{flex:1;border:0;background:none;color:#8FA6AD;font:600 13px Inter,sans-serif;padding:7px;border-radius:8px;cursor:pointer}
.tmg-seg button[aria-selected="true"]{background:#1C2C33;color:#E8F1F3}
.tmg-lb{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:4px}
.tmg-lb li{display:flex;align-items:center;gap:10px;padding:6px 8px;border-radius:10px}
.tmg-lb li.you{background:#3FD2E814}
.tmg-lb li:nth-child(-n+3) .tmg-rank-n{color:#F5C97F}
.tmg-rank-n{width:18px;text-align:center;font:700 14px 'Space Grotesk',Inter,sans-serif;color:#8FA6AD}
.tmg-lb a{display:flex}
.tmg-lb-name{flex:1;min-width:0;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tmg-lb-tile{font-size:18px}
.tmg-lb strong{font:700 15px 'Space Grotesk',Inter,sans-serif;min-width:54px;text-align:right}
.tmg-ladder{display:grid;grid-template-columns:repeat(6,1fr);gap:8px 4px}
.tmg-rung{display:flex;flex-direction:column;align-items:center;gap:2px}
.tmg-rung small{font-size:11px;color:#8FA6AD}
.tmg-rung em{font-style:normal;font-size:11px;font-weight:700;color:#A6E3B5}
.tmg-mini{width:34px;height:34px;border-radius:9px;background:var(--tb);box-shadow:0 0 8px var(--tg);display:flex;align-items:center;justify-content:center;font-size:18px;flex:none}
.tmg-rule{font-size:13px;margin:0}
.tmg-runs{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px}
.tmg-runs li{display:flex;align-items:center;gap:10px}
.tmg-run-main{flex:1;min-width:0;display:flex;flex-direction:column}
.tmg-run-main strong{font:700 15px 'Space Grotesk',Inter,sans-serif}
.tmg-run-main small{font-size:12px;color:#8FA6AD;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
/* Hub card art: four tiles in a square */
.tg-game-art.tmg-art{display:grid;grid-template-columns:repeat(2,40px);gap:6px;align-content:center;justify-content:center}
.tg-game-art.tmg-art .tmg-mini{width:40px;height:40px;font-size:22px}

@media(max-width:1099px){.tmg-layout{grid-template-columns:minmax(0,1fr) 280px}}
@media(max-width:899px){.tmg-layout{grid-template-columns:1fr}}
@media(max-width:759px){
  .tmg-main{padding:12px 10px;border-radius:0}
  .tmg-boxes{gap:6px}
  .tmg-box{padding:6px 8px}
  .tmg-box strong{font-size:19px}
  .tmg-box.top strong{font-size:16px;line-height:25px}
  .tmg-how{display:none}
  .tmg-foot{justify-content:flex-end}
}
@media(prefers-reduced-motion:reduce){.tmg-tile{transition:none}.tmg-tile .tmg-face,.tmg-board.bump,.tmg-over{animation:none!important}}
body.ttc-calm .tmg-tile{transition:none}
body.ttc-calm .tmg-tile .tmg-face,body.ttc-calm .tmg-board.bump{animation:none!important}
