:root {
    --animal-primary: #19c8b9;
    --animal-primary-deep: #0fa395;
    --animal-text: #725d42;
    --animal-text-soft: #7c5734;
    --animal-cream: #fff9e6;
    --matte-grey: #aaada9;
    --matte-grey-deep: #8b908c;
    --matte-grey-dark: #707672;
    --cold-blue: #dcefee;
}

* { box-sizing: border-box; }
html { min-width: 320px; scrollbar-width: none; }
html::-webkit-scrollbar { display: none; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--animal-text);
    font-family: "Nunito", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    background:
        linear-gradient(rgba(125, 195, 149, .9), rgba(125, 195, 149, .9)),
        url("./assets/home_bg.webp") 0 0 / auto repeat,
        #7dc395;
    animation: island-bg-scroll 80s linear infinite;
}

button, a { font: inherit; }
a { color: inherit; text-decoration: none; }
button { -webkit-tap-highlight-color: transparent; }

@keyframes island-bg-scroll {
    from { background-position: 0 0, 100% 0%, 0 0; }
    to { background-position: 0 0, 0% 100%, 0 0; }
}

.top-nav {
    position: fixed;
    top: 14px;
    left: 50%;
    z-index: 80;
    display: flex;
    gap: 5px;
    padding: 6px;
    border: 1px solid rgba(232, 226, 214, .62);
    border-radius: 999px;
    background: rgba(255, 252, 244, .92);
    box-shadow: 0 4px 16px rgba(114, 93, 66, .12);
    backdrop-filter: blur(12px);
    transform: translateX(-50%);
    white-space: nowrap;
}
.top-nav a { padding: 6px 13px; border-radius: 999px; color: var(--animal-text-soft); font-size: 13px; font-weight: 800; transition: background 180ms ease, color 180ms ease, transform 180ms ease; }
.top-nav a:hover { background: #f0e8d8; transform: translateY(-1px); }
.top-nav a.active { color: #fff; background: var(--animal-primary); }

.fridge-page { width: min(1160px, calc(100% - 40px)); min-height: calc(100vh - 70px); margin: 0 auto; padding: 92px 0 32px; }
.page-heading { text-align: center; color: var(--animal-cream); }
.eyebrow { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 10px; font-weight: 900; letter-spacing: .22em; text-shadow: 0 1px 2px rgba(74,58,40,.25); }
.eyebrow i { width: 34px; height: 1px; background: rgba(255,249,230,.65); }
.page-heading h1 { margin: 5px 0 2px; font-size: clamp(34px, 4.5vw, 52px); line-height: 1.12; text-shadow: 0 4px 1px rgba(74,58,40,.38); }
.page-heading p { margin: 0 0 10px; font-size: 14px; font-weight: 700; text-shadow: 0 1px 2px rgba(74,58,40,.24); }

/* Open composition: nothing below the navigation is boxed into a card. */
.fridge-app { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: clamp(34px, 5vw, 72px); align-items: center; }
.scene-panel, .inventory-panel { min-width: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; backdrop-filter: none; }
.scene-panel { position: relative; }
.inventory-panel { position: relative; padding: 18px 0 18px 34px; }
.inventory-panel::before { content: ""; position: absolute; left: 0; top: 3%; bottom: 3%; width: 2px; background: repeating-linear-gradient(to bottom, rgba(255,249,230,.72) 0 7px, transparent 7px 15px); }

.scene-toolbar { position: absolute; z-index: 14; top: 12px; left: 8px; right: 8px; display: flex; align-items: center; gap: 10px; min-height: 42px; }
.round-button { width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; color: var(--animal-cream); background: transparent; font-size: 21px; font-weight: 900; text-shadow: 0 2px 0 rgba(74,58,40,.28); cursor: pointer; transition: transform 160ms ease, color 160ms ease; }
.round-button:hover { color: #fff; transform: translateY(-2px) scale(1.08); }
.back-button { opacity: 0; pointer-events: none; }
.scene-panel:not([data-view="closed"]) .back-button { opacity: 1; pointer-events: auto; }
.location-copy { flex: 1; display: flex; flex-direction: column; color: var(--animal-cream); text-shadow: 0 1px 2px rgba(74,58,40,.26); }
.location-copy small { font-size: 8px; font-weight: 900; letter-spacing: .18em; opacity: .82; }
.location-copy strong { font-size: 16px; }
.sound-button[aria-pressed="false"] { color: rgba(255,249,230,.5); }

.fridge-stage { position: relative; display: grid; place-items: center; min-height: 600px; overflow: hidden; perspective: 1500px; }
.fridge-stage::before { content: ""; position: absolute; left: 50%; bottom: 46px; width: min(88%, 680px); height: 250px; border-radius: 50%; background: radial-gradient(ellipse, rgba(255,249,230,.2), transparent 68%); transform: translateX(-50%); pointer-events: none; }
.floor-shadow { position: absolute; left: 50%; bottom: 48px; width: 330px; height: 42px; border-radius: 50%; background: rgba(60,74,63,.25); filter: blur(9px); transform: translateX(-50%); }

/* Matte old refrigerator based on the supplied grey Haier reference. */
.fridge-front { position: relative; z-index: 3; width: 310px; height: 510px; padding: 57px 11px 14px; border: 7px solid var(--matte-grey-dark); border-radius: 33px 33px 17px 17px; background: var(--matte-grey-deep); box-shadow: 13px 17px 0 rgba(70,103,77,.34), 0 23px 32px rgba(56,75,61,.25); transform-origin: center bottom; transition: opacity 320ms ease, transform 580ms cubic-bezier(.2,.8,.2,1); }
.fridge-front::after { content: ""; position: absolute; inset: 7px; border: 2px solid rgba(255,255,255,.11); border-radius: 22px 22px 10px 10px; pointer-events: none; }
.control-deck { position: absolute; z-index: 4; top: 5px; left: 7px; right: 7px; height: 43px; display: flex; align-items: center; gap: 9px; padding: 0 12px; border: 3px solid #555a57; border-radius: 22px 22px 7px 7px; color: #e6e8e3; background: #747976; box-shadow: inset 0 -5px 0 rgba(60,65,62,.28); }
.deck-brand { display: flex; align-items: center; gap: 3px; margin-right: auto; font-size: 8px; font-weight: 900; letter-spacing: .08em; }
.deck-brand i { font-style: normal; font-size: 12px; }
.deck-light { width: 12px; height: 8px; border-radius: 50%; background: #f6d878; box-shadow: 0 0 0 2px #565b58, 0 0 7px #ffe9a5; }
.deck-screen { padding: 4px 7px; border-radius: 3px; color: #bfdb88; background: #343936; font-family: monospace; font-size: 9px; letter-spacing: .04em; box-shadow: inset 0 0 0 2px #292e2b; }
.deck-button { width: 13px; height: 8px; border: 2px solid #4d524f; border-radius: 50%; background: #6a706c; }

.fridge-door { position: relative; display: block; width: 100%; border: 3px solid #656a67; color: var(--animal-cream); background: #858987; box-shadow: inset 3px 3px 0 rgba(255,255,255,.08), inset -6px -5px 0 rgba(63,68,65,.12); cursor: pointer; overflow: hidden; transition: background 170ms ease, transform 170ms ease, outline 170ms ease; }
.fridge-door:hover, .fridge-door:focus-visible { background: #8f9390; transform: translateY(-2px); outline: 4px solid rgba(255,249,230,.6); outline-offset: 3px; }
.upper-door { height: 298px; border-radius: 15px 15px 8px 8px; }
.lower-door { height: 124px; margin-top: 5px; border-radius: 8px 8px 11px 11px; }
.door-handle { position: absolute; left: 17px; width: 15px; border: 3px solid #565b58; border-radius: 9px; background: #6a6f6c; box-shadow: 4px 5px 0 rgba(69,73,70,.2); }
.upper-door .door-handle { bottom: 24px; height: 104px; }
.lower-door .door-handle { top: 18px; height: 61px; }
.leaf-magnet, .flower-magnet, .face-magnet { position: absolute; display: grid; place-items: center; border: 3px solid rgba(80,86,82,.3); border-radius: 50%; box-shadow: 2px 3px 0 rgba(67,72,68,.18); }
.leaf-magnet { top: 29px; right: 43px; width: 38px; height: 38px; background: #bfe39c; font-size: 19px; transform: rotate(9deg); }
.flower-magnet { top: 70px; right: 66px; width: 27px; height: 27px; background: #f8d985; font-size: 14px; transform: rotate(-8deg); }
.face-magnet { left: 92px; bottom: 35px; width: 46px; height: 40px; border-radius: 45% 55% 50% 46%; color: #745d42; background: #9fded3; font-size: 15px; font-weight: 900; transform: rotate(-5deg); }
.door-note { position: absolute; top: 71px; left: 80px; padding: 12px 15px 10px; border: 2px solid #d1ad55; border-radius: 8px 12px 9px 13px; color: #725d42; background: #ffe99b; box-shadow: 4px 5px 0 rgba(80,84,79,.17); font-size: 13px; font-weight: 900; line-height: 1.25; text-align: left; transform: rotate(-4deg); }
.door-note::before { content: ""; position: absolute; top: -7px; left: 36%; width: 34px; height: 12px; border-radius: 3px; background: rgba(255,249,230,.65); transform: rotate(4deg); }
.door-note small { color: #9a7043; font-size: 9px; }
.door-label { position: absolute; right: 44px; bottom: 18px; display: flex; flex-direction: column; align-items: flex-end; opacity: 0; transform: translateX(8px); transition: opacity 160ms ease, transform 160ms ease; }
.lower-door .door-label { bottom: 13px; }
.fridge-door:hover .door-label, .fridge-door:focus-visible .door-label { opacity: 1; transform: none; }
.door-label b { font-size: 12px; }.door-label small { color: #dff7ee; font-size: 8px; }
.energy-sticker { position: absolute; right: 30px; top: 27px; display: grid; grid-template-columns: 32px 1fr; grid-template-rows: auto auto; padding: 8px 11px; border: 2px solid #638d71; border-radius: 13px 9px 14px 10px; color: #55715b; background: #dbe9bf; text-align: left; transform: rotate(2deg); }
.energy-sticker i { grid-row: 1 / 3; align-self: center; font-style: normal; font-size: 22px; }
.energy-sticker b { font-size: 9px; }.energy-sticker small { font-size: 6px; letter-spacing: .08em; }
.fridge-foot { position: absolute; bottom: -14px; width: 31px; height: 16px; border-radius: 0 0 7px 7px; background: #4e5450; }
.foot-left { left: 25px; }.foot-right { right: 25px; }

.stage-hint { position: absolute; z-index: 6; right: 18px; bottom: 52px; display: flex; align-items: center; gap: 7px; color: var(--animal-cream); text-shadow: 0 1px 2px rgba(74,58,40,.3); transition: opacity 250ms ease; }
.stage-hint span { font-size: 21px; animation: point 1.6s ease-in-out infinite; }
.stage-hint p { margin: 0; font-size: 10px; line-height: 1.4; font-weight: 900; }
@keyframes point { 50% { transform: translateY(-4px); } }

.interior-view { position: absolute; z-index: 2; opacity: 0; pointer-events: none; transform: scale(.6) translateY(90px); transition: opacity 420ms ease 160ms, transform 650ms cubic-bezier(.16,.8,.22,1) 100ms; }
.scene-panel[data-view="upper"] .fridge-front, .scene-panel[data-view="lower"] .fridge-front { opacity: 0; transform: scale(1.28) translateY(35px); pointer-events: none; }
.scene-panel:not([data-view="closed"]) .stage-hint { opacity: 0; }
.scene-panel[data-view="upper"] .upper-interior, .scene-panel[data-view="lower"] .lower-interior { z-index: 5; opacity: 1; pointer-events: auto; transform: scale(1) translateY(0); filter: none; }

.upper-interior { display: grid; grid-template-columns: minmax(300px, 1.5fr) minmax(150px, .7fr); gap: 13px; width: min(94%, 670px); height: min(86%, 510px); }
.cold-chamber, .door-liner, .freezer-shell { position: relative; overflow: hidden; border: 12px solid #9ca9a6; background: #edf5f3; box-shadow: inset 0 0 25px rgba(85,111,111,.14), 12px 16px 0 rgba(70,103,77,.28); }
.cold-chamber { border-radius: 24px 15px 15px 24px; }
.cold-chamber::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 12%, rgba(121,164,162,.08) 12.4% 12.8%); }
.lamp { position: absolute; top: 17px; left: 50%; width: 80px; height: 26px; border-radius: 50%; background: #c5cecc; box-shadow: 0 4px 8px rgba(80,95,96,.16); transform: translateX(-50%); }
.lamp span { position: absolute; inset: 6px 10px; border-radius: 50%; background: #fffbd1; box-shadow: 0 0 30px #fff7ae; }
.thermostat { position: absolute; top: 65px; right: 14px; display: flex; gap: 3px; padding: 5px; border: 1px solid #bac8c5; border-radius: 5px; }
.thermostat span { width: 9px; height: 4px; border-radius: 3px; background: #8da19e; }
.glass-shelf { position: absolute; left: 7%; right: 7%; height: 12px; border: 2px solid #9db6b4; border-radius: 5px; background: rgba(204,239,238,.55); box-shadow: 0 8px 8px rgba(72,112,110,.09); }
.shelf-one { top: 42%; }.shelf-two { top: 68%; }
.crisper-drawer { position: absolute; left: 7%; right: 7%; bottom: 5%; height: 21%; border: 3px solid rgba(113,156,158,.48); border-radius: 8px 8px 14px 14px; background: rgba(191,227,230,.28); }
.crisper-drawer::before { content: ""; position: absolute; top: 8px; left: 50%; width: 44%; height: 6px; border-radius: 0 0 8px 8px; border-bottom: 2px solid rgba(93,140,141,.52); transform: translateX(-50%); }
.crisper-drawer span { position: absolute; left: 50%; bottom: 10px; color: rgba(87,132,130,.58); font-size: 8px; font-weight: 900; letter-spacing: .2em; transform: translateX(-50%); }
.door-liner { border-radius: 15px 24px 24px 15px; }
.door-rack { position: absolute; left: 9%; right: 9%; border: 3px solid rgba(113,156,158,.5); border-top-width: 2px; border-radius: 6px 6px 12px 12px; background: rgba(191,227,230,.23); }
.top-rack { top: 12%; height: 17%; }.split-rack { top: 40%; height: 19%; }.bottom-rack { bottom: 8%; height: 22%; }
.split-rack i { position: absolute; left: 50%; top: 0; bottom: 0; width: 3px; background: rgba(113,156,158,.3); }
.lower-interior { width: min(74%, 450px); height: min(88%, 520px); }
.freezer-shell { width: 100%; height: 100%; padding: 52px 28px 25px; border-radius: 24px; }
.frost-mark { position: absolute; top: 15px; left: 50%; color: rgba(93,160,165,.46); font-size: 26px; transform: translateX(-50%); }
.freezer-drawer { position: relative; height: calc((100% - 24px) / 3); margin-bottom: 12px; border: 4px solid rgba(97,144,151,.48); border-radius: 8px 8px 17px 17px; background: rgba(185,221,224,.3); box-shadow: inset 0 14px 22px rgba(255,255,255,.5), 0 5px 0 rgba(100,139,143,.1); }
.freezer-drawer span { position: absolute; bottom: 12px; left: 50%; color: rgba(72,126,133,.56); font-size: 8px; font-weight: 900; letter-spacing: .18em; white-space: nowrap; transform: translateX(-50%); }
.freezer-drawer i { position: absolute; top: 10px; left: 50%; width: 40%; height: 9px; border-bottom: 3px solid rgba(80,129,135,.4); border-radius: 50%; transform: translateX(-50%); }

.level-switch { display: flex; justify-content: center; gap: 7px; margin-top: -3px; }
.level-button { display: inline-flex; align-items: center; gap: 5px; padding: 7px 10px; border: 0; border-bottom: 2px solid transparent; color: rgba(255,249,230,.82); background: transparent; font-size: 11px; font-weight: 900; text-shadow: 0 1px 2px rgba(74,58,40,.24); cursor: pointer; transition: color 170ms ease, border-color 170ms ease, transform 170ms ease; }
.level-button:hover { color: #fff; transform: translateY(-1px); }
.level-button.is-active { color: #fff; border-bottom-color: var(--animal-cream); }

.inventory-heading { display: flex; align-items: center; gap: 10px; color: var(--animal-cream); text-shadow: 0 1px 2px rgba(74,58,40,.25); }
.inventory-icon { font-size: 26px; }
.inventory-heading div { flex: 1; }
.inventory-heading small { font-size: 8px; font-weight: 900; letter-spacing: .16em; opacity: .82; }
.inventory-heading h2 { margin: 1px 0 0; font-size: 21px; }
.item-count { display: grid; place-items: center; width: 30px; height: 30px; border: 2px solid rgba(255,249,230,.7); border-radius: 50%; color: var(--animal-cream); font-weight: 900; }
.temperature-card { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 20px 0; padding: 0; }
.temperature-card div { display: flex; flex-direction: column; gap: 2px; padding-left: 10px; border-left: 3px solid rgba(255,249,230,.55); }
.temperature-card span { color: rgba(255,249,230,.72); font-size: 9px; }.temperature-card strong { color: #fff; font-size: 13px; text-shadow: 0 1px 2px rgba(74,58,40,.22); }
.empty-inventory { padding: 19px 0 17px; color: var(--animal-cream); text-align: center; }
.empty-inventory strong { display: block; margin-top: 11px; font-size: 14px; text-shadow: 0 1px 2px rgba(74,58,40,.22); }
.empty-inventory p { min-height: 42px; margin: 6px auto 0; color: rgba(255,249,230,.78); font-size: 11px; line-height: 1.7; }
.empty-basket { position: relative; width: 70px; height: 47px; margin: 0 auto; border: 4px solid #c9f0e7; border-radius: 10px 10px 17px 17px; }
.empty-basket span { position: absolute; left: 50%; top: -18px; width: 43px; height: 28px; border: 4px solid #c9f0e7; border-bottom: 0; border-radius: 50% 50% 0 0; transform: translateX(-50%); }
.empty-basket i { position: absolute; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: rgba(255,249,230,.38); }
.empty-basket i:nth-of-type(1) { left: 20px; transform: rotate(-9deg); }.empty-basket i:nth-of-type(2) { left: 50%; }.empty-basket i:nth-of-type(3) { right: 20px; transform: rotate(9deg); }
.future-slots { border-top: 1px dashed rgba(255,249,230,.52); }
.slot { display: grid; grid-template-columns: 58px 1fr 24px; align-items: center; min-height: 43px; border-bottom: 1px dashed rgba(255,249,230,.38); color: rgba(255,249,230,.78); }
.slot small { font-size: 9px; font-weight: 900; }.slot span { font-size: 10px; }.slot b { font-size: 17px; text-align: right; }
.inventory-note { margin: 12px 0 0; color: rgba(255,249,230,.6); font-size: 9px; line-height: 1.6; text-align: center; }

.footer { width: min(1160px, calc(100% - 40px)); margin: 0 auto; padding: 0 0 28px; color: rgba(255,249,230,.88); font-size: 11px; text-align: center; text-shadow: 0 1px 2px rgba(74,58,40,.22); }
.footer div { display: flex; justify-content: center; flex-wrap: wrap; gap: 15px; }.footer a { font-weight: 800; }.footer a:hover { text-decoration: underline; }.footer p { margin: 8px 0 0; }

@media (max-width: 900px) {
    .fridge-app { grid-template-columns: 1fr; gap: 18px; }
    .inventory-panel { width: min(100%, 620px); margin: 0 auto; padding: 18px 0 8px; }
    .inventory-panel::before { top: 0; bottom: auto; left: 0; right: 0; width: auto; height: 2px; background: repeating-linear-gradient(to right, rgba(255,249,230,.72) 0 7px, transparent 7px 15px); }
    .fridge-stage { min-height: 570px; }
    .future-slots { display: grid; grid-template-columns: 1fr 1fr; column-gap: 20px; }
}

@media (max-width: 620px) {
    .top-nav { top: 10px; gap: 2px; padding: 5px; }.top-nav a { padding: 5px 8px; font-size: 10.5px; }
    .fridge-page { width: calc(100% - 24px); padding-top: 73px; }.page-heading p { margin-bottom: 4px; font-size: 13px; }
    .scene-toolbar { top: 2px; }.fridge-stage { min-height: 500px; }
    .fridge-front { width: 254px; height: 425px; padding: 49px 9px 12px; border-width: 6px; border-radius: 28px 28px 14px 14px; }
    .control-deck { height: 36px; padding-inline: 8px; }.deck-screen { font-size: 7px; }.deck-brand { font-size: 7px; }
    .upper-door { height: 244px; }.lower-door { height: 101px; }
    .upper-door .door-handle { height: 84px; }.lower-door .door-handle { height: 49px; }
    .leaf-magnet { top: 22px; right: 39px; transform: scale(.86) rotate(9deg); }.flower-magnet { top: 56px; right: 59px; transform: scale(.86) rotate(-8deg); }.face-magnet { left: 75px; bottom: 27px; transform: scale(.86) rotate(-5deg); }
    .door-note { top: 53px; left: 62px; padding: 10px 12px 8px; font-size: 11px; }.energy-sticker { right: 20px; top: 18px; transform: scale(.82) rotate(2deg); transform-origin: right top; }
    .stage-hint { right: 4px; bottom: 40px; }
    .upper-interior { grid-template-columns: minmax(210px, 1.5fr) minmax(105px, .7fr); gap: 7px; width: 96%; height: 430px; }.cold-chamber, .door-liner, .freezer-shell { border-width: 8px; }.lower-interior { width: 82%; height: 440px; }.freezer-shell { padding: 45px 18px 20px; }
    .level-switch { gap: 2px; }.level-button { gap: 3px; padding: 7px 8px; font-size: 10px; }
    .inventory-heading h2 { font-size: 18px; }.future-slots { grid-template-columns: 1fr; }
}

@media (max-width: 390px) {
    .top-nav a { padding: 5px 6px; font-size: 9.6px; }.fridge-stage { min-height: 475px; }.fridge-front { transform: scale(.94); }
    .upper-interior { grid-template-columns: minmax(190px, 1.5fr) minmax(92px, .7fr); height: 405px; }.stage-hint { display: none; }.level-button span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* =========================================================
   Centered appliance composition + collapsible inventory
   ========================================================= */
html, body { min-height: 100%; }
body { overflow-x: hidden; }

.fridge-page {
    width: 100%;
    min-height: 100svh;
    padding: 68px 20px 0;
}

.fridge-app {
    display: grid;
    grid-template-columns: 1fr;
    place-items: center;
    width: 100%;
    min-height: calc(100svh - 68px);
}

.scene-panel {
    position: relative;
    width: min(760px, 100%);
    min-height: calc(100svh - 68px);
}

.fridge-stage {
    width: 100%;
    min-height: calc(100svh - 68px);
}

.scene-toolbar {
    top: 24px;
    left: 18px;
    right: 18px;
    pointer-events: none;
}

.toolbar-spacer { flex: 1; }
.scene-toolbar .back-button { pointer-events: auto; }
.sound-button,
.stage-hint { display: none; }

.fridge-front {
    background: #969b97;
    border-color: #7d837f;
    box-shadow: 13px 17px 0 rgba(75, 112, 84, .27), 0 23px 32px rgba(56, 75, 61, .2);
}

.fridge-front::after { border-color: rgba(255,255,255,.17); }

.control-deck {
    color: #f0f1ec;
    background: #a4a8a4;
    border-color: #858a86;
    box-shadow: inset 0 -5px 0 rgba(91, 96, 92, .2);
}

.fridge-door {
    color: #fff9e6;
    background: #b7bab6;
    border-color: #929793;
    box-shadow: inset 3px 3px 0 rgba(255,255,255,.14), inset -6px -5px 0 rgba(91,96,92,.1);
}

.fridge-door:hover,
.fridge-door:focus-visible { background: #c0c3bf; }

.door-handle {
    border-color: #858a86;
    background: #979c98;
    box-shadow: -4px 5px 0 rgba(89,94,90,.16);
}

.fridge-foot { background: #777d79; }

.inventory-toggle {
    position: fixed;
    top: 50%;
    right: 0;
    z-index: 72;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    width: 54px;
    padding: 14px 8px;
    border: 0;
    border-radius: 18px 0 0 18px;
    color: var(--animal-text);
    background: rgba(255, 249, 230, .96);
    box-shadow: -4px 6px 16px rgba(74,58,40,.14);
    cursor: pointer;
    transform: translateY(-50%);
    transition: transform 220ms ease, opacity 180ms ease, background 180ms ease;
}

.inventory-toggle:hover { background: #fffdf7; transform: translateY(-50%) translateX(-3px); }
.inventory-toggle span { font-size: 21px; }
.inventory-toggle strong { font-size: 11px; line-height: 1.35; writing-mode: vertical-rl; letter-spacing: .08em; }
.inventory-toggle b { display: grid; place-items: center; width: 23px; height: 23px; border-radius: 50%; color: #fff; background: var(--animal-primary); font-size: 11px; }
.inventory-open .inventory-toggle { opacity: 0; pointer-events: none; transform: translateY(-50%) translateX(20px); }

.inventory-backdrop {
    position: fixed;
    z-index: 68;
    inset: 0;
    visibility: hidden;
    opacity: 0;
    background: rgba(74,58,40,.13);
    transition: opacity 240ms ease, visibility 240ms ease;
}

.inventory-open .inventory-backdrop { visibility: visible; opacity: 1; }

.inventory-panel {
    position: fixed;
    z-index: 74;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(350px, 88vw);
    margin: 0;
    padding: 92px 28px 28px;
    overflow-y: auto;
    color: var(--animal-text);
    background: rgba(255, 249, 230, .98);
    box-shadow: -18px 0 38px rgba(74,58,40,.16);
    transform: translateX(105%);
    transition: transform 380ms cubic-bezier(.18,.8,.2,1);
}

.inventory-panel::before { display: none; }
.inventory-open .inventory-panel { transform: translateX(0); }

.inventory-heading {
    color: var(--animal-text);
    text-shadow: none;
}

.inventory-heading small { color: var(--animal-primary-deep); opacity: 1; }
.inventory-heading h2 { font-size: 21px; }
.item-count { color: var(--animal-primary-deep); border-color: rgba(25,200,185,.35); background: #e6f9f6; }
.inventory-close { width: 32px; height: 32px; padding: 0; border: 0; color: #9b856b; background: transparent; font-size: 26px; line-height: 1; cursor: pointer; }
.inventory-close:hover { color: var(--animal-primary-deep); }

.temperature-card div { border-left-color: rgba(25,200,185,.42); }
.temperature-card span { color: #a58d70; }
.temperature-card strong { color: var(--animal-text); text-shadow: none; }
.empty-inventory { color: var(--animal-text); }
.empty-inventory strong { text-shadow: none; }
.empty-inventory p { color: #9b856b; }
.empty-basket { border-color: #8eddd2; }
.empty-basket span { border-color: #8eddd2; }
.empty-basket i { background: rgba(25,200,185,.28); }
.future-slots { border-top-color: rgba(114,93,66,.2); }
.slot { color: #9b856b; border-bottom-color: rgba(114,93,66,.18); }
.slot b { color: var(--animal-primary-deep); }
.inventory-note { color: #a8957e; }

@media (max-width: 620px) {
    .fridge-page { width: 100%; padding: 60px 8px 0; }
    .fridge-app,
    .scene-panel,
    .fridge-stage { min-height: calc(100svh - 60px); }
    .scene-toolbar { top: 14px; left: 8px; right: 8px; }
    .inventory-toggle {
        top: auto;
        right: 16px;
        bottom: 16px;
        justify-content: center;
        width: 52px;
        height: 52px;
        padding: 0;
        border-radius: 50%;
        transform: none;
    }
    .inventory-toggle:hover { transform: translateY(-2px); }
    .inventory-toggle strong { display: none; }
    .inventory-toggle b { position: absolute; top: -4px; right: -4px; width: 21px; height: 21px; }
    .inventory-open .inventory-toggle { transform: translateX(20px); }
    .inventory-panel { width: min(360px, 92vw); padding: 80px 22px 24px; }
}

/* =========================================================
   Two-step opening ritual: hinge first, then zoom inside
   ========================================================= */
.fridge-front {
    transform-style: preserve-3d;
    backface-visibility: hidden;
    will-change: transform, opacity;
}

.fridge-door {
    z-index: 3;
    transform-origin: right center;
    transform-style: preserve-3d;
    backface-visibility: visible;
    will-change: transform;
    overflow: visible;
    background: #707572;
    transition: background 170ms ease, outline 170ms ease;
}

.door-front-face,
.door-back-face {
    position: absolute;
    inset: 0;
    display: block;
    overflow: hidden;
    border-radius: inherit;
    backface-visibility: hidden;
    transform-style: preserve-3d;
}

.door-front-face {
    background: #858987;
    box-shadow: inset 3px 3px 0 rgba(255,255,255,.08), inset -6px -5px 0 rgba(63,68,65,.12);
    transform: translateZ(1px);
    transition: background 170ms ease;
}

.fridge-door:hover .door-front-face,
.fridge-door:focus-visible .door-front-face { background: #8f9390; }

.door-back-face {
    border: 5px solid #929d99;
    background: #dfe9e6;
    box-shadow: inset 0 0 0 3px rgba(255,255,255,.45), inset 0 0 24px rgba(82,111,106,.15);
    transform: rotateY(180deg) translateZ(1px);
}

.door-back-face::before {
    content: "";
    position: absolute;
    inset: 11px;
    border: 3px solid rgba(129,153,149,.55);
    border-radius: 10px;
}

.door-cavity {
    position: absolute;
    z-index: 2;
    left: 11px;
    right: 11px;
    overflow: hidden;
    border: 4px solid #929d99;
    background: #eef7f5;
    box-shadow: inset 0 0 20px rgba(74,112,108,.16);
    opacity: .98;
}

.upper-cavity {
    top: 57px;
    height: 298px;
    border-radius: 15px 15px 8px 8px;
}

.lower-cavity {
    top: 360px;
    height: 124px;
    display: grid;
    gap: 5px;
    padding: 9px 14px;
    border-radius: 8px 8px 11px 11px;
}

.cavity-lamp {
    position: absolute;
    top: 14px;
    left: 50%;
    width: 50px;
    height: 14px;
    border-radius: 50%;
    background: #fff3a7;
    box-shadow: 0 0 22px rgba(255,234,125,.88);
    transform: translateX(-50%);
}

.cavity-shelf {
    position: absolute;
    left: 8%;
    right: 8%;
    height: 8px;
    border: 2px solid #9db9b5;
    border-radius: 4px;
    background: rgba(197,231,229,.68);
}

.cavity-shelf.shelf-a { top: 38%; }
.cavity-shelf.shelf-b { top: 64%; }
.cavity-bin { position: absolute; left: 8%; right: 8%; bottom: 6%; height: 22%; border: 3px solid rgba(113,156,158,.48); border-radius: 7px 7px 12px 12px; background: rgba(191,227,230,.3); }
.mini-freezer-drawer { border: 3px solid rgba(97,144,151,.5); border-radius: 5px 5px 9px 9px; background: rgba(185,221,224,.38); }

.scene-panel[aria-busy="true"] .back-button { opacity: 0; pointer-events: none; }
.scene-panel.is-opening .fridge-front,
.scene-panel.is-opening .interior-view { transition: none; }
.scene-panel.is-opening .fridge-door { pointer-events: none; }
.scene-panel.is-opening .door-label { opacity: 0; }
.scene-panel.is-opening.opening-upper .upper-interior,
.scene-panel.is-opening.opening-lower .lower-interior {
    z-index: 5;
    pointer-events: none;
    will-change: transform, opacity;
    backface-visibility: hidden;
}

@media (max-width: 620px) {
    .door-cavity { left: 9px; right: 9px; border-width: 3px; }
    .upper-cavity { top: 49px; height: 244px; }
    .lower-cavity { top: 298px; height: 101px; padding: 7px 11px; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
    .fridge-front, .fridge-door, .interior-view { will-change: auto; }
}
