html,body{height:100%;margin:0;overflow:hidden;background:#f5eddb;color:#315747;font-family:KaiTi-CJK,'LXGW WenKai Lite',serif}*{box-sizing:border-box}button,a{font:inherit}.game-shell{height:100dvh;display:grid;grid-template-rows:auto minmax(0,1fr) auto;gap:8px;padding:10px clamp(8px,2vw,24px)}.game-header{display:flex;justify-content:space-between;align-items:center;gap:12px;background:#fff9e9;border:1px solid #decfa9;border-radius:14px;padding:8px 16px}.game-header strong{font-size:clamp(20px,2.4vw,30px)}.back{color:#2e7055;text-decoration:none}.game-main{display:grid;grid-template-columns:minmax(145px,22%) minmax(0,1fr);gap:10px;min-height:0}.picture-panel{background:#fffaf0;border:1px solid #dfd4b6;border-radius:18px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:12px;text-align:center}.picture-panel span{font-size:clamp(18px,2vw,26px);font-weight:bold}.picture-panel img{display:block;width:min(100%,230px);max-height:48vh;object-fit:contain;aspect-ratio:1}.picture-panel small{font-size:clamp(12px,1.4vw,17px)}.picture-panel b{font-size:18px;color:#a36d29}.maze-play-area{padding:24px 10px;min-height:0}.maze-cell{font-family:KaiTi-CJK,'LXGW WenKai Lite',serif}footer{text-align:center;min-height:28px}footer p{margin:0;font-size:17px}footer button,.finish-card button{background:#286d55;color:white;border:0;border-radius:10px;padding:9px 18px;cursor:pointer}.finish-overlay{position:fixed;inset:0;background:#263b33a8;display:grid;place-items:center;z-index:100}.finish-card{background:#fff8e9;border:4px solid #dcb75f;border-radius:24px;padding:32px 45px;text-align:center;box-shadow:0 20px 60px #0003}.finish-card h1{font-size:42px;margin:8px}.finish-star{font-size:62px}.finish-card a{display:block;margin-top:18px;color:#286d55}[hidden]{display:none!important}@media(max-width:700px){.game-shell{gap:5px;padding:5px}.game-header{padding:5px 9px;font-size:12px}.game-main{grid-template-columns:minmax(100px,25%) minmax(0,1fr);gap:5px}.picture-panel{padding:5px;gap:5px;border-radius:10px}.picture-panel span{font-size:15px}.picture-panel img{max-height:36vh}.picture-panel small{font-size:11px}.picture-panel b{font-size:13px}.maze-play-area{padding:22px 3px}footer p{font-size:13px}}@media(max-width:500px) and (orientation:portrait){.game-main{grid-template-columns:minmax(0,1fr);grid-template-rows:115px minmax(0,1fr)}.picture-panel{flex-direction:row;justify-content:center}.picture-panel img{width:95px;max-height:100px}.picture-panel small{display:none}.maze-play-area{padding:22px 4px}}
/* Portrait: fill available width even when the tall maze limits cell height. */
.maze-grid{grid-auto-rows:var(--cell-h,var(--cell,60px))}
.maze-cell{width:var(--cell-w,var(--cell,60px));height:var(--cell-h,var(--cell,60px));display:flex;align-items:center;justify-content:center;padding:0;text-align:center;font-size:calc(min(var(--cell-h,60px),var(--cell-w,60px)) * .64);line-height:1;}
.maze-cell .maze-tag{font-size:12px;line-height:1;}
@media(max-width:700px) and (orientation:portrait){
 .maze-play-area{padding:20px 5px;}
 .maze-grid{margin:auto;}
 .maze-cell{border-radius:6px;letter-spacing:0;text-indent:0;}
 .maze-cell:not(.start):not(.finish){padding:0;}
}
