/* My Koala House */

.kh-app{position:relative;height:min(80vh,780px);min-height:460px;border-radius:18px;z-index:1;background:#eaf6f1;color:#27403a;font-family:inherit;display:flex;flex-direction:column;overflow:hidden;-webkit-user-select:none;user-select:none}
.kh-app *{box-sizing:border-box}
.kh-app button{font:inherit;cursor:pointer}










.kh-coin{width:18px;height:18px;border-radius:50%;background:radial-gradient(circle at 35% 30%,#ffe58a,#f2b01e);border:2px solid #d9930a;display:inline-block;vertical-align:-3px}







@keyframes khpop{0%{transform:scale(.6)}70%{transform:scale(1.08)}100%{transform:scale(1)}}








@keyframes khwalk{from{margin-top:0}to{margin-top:-6px}}















@keyframes khhop{40%{transform:translateY(-14px)}}









.kh-panel{width:min(340px,38vw);background:#fff;border-left:3px solid #cfe6dd;display:flex;flex-direction:column;min-height:0}





.kh-grid{flex:1;overflow-y:auto;padding:10px;touch-action:pan-y}
.kh-grid h3{margin:10px 0 6px;font-size:.9rem}
.kh-items-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(88px,1fr));gap:8px}
.kh-item{position:relative;background:#f6fbf9;border:2px solid #dcefe7;border-radius:14px;padding:6px 4px;display:flex;flex-direction:column;align-items:center;gap:2px;color:inherit;touch-action:pan-y}
.kh-item:hover{border-color:#8fd3b9}

.kh-nm{font-size:.72rem;font-weight:700;text-align:center;line-height:1.1}
.kh-pr{display:inline-flex;align-items:center;gap:3px;font-size:.72rem;font-weight:800;color:#a8690a}








.kh-kitem img{width:48px;height:56px;object-fit:contain}
.kh-modal{position:absolute;inset:0;background:rgba(30,50,45,.45);display:grid;place-items:center;z-index:20;padding:16px}
.kh-sheet{background:#fff;border-radius:22px;padding:20px;width:min(360px,100%);text-align:center;box-shadow:0 10px 30px rgba(0,0,0,.3)}
.kh-sheet h2{margin:0 0 8px;font-size:1.2rem}
.kh-buy-pic{display:grid;place-items:center;max-height:180px;overflow:hidden}
.kh-buy-pic svg{max-height:160px;width:auto;max-width:100%}
.kh-detail-pic{max-height:none;overflow:visible;padding:6px 0}
.kh-detail-pic svg{width:min(260px,70vw);height:auto;max-height:260px}
.kh-detail-pic img{width:min(240px,64vw);height:auto;max-height:260px;object-fit:contain}
.kh-detail-pic.is-locked{filter:grayscale(.5);opacity:.85}


.kh-buy-price{font-size:1.2rem;margin:8px 0}
.kh-buy-note{margin:0 0 12px;color:#4e6b63}
.kh-btns{display:flex;gap:8px;justify-content:center;flex-wrap:wrap}
.kh-btn{border:0;border-radius:999px;padding:10px 22px;font-weight:800;background:#3ec28f;color:#fff;box-shadow:0 3px 0 #1f9e6e}
.kh-btn.alt{background:#e3eeea;color:#2f4a43;box-shadow:0 3px 0 #c5d8d1}
.kh-btn:disabled{opacity:.5;cursor:not-allowed}
@media (max-width:760px),(orientation:portrait){
  
  
  
  .kh-panel{width:100%;flex:1 1 48%;border-left:0;border-top:3px solid #cfe6dd}
  
  
  
}










.kh-house-frame{width:100%;max-width:760px;margin:6px auto 0;background:#fff7e6;border:4px solid #e7c98f;border-radius:10px 10px 18px 18px;padding:0 12px 12px;box-shadow:0 6px 16px rgba(120,90,30,.2)}



















.kh-subgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(88px,1fr));gap:8px}
.kh-subitem{display:flex;flex-direction:column;align-items:center;gap:3px;border:2px solid #dcefe7;background:#f6fbf9;border-radius:12px;padding:6px;font-size:.72rem;font-weight:700;color:inherit}
.kh-subitem.on{border-color:#f5a742;background:#fff4dc}

.kh-ward{height:min(74vh,700px);flex-direction:row}
.kh-ward-stage{position:relative;flex:1;display:grid;place-items:center;background:radial-gradient(circle at 50% 40%,#f6fffb,#d4ece3);min-width:0;overflow:hidden}
.kh-ward-koala{height:84%;width:auto;max-width:100%}
.kh-wbody.hop{animation:khhop .5s}
.kh-ward-tip{position:absolute;bottom:8px;left:0;right:0;text-align:center;font-size:.8rem;color:#4e6b63;margin:0}
.kh-clear{margin:8px 0;border:0;border-radius:999px;padding:8px 16px;background:#e3eeea;font-weight:700}
@media (max-width:760px),(orientation:portrait){
  .kh-app{height:auto;min-height:0}
  .kh-ward {flex-direction:column}
  
  .kh-ward .kh-panel {max-height:46vh}
  
  
  .kh-ward-stage{height:46vh;flex:none}
}



.koala-dim3d{margin-bottom:12px}






/* ---- shop panel: category chips on top, the items of the chosen category below (same as the 2D shop) ---- */
.kh-cats{display:flex;flex-wrap:wrap;gap:6px;padding:10px 10px 6px;background:#fff}
.kh-cat{min-height:38px;padding:0 14px;border-radius:999px;border:2px solid #cfe7df;background:#fff;color:#27403a;font-weight:700;font-size:.9rem;white-space:nowrap}
.kh-cat.on{background:var(--accent,#2ec7a0);border-color:var(--accent-dark,#16a085);color:#fff}
.kh-cat:focus-visible{outline:3px solid var(--accent-dark,#16a085);outline-offset:2px}
.kh-admin-add-cat{border-style:dashed;background:transparent;color:#6b8076;font-weight:900}
.kh-shelf-head{display:flex;align-items:baseline;margin:2px 2px 8px}
.kh-admin-add-item{margin:0 0 8px}
.kh-shelf-title{font-weight:700;font-size:1.05rem}
.kh-shelf-title small{color:#6b837b;font-weight:600}
.kh-grid{scrollbar-width:thin}
.kh-item.on{border-color:#f5a742;background:#fff4dc}
.kh-state{font-size:.72rem;font-weight:800;color:#4e6b63}
.kh-item.on .kh-state{color:#a8690a}

/* ---- floor plan: the whole house is one connected picture that fits its box (no scrolling) ---- */









@keyframes khfade{from{opacity:0}to{opacity:1}}




/* ---- 3D koala page: the same wall-and-floor backdrop as the 2D koala ---- */
.kh-ward-bg{position:absolute;inset:0;width:100%;height:100%;display:block}
.kh-ward-koala{position:relative;z-index:1}
.kh-ward-tip{z-index:2}
.kh-ward .kh-ward-stage{background:#fbf1dc}

.koala-hero-avatar .kh-k3d{display:block;width:100%;height:100%}

/* the floor plan sizes itself to the picture (no empty space, no scrolling); full screen fills the screen instead */






/* narrow box (set by script): the picture on top, the shop panel under it */
.kh-narrow.kh-app{height:auto;min-height:0}



.kh-narrow .kh-panel{width:100%;flex:1 1 48%;border-left:0;border-top:3px solid #cfe6dd}
.kh-narrow.kh-ward {flex-direction:column}

.kh-narrow.kh-ward .kh-panel {max-height:46vh;flex:none}
.kh-narrow .kh-ward-stage{height:46vh;flex:none}

.kh-narrow .kh-items-grid{grid-template-columns:repeat(auto-fill,minmax(88px,1fr))}

/* ================= refined look: line icons, glass buttons, a picture behind the panel ================= */


















/* item menu */















/* panel: the same soft picture as the 2D page behind it; cards float on top */
.kh-panel{background:url("data:image/svg+xml,%3Csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20width=%27150%27%20height=%27150%27%3E%3Cg%20opacity=%27.9%27%3E%3Cellipse%20cx=%2728%27%20cy=%2732%27%20rx=%2713%27%20ry=%276%27%20transform=%27rotate%28-35%2028%2032%29%27%20fill=%27%233fb984%27%20opacity=%27.16%27/%3E%3Cellipse%20cx=%27112%27%20cy=%2796%27%20rx=%2713%27%20ry=%276%27%20transform=%27rotate%2830%20112%2096%29%27%20fill=%27%233fb984%27%20opacity=%27.16%27/%3E%3Cpolygon%20points=%27100%2C20%20103%2C28%20112%2C28%20105%2C33%20108%2C42%20100%2C37%2092%2C42%2095%2C33%2088%2C28%2097%2C28%27%20fill=%27%23f6c343%27%20opacity=%27.3%27/%3E%3Cpolygon%20points=%2740%2C108%2042%2C114%2049%2C114%2043%2C118%2045%2C125%2040%2C121%2035%2C125%2037%2C118%2031%2C114%2038%2C114%27%20fill=%27%23f6c343%27%20opacity=%27.25%27/%3E%3Ccircle%20cx=%2770%27%20cy=%2760%27%20r=%273%27%20fill=%27%23ffffff%27%20opacity=%27.7%27/%3E%3Ccircle%20cx=%27136%27%20cy=%2750%27%20r=%272.5%27%20fill=%27%23ffffff%27%20opacity=%27.7%27/%3E%3Ccircle%20cx=%2714%27%20cy=%2788%27%20r=%272.5%27%20fill=%27%23ffffff%27%20opacity=%27.7%27/%3E%3C/g%3E%3C/svg%3E") 0 0 / 150px 150px, radial-gradient(circle at 10% 6%, rgba(255, 226, 140, .55) 0 70px, transparent 71px), radial-gradient(circle at 94% 20%, rgba(168, 230, 207, .65) 0 80px, transparent 81px), linear-gradient(180deg, #d9f6ea 0%, #eefaea 55%, #fff3cf 100%);border-left:0;box-shadow:-6px 0 18px rgba(30,80,70,.1)}
.kh-narrow .kh-panel{box-shadow:0 -6px 18px rgba(30,80,70,.1)}
.kh-cats{background:transparent}
.kh-cat{background:rgba(255,255,255,.95);border:0;box-shadow:0 2px 0 rgba(130,190,170,.45);color:#27403a}
.kh-cat:active{transform:translateY(1px);box-shadow:0 1px 0 rgba(130,190,170,.45)}
.kh-cat.on{background:linear-gradient(180deg,#3fd3a6,#22b98c);color:#fff;box-shadow:0 2px 0 #178f6d}
.kh-grid .kh-item,.kh-grid .kh-subitem {background:rgba(255,255,255,.95);border:0;box-shadow:0 2px 0 rgba(130,190,170,.45)}
.kh-grid .kh-item:hover,.kh-grid .kh-subitem:hover {box-shadow:0 2px 0 #6fcfb0}
.kh-grid .kh-item.on,.kh-grid .kh-subitem.on {background:#fff6dd;box-shadow:0 0 0 2px #f5b94a,0 2px 0 #e0a02e}
.kh-shelf-head{padding:0 2px}
.kh-btn{background:linear-gradient(180deg,#3fd3a6,#22b98c);box-shadow:0 4px 12px rgba(34,185,140,.35);border:0}
.kh-btn.alt{background:#fff;color:#27403a;box-shadow:0 2px 0 rgba(130,190,170,.5),0 0 0 1px #d4e8e0}
.kh-sheet{border-radius:24px}

/* folder-style path: up button + Category > Item */












.kh-subgrid{margin-bottom:10px}


.kh-app .kh-kitem.kh-locked img{opacity:.5;filter:grayscale(.6)}
.kh-app .kh-kitem.kh-locked .kh-state{color:#8a94a0}
.kh-app .kh-kitem.kh-buy .kh-state{color:#b45309;font-weight:800}

/* Wardrobe category chips: 3D toy-style icon + label */
.kh-cat{display:inline-flex;align-items:center;gap:6px}
.kh-cat .kh-cat-ic{width:26px;height:26px;object-fit:contain;flex:none;margin-left:-4px;filter:drop-shadow(0 1px 1px rgba(0,60,50,.25))}
.kh-cat.on .kh-cat-ic{filter:drop-shadow(0 1px 2px rgba(0,60,50,.4))}
.kh-app .kh-kitem img{width:72px;height:72px;object-fit:contain}

/* ---- Item lists never scroll inside themselves: the page grows and the page scrolls (wardrobe + house plan/shop) ---- */
.kh-app.kh-ward { height: auto; min-height: 0; overflow: clip; }

.kh-app.kh-ward .kh-panel { max-height: none !important; flex: none; }
.kh-app.kh-ward .kh-grid { overflow: visible; flex: none; }

.kh-app.kh-ward:not(.kh-narrow) .kh-ward-stage { flex: 1; align-self: flex-start; position: sticky; top: 8px; height: min(74vh, 700px); }


/* House & Garden button: toy-style icon, soft white card (3D plan) */






/* ---- Inside a room: the item panel grows with its list and the page scrolls (no inner scrollbar) ---- */
.kh-app:not(.kh-ward):not(.kh-planmode) { height: auto; min-height: 0; overflow: clip; }











/* Category rows: always ONE line, scroll sideways with arrow buttons */
.kh-cats-wrap .kh-cats { flex-wrap: nowrap; overflow-x: auto; }
.kh-cats-wrap .kh-cat { flex: 0 0 auto; white-space: nowrap; }

/* Dialogs cover the window (the page can now be very tall) and lift above the tab row while open */
.kh-app .kh-modal { position: fixed; inset: 0; overflow-y: auto; align-items: safe center; z-index: 9600; }
html body #view-koala .koala-dim3d:has(.kh-modal) { position: relative; z-index: 9500; }
.kh-app:has(.kh-modal) { z-index: 9500; }



/* Room editor top bar: Canva floor-plan icon button (no label) + room thumbnail and name centred without a pill */










/* embedded editor sits under the 2D/3D tabs: give its floating bar breathing room so it doesn't touch the tab edge */


/* Compact category chips (smaller icon, tighter button) so more of the row shows; wider side panel in the room editor */
.kh-app .kh-cats-wrap .kh-cat { min-height: 32px; padding: 0 10px; gap: 4px; font-size: .8rem; }
.kh-app .kh-cats-wrap .kh-cat .kh-cat-ic { width: 18px; height: 18px; margin-left: -2px; }
.kh-app .kh-cats-wrap .kh-cats { gap: 5px; padding: 8px 8px 6px; }






.kh-subitem.locked{opacity:.85}


/* popup arrows (toy-style round buttons) and the plot picker pictures */
.kh-sheet{position:relative}
.kh-navbtn{position:absolute;top:42%;width:54px;height:54px;margin-top:-27px;padding:0;border-radius:50%;border:4px solid #fff;cursor:pointer;color:#fff;display:grid;place-items:center;
  background:radial-gradient(circle at 34% 26%,#b4f0dc 0,#5fcaa8 48%,#34a384 100%);
  box-shadow:0 5px 0 #26856a,0 10px 14px rgba(20,60,50,.32),inset 0 3px 4px rgba(255,255,255,.6),inset 0 -4px 6px rgba(20,90,70,.25);transition:transform .08s,box-shadow .08s}
.kh-navbtn.prev{left:-26px}.kh-navbtn.next{right:-26px}
.kh-navbtn:hover{filter:brightness(1.05)}
.kh-navbtn:active{transform:translateY(3px);box-shadow:0 2px 0 #26856a,0 5px 8px rgba(20,60,50,.3),inset 0 3px 4px rgba(255,255,255,.5)}
.kh-navbtn:focus-visible{outline:3px solid #ffb84d;outline-offset:2px}
.kh-navbtn svg{filter:drop-shadow(0 1px 1px rgba(20,90,70,.5))}
@media (max-width:440px){.kh-navbtn{width:46px;height:46px;margin-top:-23px}.kh-navbtn.prev{left:-14px}.kh-navbtn.next{right:-14px}}


.kh-btn.sell{background:#fff;color:#c2563f;border:2px solid #f0b8aa;box-shadow:0 3px 0 #f0b8aa}
.kh-btn.sell small{font-weight:800;opacity:.85}








/* tall / wide sub-item pictures must stay inside their box */








/* ===== item popup (detail sheet): calm card, fixed picture frame so nothing covers the price ===== */
.kh-app .kh-sheet { width: min(340px, 100%); padding: 22px 20px 20px; border-radius: 28px; background: #fff; box-shadow: 0 24px 60px rgba(20, 60, 50, .28), 0 0 0 1px rgba(60, 140, 115, .10); }
.kh-app .kh-sheet h2 { margin: 0 0 12px; font-size: 1.15rem; font-weight: 800; letter-spacing: -.01em; color: #1f3f37; }
.kh-app .kh-buy-pic, .kh-app .kh-detail-pic { display: grid; place-items: center; height: 196px; max-height: 196px; overflow: hidden; padding: 12px; margin: 0 auto 14px; border-radius: 22px; background: linear-gradient(160deg, #eefaf5, #fdf6e6); box-shadow: inset 0 0 0 1px rgba(60, 140, 115, .10); }
.kh-app .kh-detail-pic > svg, .kh-app .kh-detail-pic > img, .kh-app .kh-buy-pic > svg, .kh-app .kh-buy-pic > img { width: auto; height: auto; max-width: 100%; max-height: 170px; object-fit: contain; }




.kh-app .kh-buy-price { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 6px; padding: 5px 16px; border-radius: 999px; background: #fff6dd; color: #8a5a08; font-size: 1.1rem; }
.kh-app .kh-buy-note { margin: 0 0 14px; font-size: .84rem; line-height: 1.4; color: #5a7770; }
.kh-app .kh-btns { gap: 8px; }
.kh-app .kh-btns .kh-btn { padding: 11px 24px; border-radius: 14px; font-size: .95rem; background: linear-gradient(180deg, #46cc98, #2fb084); box-shadow: 0 1px 0 rgba(255,255,255,.5) inset, 0 4px 10px rgba(40, 160, 120, .28); }
.kh-app .kh-btns .kh-btn.alt { background: #fff; color: #35544c; box-shadow: 0 0 0 1.5px #cfe3dc; }
.kh-app .kh-btns .kh-btn.sell { background: #fff; color: #b4543a; box-shadow: 0 0 0 1.5px #f0cfc4; }
.kh-app .kh-btns .kh-btn:active { transform: translateY(1px); }
/* previous / next arrows: flat, no shadow */
.kh-app .kh-navbtn { top: 50%; width: 40px; height: 40px; margin-top: -20px; border: 1.5px solid #cfe3dc; background: #fff; color: #2c9a73; box-shadow: none; }
.kh-app .kh-navbtn.prev { left: -20px; } .kh-app .kh-navbtn.next { right: -20px; }
.kh-app .kh-navbtn:hover { background: #f1faf6; filter: none; }
.kh-app .kh-navbtn:active { transform: none; box-shadow: none; background: #e3f5ed; }
.kh-app .kh-navbtn svg { width: 20px; height: 20px; stroke-width: 3; filter: none; }
@media (max-width: 440px) { .kh-app .kh-navbtn { width: 36px; height: 36px; margin-top: -18px; } .kh-app .kh-navbtn.prev { left: -10px; } .kh-app .kh-navbtn.next { right: -10px; } }

/* ASMR toys: the picture drawn in the card, and the ▶ Listen button in the detail popup */



.kh-btn.kh-play { display: flex; align-items: center; justify-content: center; gap: 8px; width: fit-content; margin: 0 auto 12px; min-width: 180px; padding: 12px 26px; font-size: 1.05rem; background: linear-gradient(180deg, #a78bfa, #7c5ce6); box-shadow: 0 4px 12px rgba(124, 92, 230, .38); }
.kh-btn.kh-play .kh-play-ic { font-size: 1.1rem; }
.kh-btn.kh-play.is-on { background: linear-gradient(180deg, #ff8aa5, #f0577f); box-shadow: 0 4px 12px rgba(240, 87, 127, .35); }


.kh-asmr-note { margin: 0 auto 12px; max-width: 300px; padding: 10px 14px; border-radius: 14px; background: #fff4dc; color: #8a5a0a; font-weight: 800; font-size: .92rem; line-height: 1.4; text-align: center; box-shadow: 0 2px 0 #f0d49a; }

@keyframes kh-asmr-wob { from { transform: scale(1) rotate(-2deg); } to { transform: scale(1.1, .92) rotate(2deg); } }


/* moving / selling rooms on the floor plan */









/* dragging a room card from the shop onto the floor plan */





/* room popup: details, price, Buy, and a Sell row for each room of that kind */









/* dragging a sub-item card onto the piece that holds it */





.kh-subitem:not(.locked), .kh-item[data-asmr]:not(.locked) { cursor: grab; }
.kh-btns ~ .kh-btn { margin-top: 12px; }
