:root {
  --pink: #FFB6C1;
  --pink-deep: #F48FB1;
  --lavender: #E6E6FA;
  --mint: #B2F5EA;
  --cream: #FFF8F0;
  --sky: #A8D5E5;
  --purple: #C5B4E3;
  --brown: #5D4037;
  --card: rgba(255, 255, 255, 0.92);
  --shadow: 0 12px 40px rgba(93, 64, 55, 0.18);
  --radius: 28px;
  --radius-sm: 18px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  color: var(--brown);
  background: #f5e6f0;
  overflow: hidden;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: background-image 0.6s ease;
}

#app::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,248,240,0.15) 0%, rgba(255,182,193,0.25) 100%);
  pointer-events: none;
  z-index: 0;
}

.screen {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: auto;
}
.screen.active { display: flex; }

.card {
  background: var(--card);
  backdrop-filter: blur(12px);
  border-radius: var(--radius);
  border: 3px solid rgba(255,255,255,0.9);
  box-shadow: var(--shadow);
  padding: 28px 32px;
  max-width: 720px;
  width: 100%;
  animation: popIn 0.45s cubic-bezier(.34,1.56,.64,1);
}

@keyframes popIn {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes bounce {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes starPop {
  0% { transform: scale(0); }
  70% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.title {
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
  color: #6D4C41;
  margin-bottom: 8px;
}
.subtitle {
  text-align: center;
  color: #8D6E63;
  font-size: 1rem;
  margin-bottom: 20px;
  line-height: 1.5;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 14px 28px;
  border-radius: 999px;
  transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
  user-select: none;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-pink {
  background: linear-gradient(135deg, #FFB6C1, #F48FB1);
  color: #5D4037;
  box-shadow: 0 6px 0 #E5739A;
}
.btn-pink:hover { box-shadow: 0 8px 0 #E5739A; }
.btn-pink:active { box-shadow: 0 2px 0 #E5739A; }

.btn-sky {
  background: linear-gradient(135deg, #A8D5E5, #81C7DC);
  color: #37474F;
  box-shadow: 0 6px 0 #64B5C9;
}
.btn-lavender {
  background: linear-gradient(135deg, #E6E6FA, #C5B4E3);
  color: #4A148C;
  box-shadow: 0 6px 0 #B39DDB;
}
.btn-mint {
  background: linear-gradient(135deg, #B2F5EA, #81E6D9);
  color: #234E52;
  box-shadow: 0 6px 0 #4FD1C5;
}
.btn-ghost {
  background: rgba(255,255,255,0.7);
  color: var(--brown);
  border: 2px solid #E0D0C8;
  box-shadow: none;
}

.hero-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.hero-img {
  width: 180px;
  height: 180px;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(0,0,0,0.15));
  animation: bounce 2.5s ease-in-out infinite;
}
.hero-img.sm { width: 100px; height: 100px; animation: none; }
.hero-img.md { width: 130px; height: 130px; }

.topbar {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border-radius: 999px;
  padding: 8px 16px;
  border: 2px solid rgba(255,255,255,0.9);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  font-weight: 700;
  font-size: 0.95rem;
}

.stars { color: #F6C344; }
.progress-bar {
  height: 10px;
  background: rgba(255,255,255,0.6);
  border-radius: 999px;
  overflow: hidden;
  width: 120px;
  border: 1px solid rgba(255,255,255,0.8);
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #FFB6C1, #F6C344);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.stage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin: 18px 0;
}
.stage-card {
  background: rgba(255,255,255,0.85);
  border-radius: var(--radius-sm);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all 0.2s;
  position: relative;
}
.stage-card:hover:not(.locked) {
  border-color: var(--pink);
  transform: translateY(-3px);
}
.stage-card.active-stage {
  border-color: var(--pink-deep);
  box-shadow: 0 0 0 3px rgba(244,143,177,0.35);
}
.stage-card.locked {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.4);
}
.stage-card .lock {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 1.1rem;
}
.stage-card img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  margin: 0 auto 8px;
  display: block;
}
.stage-card h3 { font-size: 0.95rem; margin-bottom: 4px; }
.stage-card p { font-size: 0.75rem; color: #8D6E63; }

.unit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.unit-card {
  background: linear-gradient(160deg, #fff, #FFF0F5);
  border-radius: var(--radius-sm);
  padding: 18px 12px;
  text-align: center;
  cursor: pointer;
  border: 3px solid #FFE4EC;
  transition: all 0.2s;
}
.unit-card:hover {
  border-color: var(--pink-deep);
  transform: scale(1.04);
}
.unit-card .icon { font-size: 2rem; margin-bottom: 6px; }
.unit-card h4 { font-size: 0.95rem; }
.unit-card .stars-earned { font-size: 0.8rem; color: #F6C344; margin-top: 6px; }

.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}
.mode-btn {
  background: #fff;
  border: 3px solid #FFE4EC;
  border-radius: var(--radius-sm);
  padding: 18px 12px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
  font-family: inherit;
}
.mode-btn:hover {
  border-color: var(--pink-deep);
  background: #FFF5F8;
}
.mode-btn .icon { font-size: 1.8rem; display: block; margin-bottom: 6px; }
.mode-btn strong { display: block; font-size: 0.95rem; color: var(--brown); }
.mode-btn span { font-size: 0.75rem; color: #8D6E63; }

.game-area {
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.prompt-box {
  text-align: center;
  width: 100%;
}
.prompt-emoji {
  font-size: 4.5rem;
  line-height: 1;
  margin-bottom: 8px;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1));
}
.prompt-en {
  font-size: 1.8rem;
  font-weight: 800;
  color: #5D4037;
  letter-spacing: 0.5px;
}
.prompt-zh {
  font-size: 1rem;
  color: #8D6E63;
  margin-top: 4px;
}

.speak-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #A8D5E5, #81C7DC);
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 0 #64B5C9;
  transition: transform 0.15s;
}
.speak-btn:hover { transform: scale(1.08); }
.speak-btn:active { transform: scale(0.95); }

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
}
.choice {
  background: #fff;
  border: 3px solid #E8D5CE;
  border-radius: var(--radius-sm);
  padding: 16px 12px;
  font-size: 1.15rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--brown);
}
.choice:hover { border-color: var(--pink); background: #FFF8FA; }
.choice.correct {
  border-color: #66BB6A;
  background: #E8F5E9;
  animation: starPop 0.4s ease;
}
.choice.wrong {
  border-color: #EF5350;
  background: #FFEBEE;
  animation: shake 0.4s ease;
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.word-bank, .sentence-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  width: 100%;
  min-height: 52px;
}
.sentence-slots {
  background: rgba(255,182,193,0.15);
  border: 2px dashed #F48FB1;
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
}
.word-chip {
  background: #fff;
  border: 2px solid #E8D5CE;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  font-family: inherit;
  color: var(--brown);
  transition: all 0.15s;
}
.word-chip:hover { border-color: var(--pink); }
.word-chip.used { opacity: 0.35; pointer-events: none; }
.word-chip.in-slot {
  background: linear-gradient(135deg, #FFE4EC, #E6E6FA);
  border-color: var(--pink-deep);
}

.fill-sentence {
  font-size: 1.35rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.8;
}
.fill-blank {
  display: inline-block;
  min-width: 80px;
  border-bottom: 3px solid var(--pink-deep);
  margin: 0 4px;
  color: var(--pink-deep);
  text-align: center;
}

.feedback {
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  min-height: 28px;
}
.feedback.good { color: #43A047; }
.feedback.bad { color: #E53935; }

.hud-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 8px;
  font-weight: 700;
  font-size: 0.95rem;
}

.result-stars {
  font-size: 2.5rem;
  letter-spacing: 4px;
  animation: starPop 0.6s ease;
  text-align: center;
  margin: 12px 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 18px;
}

.growth-note {
  text-align: center;
  background: linear-gradient(135deg, #FFF0F5, #E6E6FA);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-top: 12px;
  font-size: 0.9rem;
  color: #6D4C41;
}

.footer-hint {
  margin-top: 14px;
  text-align: center;
  font-size: 0.8rem;
  color: #A1887F;
}

@media (max-width: 560px) {
  .card { padding: 20px 16px; }
  .title { font-size: 1.5rem; }
  .hero-img { width: 140px; height: 140px; }
  .choices { grid-template-columns: 1fr; }
  .mode-grid { grid-template-columns: 1fr; }
  .prompt-en { font-size: 1.4rem; }
  .prompt-emoji { font-size: 3.5rem; }
}

.unit-card.locked-unit { cursor: not-allowed; filter: grayscale(0.35); }
.prompt-zh { line-height: 1.5; }

/* ---- 3D Town HUD ---- */
#screen-3dtown { padding: 0; max-width: none; }
.town3d-wrap {
  position: relative;
  width: 100%;
  height: 100vh;
  min-height: 420px;
  border-radius: 18px;
  overflow: hidden;
  background: #ffe8f0;
  box-shadow: 0 10px 30px rgba(244,143,177,0.25);
}
#townCanvas { width: 100%; height: 100%; display: block; touch-action: none; }
.town-hud {
  position: absolute; left: 10px; right: 10px; top: 10px;
  display: flex; flex-direction: column; gap: 6px; pointer-events: none;
}
.town-hud-row { display: flex; gap: 8px; flex-wrap: wrap; pointer-events: auto; }
.btn-sm { padding: 8px 12px; font-size: 0.85rem; }
.town-status, .aff-row {
  background: rgba(255,248,240,0.92);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 0.85rem;
  color: #6d4c41;
  width: fit-content;
  max-width: 100%;
}
.aff-row { display: flex; gap: 14px; flex-wrap: wrap; }
.toast {
  position: absolute; left: 50%; bottom: 120px; transform: translateX(-50%);
  background: rgba(255,255,255,0.95); color: #5d4037; padding: 10px 16px;
  border-radius: 14px; box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  font-weight: 700; z-index: 5; max-width: 90%; text-align: center;
}
.joystick {
  position: absolute; left: 18px; bottom: 18px; width: 110px; height: 110px;
  border-radius: 50%; background: rgba(255,255,255,0.45); border: 2px solid rgba(244,143,177,0.5);
  touch-action: none; z-index: 4;
}
.joystick-stick {
  position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; margin: -24px 0 0 -24px;
  border-radius: 50%; background: #f48fb1; box-shadow: 0 4px 10px rgba(244,143,177,0.5);
}
.btn-interact {
  position: absolute; right: 18px; bottom: 28px; width: 72px; height: 72px; border-radius: 50%;
  border: none; background: linear-gradient(145deg,#f48fb1,#ce93d8); color: #fff;
  font-weight: 800; font-size: 1rem; box-shadow: 0 8px 18px rgba(206,147,216,0.45); z-index: 4;
}
.modal {
  position: fixed; inset: 0; background: rgba(62,39,35,0.35); display: flex;
  align-items: center; justify-content: center; z-index: 50; padding: 16px;
}
.modal[hidden] { display: none !important; }
.modal-card {
  background: #fff8f0; border-radius: 22px; padding: 22px 18px; max-width: 420px; width: 100%;
  box-shadow: 0 16px 40px rgba(0,0,0,0.18); text-align: center;
}
.chat-log {
  text-align: left; background: #fff; border-radius: 14px; padding: 12px; min-height: 120px;
  max-height: 220px; overflow: auto; margin: 10px 0; font-size: 0.95rem; color: #5d4037;
}
.chat-log .bubble { margin: 8px 0; padding: 8px 10px; border-radius: 12px; background: #fce4ec; }
.chat-log .bubble.me { background: #e3f2fd; }
.field { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 10px 0; color: #6d4c41; font-weight: 600; }
.field input, .field select { flex: 1; max-width: 180px; padding: 6px; border-radius: 8px; border: 1px solid #ffcdd2; }

#townCanvas {
  image-rendering: auto;
  -webkit-font-smoothing: antialiased;
}
.town3d-wrap {
  background: #fff0f5;
}

/* bunny mobile touch */
.btn-interact { min-width: 72px; min-height: 72px; touch-action: manipulation; }
.joystick { touch-action: none; -webkit-user-select: none; user-select: none; }
#townCanvas { touch-action: none; -webkit-touch-callout: none; }
.btn, button { touch-action: manipulation; }
@media (hover: none) {
  .btn:hover { filter: none; }
}

/* ---- word card ---- */
.word-card { text-align:center; max-width:420px; }
.word-stage { position:relative; height:170px; display:flex; align-items:center; justify-content:center; background:radial-gradient(circle,#fff6fb 0%,#ffe3ef 70%,transparent 72%); border-radius:20px; margin-bottom:6px; }
.word-pic { max-height:150px; max-width:200px; filter:drop-shadow(0 6px 8px rgba(180,90,130,.25)); }
.word-spark { position:absolute; right:22%; top:8%; font-size:26px; animation:spark 1.4s ease-in-out infinite; }
@keyframes spark { 0%,100%{opacity:.2;transform:scale(.7)} 50%{opacity:1;transform:scale(1.2)} }
.word-ex { font-size:1rem; color:#7a4a63; margin:6px 4px; line-height:1.5; }
.word-sent { font-size:1.05rem; color:#4a3a5a; margin:6px 0; }
.word-sent b { color:#d1497d; font-size:1.2rem; }
.anim-bounce { animation:a-bounce 1s ease-in-out infinite; }
.anim-sleep { animation:a-sleep 2.4s ease-in-out infinite; }
.anim-squish { animation:a-squish 1.2s ease-in-out infinite; }
.anim-glow { animation:a-glow 1.4s ease-in-out infinite; }
.anim-open { animation:a-open 1.6s ease-in-out infinite; transform-origin:left center; }
.anim-sit { animation:a-squish 1.6s ease-in-out infinite; }
.anim-flicker { animation:a-glow .5s steps(2) infinite; }
.anim-wiggle { animation:a-wiggle .9s ease-in-out infinite; }
.anim-shiver { animation:a-wiggle .25s linear infinite; }
.anim-steam { animation:a-bounce 1.6s ease-in-out infinite; }
.anim-tilt { animation:a-tilt 1.6s ease-in-out infinite; transform-origin:bottom center; }
.anim-spin { animation:a-spin 2.2s linear infinite; }
.anim-slidedown { animation:a-slide 1.6s ease-in infinite; }
.anim-swing { animation:a-swing 1.8s ease-in-out infinite; transform-origin:top center; }
.anim-seesaw { animation:a-seesaw 2s ease-in-out infinite; }
@keyframes a-bounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-16px)} }
@keyframes a-sleep { 0%,100%{transform:scale(1)} 50%{transform:scale(1.04) translateY(2px)} }
@keyframes a-squish { 0%,100%{transform:scale(1,1)} 50%{transform:scale(1.08,.9)} }
@keyframes a-glow { 0%,100%{filter:brightness(1) drop-shadow(0 0 0 #ffe9a0)} 50%{filter:brightness(1.25) drop-shadow(0 0 18px #ffe9a0)} }
@keyframes a-open { 0%,100%{transform:perspective(400px) rotateY(0)} 50%{transform:perspective(400px) rotateY(-25deg)} }
@keyframes a-wiggle { 0%,100%{transform:rotate(0)} 25%{transform:rotate(-6deg)} 75%{transform:rotate(6deg)} }
@keyframes a-tilt { 0%,100%{transform:rotate(0)} 50%{transform:rotate(-20deg)} }
@keyframes a-spin { to{transform:rotate(360deg)} }
@keyframes a-slide { 0%{transform:translate(-30px,-20px)} 100%{transform:translate(30px,20px)} }
@keyframes a-swing { 0%,100%{transform:rotate(-14deg)} 50%{transform:rotate(14deg)} }
@keyframes a-seesaw { 0%,100%{transform:rotate(-12deg)} 50%{transform:rotate(12deg)} }

/* ---- shop ---- */
.shop-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; margin:8px 0; }
.shop-item { background:#fff7fb; border:2px solid #ffd3e4; border-radius:14px; padding:6px 2px; cursor:pointer; font-size:.85rem; color:#7a4a63; }
.shop-item img { width:56px; height:56px; object-fit:contain; display:block; margin:0 auto 2px; }
.shop-item:active { transform:scale(.95); }
@media (max-width:420px){ .shop-grid{grid-template-columns:repeat(3,1fr);} }

/* ---- claw ---- */
.claw-box { position:relative; height:230px; background:linear-gradient(#fdf0f7,#f6d9ea); border:4px solid #f19ac0; border-radius:16px; overflow:hidden; margin:8px 0; }
.claw-rail { position:absolute; top:6px; left:6px; right:6px; height:6px; background:#c9a4c0; border-radius:3px; }
.claw { position:absolute; top:6px; left:10%; width:56px; margin-left:-28px; display:flex; flex-direction:column; align-items:center; }
.claw-rope { width:3px; height:20px; background:#888; transition:height .8s ease; }
.claw-hand { display:block; }
.claw-prize { width:50px; height:50px; object-fit:contain; margin-top:-6px; }
.claw-toys { position:absolute; bottom:6px; left:0; right:0; display:flex; flex-wrap:wrap; justify-content:space-around; gap:2px; }
.claw-toys img { width:50px; height:50px; object-fit:contain; }
[hidden]{display:none !important;}

/* dedicated exit button in every room / sub-scene */
.btn-home {
  position: absolute; top: calc(env(safe-area-inset-top, 0px) + 74px); right: 12px; z-index: 7;
  min-height: 52px; min-width: 120px; padding: 10px 18px;
  border: 3px solid #fff; border-radius: 26px;
  background: linear-gradient(145deg,#ffb74d,#f48fb1); color: #fff;
  font-size: 1.1rem; font-weight: 800; letter-spacing: 1px;
  box-shadow: 0 4px 12px rgba(244,143,177,0.45); cursor: pointer;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.btn-home:active { transform: scale(0.95); }
.town3d-wrap:has(#btnTownHome:not([hidden])) .town-hud { right: 140px; }
.toast { pointer-events: none; }

.claw-collection { font-size: .85rem; margin: 6px 0; display:flex; flex-wrap:wrap; align-items:center; gap:4px; justify-content:center; }
.claw-collection img { width: 34px; height: 34px; object-fit: contain; cursor: pointer; }

/* keep the town HUD clear of the global top bar (iPad / landscape) */
.town-hud { top: calc(env(safe-area-inset-top, 0px) + 74px); }
.town-status { max-width: 520px; }
@media (max-width: 560px) {
  .town-hud { top: calc(env(safe-area-inset-top, 0px) + 112px); }
  #btnTownHome { top: calc(env(safe-area-inset-top, 0px) + 112px) !important; }
}
/* ---- supermarket v2 ---- */
.shop-card { max-width:none !important; width:min(760px,96vw); max-height:calc(100dvh - 24px); display:flex; flex-direction:column; overflow:hidden; }
.shop-head { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.shop-head .title { margin:0; }
.cart-btn { position:relative; background:#fff0f6; border:2px solid #ffb3cf; color:#a14a72; min-height:44px; padding:6px 14px; border-radius:22px; font-weight:700; }
.cart-btn.bump { animation:cartBump .35s ease; }
@keyframes cartBump { 50% { transform:scale(1.15); } }
.cart-count { display:inline-block; min-width:22px; height:22px; line-height:22px; border-radius:11px; background:#ff6fa1; color:#fff; font-size:.85rem; text-align:center; margin-left:4px; }
.shop-tabs { display:flex; gap:6px; overflow-x:auto; -webkit-overflow-scrolling:touch; padding:8px 2px; scrollbar-width:none; flex-shrink:0; }
.shop-tabs::-webkit-scrollbar { display:none; }
.shop-tab { flex:0 0 auto; border:2px solid #ffd3e4; background:#fff; color:#7a4a63; border-radius:18px; padding:6px 12px; font-size:.95rem; min-height:40px; white-space:nowrap; }
.shop-tab.on { background:#ff8fb7; border-color:#ff8fb7; color:#fff; font-weight:700; }
#shopAisle { display:flex; flex-direction:column; min-height:0; flex:1; }
#shopAisle .shop-grid { overflow-y:auto; -webkit-overflow-scrolling:touch; max-height:min(52dvh,440px); grid-template-columns:repeat(auto-fill,minmax(104px,1fr)); padding:2px; background:#fdf3ea; border-radius:12px; }
.shop-item { position:relative; display:flex; flex-direction:column; align-items:center; gap:1px; }
.shop-item img { width:60px; height:60px; }
.si-en { color:#5a7fc0; font-size:.9rem; }
.si-p { color:#c08a20; font-size:.85rem; }
.si-q { position:absolute; top:4px; right:6px; background:#ff6fa1; color:#fff; font-style:normal; border-radius:10px; min-width:20px; font-size:.8rem; }
.cart-list { overflow-y:auto; max-height:46dvh; display:flex; flex-direction:column; gap:6px; margin:8px 0; }
.cart-row { display:flex; align-items:center; gap:8px; background:#fff7fb; border:2px solid #ffd3e4; border-radius:14px; padding:4px 8px; }
.cart-row img { width:44px; height:44px; object-fit:contain; }
.cr-name { flex:1; color:#7a4a63; } .cr-name b { color:#5a7fc0; }
.cr-p { color:#c08a20; }
.qty-btn { width:40px; height:40px; border-radius:20px; border:2px solid #ffb3cf; background:#fff; font-size:1.3rem; color:#a14a72; }
.qty { min-width:24px; text-align:center; font-weight:700; }
.cart-total { text-align:center; font-size:1.1rem; color:#7a4a63; font-weight:700; }
.cart-empty { text-align:center; color:#a07; opacity:.7; }
.pay-items { display:flex; flex-wrap:wrap; gap:6px; justify-content:center; margin:6px 0; }
.pi { display:flex; align-items:center; gap:2px; background:#fff7fb; border-radius:10px; padding:2px 6px; color:#c08a20; }
.pi img { width:36px; height:36px; object-fit:contain; }
.pay-q { font-size:1.25rem; text-align:center; color:#5b3a50; font-weight:700; margin:8px 0; }
.pay-choices { display:grid; grid-template-columns:repeat(4,1fr); gap:10px; }
.pay-choice { font-size:1.6rem; min-height:60px; border-radius:16px; border:3px solid #b9dcff; background:#f3f9ff; color:#3b6aa8; font-weight:800; }
.pay-choice.wrong { border-color:#ffc0c0; background:#fff2f2; color:#d99; }
.pay-choice.right { border-color:#7fd69a; background:#eaffef; color:#2f9a55; }
.pay-hint { text-align:center; color:#7a4a63; margin-top:8px; min-height:1.4em; }
.pay-hint .dots { color:#ff8fb7; letter-spacing:2px; font-size:1.1rem; word-break:break-all; }
.pay-teach { margin-top:8px; background:#fffbe8; border-radius:12px; padding:6px; }
@media (max-width:420px){ .pay-choices{grid-template-columns:repeat(2,1fr);} #shopAisle .shop-grid{grid-template-columns:repeat(3,1fr);} }
#modalShop .modal-card.shop-card { max-width:760px !important; width:min(760px,96vw) !important; }
.btn-cart-hud { position:absolute; top:calc(env(safe-area-inset-top,0px) + 134px); right:12px; z-index:7; min-height:52px; min-width:84px; padding:8px 14px; border:3px solid #fff; border-radius:26px; background:linear-gradient(145deg,#81d4fa,#f48fb1); color:#fff; font-size:1.2rem; font-weight:800; box-shadow:0 4px 12px rgba(129,212,250,.45); }
.btn-cart-hud.bump { animation:cartBump .35s ease; }
@media (max-width:560px){ .btn-cart-hud{ top:calc(env(safe-area-inset-top,0px) + 172px); } }
.item-card { max-width:340px !important; }
.item-img { width:120px; height:120px; object-fit:contain; display:block; margin:0 auto; }
.item-zh { font-size:1.4rem; color:#7a4a63; font-weight:700; }
.item-en { font-size:1.7rem; color:#3b6aa8; font-weight:800; }
.item-p { color:#c08a20; margin:4px 0 8px; }
/* 🎤 pronunciation check */
.say-box { position:relative; margin:8px auto 4px; text-align:center; }
.btn-say { min-height:60px; min-width:220px; padding:12px 26px; border:3px solid #fff; border-radius:32px; background:linear-gradient(145deg,#ffd54f,#ff8a65); color:#fff; font-size:1.35rem; font-weight:800; box-shadow:0 5px 14px rgba(255,138,101,.45); cursor:pointer; touch-action:manipulation; }
.btn-say:active { transform:scale(.96); }
.btn-say.listening { background:linear-gradient(145deg,#ef5350,#f48fb1); animation:sayPulse 1s ease-in-out infinite; }
@keyframes sayPulse { 0%,100% { box-shadow:0 0 0 0 rgba(239,83,80,.55); transform:scale(1); } 50% { box-shadow:0 0 0 16px rgba(239,83,80,0); transform:scale(1.06); } }
.say-msg { min-height:1.4em; margin-top:6px; font-size:1.05rem; font-weight:700; color:#7a4a63; }
.say-msg.ok { color:#2e9d5b; font-size:1.25rem; }
.say-msg.bad { color:#d9534f; }
.say-msg.soft { color:#8a6d3b; }
.say-fx { position:absolute; left:50%; top:30px; pointer-events:none; }
.say-fx i { position:absolute; font-style:normal; font-size:1.6rem; animation:sayPop 1.3s ease-out forwards; }
@keyframes sayPop { 0% { transform:translate(0,0) scale(.4); opacity:1; } 100% { transform:translate(var(--dx),var(--dy)) scale(1.2) rotate(200deg); opacity:0; } }
.say-self { display:flex; gap:10px; justify-content:center; margin-top:6px; }
.say-self[hidden] { display:none; }
.say-self .btn { min-height:52px; font-size:1.1rem; }
.say-debug { text-align:left; max-height:180px; overflow:auto; font-size:10px; line-height:1.3; background:#222; color:#9f9; padding:6px; border-radius:8px; white-space:pre-wrap; word-break:break-all; margin-top:6px; }
.tm-ctl { position:absolute; left:50%; transform:translateX(-50%); bottom:calc(env(safe-area-inset-bottom,0px) + 18px); z-index:8; display:flex; gap:10px; }
.tm-ctl[hidden] { display:none; }
.tm-ctl button { min-height:58px; min-width:92px; padding:8px 14px; border:3px solid #fff; border-radius:28px; font-size:1.15rem; font-weight:800; color:#fff; box-shadow:0 4px 12px rgba(0,0,0,.15); touch-action:manipulation; }
#tmSlow { background:linear-gradient(145deg,#81c784,#4db6ac); }
#tmFast { background:linear-gradient(145deg,#ffb74d,#f06292); }
#tmStop { background:linear-gradient(145deg,#90a4ae,#78909c); }
@media (max-width:560px){ .tm-ctl{ bottom:calc(env(safe-area-inset-bottom,0px) + 128px); } .tm-ctl button{ min-width:84px; font-size:1rem; } }
@media (max-width:560px){
  .tm-ctl{bottom:18px !important;gap:5px !important;left:50%;transform:translateX(-50%);}
  .tm-ctl button{white-space:nowrap;padding:8px 9px !important;font-size:13px !important;min-width:0 !important;}
}
body.tm-on #joystickBase, body.tm-on #btnInteract{display:none !important;}

/* collapsible town menu */
.btn-menu { font-weight: 700; }
.town-menu { position: absolute; inset: 0; z-index: 8; background: rgba(80,40,60,0.18); display: flex; align-items: flex-start; justify-content: flex-start; padding: 58px 10px 10px; }
.town-menu[hidden] { display: none; }
.town-menu-card { position: relative; background: #fff8f0; border-radius: 18px; padding: 14px 14px 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.18); max-width: min(420px, 100%); display: flex; flex-direction: column; gap: 8px; }
.town-menu-card .town-status, .town-menu-card .aff-row { background: #ffeef4; margin-right: 30px; }
.town-menu-x { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: #f8bbd0; color: #6d4c41; font-size: 16px; font-weight: 700; }
.town-menu-title { font-weight: 700; color: #b0487a; font-size: 0.95rem; }
.town-menu-dests { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.town-menu-dests button { border: 2px solid #f48fb1; background: #fff; color: #b0487a; border-radius: 14px; padding: 10px 6px; font-size: 1rem; font-weight: 700; }

#nl-badge-frame{display:none!important}

.car-ctl { position:absolute; right:12px; bottom:calc(env(safe-area-inset-bottom,0px) + 112px); z-index:8; display:flex; flex-direction:column; gap:8px; }
.car-ctl[hidden] { display:none; }
.car-ctl button { min-height:48px; min-width:96px; padding:6px 12px; border:3px solid #fff; border-radius:24px; font-size:1rem; font-weight:800; color:#fff; background:linear-gradient(145deg,#ff8a80,#f06292); box-shadow:0 4px 12px rgba(0,0,0,.15); touch-action:manipulation; }
#carOut { background:linear-gradient(145deg,#90a4ae,#78909c); }
#carWord { background:linear-gradient(145deg,#64b5f6,#7986cb); }
#carFast { background:linear-gradient(145deg,#ffb74d,#f06292); }
.bike-ctl button { background:linear-gradient(145deg,#f8bbd0,#ec407a); }
@media (orientation: landscape) and (max-height: 520px) { .btn-home { top: calc(env(safe-area-inset-top, 0px) + 96px); z-index: 40; min-height: 44px; } }

@media (orientation: landscape) and (max-height: 520px) {
  .town-hud { top: calc(env(safe-area-inset-top, 0px) + 92px); left: auto; right: calc(env(safe-area-inset-right,0px) + 12px); }
  .town-hud-row { justify-content: flex-end; }
  .town3d-wrap:has(#btnTownHome:not([hidden])) .town-hud { right: calc(env(safe-area-inset-right,0px) + 12px); }
}
@media (orientation: landscape) and (max-height: 520px) {
  .town-hud, .town3d-wrap:has(#btnTownHome:not([hidden])) .town-hud { left: calc(env(safe-area-inset-left,0px) + 12px); right: auto; top: calc(env(safe-area-inset-top, 0px) + 104px); }
  .town-hud-row { justify-content: flex-start; }
  .btn-home { top: calc(env(safe-area-inset-top,0px) + 100px); min-height: 40px; padding-top: 6px; padding-bottom: 6px; }
}
