:root{--ink:#103f35;--deep:#0a302c;--mint:#a1dac1;--cream:#fffbea;--gold:#ffe8aa}*{box-sizing:border-box}html,body{margin:0;min-height:100%;font-family:ui-rounded,system-ui,-apple-system,"PingFang SC","Microsoft YaHei",sans-serif;color:var(--ink)}body{background:radial-gradient(circle at 20% 0,#c9f1dd 0,transparent 35%),linear-gradient(180deg,#9cd6bc 0%,#99d7b5 43%,#69a36d 43%,#498f66 100%);background-attachment:fixed}body:after{content:"";position:fixed;inset:0;pointer-events:none;opacity:.35;background-image:radial-gradient(#fff 2px,transparent 3px);background-size:91px 89px}.app{position:relative;z-index:1;width:min(100%,740px);margin:auto;padding:16px 15px 24px;min-height:100dvh}.top{display:flex;align-items:center;justify-content:space-between;gap:8px}.brand{display:flex;gap:10px;align-items:center;min-width:0}.logo{position:relative;width:44px;height:44px;border-radius:13px;border:3px solid white;background:#f36b48;color:white;box-shadow:0 4px #ad4836;transform:rotate(-5deg);font-size:24px;font-weight:950;display:grid;place-items:center;flex:none}.logo span{font-size:10px;position:absolute;right:2px;top:0}.brand h1{font-size:clamp(22px,5vw,36px);line-height:1;margin:0 0 4px;font-weight:1000;letter-spacing:-1.2px}.brand p{font-size:11px;margin:0;white-space:nowrap;opacity:.82}.controls{display:flex;gap:5px;align-items:center}.controls button,.controls select{height:38px;background:var(--cream);border:0;border-radius:12px;box-shadow:0 4px 0 #c99e5a;color:var(--ink);font-weight:800}.controls button{width:35px;font-size:19px;cursor:pointer}.controls select{max-width:91px;font-size:11px;padding:0 4px}.stats{margin-top:15px;display:grid;grid-template-columns:repeat(3,1fr);gap:7px}.stat{background:#fbf8e3eb;border:2px solid #fff9df;border-radius:14px;height:62px;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:2px;box-shadow:0 5px 12px #3f8f7820}.stat strong{font-size:19px}.stat small{font-size:11px;color:#648376}.progress{background:linear-gradient(130deg,#064d55,#052b36);color:#ddfffb;border-radius:17px;margin-top:11px;padding:14px 17px;box-shadow:0 5px 0 #03444b,0 12px 20px #24695130;border:1px solid #25bec7}.progress-head,.progress-foot{display:flex;justify-content:space-between;align-items:center;gap:9px}.progress-head{font-size:15px}.progress-head>span:first-child{color:#ffe4a2}.progress-head>span:last-child{font-size:11px;color:#a4e4de;letter-spacing:1px}.progress-track{height:9px;background:#104b53;border-radius:20px;overflow:hidden;margin:12px 0 9px;box-shadow:inset 0 2px 4px #0018}.progress-track>div{height:100%;width:0%;background:linear-gradient(90deg,#44e0d9,#f9e892);border-radius:20px;transition:width .45s}.progress-foot{font-size:11px;color:#a8cfca}.progress-foot span:last-child{color:#ffe4a2;font-weight:900}.board{position:relative;height:clamp(310px,52vh,430px);min-height:310px;margin-top:15px;border:2px solid #d4edbb77;border-radius:27px;overflow:hidden;background:radial-gradient(ellipse at 50% 30%,#91cdb3aa,#6fac91bd 70%);box-shadow:inset 0 10px 22px #225b4b2b,0 8px 25px #2e655a29}.board:after{content:"";position:absolute;inset:auto 0 0;height:25%;background:linear-gradient(170deg,#487f6a55,#1f725351);clip-path:polygon(0 15%,48% 65%,100% 0,100% 100%,0 100%);pointer-events:none}.board-shine{position:absolute;inset:0;background-image:radial-gradient(#ffffff75 2px,transparent 3px);background-size:80px 77px}.board-decoration{position:absolute;font-size:26px;color:#f9ebbf40;pointer-events:none}.d1{left:7%;bottom:14%}.d2{right:9%;top:12%}.tiles{position:absolute;inset:0;z-index:2}.tile{position:absolute;display:grid;place-items:center;user-select:none;-webkit-tap-highlight-color:transparent;background:linear-gradient(145deg,#fffce8,#fdf0c9);border:2px solid #fff8df;border-radius:12px;box-shadow:0 5px 0 #c28d55,0 8px 9px #153d3940;transition:transform .16s,filter .16s,opacity .16s;cursor:pointer;padding:0;font-family:"Apple Color Emoji","Segoe UI Emoji",sans-serif}.tile .emoji{font-size:clamp(24px,5.2vw,36px);filter:drop-shadow(0 2px 1px #0002);line-height:1}.tile.covered{filter:brightness(.6) saturate(.7);cursor:default}.tile:not(.covered):active{transform:translateY(3px) scale(.95)}.tile.hint{outline:3px solid #f5e771}.tray{margin-top:12px;padding:11px;background:linear-gradient(#194c3b,#103b2f);border-radius:20px;box-shadow:0 6px #092d26;color:white}.tray-top{display:flex;justify-content:space-between;margin:0 3px 7px;font-size:13px}.tray-slots{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:4px}.slot{height:clamp(60px,10vw,86px);border:2px dashed #597d65;border-radius:11px;background:#092f263b;display:grid;place-items:center;font-size:clamp(21px,4.6vw,32px)}.slot.filled{background:#fff6d8;border:2px solid #fff3c4;box-shadow:inset 0 -4px #d9b880}.tools{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-top:13px}.tool{border:2px solid #c6e2ce;background:#b2ceba;border-radius:15px;min-height:58px;box-shadow:0 5px 0 #688d76;cursor:pointer;color:#234a3e;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:4px}.tool.featured{background:#ffebb3;border-color:#fff3ca;box-shadow:0 5px 0 #bc8b53}.tool strong{font-size:14px}.tool small{font-size:11px}.tool:disabled{opacity:.45;cursor:not-allowed}.app footer{text-align:center;color:#d6f4dd;font-size:11px;margin-top:16px;letter-spacing:2px}.modal{position:fixed;z-index:20;inset:0;background:#07352c9c;display:none;align-items:center;justify-content:center;padding:24px;backdrop-filter:blur(5px)}.modal.visible{display:flex}.dialog{width:min(100%,350px);background:#fff9e7;border:5px solid white;border-radius:26px;text-align:center;padding:27px 23px;box-shadow:0 15px 0 #284f4480,0 30px 70px #071e1b66}.medal{font-size:60px}.dialog h2{margin:10px 0;font-size:25px}.dialog p{line-height:1.65;font-size:14px;color:#56756a;white-space:pre-line}.primary,.secondary{width:100%;border:0;border-radius:13px;padding:14px;font-size:16px;font-weight:900;cursor:pointer}.primary{background:#17c8d2;color:#04383d;box-shadow:0 5px #098995;margin-top:12px}.secondary{background:transparent;color:#638177;margin-top:13px}.toast{position:fixed;z-index:40;bottom:22%;left:50%;transform:translate(-50%,10px);background:#133f35;color:white;border-radius:50px;padding:12px 19px;font-size:13px;box-shadow:0 10px 40px #1235;opacity:0;pointer-events:none;transition:.2s;white-space:nowrap}.toast.show{opacity:1;transform:translate(-50%,0)}@media(max-width:430px){.app{padding:13px 10px 18px}.brand p{font-size:9px}.logo{width:37px;height:37px;font-size:22px}.controls{gap:4px}.controls button{width:31px;height:34px;font-size:17px}.controls select{max-width:78px;height:34px;font-size:10px}.stats{margin-top:13px}.board{height:43dvh;min-height:305px;margin-top:12px}.tray{margin-top:10px}.tile{border-radius:9px}.tools{margin-top:10px}.tool{min-height:55px}.tool strong{font-size:12px}}@media(max-height:730px) and (max-width:500px){.app{padding-top:8px}.stats{margin-top:9px}.stat{height:48px}.progress{padding:9px 13px}.progress-track{margin:7px 0}.board{height:38dvh;min-height:245px}.slot{height:50px}.tool{min-height:47px}.app footer{display:none}} 

.custom-game-logo{display:block;object-fit:cover;border-radius:14px;flex-shrink:0;width:48px;height:48px;box-shadow:0 4px 9px #0b46382b}

/* V4: the play screen and the game share an identical portrait viewport */
html,body{width:100%;height:100%;overflow:hidden}body{display:grid;place-items:center}.app{width:min(100vw,calc(100dvh * 941 / 1672));height:min(100dvh,calc(100vw * 1672 / 941));min-height:0;max-height:100dvh;padding:clamp(7px,1.2vh,13px) clamp(8px,2.5%,15px) 9px;display:flex;flex-direction:column;overflow:hidden}.top{flex:none;min-height:38px}.brand h1{font-size:clamp(18px,4.2vw,30px)}.brand p{font-size:clamp(8px,1.5vw,11px);white-space:normal;line-height:1.15;max-width:220px}.custom-game-logo{width:clamp(33px,7vw,47px);height:clamp(33px,7vw,47px)}.stats{flex:none;margin-top:clamp(6px,1.2vh,13px);gap:5px}.stat{height:clamp(43px,7vh,60px)}.stat strong{font-size:clamp(15px,3.2vw,20px)}.stat small{font-size:clamp(9px,1.6vw,11px)}.progress{flex:none;margin-top:clamp(7px,1.15vh,12px);padding:clamp(8px,1.5vh,13px) 12px}.progress-track{margin:clamp(6px,1vh,10px) 0}.board{flex:1 1 auto;min-height:80px;height:auto;margin-top:clamp(8px,1.5vh,14px);border-radius:20px}.tray{flex:none;margin-top:clamp(7px,1.2vh,12px);padding:8px}.tray-top{margin-bottom:5px}.slot{height:clamp(35px,6.5vh,75px)}.tools{flex:none;margin-top:8px;gap:5px}.tool{min-height:clamp(42px,7vh,58px)}.app footer{flex:none;margin-top:clamp(6px,1vh,12px);font-size:10px}.controls select{max-width:clamp(70px,18vw,102px)}@media(max-height:700px){.app{padding-top:5px;padding-bottom:5px}.progress{padding:6px 9px}.progress-head{font-size:12px}.progress-foot{font-size:9px}.stat{height:42px}.tools{margin-top:6px}.tray{padding:6px}.slot{height:34px}.app footer{display:none}}

/* V7 mobile layout and safe-area improvements */
body{display:flex;justify-content:center}.app{max-width:540px!important;padding-top:max(12px,env(safe-area-inset-top))!important;padding-bottom:max(14px,env(safe-area-inset-bottom))!important}.home-link{height:38px;min-width:34px;display:grid;place-items:center;text-decoration:none;color:#174b3c;background:#fffbea;border-radius:12px;box-shadow:0 4px 0 #c99e5a;font-size:24px;font-weight:bold}.board{height:clamp(275px,43dvh,410px)}.tray .slot{height:clamp(43px,7.5dvh,68px)}@media(max-width:430px){.top{flex-wrap:wrap}.brand{flex:1 1 180px}.controls{flex:1 0 auto;justify-content:flex-end}.brand h1{font-size:24px}.brand p{white-space:normal;line-height:1.2}.board{height:clamp(270px,39dvh,370px)}.tray .slot{height:clamp(39px,6.5dvh,60px)}.stats{margin-top:9px}.progress{padding:10px 13px}.progress-track{margin:8px 0}.app footer{margin-top:9px}}@media(max-height:700px) and (max-width:500px){.board{height:34dvh;min-height:210px}.stat{height:46px}.tool{min-height:46px}}
