/* These two controls are icons at every size. Keep 44px touch targets. */
.orders[data-mode="queue"] .order-shop{flex-basis:48px}
.counter-mode button,.orders .order-shop .shop-entry{display:grid;place-items:center;width:44px;min-width:44px;height:44px;min-height:44px;padding:4px;border-radius:14px;transform:none}
.counter-mode button{margin:auto}
.counter-mode button svg,.orders .order-shop .shop-entry>svg{display:block;width:32px;height:32px;filter:none;pointer-events:none}
.counter-mode button:hover,.orders .order-shop .shop-entry:hover{background:#fff8de;border-color:#809b66}
.board-click-hint{display:none}

@media(hover:hover) and (pointer:fine){
 .cell.selected::before{inset:2px;border:3px solid #658f62;border-radius:20%;background:#c7e0ba33;box-shadow:inset 0 0 0 1px #fffbe7;z-index:3}
 .cell.match{background:linear-gradient(#f8f2d3,#d9e5b9);box-shadow:inset 0 0 0 2px #a8ba72}
 .cell.match::before{content:'+';position:absolute;right:4px;top:4px;width:17px;height:17px;border-radius:50%;background:#739658;color:#fffbea;font:700 15px/17px sans-serif;z-index:5}
 
 .cell:not(.empty):hover{cursor:pointer}
}

/* Both screens use the wide layout at the same breakpoint. No hover gate:
   touch laptops and large tablets have room for the same desktop panels. */
@media(min-width:900px){
 body:has(.game-shell[data-screen="home"]){display:flow-root;padding:0;min-height:0;height:var(--app-height);overflow:hidden}
 .game-shell[data-screen="home"],.display-app .game-shell[data-screen="home"]{width:calc(100% - 40px);max-width:1320px;height:calc(var(--app-height) - 32px);min-height:0;margin:16px auto;padding:12px 18px 16px;border:1px solid #c4ab80;border-radius:24px;display:flex;flex-direction:column;gap:8px;background:linear-gradient(120deg,#dbe4c4f5,#aaba8ff5);box-shadow:0 12px 45px #30432c55,inset 0 0 0 3px #edd9ae88}
 .game-shell[data-screen="home"] .hud{grid-area:auto;flex:0 0 64px;width:100%;height:64px;padding:3px 7px;gap:16px;background:none}
 .game-shell[data-screen="home"] .level-badge{width:56px;height:56px}
 .game-shell[data-screen="home"] .level-badge strong{font-size:25px}
 .game-shell[data-screen="home"] .resource{flex:0 1 260px;height:40px;margin-right:auto}
 .game-shell[data-screen="home"] .resource strong{font-size:23px}
 .game-shell[data-screen="home"] .round-button{width:44px;height:44px}
 .game-shell[data-screen="home"] #home-screen{display:grid;grid-template-columns:minmax(0,1fr) 360px;grid-template-rows:minmax(0,1fr) 76px;gap:16px 20px;padding:0;flex:1;min-width:0;min-height:0}
 .game-shell[data-screen="home"] .home-living{grid-column:1;grid-row:1/3;min-width:0;min-height:0;gap:12px}
 .game-shell[data-screen="home"] .home-heading{height:40px;min-height:40px;padding:0 4px}
 .game-shell[data-screen="home"] .home-heading h1{font-size:27px;line-height:36px;color:#52663e;text-shadow:none}
 .game-shell[data-screen="home"] .home-room{min-height:100px;border-radius:24px}
 .game-shell[data-screen="home"] .home-room-badge{font-size:12px;line-height:18px;padding:6px 12px;color:#685131}
 .game-shell[data-screen="home"] .home-memory{width:76px;height:82px}
 .game-shell[data-screen="home"] .home-goal{min-height:64px;padding:9px 16px;gap:14px;border-radius:17px}
 .game-shell[data-screen="home"] .home-goal small{font-size:12px;line-height:18px;color:#76603d}
 .game-shell[data-screen="home"] .home-goal strong{font-size:17px;line-height:23px;color:#59432c}
 .game-shell[data-screen="home"] .home-goal b{font-size:14px;color:#705735}
 .game-shell[data-screen="home"] .home-shortcuts{height:78px;gap:8px}
 .game-shell[data-screen="home"] .home-shortcuts button{gap:4px;border-radius:16px;color:#485f34}
 .game-shell[data-screen="home"] .home-shortcuts button>span{width:38px;height:36px}
 .game-shell[data-screen="home"] .home-shortcuts small{font-size:13px;line-height:17px}
 .game-shell[data-screen="home"] .home-studio{grid-column:2;grid-row:1;display:flex;flex-direction:column;min-height:0;min-width:0;padding:14px;border-radius:22px}
 .game-shell[data-screen="home"] .home-studio-heading{display:flex;flex-direction:column;align-items:stretch;gap:12px;height:auto;flex-shrink:0;margin:0 0 12px}
 .game-shell[data-screen="home"] .home-studio h2{font-family:var(--font-name);font-size:21px;line-height:28px;font-weight:400;color:#604b30;margin:0 2px}
 .game-shell[data-screen="home"] .home-categories{display:grid;grid-template-columns:repeat(5,auto);gap:6px}
 .game-shell[data-screen="home"] .home-categories button{min-height:44px;padding:4px;font-size:12px;color:#6b5236}
 .game-shell[data-screen="home"] .home-categories button[aria-pressed="true"]{color:#fffdf0;background:#748b53}
 .game-shell[data-screen="home"] .home-collection{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:minmax(165px,auto);gap:10px;flex:1;min-height:0;overflow-x:hidden;overflow-y:auto;align-content:start;align-items:stretch;scroll-snap-type:none;padding:2px 3px 5px;touch-action:pan-y;overscroll-behavior:contain}
 .game-shell[data-screen="home"] .home-decor-card{min-width:0;min-height:165px;padding:9px;gap:8px;border-radius:16px}
 .game-shell[data-screen="home"] .collection-card{min-height:172px;gap:4px;padding:8px}
 .game-shell[data-screen="home"] .home-collection:has(>.collection-summary){grid-auto-rows:auto}
 .game-shell[data-screen="home"] .home-collection{height:auto;max-height:none;align-items:stretch}
 .game-shell[data-screen="home"] .home-collection>.home-decor-card,.game-shell[data-screen="home"] .home-collection>.home-memory-empty{height:auto;max-height:none}
 .game-shell[data-screen="home"] .home-collection>.treasure-summary{height:max-content;min-height:109px;max-height:none}
 .game-shell[data-screen="home"] .collection-summary{grid-column:1/-1;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));justify-content:start;align-content:start;gap:6px}
 .game-shell[data-screen="home"] .collection-summary>strong,.game-shell[data-screen="home"] .collection-summary>small,.game-shell[data-screen="home"] .collection-summary .collection-order-progress{grid-column:1/-1}
 .game-shell[data-screen="home"] .collection-set-card{grid-column:1/-1;min-height:176px;gap:6px;padding:8px}
 .game-shell[data-screen="home"] .collection-overview{grid-column:1/-1;min-height:172px;gap:8px;padding:12px}
 .game-shell[data-screen="home"] .keepsake-card{min-height:172px;gap:4px;padding:8px}
 .game-shell[data-screen="home"] .home-decor-art{width:92px;height:78px;margin:0 0 8px}
 .game-shell[data-screen="home"] .home-decor-preview strong,.game-shell[data-screen="home"] .home-photo-card>strong{font-size:12px;line-height:18px;white-space:normal;color:#5d472e}
 .game-shell[data-screen="home"] .home-decor-apply{min-height:44px;font-size:12px;line-height:17px;color:#674b29}
 .game-shell[data-screen="home"] .home-decor-apply:disabled{opacity:1;color:#7a6e53;background:#e9dfc9}
 .game-shell[data-screen="home"] .home-theme-swatch{width:76px;height:63px}
 .game-shell[data-screen="home"] .home-photo-art{width:80px;height:85px}
 .game-shell[data-screen="home"] .home-memory-empty{grid-column:1/-1;min-width:0;display:flex;flex-direction:column;align-items:flex-start;padding:10px;gap:12px}
 .game-shell[data-screen="home"] .home-memory-empty strong{font-size:16px;color:#604b30}
 .game-shell[data-screen="home"] .home-memory-empty small{font-size:13px;line-height:1.7;color:#6e5a3d}
 .game-shell[data-screen="home"] .home-memory-empty button{width:100%;font-size:13px;color:#4f6438}
 .game-shell[data-screen="home"] .home-play{grid-column:2;grid-row:2;height:76px;min-height:0;margin:0;border-radius:20px;background:linear-gradient(#91a86c,#6c884d)}
 .game-shell[data-screen="home"] .home-play strong{font-size:24px;line-height:30px}
 .game-shell[data-screen="home"] .home-preview-tag{font-size:13px;color:#70512d}
}
@media(min-width:900px) and (max-width:1099px){
 .game-shell[data-screen="home"] #home-screen{grid-template-columns:minmax(0,1fr) 320px;gap:12px}
 .game-shell[data-screen="home"] .home-studio{padding:10px}
}
@media(min-width:900px) and (max-height:650px){
 .game-shell[data-screen="home"],.display-app .game-shell[data-screen="home"]{padding:8px 12px 12px;gap:4px}
 .game-shell[data-screen="home"] .hud{flex-basis:52px;height:52px}
 .game-shell[data-screen="home"] .level-badge{height:44px;width:44px}
 .game-shell[data-screen="home"] .home-living{gap:7px}
 .game-shell[data-screen="home"] .home-heading{height:30px;min-height:30px}.game-shell[data-screen="home"] .home-heading h1{font-size:23px;line-height:29px}
 .game-shell[data-screen="home"] .home-goal{min-height:50px;padding:5px 12px}.game-shell[data-screen="home"] .home-shortcuts{height:64px}
 .game-shell[data-screen="home"] #home-screen{grid-template-rows:minmax(0,1fr) 62px;row-gap:10px}
 .game-shell[data-screen="home"] .home-play{height:62px}.game-shell[data-screen="home"] .home-play strong{font-size:21px}
}

/* A desktop cafe has a scrollable order rail and a full-height merge tray. */
@media(min-width:900px){
 body:has(.game-shell[data-screen="merge"]){display:flow-root;padding:0;height:var(--app-height);min-height:0;overflow:hidden}
 .game-shell[data-screen="merge"],.display-app .game-shell[data-screen="merge"]{width:calc(100% - 32px);max-width:min(1320px,calc(78dvh + 286px));height:calc(var(--app-height) - 32px);min-height:0;margin:16px auto;padding:12px;display:grid;grid-template-columns:300px minmax(0,1fr);grid-template-rows:62px minmax(0,1fr) 82px;grid-template-areas:"hud game" "cafe game" "dock game";gap:12px 20px;border:1px solid #cbb185;border-radius:24px;background:linear-gradient(115deg,#93a978f5,#708952f5);box-shadow:0 12px 45px #30432c55,inset 0 0 0 3px #d7bd9233}
 .game-shell[data-screen="merge"] .hud{grid-area:hud;height:62px;padding:0 4px;gap:12px;background:none}
 .game-shell[data-screen="merge"] .level-badge{width:52px;height:52px}
 .game-shell[data-screen="merge"] .resource{height:35px}
 .game-shell[data-screen="merge"] .resource strong{font-size:18px}
 .game-shell[data-screen="merge"] .round-button{width:32px;height:32px}
 .game-shell[data-screen="merge"] .cafe-stage{grid-area:cafe;height:100%;min-height:0;margin:0;border:1px solid #c6b78c;border-radius:18px;overflow:hidden;background:linear-gradient(#f6eddaeb,#efe1c8ed),url('./cafe-illustration-v1-v109.webp') center/cover}
 .game-shell[data-screen="merge"] .counter{display:none}
 .game-shell[data-screen="merge"] .orders[data-mode="queue"]{position:absolute;inset:0;gap:0;display:flex;flex-direction:column;align-items:stretch;--guest-size:106px;--order-card-h:72px;--counter-gap:10px}
 .game-shell[data-screen="merge"] .orders[data-mode="queue"] .order-shop{position:relative;inset:auto;order:-1;width:100%;height:62px;min-height:62px;flex:0 0 62px;padding:9px 12px;display:flex;flex-direction:row;align-items:center;justify-content:flex-end;gap:8px;border-bottom:1px solid #d6c29b;background:#f9f2df}
 .game-shell[data-screen="merge"] .order-shop::before{content:'주문';margin-right:auto;color:#786747;font:20px CafeName,sans-serif}
 .game-shell[data-screen="merge"] .order-shop .counter-mode{position:static;inset:auto;width:44px;height:44px;min-height:44px}
 .game-shell[data-screen="merge"] .orders .order-shop .shop-entry{display:grid;margin:0;max-width:none}
 .game-shell[data-screen="merge"] .orders[data-mode="queue"] .order-queue{width:100%;height:auto;min-height:0;flex:1;display:flex;flex-direction:column;justify-content:flex-start;align-items:stretch;padding:10px;gap:10px;overflow-x:hidden;overflow-y:auto;scroll-snap-type:y proximity;scrollbar-width:thin;scrollbar-color:#9aaa76 #e9dfc4;touch-action:pan-y;overscroll-behavior:contain;scroll-padding:10px}
 .game-shell[data-screen="merge"] .orders[data-mode="queue"] .order-queue .order{width:100%;height:148px;min-height:148px;min-width:0;flex:0 0 148px;display:flex;flex-direction:row;align-items:flex-end;justify-content:flex-end;padding:10px 8px;border:1px solid #d6bd96;border-radius:16px;background:linear-gradient(130deg,#fffaf0,#f0e2c6);box-shadow:0 3px 0 #bbaa8133;scroll-snap-align:start;overflow:hidden}
 .game-shell[data-screen="merge"] .orders .order-guest,.game-shell[data-screen="merge"] .orders .paired-order .order-guest{left:2px;bottom:9px;width:108px;height:116px;min-width:0;min-height:0;max-width:none;transform:none;filter:none}
 .game-shell[data-screen="merge"] .extra-order-list .order-guest>svg{width:106px;height:116px;max-width:100%;max-height:100%}
 .game-shell[data-screen="merge"] .orders .queue-kind{display:block;top:9px;left:9px;font-size:12px;line-height:17px;padding:1px 6px}
 .game-shell[data-screen="merge"] .orders .guest-delivery-pending{bottom:-5px;left:50%;font-size:9px;line-height:13px;padding:2px 5px;white-space:nowrap}
 .game-shell[data-screen="merge"] .orders .order-reward{top:12px;right:10px;font-size:12px;line-height:22px;padding:1px 6px}
 .game-shell[data-screen="merge"] .orders .order-gift-preview{width:23px;height:23px}
 .game-shell[data-screen="merge"] .orders .serve:not(.shop-entry){width:calc(100% - 104px);max-width:none;height:76px;min-height:76px;margin:0;padding:4px;border-radius:13px;transform:none;flex-shrink:0}
 .game-shell[data-screen="merge"] .orders .serve .order-food-art{width:60px;height:60px}
 .game-shell[data-screen="merge"] .orders .extra-food-card.multiple-foods{display:flex;flex-direction:row;gap:3px;height:76px;min-height:76px}
 .game-shell[data-screen="merge"] .orders .counter-food{min-width:0;min-height:60px;height:64px;flex:1;width:auto;touch-action:pan-y}
 .game-shell[data-screen="merge"] .orders .multiple-foods .counter-food .order-food-art{width:56px;height:56px}
 .game-shell[data-screen="merge"] .orders .order-tier{width:18px;height:18px;font-size:10px;top:3px;left:3px;right:auto}
 .game-shell[data-screen="merge"] .orders .counter-food-check{width:18px;height:18px;font-size:11px;right:0;top:0}
 .game-shell[data-screen="merge"] .orders .festival-queue-deliver{inset:auto auto 10px 8px;width:98px;height:114px;min-height:0;display:flex;flex-direction:column;justify-content:center;gap:4px;padding:6px}
 .game-shell[data-screen="merge"] .festival-queue-deliver>span{font-size:12px;line-height:17px;white-space:normal}
 .game-shell[data-screen="merge"] .festival-queue-deliver i{width:40px;height:40px}.game-shell[data-screen="merge"] .festival-queue-deliver small{font-size:10px}
 .game-shell[data-screen="merge"] .play-area{grid-area:game;min-width:0;min-height:0;height:100%;padding:25px 8px 4px;align-items:center;justify-content:center}
 .game-shell[data-screen="merge"] .board-frame{border-radius:15px;padding:7px;border-width:3px}
 .game-shell[data-screen="merge"] .board-heading{top:-24px;height:20px;font-size:11px;line-height:18px;gap:8px}
 .game-shell[data-screen="merge"] .board-heading #capacity{font-size:11px;white-space:nowrap}
 .game-shell[data-screen="merge"] .board-click-hint{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#fff8e7;font-size:11px;letter-spacing:0}
 .game-shell[data-screen="merge"] .bottom-dock{grid-area:dock;width:100%;height:82px;min-height:82px;display:flex;flex-direction:row;align-items:center;gap:5px;padding:0}
 .game-shell[data-screen="merge"] .bottom-dock #management,.game-shell[data-screen="merge"] .bottom-dock #collection,.game-shell[data-screen="merge"] .bottom-dock #rewards{width:46px;min-width:46px;height:70px;min-height:70px}
 .game-shell[data-screen="merge"] .bottom-dock #management .dock-icon{width:44px;height:44px;border-radius:13px}.game-shell[data-screen="merge"] .bottom-dock #management .dock-icon>svg{width:38px;height:38px}
 .game-shell[data-screen="merge"] .item-panel{height:64px;min-height:64px;min-width:0;flex:1}
 .game-shell[data-screen="merge"] .item-summary{gap:2px}.game-shell[data-screen="merge"] #selection-art{width:28px;height:32px}.game-shell[data-screen="merge"] #selection-label{font-size:11px}.game-shell[data-screen="merge"] #selection-tier{font-size:8px}.game-shell[data-screen="merge"] #selection-hint{display:none}

 .game-shell[data-screen="merge"] #save-status:not([hidden]){position:absolute;bottom:1px;left:14px;right:auto;max-width:300px;background:#fff1d4;border-radius:6px;padding:2px 5px}
}
