/* Matching-game preview: full-window Bosphorus garden scene, glossy toy UI. No ads, no dim overlay. */
:root{--ink:#1f3350;--aqua:#66e1d3;--aqua-d:#1fa99a;--sun:#ffd768;--sun-d:#e0a42d;--coral:#ff7a6b;--coral-d:#c94b3d;--cream:#fffaf0;--glass:rgba(255,255,255,.82)}
*{box-sizing:border-box}
html,body{margin:0;height:100%;overflow:hidden}
body{font-family:'Nunito','Baloo 2',system-ui,-apple-system,'Segoe UI',sans-serif;color:var(--ink);background:#9fd8ee url('../../../assets/game/pilot-studio/art/memory-table.webp') center 38%/cover no-repeat;-webkit-tap-highlight-color:transparent}
.sr-only{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
.mg-noscript{position:fixed;top:40%;left:50%;transform:translateX(-50%);background:var(--cream);padding:16px 20px;border-radius:16px;font-weight:800}
[hidden]{display:none!important}
button{font:inherit;color:inherit}
:focus-visible{outline:4px solid #fff;outline-offset:3px;box-shadow:0 0 0 7px #2f6fd8}

.mg{position:fixed;inset:0;display:flex;flex-direction:column;padding:max(10px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) max(10px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));gap:10px;overflow:hidden}

/* ---------- top bar ---------- */
.mg-top{display:flex;flex-wrap:wrap;align-items:center;gap:8px 10px;flex:none;position:relative;z-index:3}
.mg-brand{order:0;font-weight:900;font-size:20px;line-height:1;letter-spacing:-.5px;color:#fff;text-decoration:none;padding:9px 13px 8px;border-radius:15px;background:linear-gradient(180deg,#7ff0e2,#2fc3b2);box-shadow:inset 0 2px 0 #ffffffa0,inset 0 -3px 0 #0000001a,0 4px 0 var(--aqua-d),0 8px 16px #0d4c4c40;text-shadow:0 2px 0 #1a8f83}
.mg-brand span{display:block;font-size:8px;letter-spacing:3.4px;margin-top:3px}
.mg-actions{order:1;margin-left:auto;display:flex;gap:8px}
.mg-icon{width:48px;height:48px;border:0;border-radius:15px;display:grid;place-items:center;cursor:pointer;background:linear-gradient(180deg,#fff,#e9f4ff);box-shadow:inset 0 2px 0 #fff,inset 0 -3px 0 #0000000f,0 4px 0 #9fb8d6,0 8px 16px #1a3a5c33;color:#2a4f7a;touch-action:manipulation}
.mg-icon svg{width:24px;height:24px;fill:currentColor}
.mg-icon:active{transform:translateY(3px);box-shadow:inset 0 2px 0 #fff,0 1px 0 #9fb8d6}
.mg-hud{order:2;flex:1 0 100%;display:flex;gap:6px;justify-content:center}
.mg-chip{flex:1 1 0;max-width:132px;min-width:0;display:flex;flex-direction:column;align-items:center;padding:5px 6px 6px;border-radius:14px;background:var(--glass);backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);box-shadow:inset 0 2px 0 #fff,0 3px 0 #b9cde2,0 6px 14px #1a3a5c26;position:relative}
.mg-chip small{font-size:9px;font-weight:900;letter-spacing:1.2px;color:#5b6f8c}
.mg-chip strong{font-size:20px;font-weight:900;line-height:1.1;font-variant-numeric:tabular-nums}
.mg-bar{position:absolute;left:10px;right:10px;bottom:4px;height:4px;border-radius:4px;background:#d8e6f3;overflow:hidden}
.mg-bar i{display:block;height:100%;width:0;background:linear-gradient(90deg,var(--aqua),#3dd17a);border-radius:4px;transition:width .35s}
.mg-chip-combo.is-hot{background:linear-gradient(180deg,#fff5c8,#ffd768);box-shadow:inset 0 2px 0 #fff,0 3px 0 var(--sun-d),0 6px 16px #e0a42d66;animation:mg-pulse .5s}
@media(min-width:700px){.mg-hud{order:1;flex:1 1 auto;justify-content:center}.mg-actions{order:2;margin-left:0}.mg-chip{max-width:120px;padding:6px 10px 8px}.mg-chip strong{font-size:22px}}

/* ---------- glossy toy buttons ---------- */
.mg-btn{border:0;cursor:pointer;touch-action:manipulation;font-weight:900;border-radius:18px;min-height:48px;padding:12px 20px;display:inline-flex;align-items:center;justify-content:center;gap:8px;transition:transform .08s,box-shadow .08s}
.mg-btn svg{width:20px;height:20px;fill:currentColor;flex:none}
.mg-primary{font-size:18px;color:#3b2a06;background:linear-gradient(180deg,#fff0a8 0%,#ffd768 45%,#ffc23d 100%);box-shadow:inset 0 3px 0 #fffbe0,inset 0 -4px 0 #00000014,0 6px 0 var(--sun-d),0 12px 22px #b5791f55;text-shadow:0 1px 0 #fff6}
.mg-secondary{font-size:15px;color:var(--ink);background:linear-gradient(180deg,#fff,#eaf3ff);box-shadow:inset 0 2px 0 #fff,inset 0 -3px 0 #0000000d,0 5px 0 #a9bfdc,0 10px 18px #1a3a5c2e}
.mg-btn:active{transform:translateY(4px)}
.mg-primary:active{box-shadow:inset 0 3px 0 #fffbe0,0 2px 0 var(--sun-d)}
.mg-secondary:active{box-shadow:inset 0 2px 0 #fff,0 1px 0 #a9bfdc}

/* ---------- title ---------- */
.mg-title{flex:1;min-height:0;display:flex;align-items:center;justify-content:center}
.mg-title-card{width:min(940px,100%);max-height:100%;overflow:auto;overscroll-behavior:contain;display:grid;gap:14px;padding:18px;border-radius:30px;background:linear-gradient(180deg,rgba(255,255,255,.9),rgba(255,250,236,.86));backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);box-shadow:inset 0 3px 0 #fff,0 8px 0 #e9c98f,0 22px 50px #3a2a0d40;border:3px solid #fff}
.mg-hero{text-align:center;display:flex;flex-direction:column;align-items:center}
.mg-hero-cards{position:relative;width:170px;height:96px;margin:2px auto 4px}
.mg-hero-cards img{position:absolute;width:82px;height:82px;top:6px;border-radius:18px;filter:drop-shadow(0 8px 10px #3a2a0d40)}
.mg-hero-cards .c1{left:44px;transform:rotate(-4deg);z-index:2;animation:mg-bob 3s ease-in-out infinite}
.mg-hero-cards .c2,.mg-hero-cards .c3{width:66px;height:66px;top:18px;padding:8px;background:radial-gradient(circle at 35% 25%,#fff,#fff4d6 70%);border:3px solid var(--sun)}
.mg-hero-cards .c2{left:0;transform:rotate(-14deg);animation:mg-bob 3s ease-in-out -1s infinite}
.mg-hero-cards .c3{right:0;transform:rotate(14deg);animation:mg-bob 3s ease-in-out -2s infinite}
.mg-eyebrow{margin:0;font-size:11px;font-weight:900;letter-spacing:2px;text-transform:uppercase;color:#d0782c}
.mg-logo{margin:2px 0 4px;font-size:clamp(34px,7vw,60px);line-height:1;font-weight:900;letter-spacing:-1.5px;color:#fff;-webkit-text-stroke:2px #2a7fc9;paint-order:stroke fill;text-shadow:0 4px 0 #2a7fc9,0 9px 14px #1a3a5c55;background:none}
.mg-lead{margin:4px auto 0;max-width:420px;font-size:15px;line-height:1.45;font-weight:700;color:#41557a}
.mg-choices{display:grid;gap:12px;align-content:center}
.mg-group-label{margin:0 0 6px 4px;font-size:12px;font-weight:900;letter-spacing:1.4px;text-transform:uppercase;color:#5b6f8c}
.mg-levels{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
.mg-level{flex-direction:column;gap:1px;padding:8px 4px 9px;min-height:84px;font-size:13px;color:var(--ink);background:linear-gradient(180deg,#fff,#eef5ff);box-shadow:inset 0 2px 0 #fff,0 4px 0 #b3c7e0,0 8px 14px #1a3a5c22;border-radius:16px}
.mg-level b{font-size:24px;line-height:1;color:#2a7fc9}
.mg-level small{font-size:11px;color:#5b6f8c;font-weight:800}
.mg-level[aria-pressed=true]{background:linear-gradient(180deg,#bff8ef,#66e1d3);box-shadow:inset 0 2px 0 #e9fffb,0 4px 0 var(--aqua-d),0 8px 16px #1fa99a55}
.mg-level[aria-pressed=true] b{color:#0d6157}
.mg-stars{display:flex;gap:1px;height:14px;font-size:12px;line-height:14px}
.mg-stars i{font-style:normal;color:#c7d3e2}
.mg-stars i.on{color:#ffb800;text-shadow:0 1px 0 #b47a00}
.mg-themes{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.mg-theme{justify-content:flex-start;gap:6px;padding:6px 8px;min-height:48px;font-size:13px;color:var(--ink);background:linear-gradient(180deg,#fff,#fff5e2);box-shadow:inset 0 2px 0 #fff,0 4px 0 #e2c58f,0 8px 14px #3a2a0d1f;border-radius:14px;overflow:hidden}
.mg-theme img{width:32px;height:32px;flex:none}
.mg-theme span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mg-theme[aria-pressed=true]{background:linear-gradient(180deg,#fff2b5,#ffd768);box-shadow:inset 0 2px 0 #fffbe0,0 4px 0 var(--sun-d),0 8px 16px #e0a42d55}
.mg-play{width:100%;min-height:58px;font-size:22px;margin-top:4px}
.mg-play svg{width:24px;height:24px}
@media(min-width:760px) and (min-height:520px){.mg-title-card{grid-template-columns:1fr 1.15fr;align-items:center;padding:28px 30px;gap:26px}.mg-hero-cards{width:230px;height:140px}.mg-hero-cards img{width:116px;height:116px}.mg-hero-cards .c1{left:57px}.mg-hero-cards .c2,.mg-hero-cards .c3{width:92px;height:92px;top:28px;padding:12px}.mg-lead{font-size:17px}}
@media(max-height:560px) and (min-width:560px){.mg-title-card{grid-template-columns:.9fr 1.3fr;align-items:center;gap:16px;padding:12px 16px}.mg-hero-cards{width:140px;height:74px}.mg-hero-cards img{width:64px;height:64px;top:4px}.mg-hero-cards .c1{left:38px}.mg-hero-cards .c2,.mg-hero-cards .c3{width:52px;height:52px;top:14px;padding:6px}.mg-logo{font-size:36px}.mg-lead{font-size:13px}.mg-choices{gap:7px}.mg-level{min-height:64px;padding:5px 3px 6px}.mg-level b{font-size:19px}.mg-theme{min-height:44px;padding:4px 7px}.mg-theme img{width:26px;height:26px}.mg-play{min-height:50px;font-size:19px}}
@media(max-width:480px){.mg-theme{flex-direction:column;gap:2px;padding:6px 4px 7px;min-height:62px}.mg-theme span{max-width:100%}}
@media(max-width:380px){.mg-title-card{padding:14px 12px;gap:10px}.mg-level{min-height:76px;font-size:12px}.mg-level small{font-size:10px}.mg-theme{font-size:12px}.mg-theme img{width:26px;height:26px}.mg-lead{font-size:14px}}

/* ---------- board ---------- */
.mg-stage{flex:1;min-height:0;display:flex;align-items:center;justify-content:center;position:relative}
.mg-board{display:grid;gap:var(--gap,10px);padding:var(--pad,16px);border-radius:28px;background:#efe3c8 url('../../../assets/game/pilot-studio/art/garden-board.webp') center/cover;box-shadow:inset 0 0 0 4px #ffffffb0,inset 0 0 30px #5a7a2a40,0 8px 0 #b89a62,0 22px 44px #2a1f0a4d}
.mg-card{width:var(--cw,80px);height:var(--cw,80px);padding:0;border:0;background:none;cursor:pointer;perspective:700px;border-radius:18%;touch-action:manipulation;transition:transform .15s}
.mg-card-inner{position:relative;display:block;width:100%;height:100%;transform-style:preserve-3d;transition:transform .42s cubic-bezier(.3,1.35,.5,1)}
.mg-card-back,.mg-card-face{position:absolute;inset:0;display:grid;place-items:center;backface-visibility:hidden;-webkit-backface-visibility:hidden;border-radius:18%}
.mg-card-back img{width:108%;height:108%;margin:-4%;filter:drop-shadow(0 5px 4px #3a2a0d55);pointer-events:none}
.mg-card-face{transform:rotateY(180deg);background:radial-gradient(circle at 32% 22%,#fff 0,#fffaf0 45%,#ffe9b8 100%);border:max(3px,calc(var(--cw,80px)*.05)) solid var(--sun);box-shadow:inset 0 3px 0 #fff,inset 0 -5px 0 #f3cf7f,0 5px 0 var(--sun-d),0 8px 12px #3a2a0d40}
.mg-card-face img{width:74%;height:74%;object-fit:contain;filter:drop-shadow(0 3px 2px #3a2a0d33);pointer-events:none}
.mg-card.is-up .mg-card-inner,.mg-card.is-matched .mg-card-inner{transform:rotateY(180deg)}
.mg-card.is-matched{cursor:default}
.mg-card.is-matched .mg-card-face{border-color:var(--aqua);box-shadow:inset 0 3px 0 #fff,inset 0 -5px 0 #a8efe5,0 5px 0 var(--aqua-d),0 0 0 4px #ffffff99,0 0 22px #66e1d3cc;animation:mg-pop .5s cubic-bezier(.3,1.6,.5,1)}
.mg-card.is-matched .mg-card-face::after{content:'✓';position:absolute;right:-6%;top:-6%;width:30%;height:30%;min-width:18px;min-height:18px;border-radius:50%;display:grid;place-items:center;font-size:max(11px,calc(var(--cw,80px)*.16));font-weight:900;color:#fff;background:linear-gradient(180deg,#5fe39b,#21b06a);box-shadow:0 2px 0 #148a50}
.mg-card.is-miss .mg-card-face{border-color:var(--coral);box-shadow:inset 0 3px 0 #fff,inset 0 -5px 0 #ffc7bf,0 5px 0 var(--coral-d),0 0 18px #ff7a6b99}
.mg-card.is-miss{animation:mg-shake .4s .25s}
@media(hover:hover){.mg-card:not(.is-matched):not(.is-up):hover{transform:translateY(-4px) rotate(-1deg)}}
.mg-card:active:not(.is-matched){transform:scale(.95)}
.mg-card:focus-visible{outline-offset:2px}

/* ---------- panels (no backdrop dimming) ---------- */
.mg-panel-wrap{position:absolute;inset:0;z-index:5;display:flex;align-items:center;justify-content:center;padding:16px;pointer-events:none}
.mg-panel{pointer-events:auto;width:min(480px,100%);max-height:100%;overflow:auto;text-align:center;padding:22px 20px 20px;border-radius:30px;border:3px solid #fff;background:linear-gradient(180deg,#fff,#fff8e6);isolation:isolate;transform:translateZ(200px);box-shadow:inset 0 3px 0 #fff,0 8px 0 #e9c98f,0 26px 60px #3a2a0d55;animation:mg-in .35s cubic-bezier(.3,1.4,.5,1)}
.mg-panel h2{margin:4px 0 6px;font-size:clamp(28px,6vw,40px);line-height:1.05;font-weight:900;color:#fff;-webkit-text-stroke:2px #2a7fc9;paint-order:stroke fill;text-shadow:0 3px 0 #2a7fc9}
.mg-panel p{margin:0 0 12px;font-weight:700;color:#41557a}
.mg-row{display:flex;flex-wrap:wrap;gap:10px;justify-content:center;margin-top:8px}
.mg-row .mg-primary{flex:1 1 100%}
.mg-row .mg-secondary{flex:1 1 140px;white-space:nowrap}
.mg-result-stars{display:flex;justify-content:center;gap:6px;font-size:52px;line-height:1}
.mg-result-stars i{font-style:normal;color:#dbe4ee;text-shadow:0 3px 0 #b8c6d6;animation:mg-star .5s cubic-bezier(.3,1.7,.5,1) both;animation-delay:var(--d)}
.mg-result-stars i.on{color:#ffc21a;text-shadow:0 3px 0 #c98a00,0 0 18px #ffd76899}
.mg-result-stars i:nth-child(2){font-size:64px;margin-top:-10px}
.mg-badge{display:inline-block;padding:5px 14px;border-radius:20px;color:#fff!important;background:linear-gradient(180deg,#ff9a8c,#ff6a5a);box-shadow:0 3px 0 var(--coral-d);font-weight:900!important}
.mg-stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;margin:8px 0 6px}
.mg-stats div{padding:7px 3px;border-radius:14px;background:#fff;box-shadow:inset 0 -3px 0 #e6eef7,0 2px 0 #d4e0ee}
.mg-stats dt{font-size:10px;font-weight:900;letter-spacing:.6px;text-transform:uppercase;color:#5b6f8c}
.mg-stats dd{margin:2px 0 0;font-size:18px;font-weight:900;font-variant-numeric:tabular-nums}
@media(max-height:500px){.mg-panel{padding:12px 16px;width:min(560px,100%)}.mg-result-stars{font-size:34px}.mg-result-stars i:nth-child(2){font-size:42px;margin-top:-6px}.mg-panel h2{font-size:26px;margin:2px 0}.mg-panel p{margin-bottom:6px}.mg-stats{margin:4px 0}.mg-stats dd{font-size:15px}.mg-row{margin-top:4px;gap:8px}.mg-row .mg-primary{flex:1 1 160px}.mg-btn{min-height:44px;padding:8px 14px}}
@media(max-width:360px){.mg-stats{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* ---------- feedback ---------- */
.mg-fx{position:absolute;inset:0;pointer-events:none;z-index:4;overflow:hidden}
.mg-spark{position:absolute;width:10px;height:10px;margin:-5px 0 0 -5px;border-radius:50%;background:radial-gradient(circle,#fff,#ffd768 60%,transparent 70%);animation:mg-spark .7s ease-out forwards}
.mg-toast{position:absolute;transform:translate(-50%,-100%);white-space:nowrap;font-size:22px;font-weight:900;color:#fff;-webkit-text-stroke:1.5px #1fa99a;paint-order:stroke fill;text-shadow:0 3px 0 #1fa99a,0 6px 12px #0d4c4c55;animation:mg-toast 1s ease-out forwards}
.mg-toast.is-combo{font-size:30px;-webkit-text-stroke-color:#d0782c;text-shadow:0 3px 0 #d0782c,0 0 18px #ffd768}
.mg-confetti{position:absolute;top:-16px;width:10px;height:16px;border-radius:3px;animation:mg-fall 2.4s cubic-bezier(.3,.6,.6,1) forwards}

@keyframes mg-bob{0%,100%{translate:0 0}50%{translate:0 -6px}}
@keyframes mg-pop{0%{scale:1}40%{scale:1.12}100%{scale:1}}
@keyframes mg-shake{0%,100%{translate:0}20%{translate:-6px}40%{translate:6px}60%{translate:-4px}80%{translate:3px}}
@keyframes mg-pulse{0%{scale:1}40%{scale:1.12}100%{scale:1}}
@keyframes mg-spark{to{transform:rotate(var(--a)) translateY(-46px) scale(.3);opacity:0}}
@keyframes mg-toast{0%{opacity:0;translate:0 10px;scale:.6}20%{opacity:1;translate:0 0;scale:1.08}70%{opacity:1}100%{opacity:0;translate:0 -26px;scale:1}}
@keyframes mg-fall{0%{transform:translateY(0) rotate(0)}100%{transform:translateY(105vh) rotate(var(--r));opacity:.8}}
@keyframes mg-in{from{opacity:0;scale:.85}to{opacity:1;scale:1}}
@keyframes mg-star{from{opacity:0;scale:.2;rotate:-30deg}to{opacity:1;scale:1;rotate:0}}

@media(max-height:500px){.mg{gap:6px;padding-top:max(6px,env(safe-area-inset-top));padding-bottom:max(6px,env(safe-area-inset-bottom))}.mg-brand{font-size:16px;padding:7px 10px 6px}.mg-icon{width:44px;height:44px}.mg-chip{padding:3px 8px 6px}.mg-chip strong{font-size:18px}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}
