/* Teddy choices fill the available stage; the backdrop belongs to the viewport. */
.scene-hello_teddy {
  min-height: 0;
  height: auto;
  flex: 1;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  padding: clamp(16px, 2.5vw, 30px);
  display: flex;
  flex-direction: column;
  gap: 20px;
  background-position: center;
}
.request-slot { display: flex; justify-content: center; flex: none; position: relative; z-index: 3; }
.teddy-request {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  gap: 12px;
  padding: 10px 22px;
  border: 2px solid #fffdf6;
  border-radius: 25px;
  background: #fffdf3;
  box-shadow: 0 5px 0 #bfa97845;
  position: relative;
  color: #365f55;
}
.teddy-request::after {
  content: '';
  position: absolute;
  bottom: -12px;
  left: calc(50% - 12px);
  border: 12px solid transparent;
  border-top-color: #fffdf3;
  border-bottom: 0;
}
.teddy-request .word-card { padding: 0; min-height: 44px; border-radius: 12px; background: transparent; box-shadow: none; gap: 4px; flex-direction: column; }
.teddy-request .word-card.speaking { background: #fff0c5; transform: none; }
.teddy-request .word-card strong { font-size: clamp(21px, 3.2vw, 34px); line-height: 1.25; overflow-wrap: normal; }
.request-speaker { width: 29px; height: 29px; flex: none; color: #57917c; }
.request-speaker svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2.5; }
.teddy-playfield { grid-template-rows: minmax(0, 1fr); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr); gap: clamp(10px, 2vw, 26px); min-height: 0; flex: 1; width: 100%; max-width: 880px; margin: 0 auto; }
.toy-side { min-height: 0; display: grid; grid-template-rows: repeat(3, minmax(0, 1fr)); gap: clamp(12px, 2vw, 22px); align-items: center; justify-items: center; }
.toy-slot { min-height: 0; width: 100%; height: 100%; max-width: 140px; max-height: 140px; display: grid; place-items: center; }
.teddy-choice {
  width: 100%;
  height: 100%;
  min-height: 66px;
  border: 3px solid #fffdf5;
  border-radius: 28%;
  padding: 6px;
  background: #fffaf0ee;
  box-shadow: 0 6px 0 #aa936542, 0 9px 20px #66593912;
  transition: opacity .25s, transform .25s, visibility .25s;
  touch-action: none;
  cursor: grab;
  -webkit-touch-callout: none;
}
.teddy-choice .object-art { display: block; width: 100%; height: 100%; max-width: 116px; max-height: 116px; margin: auto; }
.teddy-choice:active:not(:disabled) { transform: translateY(4px) scale(.94); box-shadow: 0 2px 0 #aa936542; }
.teddy-choice.gone { opacity: 0; transform: scale(.35) rotate(-12deg); visibility: hidden; pointer-events: none; }
.teddy-choice.given { visibility: hidden; }
.teddy-choice:disabled { cursor: default; }
.teddy-middle { position: relative; min-width: 0; display: grid; align-items: center; align-self: center; justify-self: center; width: 100%; max-width: min(390px, calc(100dvh - 270px)); aspect-ratio: 1; }
.teddy-listen { width: 100%; aspect-ratio: 1; padding: 0; border: 0; border-radius: 44%; background: transparent; z-index: 1; touch-action: manipulation; }
.listening-bear { width: 100%; height: 100%; }
.teddy-listen:active { transform: scale(.98); }
.teddy-rug { position: absolute; left: -9%; right: -9%; top: 68%; height: 19%; border-radius: 50%; background: #dfbe7c7a; box-shadow: inset 0 4px 0 #fff4; }
.teddy-gift { position: absolute; z-index: 2; width: 30%; aspect-ratio: 1; left: 35%; top: 58%; pointer-events: none; filter: drop-shadow(0 4px 3px #71523840); }
.teddy-gift.arriving { animation: teddy-delivery .43s ease-out both; }
.teddy-success { position: absolute; left: -10%; right: -10%; bottom: 0; text-align: center; pointer-events: none; z-index: 2; }
.teddy-success strong { display: inline-block; padding: 8px 16px; border-radius: 22px; background: #fff7dc; color: #48785c; font-size: clamp(18px, 2.8vw, 30px); box-shadow: 0 4px 0 #aa936529; }
.happy-hearts { font-size: clamp(23px, 4vw, 42px); color: #dc8c7e; letter-spacing: 5px; margin-bottom: 4px; animation: teddy-hearts .8s ease-out; text-shadow: 0 2px #fff8; }
.teddy-listen.happy { animation: teddy-happy .65s ease-out 2; }
.teddy-request:focus-visible, .teddy-listen:focus-visible, .teddy-choice:focus-visible { outline: 4px solid #467e73; outline-offset: 4px; }
@keyframes teddy-delivery { from { transform: translate(var(--gift-x), var(--gift-y)) scale(1.4); } to { transform: translate(0, 0) scale(1); } }
@keyframes teddy-happy { 30% { transform: translateY(-12px) rotate(-3deg); } 65% { transform: translateY(-5px) rotate(3deg); } }
@keyframes teddy-hearts { from { opacity: 0; transform: translateY(15px) scale(.6); } to { opacity: 1; transform: none; } }
@media (max-width: 500px) {
  body[data-game="hello_teddy"] .game-shell { gap: 12px; }
  .scene-hello_teddy { padding: 14px 0; gap: 18px; }
  .teddy-playfield { grid-template-columns: minmax(0, 1fr) minmax(0, 1.65fr) minmax(0, 1fr); gap: 6px; }
  .toy-side { gap: 20px; }
  .toy-slot { max-height: 92px; }
  .teddy-choice { border-width: 2px; padding: 3px; min-height: 64px; }
  .teddy-request { padding: 10px 12px; gap: 7px; border-radius: 21px; }
  .teddy-request .word-card strong { font-size: 21px; }
  .request-speaker { width: 23px; height: 23px; }
  .teddy-request .gloss { font-size: 13px; }
  .listening-bear { transform: scale(1.18); }
  .teddy-rug { top: 78%; height: 18%; }
  .teddy-gift { top: 54%; width: 38%; left: 31%; }
  .teddy-success { bottom: -32%; left: -15%; right: -15%; }
  .teddy-success strong { padding: 7px 10px; font-size: 18px; }
  .happy-hearts { font-size: 25px; }
}
@media (max-width: 350px) {
  .teddy-request .word-card strong { font-size: 19px; }
  .scene-hello_teddy { padding-inline: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .teddy-gift.arriving, .teddy-listen.happy, .happy-hearts { animation: none; }
  .teddy-choice { transition: none; }
}

/* The same compressed picture follows the finger and becomes Teddy's gift. */
.teddy-object { object-fit: contain; pointer-events: none; -webkit-user-drag: none; }
.teddy-choice.dragging { opacity: .28; transform: scale(.94); }
.teddy-drag-ghost { position: fixed; z-index: 100; pointer-events: none; transform: translate(-50%, -50%) scale(1.08); filter: drop-shadow(0 10px 8px #59442d40); }
.teddy-drag-ghost .object-art { width: 100%; height: 100%; }
.drag-active .teddy-listen { outline: 3px dashed #fff9; outline-offset: -6px; }
.drag-active .teddy-listen.drop-ready { outline: 5px solid #77bca3; background: #ebffe247; box-shadow: 0 0 24px #fff8; }

/* Keep the whole game visible on short landscape screens as well. */
@media (max-height: 600px) {
  body[data-game="hello_teddy"] .game-shell { gap: 6px; padding-top: max(6px, env(safe-area-inset-top)); padding-bottom: max(6px, env(safe-area-inset-bottom)); }
  .scene-hello_teddy { padding: 4px 8px; gap: 6px; }
  .topbar { grid-template-columns: 44px 1fr 44px; }
  .round-button { width: 44px; height: 44px; }
  .heading h1 { font-size: 18px; }
  .heading p { display: none; }
  .teddy-request { padding: 4px 12px; gap: 8px; border-radius: 18px; }
  .teddy-request .word-card { min-height: 32px; gap: 0; }
  .teddy-request .word-card strong { font-size: 20px; }
  .teddy-request .gloss { font-size: 12px; }
  .request-speaker { width: 23px; height: 23px; }
  .toy-side { gap: 6px; }
  .toy-slot { max-height: 98px; max-width: 110px; }
  .teddy-choice { min-height: 44px; padding: 3px; border-width: 2px; border-radius: 22px; }
  .teddy-middle { max-width: min(300px, calc(100dvh - 210px)); }
  .teddy-success { bottom: -8%; }
  .teddy-success strong { font-size: 18px; padding: 5px 10px; }
  .happy-hearts { font-size: 22px; margin-bottom: 0; }
  .game-shell > .hint { font-size: 12px; padding: 3px 10px; }
}
@media (max-height: 420px) {
  .game-shell > .hint { display: none; }
  .teddy-middle { max-width: min(240px, calc(100dvh - 180px)); }
  .teddy-request .gloss { display: none; }
}
