
/* Kolobok Match-3 + Winter Tree UI */
.match-page,.tree-page{max-width:560px;margin:0 auto;padding:16px 13px 120px;color:#f4f7ff}
.match-hero{position:relative;overflow:hidden;display:flex;align-items:center;min-height:174px;padding:20px 18px;border:1px solid rgba(115,195,255,.26);border-radius:25px;background:radial-gradient(circle at 82% 20%,rgba(255,188,79,.2),transparent 36%),linear-gradient(135deg,#102642,#10152c 65%,#281c3d);box-shadow:0 18px 40px #0005}
.match-hero-copy{position:relative;z-index:2;max-width:70%}.match-kicker{font-size:9px;letter-spacing:1.5px;color:#8bdfff;font-weight:900}.match-hero h2{font-size:28px;line-height:1.02;margin:10px 0 8px;font-weight:1000;letter-spacing:-1px}.match-hero h2 span{color:#ffd36e}.match-hero p{font-size:11px;line-height:1.5;color:#bdcde1;margin:0;max-width:255px}.match-hero-art{position:absolute;width:46%;right:-3%;bottom:-18px;height:180px}.match-hero-art img{width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 10px 16px #0009)}
.match-stats{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:12px 0}.match-stats>div{padding:10px 11px;border-radius:15px;background:linear-gradient(145deg,#192b43,#121c30);border:1px solid #ffffff14;box-shadow:inset 0 1px #ffffff0b}.match-stats small,.match-stats em{display:block;color:#8fa4bf;font-size:9px;font-style:normal;font-weight:900;letter-spacing:.8px}.match-stats strong{display:block;margin-top:4px;font-size:20px;font-weight:1000;color:#fff}.match-stats em{font-size:8px;color:#69d8b0;margin-top:2px}
.match-mission-card{padding:14px 15px;border-radius:18px;border:1px solid rgba(255,205,105,.25);background:linear-gradient(125deg,#2b2940,#1a2339 70%);box-shadow:0 10px 24px #0003}.mission-top{display:flex;align-items:center;gap:6px;color:#ffd777;font-weight:1000}.mission-top .mission-tag{margin-right:auto;font-size:9px;letter-spacing:1.2px}.mission-top>span:nth-child(2){font-size:19px}.mission-top small{font-size:9px;color:#a8b6ca}.match-mission-card h3{font-size:17px;margin:7px 0 3px}.match-mission-card p{margin:0;color:#b8c7da;font-size:11px}.mission-progress{height:7px;border-radius:10px;background:#0b1423;margin-top:12px;overflow:hidden}.mission-progress span{display:block;height:100%;width:0;background:linear-gradient(90deg,#41d8bd,#fbd16e);border-radius:10px;transition:width .25s}.mission-count{text-align:right;font-size:9px;color:#91a8c5;margin-top:5px}
.match-start-wrap{padding:12px 0}.match-primary{border:0;border-radius:14px;padding:14px 18px;width:100%;color:#172039;background:linear-gradient(110deg,#ffe08c,#ffb94f);font-weight:1000;letter-spacing:.8px;box-shadow:0 7px 20px #ffbc4c35}.match-primary span{float:right}.match-game[hidden],#match-start[hidden]{display:none!important}
.match-board-frame{padding:9px;border-radius:19px;background:linear-gradient(145deg,#243f5d,#101c32);border:1px solid #8bdfff45;box-shadow:0 12px 30px #0005}.match-board-top{display:flex;justify-content:space-between;padding:0 3px 8px;font-size:9px;font-weight:1000;letter-spacing:1px;color:#9edfff}.match-board{display:grid;grid-template-columns:repeat(10,minmax(0,1fr));gap:2px;aspect-ratio:1/1;padding:4px;border-radius:12px;background:radial-gradient(circle at 50% 0%,#2e5473,#14253e 75%)}.match-cell{position:relative;min-width:0;min-height:0;aspect-ratio:1;border:0;padding:1px;border-radius:5px;background:linear-gradient(145deg,#375a7a,#1b3450);box-shadow:inset 0 1px 2px #ffffff28,0 1px 2px #0007;overflow:hidden;transition:transform .12s,filter .12s}.match-cell:active{transform:scale(.9)}.match-cell img{width:100%;height:100%;object-fit:contain;display:block;filter:drop-shadow(0 1px 1px #0008);pointer-events:none}.match-cell.selected{outline:2px solid #ffe28c;outline-offset:-2px;transform:scale(1.06);z-index:3;filter:brightness(1.2)}.match-cell.void{visibility:hidden;pointer-events:none}.match-special{position:absolute;right:0;top:-3px;font-style:normal;font-size:12px;color:#fff5a2;text-shadow:0 0 7px #ffb82d}.match-special.bomb{color:#ffed8c;font-size:17px}.match-ice{position:absolute;inset:0;display:grid;place-items:center;color:#e1f7ff;font-size:22px;background:linear-gradient(135deg,#d9f7ff66,#71bde766);text-shadow:0 1px 5px #14517c}.match-chain{position:absolute;inset:0;display:grid;place-items:center;color:#fff0bb;font-size:19px;text-shadow:0 1px 5px #5b3216;background:#6b512a33}.match-booster-row{display:grid;grid-template-columns:repeat(3,1fr);gap:7px;margin:10px 0}.match-booster{border:1px solid #ffffff1c;border-radius:13px;padding:9px 3px;background:linear-gradient(145deg,#202f48,#131d30);color:#fff;display:flex;flex-direction:column;align-items:center;gap:3px}.match-booster>span{font-size:20px}.match-booster b{font-size:10px}.match-booster small{font-size:9px;color:#9db2cb}.match-booster i{font-style:normal;color:#ffd777}.match-restart{width:100%;padding:10px;border:1px solid #ffffff22;border-radius:12px;color:#9db3ce;background:#17253b;font-size:11px}.match-result{display:none;position:fixed;z-index:10020;inset:0;background:#050b17c9;backdrop-filter:blur(8px);align-items:center;justify-content:center;padding:24px}.match-result.show{display:flex}.match-result-card{width:min(100%,360px);padding:25px 22px;border-radius:24px;text-align:center;background:linear-gradient(145deg,#243b59,#111b30);border:1px solid #ffdb8a77;box-shadow:0 25px 70px #000a}.match-result-spark{font-size:40px;color:#ffdf88}.match-result-card h3{font-size:22px;margin:5px 0 8px}.match-result-card p{font-size:13px;color:#bdcce0;line-height:1.55;margin-bottom:18px}.match-footnote{text-align:center;color:#7f94af;font-size:9px;line-height:1.5;margin:7px 8px 0}
.tree-heading{text-align:center;padding:10px 0 2px}.tree-heading>span{font-size:9px;letter-spacing:2px;color:#83d9ff;font-weight:900}.tree-heading h2{font-size:25px;letter-spacing:1px;margin:6px 0;color:#f8e5b0}.tree-heading p{font-size:11px;color:#a9bdd4;margin:0}
.tree-scene{position:relative;margin:14px auto 18px;max-width:440px;min-height:460px;display:flex;align-items:flex-end;justify-content:center;overflow:hidden;border-radius:26px;border:1px solid #9edfff30;background:radial-gradient(ellipse at 50% 75%,#397b9b55,transparent 50%),linear-gradient(180deg,#0c1b34,#132b46 65%,#24445b);box-shadow:inset 0 0 45px #6bc8ff18,0 18px 35px #0005}.tree-scene:before{content:"";position:absolute;inset:0;background-image:radial-gradient(#fff 1px,transparent 1.8px);background-size:38px 42px;opacity:.32}
.holiday-tree{position:relative;width:82%;height:410px;transform:rotate(var(--tilt,0deg));transform-origin:50% 100%;transition:transform .22s ease-out;z-index:2}.tree-topper{position:absolute;z-index:8;top:0;left:50%;transform:translateX(-50%);font-size:39px;color:#ffe38b;text-shadow:0 0 9px #ffe58c,0 0 25px #ffcf52;animation:treeTwinkle 2s infinite alternate}.tree-layer{position:absolute;left:50%;transform:translateX(-50%);height:0;border-left:0 solid transparent;border-right:0 solid transparent;border-bottom:0 solid transparent;filter:drop-shadow(0 7px 5px #0005)}.layer-one{top:35px;border-left:63px solid transparent;border-right:63px solid transparent;border-bottom:110px solid #1d9a71}.layer-two{top:91px;border-left:91px solid transparent;border-right:91px solid transparent;border-bottom:130px solid #16835f}.layer-three{top:155px;border-left:121px solid transparent;border-right:121px solid transparent;border-bottom:137px solid #126b51}.layer-four{top:222px;border-left:151px solid transparent;border-right:151px solid transparent;border-bottom:145px solid #105840}.tree-branch{position:absolute;top:100%;left:-50%;width:100%;height:12px;border-radius:50%;background:linear-gradient(180deg,#52b88a,#0b573f);box-shadow:0 4px 0 #0a4b38}.branch-snow{position:absolute;left:-3%;top:-5px;width:106%;height:9px;border-radius:50%;background:linear-gradient(180deg,#fff,#bde9ff);box-shadow:0 2px 5px #d8f5ff9c;opacity:.92}.tree-trunk{position:absolute;z-index:-1;bottom:0;left:43%;width:14%;height:82px;background:linear-gradient(90deg,#603b2d,#a36b43,#563527);border-radius:4px}.tree-pot{position:absolute;bottom:-1px;left:34%;width:32%;height:42px;background:linear-gradient(90deg,#9b302d,#e45c46,#922b2b);clip-path:polygon(8% 0,92% 0,82% 100%,18% 100%);border-bottom:5px solid #6d2424}.tree-floor-snow{position:absolute;bottom:27px;left:0;width:100%;height:17px;border-radius:50%;background:#e8f8ff;box-shadow:0 0 15px #c8f0ff;z-index:-2}.tree-garland{position:absolute;z-index:5;left:50%;width:0;height:0;border-radius:50%;border-bottom:2px dashed #ffcf72;filter:drop-shadow(0 0 4px #ffd66b)}.garland-one{top:105px;width:124px;height:70px;transform:translateX(-50%) rotate(12deg);border-bottom:2px solid #ffd36e}.garland-two{top:190px;width:225px;height:95px;transform:translateX(-50%) rotate(-8deg);border-bottom:2px solid #f2a8e8}.garland-three{top:270px;width:280px;height:110px;transform:translateX(-50%) rotate(8deg);border-bottom:2px solid #7deaff}
#tree-ornaments{position:absolute;inset:20px 0 45px;z-index:7}.tree-bauble{position:absolute;width:39px;height:43px;border:2px solid #ffe7a4;border-radius:50% 50% 48% 48%;padding:2px;background:radial-gradient(circle at 28% 22%,#fff8,#fff0 35%),linear-gradient(135deg,#e14e5c,#7d102f);box-shadow:0 4px 10px #0008,inset 0 0 8px #fff7;transform:rotate(var(--lag,0deg));transform-origin:50% -10px;animation:baubleSway 3s ease-in-out infinite alternate}.tree-bauble:before{content:"";position:absolute;top:-7px;left:14px;width:8px;height:7px;border:1px solid #f5d78a;border-radius:3px 3px 0 0;background:#d5a64c}.tree-bauble img{width:100%;height:100%;object-fit:contain;border-radius:50%;background:#fff8}.tree-bauble.gold{background:linear-gradient(135deg,#fff1a5,#d99a27,#fff0a8)}.tree-bauble.tinsel,.tree-bauble.light,.tree-bauble.snow,.tree-bauble.topper{width:34px;height:34px;border-radius:50%;font-size:20px;display:grid;place-items:center;background:#f9d46b}.tree-bauble.tinsel{background:linear-gradient(135deg,#f3a9eb,#8d4cb3)}.tree-bauble.light{background:linear-gradient(135deg,#b7fff3,#3299d4)}.tree-bauble.snow{background:linear-gradient(135deg,#fff,#8bdcff)}.tree-bauble.topper{background:linear-gradient(135deg,#ffe9a1,#c28b29)}.tree-bauble.selected{outline:3px solid #fff;z-index:9}.tree-bauble:nth-child(3n){animation-delay:-1.1s}.tree-bauble:nth-child(2n){animation-delay:-.5s}.tree-snowbank{position:absolute;bottom:0;left:-5%;width:110%;height:32px;border-radius:50% 50% 0 0;background:linear-gradient(#e8f8ff,#a8d7ed);z-index:3}.tree-fall-snow{position:absolute;top:30%;left:var(--x);width:7px;height:7px;border-radius:50%;background:white;box-shadow:0 0 8px #fff;animation:treeSnowFall .9s ease-in forwards;z-index:12}.tree-fall-snow{left:var(--x,50%);transform:translateY(var(--fall,150px))}.tree-controls{padding:16px;border-radius:20px;background:linear-gradient(145deg,#1b2c45,#101a2c);border:1px solid #ffffff19}.tree-controls h3{font-size:16px;margin:0 0 12px}.tree-decor-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}.tree-add{display:flex;flex-direction:column;align-items:center;gap:4px;padding:10px 4px;border:1px solid #ffffff18;border-radius:13px;background:#243752;color:#fff}.tree-add span{font-size:22px}.tree-add b{font-size:9px}.tree-motion-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:12px}.tree-motion-actions button{border:1px solid #8bdfff55;border-radius:12px;padding:10px 6px;background:#183a52;color:#dff7ff;font-size:10px;font-weight:900}.tree-motion-actions button+button{background:#4a352d;border-color:#f4c77b55;color:#ffe7bd}.tree-controls>p{font-size:10px;line-height:1.5;color:#93a9c2;margin:10px 0 0;text-align:center}
.holiday-tree.shaking{animation:treeShake .7s ease-in-out}@keyframes treeShake{0%,100%{transform:rotate(var(--tilt,0deg))}20%{transform:rotate(calc(var(--tilt,0deg) - 7deg))}45%{transform:rotate(calc(var(--tilt,0deg) + 8deg))}70%{transform:rotate(calc(var(--tilt,0deg) - 4deg))}}@keyframes baubleSway{from{translate:0 0;rotate:-4deg}to{translate:0 2px;rotate:5deg}}@keyframes treeTwinkle{from{filter:drop-shadow(0 0 4px #ffe58c)}to{filter:drop-shadow(0 0 17px #ffe58c)}}@keyframes treeSnowFall{to{translate:0 var(--fall,180px);opacity:0}}
@media(min-width:600px){.match-page,.tree-page{padding-top:24px}.match-board{gap:4px}.match-cell{border-radius:7px}.tree-scene{min-height:530px}.holiday-tree{transform:scale(1.12) rotate(var(--tilt,0deg));transform-origin:50% 100%}}
@media(prefers-reduced-motion:reduce){.tree-bauble,.tree-topper,.holiday-tree{animation:none!important;transition:none!important}}
/* The medal number must never overlap the score. Keep a clean, compact podium. */
#screen-leaders .top-player-card{position:relative;overflow:visible;padding-right:14px}
#screen-leaders .top-player-card .tp-medal{position:static!important;display:flex!important;align-items:center;justify-content:center;flex:0 0 25px;width:25px;height:25px;margin-left:8px;border-radius:50%;font-size:12px;line-height:1;box-shadow:none!important}
#screen-leaders .top-player-card .tp-right{position:relative;z-index:1;white-space:nowrap;margin-left:auto;padding-right:0}
#screen-leaders .top-player-card .tp-medal::before,#screen-leaders .top-player-card .tp-medal::after{content:none!important;display:none!important}
#screen-leaders .top-player-card.rank-1::before,#screen-leaders .top-player-card.rank-2::before,#screen-leaders .top-player-card.rank-3::before{content:none!important;display:none!important}

.layer-one .tree-branch{width:126px;left:-63px}.layer-two .tree-branch{width:182px;left:-91px}.layer-three .tree-branch{width:242px;left:-121px}.layer-four .tree-branch{width:302px;left:-151px}
.tree-topper{width:28px;height:38px;display:block;font-size:0;background:linear-gradient(100deg,#fff0a8,#d69a2f 48%,#fff0a8);clip-path:polygon(50% 0,100% 100%,0 100%);filter:drop-shadow(0 0 10px #ffe58c);animation:treeTwinkle 2s infinite alternate}
.tree-topper:after{content:'✦';position:absolute;top:-16px;left:7px;font-size:16px;color:#fff0a8;text-shadow:0 0 9px #ffe58c}
@media(max-width:380px){.nav-btn{font-size:8px!important}.nav-btn i{font-size:17px!important}.match-hero h2{font-size:25px}}

/* Shared premium finish across the existing Kolobok screens */
.screen.page-bg{background-image:radial-gradient(ellipse at 12% 0%,rgba(80,170,220,.075),transparent 34%),radial-gradient(ellipse at 100% 70%,rgba(255,194,91,.045),transparent 36%)}
.page-title{letter-spacing:.8px;text-shadow:0 5px 24px rgba(95,185,255,.14)}
.nav-btn{transition:transform .2s ease,color .2s ease,background .2s ease,border-color .2s ease}
.nav-btn:active{transform:scale(.94)}
.action-btn,.invite-btn,.reset-btn,.leader-tab,.market-item,.tree-add,.match-booster{transition:transform .18s ease,filter .18s ease,box-shadow .18s ease}
.action-btn:active,.invite-btn:active,.reset-btn:active,.leader-tab:active,.tree-add:active,.match-booster:active{transform:scale(.97);filter:brightness(1.12)}
#screen-leaders .leader-header h2{letter-spacing:1.4px}
#screen-leaders .player-rank-box{backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px)}
#screen-leaders .top-player-card{backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px)}
@media(max-width:420px){nav{gap:0;padding-left:2px;padding-right:2px}.nav-btn{padding-left:1px;padding-right:1px}.nav-btn i{margin-bottom:1px}}

/* Premium winter mini-market */
.winter-market{margin:16px 0 14px;padding:15px;border:1px solid rgba(255,211,130,.24);border-radius:22px;background:radial-gradient(circle at 100% 0%,rgba(255,202,106,.12),transparent 35%),linear-gradient(145deg,#1b2d46,#111d31 70%);box-shadow:0 16px 35px #0004,inset 0 1px #ffffff10}
.winter-market-head{display:flex;align-items:center;justify-content:space-between;gap:8px}.market-kicker{font-size:8px;letter-spacing:1.5px;color:#8de2ff;font-weight:1000}.winter-market-head h3{font-size:17px;margin:5px 0 4px;color:#fff3d0}.winter-market-head p{font-size:10px;line-height:1.4;color:#a9bdd2;margin:0;max-width:235px}.market-wallet{flex:0 0 auto;text-align:right;padding:9px 10px;border-radius:13px;background:#0d192a;border:1px solid #ffda8b3b}.market-wallet small{display:block;color:#91a8c2;font-size:7px;font-weight:1000;letter-spacing:.8px}.market-wallet strong{display:block;color:#ffdc8b;font-size:16px;margin-top:3px;white-space:nowrap}
.market-tabs{display:flex;gap:5px;overflow-x:auto;padding:13px 0 10px;scrollbar-width:none}.market-tabs::-webkit-scrollbar{display:none}.market-tab{flex:0 0 auto;border:1px solid #ffffff18;border-radius:20px;padding:7px 11px;background:#243750;color:#aebed2;font-size:9px;font-weight:900}.market-tab.active{background:linear-gradient(110deg,#ffe5a0,#ffbd5c);border-color:#ffe6a6;color:#30233a;box-shadow:0 4px 12px #ffbf5b33}
.winter-market-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}.market-product{min-width:0;overflow:hidden;border-radius:15px;background:linear-gradient(145deg,#263b56,#17263b);border:1px solid #ffffff17;box-shadow:0 7px 17px #0003;display:flex;flex-direction:column}.market-product-art{height:110px;position:relative;display:grid;place-items:center;overflow:hidden;background:radial-gradient(circle at 50% 35%,#47708c,#1b304a 75%)}.market-product-art:after{content:"";position:absolute;inset:0;background:linear-gradient(180deg,transparent 60%,#17263b)}.market-product-art img{position:relative;z-index:1;width:86%;height:105px;object-fit:contain;filter:drop-shadow(0 6px 8px #0008)}.market-product-art>span:not(.market-rarity){font-size:49px;filter:drop-shadow(0 5px 10px #0008);z-index:1}.art-light{background:radial-gradient(circle,#477e86,#1b304a 75%)}.art-special{background:radial-gradient(circle,#765c78,#1b304a 75%)}.market-rarity{position:absolute;z-index:2;top:7px;left:7px;padding:4px 6px;border-radius:20px;background:#071322b8;color:#dcecff;font-size:7px;font-weight:1000;letter-spacing:.4px}.rarity-легендарный{color:#ffe29a;border:1px solid #ffcf5c88}.rarity-эпический{color:#e3b6ff;border:1px solid #c58aff66}.rarity-редкий{color:#a9eaff;border:1px solid #77d7ff66}.market-product-info{padding:9px;display:flex;flex-direction:column;flex:1}.market-product-info h4{font-size:10px;line-height:1.3;margin:0 0 4px;color:#fff;font-weight:1000}.market-product-info p{font-size:8px;line-height:1.4;color:#9db1c9;margin:0 0 9px;min-height:22px}.market-product-foot{display:flex;align-items:center;justify-content:space-between;gap:5px;margin-top:auto}.market-price{font-size:9px;color:#ffdc8b;white-space:nowrap}.market-buy{border:0;border-radius:8px;padding:7px 9px;background:linear-gradient(110deg,#ffe29a,#ffbc5c);color:#2b2432;font-size:8px;font-weight:1000;white-space:nowrap}.market-buy:disabled{opacity:.42;filter:grayscale(.7)}.market-buy.owned-btn{background:#284c60;color:#bceeff;border:1px solid #80dfff55}.market-product.is-owned{border-color:#8bdfff35}.market-empty{grid-column:1/-1;text-align:center;padding:25px 10px;color:#a5b8cd;font-size:11px}.market-note{padding-top:10px;text-align:center;color:#7f95ae;font-size:8px;line-height:1.5}
.tree-controls{border-color:#8bdfff27}.tree-controls-title{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}.tree-controls-title>div>span{font-size:8px;letter-spacing:1.3px;color:#83dfff;font-weight:1000}.tree-controls-title h3{margin:4px 0 0;font-size:15px}.tree-live-dot{font-size:8px;color:#7be6bd;letter-spacing:1px}.tree-live-dot:first-letter{font-size:12px}
.tree-bauble.garland{width:40px;height:18px;border-radius:10px;background:linear-gradient(90deg,#e74d69,#ffdc7b,#6ee6cb,#8b8bff);box-shadow:0 0 12px #ffdc7b77}.tree-bauble.ribbon{background:linear-gradient(135deg,#ffb1c7,#b62b5d)}.tree-bauble.bell{background:linear-gradient(135deg,#fff0a5,#b98125)}.tree-bauble.candy{background:repeating-linear-gradient(45deg,#fff 0 5px,#d94c5d 5px 10px)}
/* Consistent depth and hierarchy on the rest of the application */
.page-content{isolation:isolate}.screen.page-bg .page-title,.screen.page-bg h2{ text-wrap:balance}
.card,.raffle-card,.profile-modal .modal-content,.shop-card,.market-card,.leader-panel,.player-rank-box{box-shadow:0 12px 30px rgba(0,0,0,.2),inset 0 1px rgba(255,255,255,.035)}
button{ -webkit-tap-highlight-color:transparent}
button:focus-visible{outline:2px solid #9fe7ff;outline-offset:3px}
input,select,textarea{accent-color:#ffd47d}
#screen-tree .tree-heading h2{ text-shadow:0 4px 25px rgba(115,211,255,.2)}
#screen-leaders .leader-tabs{max-width:100%;margin-left:auto;margin-right:auto}
#screen-leaders .leader-tab{min-height:40px}
#screen-raffle .raffle-card{border:1px solid rgba(255,211,130,.22);box-shadow:0 15px 40px #0004}
#screen-shop .page-title,#screen-market .page-title{margin-bottom:16px}
@media(max-width:390px){.winter-market{padding:12px}.market-wallet{padding:8px}.market-wallet strong{font-size:14px}.market-product-art{height:96px}.market-product-art img{height:92px}.market-product-info{padding:8px}.market-buy{padding:7px}.winter-market-head h3{font-size:15px}}


/* Verified mobile recovery: the page scrolls independently from the fixed nav. */
#screen-minigames.page-bg, #screen-tree.page-bg {
  display: block;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
#screen-minigames .match-page, #screen-tree .tree-page {
  width: 100%;
  min-height: max-content;
  box-sizing: border-box;
  padding-bottom: calc(var(--nav-height, 82px) + 34px + env(safe-area-inset-bottom, 0px));
}
#screen-minigames .match-board-frame { width: 100%; min-width: 0; box-sizing: border-box; }
#screen-minigames .match-board {
  width: 100%; max-width: 100%; aspect-ratio: 1 / 1;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  grid-template-rows: repeat(10, minmax(0, 1fr));
  gap: clamp(1px, .55vw, 3px);
}
#screen-minigames .match-cell { width: 100%; height: 100%; min-width: 0; min-height: 0; aspect-ratio: auto; padding: 0; }
#screen-minigames .match-cell img { width: 100%; height: 100%; max-width: 100%; max-height: 100%; object-fit: contain; }
#screen-minigames .match-hero-art img { object-fit: contain; object-position: center bottom; }

/* Tree tiers use explicit boxes and clip-path instead of zero-width border triangles. */
#screen-tree .tree-scene { width: 100%; height: 480px; min-height: 480px; position: relative; overflow: hidden; }
#screen-tree .holiday-tree { width: 100%; max-width: 380px; height: 410px; flex: 0 0 410px; position: relative; }
#screen-tree .tree-layer {
  position: absolute; left: 50%; height: auto; border: 0 !important;
  transform: translateX(-50%);
  background: transparent url("../img/tree-tier.svg") center / 100% 100% no-repeat;
  filter: drop-shadow(0 7px 5px #0007);
}
#screen-tree .layer-one { top: 24px; width: 39%; height: 128px; z-index: 5; }
#screen-tree .layer-two { top: 84px; width: 59%; height: 151px; z-index: 4; }
#screen-tree .layer-three { top: 158px; width: 79%; height: 163px; z-index: 3; }
#screen-tree .layer-four { top: 232px; width: 98%; height: 170px; z-index: 2; }
#screen-tree .tree-branch { position: absolute; top: auto; bottom: 0; left: 0; width: 100%; height: 12px; border-radius: 50%; background: linear-gradient(180deg, #58c596, #0a543d); box-shadow: 0 4px 0 #073f32; }
#screen-tree .branch-snow { position: absolute; left: -2%; top: -5px; width: 104%; height: 8px; border-radius: 50%; background: linear-gradient(180deg, #fff, #bde9ff); box-shadow: 0 2px 5px #d8f5ff9c; }
#screen-tree .tree-trunk { z-index: 1; }
#screen-tree .tree-pot { z-index: 2; }
#screen-tree .tree-garland { z-index: 6; }
#screen-tree #tree-ornaments { z-index: 7; }
#screen-tree .tree-topper { z-index: 8; }

/* Medal is a separate row beneath the score: it can never cover the points. */
#screen-leaders .podium-card { overflow: visible; }
#screen-leaders .podium-card .tp-right {
  position: relative; z-index: 1; display: flex; flex: 0 0 auto;
  align-items: center; justify-content: center; gap: 4px;
  width: 100%; min-width: 0; min-height: 18px; margin: 8px 0 0;
  padding: 0 3px; white-space: nowrap; overflow: hidden;
}
#screen-leaders .podium-card .tp-stars-val { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
#screen-leaders .podium-card .tp-medal {
  position: static !important; display: grid !important; place-items: center;
  flex: 0 0 23px !important; width: 23px !important; height: 23px !important;
  margin: 7px auto 0 !important; border-radius: 50%; line-height: 1;
}
#screen-leaders .podium-card .tp-medal::before, #screen-leaders .podium-card .tp-medal::after { content: none !important; display: none !important; }
#screen-leaders .player-rank-box { width: 100%; box-sizing: border-box; gap: 12px; }
#screen-leaders .rank-score { min-width: 0; display: flex; align-items: center; gap: 7px; white-space: nowrap; }
#screen-leaders .rank-score #player-score { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 380px) {
  #screen-tree .tree-scene { height: 465px; min-height: 465px; }
  #screen-tree .holiday-tree { height: 398px; flex-basis: 398px; }
  #screen-tree .layer-one { top: 25px; height: 118px; }
  #screen-tree .layer-two { top: 82px; height: 143px; }
  #screen-tree .layer-three { top: 151px; height: 153px; }
  #screen-tree .layer-four { top: 220px; height: 165px; }
  #screen-leaders .podium-card .tp-medal { margin-top: 5px !important; }
}
