@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@500;600;700;800&display=swap');

:root {
  --ink: #2f2933;
  --muted: #746d79;
  --paper: #f7f4fa;
  --white: #fff;
  --purple: #9b78ba;
  --purple-deep: #73548d;
  --purple-soft: #eee6f5;
  --green: #174b3e;
  --green-light: #bce879;
  --pink: #e4a0c3;
  --yellow: #ffe382;
  --line: #ded7e3;
  --shadow: 0 18px 48px rgba(64, 48, 75, .14);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 1120px; color: var(--ink); background: var(--paper); font-family: "Nunito", "Avenir Next", sans-serif; letter-spacing: 0; }
button { font: inherit; }
.topbar { height: 76px; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
.brand, .lesson-controls, .segmented { display: flex; align-items: center; }
.brand { gap: 12px; }
.brand-mark { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 8px; color: #fff; background: var(--green); font: 700 27px "Kaiti SC", "STKaiti", serif; box-shadow: 5px 5px 0 var(--green-light); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 18px; }
.brand small { color: var(--muted); font-size: 12px; }
.lesson-controls { gap: 12px; }
.segmented { gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: #f7f3fa; }
.segmented span { padding: 0 8px; color: var(--muted); font-size: 13px; font-weight: 800; }
.segmented button, .icon-button { height: 34px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.segmented button { padding: 0 12px; font-weight: 800; }
.segmented button.active { color: var(--purple-deep); background: #fff; box-shadow: 0 2px 10px rgba(80,61,94,.11); }
.icon-button { width: 38px; border: 1px solid var(--line); background: #fff; font-size: 21px; }

.game-shell { height: calc(100vh - 76px); min-height: 710px; display: grid; grid-template-columns: 330px minmax(760px, 1fr); }
.mission-panel { padding: 34px 28px; border-right: 1px solid var(--line); background: #fff; }
.mission-kicker { margin-bottom: 8px; color: var(--purple-deep); font-size: 11px; font-weight: 800; letter-spacing: 1.4px; }
.mission-panel h1 { min-height: 92px; margin: 0; font-size: 29px; line-height: 1.18; }
.mission-panel > p { min-height: 48px; margin: 8px 0 20px; color: var(--muted); font-size: 15px; line-height: 1.5; }
.mission-status { display: flex; align-items: center; gap: 8px; margin: 10px 0 16px; font-size: 14px; }
.mission-status span { width: 10px; height: 10px; border-radius: 50%; background: var(--purple); }
.mission-status.done span { background: var(--green-light); box-shadow: 0 0 0 5px rgba(188,232,121,.24); }
.answer { min-height: 122px; padding: 15px 16px; border-radius: 8px; background: var(--purple-soft); transition: .18s ease; }
.answer.hidden { visibility: hidden; opacity: 0; }
.answer span, .answer strong, .answer small { display: block; }
.answer span { color: var(--purple-deep); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.answer strong { margin-top: 7px; font: 500 31px/1.25 "Kaiti SC", "STKaiti", "KaiTi", serif; }
.answer small { margin-top: 4px; color: var(--muted); font-size: 14px; }
.mission-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.button { min-height: 42px; border: 1px solid var(--line); border-radius: 7px; font-weight: 800; cursor: pointer; }
.button.primary { color: #fff; background: var(--green); border-color: var(--green); }
.button.secondary { color: var(--purple-deep); background: #fff; }
.mission-progress { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px; margin-top: 16px; color: var(--muted); font-size: 12px; font-weight: 800; }
.mission-progress > div { height: 6px; overflow: hidden; border-radius: 4px; background: #eee8f1; }
.mission-progress i { display: block; width: 8.33%; height: 100%; border-radius: 4px; background: var(--pink); transition: width .2s ease; }
.language-strip { margin-top: 28px; display: grid; grid-template-columns: 76px 1fr; gap: 8px 10px; padding-top: 19px; border-top: 1px solid var(--line); }
.language-strip span { color: var(--muted); font-size: 12px; font-weight: 800; }
.language-strip strong { font: 500 23px "Kaiti SC", "STKaiti", "KaiTi", serif; }

.play-area { position: relative; overflow: hidden; padding: 34px 36px 28px; background: radial-gradient(circle at 72% 20%, #fff 0 5%, transparent 28%), #f6f1f8; }
.floor-label { position: absolute; left: 17px; color: #9a8da1; font-size: 10px; font-weight: 800; letter-spacing: 1px; writing-mode: vertical-rl; }
.upper-label { top: 170px; }
.lower-label { top: 500px; }
.house { position: relative; width: min(980px, calc(100vw - 430px)); height: 620px; margin: 20px auto 0; border: 9px solid var(--green); border-top: 0; background: #fff; box-shadow: var(--shadow); }
.roof { position: absolute; z-index: 1; left: -34px; right: -34px; top: -74px; height: 78px; overflow: hidden; }
.roof::before { content: ""; position: absolute; left: 50%; top: 6px; width: 76%; height: 128px; transform: translateX(-50%) rotate(45deg); border: 9px solid var(--green); background: #f3d8e7; border-radius: 5px; }
.roof span { position: absolute; z-index: 2; right: 17%; top: 6px; width: 48px; height: 60px; border: 7px solid var(--green); background: #fff; }
.room { position: absolute; overflow: hidden; border: 4px solid var(--green); background: #fdfcfe; }
.bedroom { left: 0; top: 0; width: 58%; height: 50%; background: #f7f0fa; }
.bathroom { right: 0; top: 0; width: 42%; height: 50%; background: #edf7f2; }
.living { left: 0; bottom: 0; width: 58%; height: 50%; background: #fff8ee; }
.kitchen { right: 0; bottom: 0; width: 42%; height: 50%; background: #f2f7f4; }
.room-name { position: absolute; z-index: 2; left: 14px; top: 11px; color: var(--green); font: 600 23px "Kaiti SC", "STKaiti", serif; }
.room-name small { margin-left: 5px; color: #7d8c85; font: 800 10px "Nunito", sans-serif; text-transform: uppercase; }
.target.target-active { outline: 5px solid rgba(188,232,121,.7); outline-offset: 4px; }
.state-light { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: #b9b2bc; }
[data-state="on"] .state-light, [data-state="open"] .state-light, [data-state="clean"] .state-light { background: #7fd066; box-shadow: 0 0 0 4px rgba(127,208,102,.18); }
.appliance { cursor: pointer; transition: transform .14s ease, filter .14s ease; }
.appliance:hover { transform: translateY(-2px); filter: brightness(1.02); }
.appliance:focus-visible { outline: 4px solid var(--yellow); outline-offset: 3px; }

.window { position: absolute; left: 46%; top: 42px; width: 96px; height: 82px; display: grid; grid-template-columns: 1fr 1fr; border: 7px solid #604c66; background: #cce8f2; }
.window span { border: 2px solid #fff; transform-origin: left; transition: transform .2s ease; }
.window[data-state="closed"] span { transform: scaleX(.08); }
.window .state-light { right: -12px; bottom: -12px; }
.bed { position: absolute; left: 19px; bottom: 21px; width: 190px; height: 94px; border: 6px solid #604c66; border-radius: 10px 10px 4px 4px; background: #d8c0e7; }
.bed .pillow { position: absolute; left: 12px; top: 10px; width: 54px; height: 27px; border-radius: 8px; background: #fff; }
.bed b, .wardrobe b, .sofa b, .coffee-table b, .fridge b, .counter b, .dining-table b, .basket b, .shelf b { position: absolute; left: 50%; bottom: 5px; transform: translateX(-50%); white-space: nowrap; font: 500 16px "Kaiti SC", serif; }
.wardrobe { position: absolute; right: 17px; bottom: 18px; width: 112px; height: 145px; border: 6px solid #604c66; background: #e8d7ca; }
.wardrobe::after { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; border-left: 3px solid #604c66; }
.wardrobe i { position: absolute; z-index: 2; top: 58px; left: 42%; width: 6px; height: 6px; border-radius: 50%; background: #604c66; box-shadow: 18px 0 #604c66; }
.ac { position: absolute; left: 16px; top: 52px; width: 133px; height: 45px; display: grid; place-items: center; border: 4px solid #605766; border-radius: 7px; background: #fff; }
.ac[data-state="on"]::after { content: "≈ ≈ ≈"; position: absolute; top: 38px; color: #79bcd0; font-size: 17px; }
.ac .state-light { right: 8px; top: 8px; }
.ac b { font: 500 15px "Kaiti SC", serif; }

.washer { position: absolute; left: 28px; bottom: 25px; width: 122px; height: 149px; border: 6px solid #56645e; border-radius: 8px; background: #fff; }
.washer-door { position: absolute; left: 24px; top: 39px; width: 64px; height: 64px; border: 8px solid #87978f; border-radius: 50%; background: #bbd8df; }
.washer[data-state="washing"] .washer-door { animation: spin 1.2s linear infinite; background: conic-gradient(#bbd8df,#fff,#bbd8df); }
@keyframes spin { to { transform: rotate(360deg); } }
.washer b { position: absolute; left: 50%; bottom: 5px; transform: translateX(-50%); white-space: nowrap; font: 500 15px "Kaiti SC", serif; }
.washer .state-light { right: 10px; top: 11px; }
.basket { position: absolute; right: 24px; bottom: 28px; width: 112px; height: 72px; border: 6px solid #78645c; border-top-width: 3px; transform: perspective(80px) rotateX(-7deg); background: repeating-linear-gradient(90deg,#ead9bd 0 11px,#caa97f 12px 15px); }
.shelf { position: absolute; right: 26px; top: 58px; width: 140px; height: 47px; border: 5px solid #65535f; background: #e3d3bc; }

.stairs { position: absolute; z-index: 6; left: 54%; top: 238px; width: 95px; height: 145px; transform: translateX(-50%); pointer-events: none; }
.stairs i { display: block; width: 100%; height: 22px; border-top: 5px solid #604c66; border-left: 5px solid #604c66; transform: skewY(-25deg); background: #ecdaf4; }
.door { position: absolute; left: 16px; bottom: 0; width: 78px; height: 176px; border: 7px solid #604c66; transform-origin: left; background: #ddb98a; transition: transform .22s ease; }
.door[data-state="open"] { transform: perspective(260px) rotateY(-55deg); }
.door i { position: absolute; right: 9px; top: 82px; width: 9px; height: 9px; border-radius: 50%; background: #604c66; }
.door b { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); font: 500 17px "Kaiti SC", serif; }
.door .state-light { right: -13px; top: -13px; }
.tv { position: absolute; left: 126px; top: 62px; width: 145px; height: 103px; padding: 8px; border: 7px solid #3f3842; border-radius: 7px; background: #242227; }
.tv .screen { height: 60px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg,#8b6cad,#e6a3c6); font: 500 20px "Kaiti SC", serif; }
.tv[data-state="off"] .screen { color: transparent; background: #161619; }
.tv b { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); color: #fff; font: 500 14px "Kaiti SC", serif; }
.tv .state-light { right: 7px; bottom: 7px; }
.sofa { position: absolute; left: 300px; bottom: 18px; width: 192px; height: 92px; border: 6px solid #604c66; border-radius: 28px 28px 8px 8px; background: #e7a9c8; }
.sofa i { position: absolute; inset: 24px 16px 13px; border-radius: 10px; background: #f2c8dd; }
.coffee-table { position: absolute; left: 322px; top: 111px; width: 145px; height: 47px; border: 6px solid #604c66; background: #dcb987; }
.computer { position: absolute; right: 18px; top: 54px; width: 77px; height: 82px; }
.computer-screen { width: 77px; height: 52px; border: 6px solid #464046; border-radius: 5px; background: #18181a; }
.computer[data-state="on"] .computer-screen { background: linear-gradient(145deg,#bce879,#e7f7d0); }
.computer::after { content: ""; position: absolute; left: 31px; top: 52px; width: 18px; height: 22px; border-bottom: 5px solid #464046; border-left: 5px solid #464046; }
.computer b { position: absolute; left: 50%; bottom: -3px; transform: translateX(-50%); font: 500 14px "Kaiti SC", serif; }
.computer .state-light { right: -4px; top: 45px; }

.fridge { position: absolute; left: 16px; bottom: 18px; width: 105px; height: 190px; border: 6px solid #52635c; border-radius: 7px; background: #dcece6; }
.fridge::after { content: ""; position: absolute; left: 0; right: 0; top: 67px; border-top: 5px solid #52635c; }
.fridge i { position: absolute; right: 10px; top: 29px; width: 5px; height: 26px; border-radius: 4px; background: #52635c; }
.counter { position: absolute; right: 15px; bottom: 17px; width: 170px; height: 80px; border: 6px solid #60564d; background: #dac2a0; }
.dining-table { position: absolute; left: 135px; top: 98px; width: 150px; height: 61px; border: 6px solid #604c66; border-radius: 50%; background: #e0bd8f; }
.lamp { position: absolute; right: 17px; top: 23px; width: 62px; height: 75px; }
.lamp i { display: block; width: 62px; height: 40px; border: 5px solid #5a515b; border-radius: 50% 50% 8px 8px; background: #aaa3ab; }
.lamp[data-state="on"] i { background: var(--yellow); box-shadow: 0 0 35px 14px rgba(255,227,130,.65); }
.lamp b { display: block; text-align: center; font: 500 15px "Kaiti SC", serif; }
.lamp .state-light { right: -3px; top: 38px; }

.avatar { position: absolute; z-index: 12; width: 48px; text-align: center; pointer-events: none; transition: left .25s ease, top .25s ease; }
.avatar span { width: 39px; height: 39px; display: grid; place-items: center; margin: auto; border-radius: 50%; color: #fff; border: 4px solid #fff; font-weight: 800; box-shadow: 0 3px 10px rgba(0,0,0,.18); }
.avatar b { display: block; padding: 2px 4px; border-radius: 4px; color: #fff; background: var(--ink); font-size: 10px; white-space: nowrap; }
.teacher-avatar { left: 44%; top: 485px; }
.teacher-avatar span { background: var(--green); }
.valerie-avatar { left: 49%; top: 485px; }
.valerie-avatar span { background: var(--purple); }
.avatar.active-speaker span { box-shadow: 0 0 0 6px var(--yellow), 0 3px 10px rgba(0,0,0,.18); }

.item { position: absolute; z-index: 20; min-width: 62px; min-height: 56px; padding: 4px 6px 3px; border: 2px solid rgba(67,55,69,.18); border-radius: 8px; color: var(--ink); background: rgba(255,255,255,.92); box-shadow: 0 7px 16px rgba(55,43,60,.15); cursor: grab; touch-action: none; user-select: none; }
.item:active { cursor: grabbing; }
.item.dragging { z-index: 80; transform: scale(1.07); box-shadow: 0 16px 28px rgba(55,43,60,.24); }
.item b { display: block; font: 500 15px "Kaiti SC", serif; }
.chair { left: 16%; top: 493px; }
.chair i { display: block; width: 35px; height: 30px; margin: auto; border: 5px solid #775f4a; border-top: 0; background: #ddb98a; }
.fruit { left: 72%; top: 502px; }
.fruit i { display: inline-block; margin: 1px; color: #df6877; }
.fruit i:nth-child(2) { color: #efb54e; }
.fruit i:nth-child(3) { color: #83b96a; }
.cup { left: 84%; top: 514px; }
.cup i { display: block; width: 27px; height: 29px; margin: auto; border: 5px solid #6f89a1; border-top-width: 3px; border-radius: 3px 3px 8px 8px; }
.clothes { left: 29%; top: 198px; }
.clothes i { display: block; width: 35px; height: 27px; margin: auto; background: var(--pink); clip-path: polygon(18% 0,38% 12%,62% 12%,82% 0,100% 25%,82% 39%,75% 27%,75% 100%,25% 100%,25% 27%,18% 39%,0 25%); }
.clothes[data-clean="true"] i { background: var(--green-light); }
.quilt { left: 43%; top: 518px; }
.quilt i { display: block; width: 43px; height: 28px; margin: auto; border-radius: 5px; background: repeating-linear-gradient(45deg,#b697d0 0 7px,#d8c5e7 7px 14px); }
.book { left: 38%; top: 112px; }
.book i { display: block; width: 37px; height: 29px; margin: auto; border: 4px solid #596f88; border-left-width: 7px; background: #d6e4ef; }
.box { left: 6%; top: 502px; }
.box i { display: block; width: 38px; height: 30px; margin: auto; border: 4px solid #725d47; background: #d7b07c; }
.activity-log { max-width: 980px; margin: 12px auto 0; min-height: 42px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); background: rgba(255,255,255,.8); font-size: 14px; font-weight: 700; }

@media (max-height: 800px) {
  .game-shell { min-height: 650px; }
  .play-area { padding-top: 22px; }
  .house { transform: scale(.9); transform-origin: top center; margin-top: 30px; }
  .activity-log { margin-top: -42px; }
}
