@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Fraunces:opsz,wght@9..144,500;9..144,600&display=swap');
:root {
  font-family: 'DM Sans', system-ui, sans-serif;
  color: #f8f0de;
  background: #182c32;
  color-scheme: dark;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background:
    radial-gradient(ellipse at 80% 0, #35544788, transparent 60%), #182c32;
  min-height: 100dvh;
}
header {
  max-width: 1200px;
  margin: auto;
  display: flex;
  justify-content: space-between;
  gap: 15px;
  align-items: center;
  padding: 25px 28px;
  font-size: 0.72rem;
  letter-spacing: 0.13em;
}
header a {
  color: #e8c99b;
  text-decoration: none;
}
small {
  font-size: 0.68rem;
  letter-spacing: 0;
  color: #b5c8c4;
  margin-left: 8px;
}
main {
  max-width: 1100px;
  padding: 24px;
  margin: auto;
}
.card {
  max-width: 600px;
  margin: 32px auto;
  padding: 36px;
  border: 1px solid #78938855;
  border-radius: 28px;
  background: #223b3f;
}
.welcome {
  padding: 50px;
  max-width: 700px;
}
h1 {
  font:
    500 clamp(2.6rem, 6vw, 4.6rem)/1.05 'Fraunces',
    Georgia,
    serif;
  letter-spacing: -0.04em;
  margin: 14px 0 24px;
}
h1 em {
  font-style: normal;
  color: #e7bb86;
}
p {
  line-height: 1.7;
  color: #c2d1cb;
}
.eyebrow {
  text-transform: uppercase;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.19em;
  color: #d4b88b;
}
button,
input,
textarea,
select {
  font: inherit;
}
button {
  border: 0;
  background: #eac493;
  color: #243637;
  font-weight: 700;
  padding: 16px 22px;
  border-radius: 13px;
  cursor: pointer;
  min-height: 48px;
}
button:hover {
  filter: brightness(1.08);
}
button:disabled {
  opacity: 0.55;
  cursor: wait;
}
.secondary {
  background: transparent;
  border: 1px solid #7b9990;
  color: #f3e8d4;
}
.plain {
  background: transparent;
  color: #c3d2cc;
  font-weight: 500;
  font-size: 0.85rem;
}
.choices {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 30px 0 20px;
}
.fine {
  font-size: 0.78rem;
  line-height: 1.6;
  color: #adbfba;
}
.text-link {
  color: #e7c395;
  font-size: 0.85rem;
  text-decoration: none;
  display: inline-block;
  margin-top: 8px;
}
label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  margin: 22px 0 9px;
}
input,
textarea,
select {
  width: 100%;
  padding: 15px;
  border: 1px solid #749287;
  border-radius: 12px;
  background: #172f34;
  color: #fff1dc;
}
textarea {
  resize: vertical;
  line-height: 1.5;
}
form > button {
  width: 100%;
  margin-top: 22px;
}
#code {
  font-size: 1.5rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}
h2 {
  font:
    500 1.4rem 'Fraunces',
    Georgia,
    serif;
  margin-top: 32px;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #ffe0a3;
  outline-offset: 4px;
}
[hidden] {
  display: none !important;
}
.stage {
  height: min(72dvh, 740px);
  min-height: 410px;
  position: relative;
  isolation: isolate;
  overflow: clip;
  border-radius: 32px;
  background: linear-gradient(#e5e4c8, #c6d7b0 65%, #9cb99a);
  color: #344e43;
}
.sun {
  position: absolute;
  top: 9%;
  right: 15%;
  width: 95px;
  height: 95px;
  background: #f8e7b0;
  border-radius: 50%;
  box-shadow: 0 0 70px #ffffc866;
}
.hill {
  position: absolute;
  border-radius: 50% 50% 0 0;
  bottom: -120px;
  width: 90%;
  height: 240px;
  z-index: -1;
}
.hill1 {
  left: -20%;
  background: #9eb694;
}
.hill2 {
  right: -25%;
  background: #87a58d;
  bottom: -140px;
}
.spark {
  position: absolute;
  color: #a48152;
  font-size: 2rem;
}
.s1 {
  top: 18%;
  left: 15%;
}
.s2 {
  top: 42%;
  right: 18%;
  font-size: 1.5rem;
}
.bear {
  position: absolute;
  width: min(420px, 68vw, 55dvh);
  bottom: 55px;
  left: 50%;
  transform: translateX(-50%);
  animation: breathe 4s ease-in-out infinite;
}
.bear svg {
  display: block;
  width: 100%;
}
.mouth {
  opacity: 0;
  transform-origin: 210px 237px;
}
.talking .mouth {
  opacity: 1;
  animation: talk 0.22s infinite alternate;
}
.eyes {
  transform-origin: 210px 164px;
  animation: blink 6s infinite;
}
.wave .wave-arm {
  transform-origin: 290px 270px;
  animation: wave 0.65s infinite alternate;
}
.sleepy .eyes {
  transform: scaleY(0.2);
  animation: none;
}
.love::after {
  content: '♡';
  position: absolute;
  right: 0;
  top: 20%;
  font-size: 4rem;
  color: #b66770;
  animation: breathe 1.7s infinite;
}
.bubble {
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 85%;
  max-height: 110px;
  overflow: auto;
  text-align: center;
  background: #fff7e5ed;
  padding: 17px 26px;
  border-radius: 20px;
  font:
    500 clamp(1.1rem, 2.6vw, 1.6rem)/1.35 'Fraunces',
    Georgia,
    serif;
  box-shadow: 0 8px 30px #4f6b4422;
  white-space: pre-wrap;
}
.scene-label {
  position: absolute;
  bottom: 12px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.76rem;
  color: #355b49;
  letter-spacing: 0.1em;
}
.tablet-tools {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin: 16px 0;
}
.tablet-tools span {
  flex: 1;
  min-width: 200px;
  font-size: 0.8rem;
  color: #c3d1c9;
}
.tablet-tools button {
  font-size: 0.78rem;
  padding: 10px 14px;
}
.pairing {
  text-align: center;
  border: 1px dashed #73958a;
  border-radius: 18px;
  padding: 20px;
  font-size: 0.82rem;
  color: #c6d3cc;
}
.pairing strong {
  display: block;
  font-size: 1.9rem;
  letter-spacing: 0.2em;
  color: #f5d39e;
  margin: 10px;
}
.pairing small {
  display: block;
}
.remote-head {
  display: flex;
  gap: 20px;
  align-items: center;
}
.remote-head h1 {
  font-size: 2.6rem;
  margin: 0;
}
.bear-icon {
  font-size: 3rem;
}
.compose-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: #b4c6be;
  margin-top: 6px;
  gap: 10px;
}
.quick {
  display: flex;
  gap: 8px;
  margin-top: 15px;
}
.quick button {
  flex: 1;
  font-size: 0.75rem;
  background: #34514e;
  color: #eed8b7;
  padding: 8px;
}
#history {
  list-style: none;
  padding: 0;
}
#history li {
  border-top: 1px solid #65837755;
  padding: 12px 0;
  color: #e1d7c2;
  font-size: 0.9rem;
  white-space: pre-wrap;
}
#history small {
  display: block;
  margin: 5px 0;
}
.notice {
  max-width: 650px;
  margin: 15px auto;
  color: #ffdbab;
  text-align: center;
}
.stage:fullscreen {
  height: 100dvh;
  border-radius: 0;
}
.stage:fullscreen .bear {
  width: min(600px, 75vw, 72dvh);
}
@keyframes breathe {
  50% {
    transform: translateX(-50%) translateY(-6px);
  }
}
@keyframes blink {
  0%,
  44%,
  48%,
  100% {
    transform: scaleY(1);
  }
  46% {
    transform: scaleY(0.1);
  }
}
@keyframes talk {
  from {
    transform: scaleY(0.4);
  }
  to {
    transform: scaleY(1);
  }
}
@keyframes wave {
  from {
    transform: rotate(-12deg);
  }
  to {
    transform: rotate(-45deg);
  }
}
@media (max-width: 600px) {
  header {
    padding: 20px 18px;
    font-size: 0.62rem;
  }
  header small {
    display: block;
    margin: 5px 0;
  }
  main {
    padding: 8px 14px;
  }
  .card {
    padding: 25px;
    margin: 16px auto;
    border-radius: 22px;
  }
  .welcome {
    padding: 32px 26px;
  }
  .choices {
    flex-direction: column;
  }
  .stage {
    border-radius: 24px;
    height: 68dvh;
  }
  .bear {
    bottom: 45px;
  }
  .bubble {
    font-size: 1.12rem;
    padding: 14px 20px;
  }
  .remote-head h1 {
    font-size: 2.2rem;
  }
  .tablet-tools {
    gap: 8px;
  }
  .pairing strong {
    font-size: 1.5rem;
  }
  .quick {
    flex-wrap: wrap;
  }
}
@media (prefers-reduced-motion: reduce) {
  .bear,
  .eyes,
  .wave .wave-arm,
  .love::after {
    animation: none;
  }
}

.sound-settings {
  border: 1px solid #78938855;
  border-radius: 18px;
  padding: 20px;
  margin: 18px 0;
  background: #223b3f;
}
.sound-settings summary {
  cursor: pointer;
  font-weight: 700;
}
.sound-settings p {
  font-size: 0.85rem;
}
.playback {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}
.playback button {
  flex: 1;
  font-size: 0.8rem;
  padding: 12px;
}
input[type='range'] {
  accent-color: #eac493;
  padding: 8px 0;
  border: 0;
  background: transparent;
  min-height: 40px;
}
output {
  font-variant-numeric: tabular-nums;
}
#speech-progress {
  color: #efd09d;
}

.demo-mode .stage {
  height: 42dvh;
  min-height: 300px;
}
.demo-mode .bear {
  width: min(260px, 45vw, 32dvh);
  bottom: 24px;
}
.demo-mode .scene-label {
  bottom: 0;
}
.demo-mode .bubble {
  top: 12px;
  font-size: 1.1rem;
  max-height: 85px;
}
.demo-mode #remote {
  max-width: 760px;
  margin: 20px auto;
}
.demo-mode .tablet-tools #tablet-status {
  font-size: 0.8rem;
}
/* Alpha 0.3: reactions work independently from the speech queue. */
.reactions {
  border-top: 1px solid #65837755;
  border-bottom: 1px solid #65837755;
  padding: 0 0 12px;
  margin: 20px 0;
}
.reactions h2 {
  margin: 18px 0 8px;
}
.expression-pad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.expression-pad button {
  background: #34514e;
  color: #f2dec0;
  font-size: 0.83rem;
  padding: 12px 8px;
}
.expression-pad button:hover {
  background: #49675b;
}
.sound-option {
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 400;
  font-size: 0.76rem;
  line-height: 1.4;
}
.sound-option input {
  width: 18px;
  height: 18px;
  accent-color: #eac493;
  flex-shrink: 0;
}
.head,
.wave-arm {
  transform-box: view-box;
  transform-origin: 210px 275px;
  transition: transform 0.6s ease;
}
.wave-arm {
  transform-origin: 290px 270px;
}
.head {
  animation: curious-idle 12s ease-in-out infinite;
}
.smile {
  transition: opacity 0.2s;
}
.tongue {
  opacity: 0;
}
.talking .mouth {
  animation: chatter 0.78s ease-in-out infinite;
  opacity: 1;
}
.talking .tongue {
  opacity: 0.8;
}
.talking .smile {
  opacity: 0.35;
}
.talking .head {
  animation: speech-nod 2.5s ease-in-out infinite;
}
.happy .head {
  transform: rotate(-3deg);
}
.wave .wave-arm {
  animation: friendly-wave 0.62s ease-in-out infinite alternate;
}
.wave .head {
  animation: none;
  transform: rotate(-6deg);
}
.tilt .head {
  animation: head-tilt 3.5s ease-in-out infinite;
}
.giggle svg {
  animation: giggle-bounce 0.38s ease-in-out infinite;
}
.giggle .head {
  animation: giggle-head 0.38s ease-in-out infinite;
}
.giggle .eyes {
  animation: none;
  transform: scaleY(0.3);
}
.giggle .mouth {
  opacity: 1;
  animation: chatter 0.36s infinite;
}
.giggle .tongue {
  opacity: 1;
}
.giggle .smile {
  opacity: 0;
}
.sleepy .head {
  animation: sleep-nod 5s ease-in-out infinite;
}
.sleepy .eyes {
  animation: none;
  transform: scaleY(0.12);
}
.sleepy:not(.talking) .mouth {
  opacity: 0.75;
  transform: scale(0.5, 0.9);
}
.sleepy::after {
  content: 'z z z';
  position: absolute;
  right: -10px;
  top: 8%;
  font:
    500 1.5rem Georgia,
    serif;
  color: #53685e;
  animation: dream 3s ease-in-out infinite;
}
.love::after {
  animation: heart-float 2s ease-in-out infinite;
}
.love .head {
  animation: love-tilt 3s ease-in-out infinite;
}
.neutral .head {
  animation: curious-idle 12s ease-in-out infinite;
}
@keyframes chatter {
  0%,
  100% {
    transform: scale(0.65, 0.15);
  }
  15% {
    transform: scale(0.85, 0.85);
  }
  28% {
    transform: scale(1.1, 0.35);
  }
  43% {
    transform: scale(0.75, 1);
  }
  56% {
    transform: scale(0.9, 0.2);
  }
  74% {
    transform: scale(1, 0.7);
  }
  88% {
    transform: scale(0.8, 0.3);
  }
}
@keyframes curious-idle {
  0%,
  45%,
  100% {
    transform: rotate(0);
  }
  55%,
  65% {
    transform: rotate(3deg);
  }
  80% {
    transform: rotate(-2deg);
  }
}
@keyframes speech-nod {
  0%,
  100% {
    transform: rotate(-2deg);
  }
  50% {
    transform: rotate(2deg) translateY(2px);
  }
}
@keyframes friendly-wave {
  from {
    transform: rotate(-18deg);
  }
  to {
    transform: rotate(-65deg);
  }
}
@keyframes head-tilt {
  0%,
  100% {
    transform: rotate(0);
  }
  30%,
  70% {
    transform: rotate(12deg);
  }
}
@keyframes giggle-bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}
@keyframes giggle-head {
  0%,
  100% {
    transform: rotate(-3deg);
  }
  50% {
    transform: rotate(3deg);
  }
}
@keyframes sleep-nod {
  0%,
  100% {
    transform: rotate(5deg) translateY(0);
  }
  55% {
    transform: rotate(9deg) translateY(8px);
  }
}
@keyframes dream {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  45% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-18px);
  }
}
@keyframes heart-float {
  0%,
  100% {
    transform: translateY(0) scale(0.95);
  }
  50% {
    transform: translateY(-12px) scale(1.1);
  }
}
@keyframes love-tilt {
  0%,
  100% {
    transform: rotate(-5deg);
  }
  50% {
    transform: rotate(5deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .bear svg,
  .bear .head,
  .bear .wave-arm,
  .bear .mouth,
  .bear::after {
    animation: none !important;
    transition: none;
  }
  .talking .mouth {
    transform: scaleY(0.6);
  }
}
/* Keep the bear in view while trying reactions in the single-device demo. */
.demo-mode #tablet {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #182c32;
  padding-bottom: 4px;
}
.demo-mode .stage {
  height: 30dvh;
  min-height: 260px;
}
.demo-mode .bear {
  width: min(220px, 34vw, 24dvh);
  bottom: 18px;
}
.demo-mode .tablet-tools {
  margin: 6px 0;
}
.demo-mode .sound-settings {
  margin: 6px 0;
  padding: 10px;
}
.demo-mode #tablet:has(.sound-settings[open]) {
  position: relative;
}

/* Alpha 0.4: one clear composer, with secondary controls tucked away. */
header {
  padding: 18px 24px;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 24px;
}
.ui-picker {
  font-size: 0.64rem;
  letter-spacing: 0.03em;
  margin: 0;
  color: #bdcfc5;
}
.ui-picker select {
  width: auto;
  display: block;
  padding: 6px 24px 6px 10px;
  font-size: 0.78rem;
  margin-top: 4px;
  border-radius: 9px;
}
#remote {
  max-width: 680px;
  padding: 30px;
}
.remote-head h1 {
  font-size: 2.7rem;
}
.remote-head .eyebrow {
  margin: 0 0 8px;
}
.connection {
  background: #31534866;
  border: 1px solid #73978844;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 0.78rem;
  margin: 20px 0;
}
.language-note {
  font-size: 0.72rem;
  margin: 7px 0 18px;
}
.section-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.section-line h2 {
  font:
    600 1.05rem 'DM Sans',
    sans-serif;
  margin: 0;
}
.section-line > span {
  font-size: 0.68rem;
  color: #b6c6bb;
}
.phrase-section {
  background: #334b433d;
  border: 1px solid #73978844;
  border-radius: 16px;
  padding: 16px;
  margin: 18px 0;
}
.phrase-section .quick {
  margin: 12px 0 0;
}
.phrase-section .quick button {
  background: #3c5850;
  border: 1px solid #668b7966;
  font-size: 0.82rem;
  min-height: 46px;
}
.phrase-section .quick button:nth-child(2) {
  background: #644d4b66;
  border-color: #a17a6b55;
}
.phrase-section .quick button:nth-child(3) {
  background: #4c4e6d66;
  border-color: #8584a255;
}
.phrase-section p {
  font-size: 0.7rem;
  margin: 10px 0 0;
}
.voice-details,
.history-panel,
.reactions {
  border: 1px solid #78938844;
  border-radius: 12px;
  padding: 13px 15px;
  margin: 16px 0;
  background: #1b333644;
}
.voice-details summary,
.history-panel summary,
.reactions summary {
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  color: #d8dfcc;
}
.voice-details[open] summary,
.reactions[open] summary {
  margin-bottom: 14px;
}
.send-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  align-items: end;
  gap: 12px;
}
.send-row label {
  margin-top: 12px;
}
.send-row button {
  height: 51px;
}
.playback {
  gap: 8px;
}
.playback button {
  min-height: 40px;
  padding: 9px;
  font-size: 0.75rem;
}
.reactions .expression-pad button {
  min-height: 42px;
  font-size: 0.78rem;
}
.history-panel #history {
  margin-bottom: 0;
}
.demo-link {
  display: block;
  border-top: 1px solid #73978844;
  margin-top: 24px;
  padding-top: 20px;
  color: #eac493;
  font-weight: 600;
  text-decoration: none;
}
.welcome .fine {
  font-size: 0.72rem;
}
#message {
  background: #182e32;
  font-size: 1rem;
  border-color: #8f9b7e77;
  min-height: 106px;
}
.demo-mode #tablet {
  border-radius: 20px;
  box-shadow: 0 12px 24px #10222a55;
}
.demo-mode .stage {
  height: 25dvh;
  min-height: 220px;
}
.demo-mode .bear {
  width: min(180px, 32vw, 20dvh);
}
.demo-mode .tablet-tools .plain {
  display: none;
}
.demo-mode .tablet-tools {
  padding: 4px 8px;
}
.demo-mode .sound-settings {
  font-size: 0.75rem;
}
.demo-mode #remote {
  max-width: 760px;
}
.demo-mode .remote-head {
  display: none;
}
@media (max-width: 600px) {
  header {
    padding: 14px 16px;
  }
  .header-right {
    gap: 12px;
  }
  .header-right > span {
    font-size: 0.58rem;
  }
  .ui-picker select {
    max-width: 118px;
  }
  .ui-picker {
    font-size: 0.6rem;
  }
  #remote {
    padding: 20px;
  }
  .remote-head h1 {
    font-size: 2.2rem;
  }
  .phrase-section {
    padding: 13px;
  }
  .send-row {
    grid-template-columns: 1fr;
  }
  .send-row button {
    width: 100%;
  }
  .demo-mode .stage {
    min-height: 190px;
    height: 24dvh;
  }
  .demo-mode .bear {
    width: min(165px, 34vw, 19dvh);
  }
  .demo-mode .tablet-tools #tablet-status {
    flex-basis: 100%;
    font-size: 0.68rem;
  }
  .demo-mode .tablet-tools {
    gap: 4px;
  }
  .demo-mode .tablet-tools button {
    min-height: 32px;
    padding: 6px 10px;
  }
  .demo-mode .sound-settings {
    display: none;
  }
  .demo-mode .bubble {
    font-size: 0.92rem;
    max-height: 64px;
    padding: 9px 15px;
    top: 8px;
  }
}

.pairing {
  margin: 20px 0;
  padding: 24px;
  background: #223b3f;
}
.pairing h2 {
  margin: 0;
  font-size: 1.4rem;
}
.pairing > p {
  font-size: 0.85rem;
  margin: 10px auto 20px;
  max-width: 480px;
}
.pairing-methods {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
}
.pair-qr {
  width: 210px;
  max-width: 65vw;
  background: white;
  border-radius: 14px;
  padding: 6px;
  flex-shrink: 0;
}
.pair-qr svg {
  display: block;
  width: 100%;
  height: auto;
}
.manual-pair {
  max-width: 100%;
}
.manual-pair strong {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.15em;
  white-space: nowrap;
}
.manual-pair small {
  line-height: 1.6;
}
.pairing #pair-status {
  margin-bottom: 0;
}
@media (max-width: 600px) {
  .pairing {
    padding: 20px 12px;
  }
  .pairing-methods {
    gap: 18px;
  }
  .pair-qr {
    width: 190px;
  }
  .manual-pair strong {
    font-size: 1.4rem;
  }
}

.local-voice-pack {
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid #648d7c66;
  border-radius: 14px;
  background: #648d7c12;
}
.local-voice-pack h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}
.local-voice-pack p {
  margin: 0.5rem 0;
}

/* Alpha 0.5.1: one settings sheet; the main surface is for play. */
.settings-button {
  padding: 9px 14px;
  min-height: 42px;
  font-size: 0.8rem;
  letter-spacing: 0;
}
.header-right {
  gap: 16px;
}
#settings-dialog {
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100dvh - 40px);
  padding: 0 24px 20px;
  border: 1px solid #78938866;
  border-radius: 24px;
  background: #223b3f;
  color: #f8f0de;
  box-shadow: 0 24px 100px #061b25aa;
}
#settings-dialog::backdrop {
  background: #081c25b8;
  backdrop-filter: blur(5px);
}
.settings-heading {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #223b3f;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid #78938844;
}
.settings-heading h2 {
  margin: 0;
  font-size: 1.6rem;
}
.settings-heading button {
  min-height: 42px;
  color: #eac493;
  padding: 8px 14px;
}
.settings-group {
  padding: 18px 0;
  border-bottom: 1px solid #78938833;
}
.settings-group h3 {
  font-size: 1rem;
  margin: 0;
}
.settings-group label:first-child {
  margin-top: 0;
}
#settings-dialog .ui-picker {
  font-size: 0.82rem;
  font-weight: 700;
}
#settings-dialog .ui-picker select {
  width: 100%;
  padding: 12px;
  margin-top: 9px;
  font-size: 0.9rem;
}
#settings-dialog .fine {
  margin: 10px 0 0;
}
#settings-dialog button.secondary {
  margin-top: 16px;
}
#settings-dialog .session-settings {
  border-bottom: 0;
  padding-bottom: 0;
}
#settings-dialog .local-voice-pack {
  margin: 18px 0 0;
  padding: 14px;
}
.local-voice-pack summary {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.6;
}
.receiver-settings,
.controller-settings,
.session-settings {
  display: none;
}
body[data-screen='tablet'] .receiver-settings,
body[data-screen='remote'] .controller-settings,
body[data-screen='tablet'] .session-settings,
body[data-screen='remote'] .session-settings,
.demo-mode .controller-settings {
  display: block;
}
.receiver-end,
.controller-end {
  display: none;
}
body[data-screen='tablet'] .receiver-end,
body[data-screen='remote'] .controller-end,
.demo-mode .controller-end {
  display: inline-block;
}
.demo-mode .receiver-settings.settings-group,
.demo-mode .receiver-only-controls,
.demo-mode .receiver-playback {
  display: none;
}
.receiver-playback {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.receiver-playback > p {
  margin: 0;
}
.spoken-language-row {
  display: flex;
  gap: 16px;
  align-items: center;
  padding-bottom: 4px;
}
.spoken-language-row label {
  flex: 1;
  margin: 0;
  font-size: 0.75rem;
  font-weight: 500;
  color: #bdcfc5;
}
.spoken-language-row select {
  width: auto;
  max-width: 62%;
  padding: 10px 30px 10px 12px;
  font-size: 0.8rem;
}
.phrase-section {
  background: none;
  border: 0;
  padding: 0;
  margin: 18px 0;
}
.section-line > span {
  display: none;
}
.section-line h2 {
  font-size: 0.78rem;
  font-weight: 500;
  color: #bdcfc5;
}
.phrase-section .quick {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.phrase-section .quick button {
  padding: 10px 8px;
}
.compose-meta > span:last-child {
  display: none;
}
.compose-meta {
  justify-content: flex-end;
}
#remote > .playback {
  justify-content: flex-end;
  margin: 10px 0 16px;
}
#remote > .playback button {
  border-color: transparent;
  color: #bdcfc5;
}
.history-panel,
.reactions {
  border-width: 0;
  border-top-width: 1px;
  border-radius: 0;
  background: none;
  padding: 14px 0;
  margin: 0;
}
.connection {
  border: 0;
  background: none;
  padding: 0;
  margin: 0 0 18px;
  color: #b4d3be;
  font-size: 0.72rem;
}
.demo-mode #tablet .tablet-tools {
  position: absolute;
  right: 10px;
  bottom: 8px;
  margin: 0;
  padding: 0;
}
.demo-mode #tablet-status {
  display: none;
}
.demo-mode #tablet .tablet-tools button {
  font-size: 0.68rem;
  min-height: 34px;
  padding: 6px 10px;
  background: #26443d;
}
.demo-mode #tablet {
  padding: 0;
  box-shadow: none;
}
.demo-mode #remote {
  margin: 18px auto 0;
}
@media (min-width: 900px) {
  .demo-mode main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 28px;
    align-items: start;
    max-width: 1200px;
    padding-top: 12px;
  }
  .demo-mode #tablet {
    top: 24px;
  }
  .demo-mode .stage {
    min-height: 460px;
    height: min(73dvh, 660px);
  }
  .demo-mode .bear {
    width: min(310px, 34vw, 42dvh);
    bottom: 40px;
  }
  .demo-mode .bubble {
    font-size: 1.25rem;
  }
  .demo-mode #remote {
    margin: 0;
    padding: 24px;
    border-radius: 24px;
  }
  .demo-mode #notice {
    grid-column: 1 / -1;
  }
}
@media (max-width: 600px) {
  header {
    padding: 12px 16px;
    gap: 8px;
  }
  header a {
    font-size: 0.6rem;
    letter-spacing: 0.06em;
  }
  .header-right {
    gap: 10px;
  }
  .header-right > span small {
    display: block;
    margin-left: 0;
    margin-top: 3px;
  }
  .settings-button {
    font-size: 0.73rem;
    min-height: 42px;
    padding: 8px 12px;
  }
  main {
    padding: 12px;
  }
  .demo-mode #remote {
    padding: 18px;
    margin-top: 14px;
    border-radius: 20px;
  }
  .demo-mode .stage {
    height: 23dvh;
    min-height: 165px;
    border-radius: 22px;
  }
  .demo-mode .bear {
    width: min(150px, 33vw, 18dvh);
    bottom: 17px;
  }
  .demo-mode .scene-label {
    display: none;
  }
  .demo-mode .bubble {
    top: 8px;
    padding: 7px 12px;
    max-height: 50px;
    font-size: 0.85rem;
  }
  .send-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    gap: 8px;
  }
  .send-row label {
    font-size: 0.68rem;
  }
  .send-row select {
    font-size: 0.78rem;
    padding: 12px 8px;
  }
  .send-row button {
    font-size: 0.82rem;
    padding: 12px 10px;
  }
  .phrase-section .quick button {
    font-size: 0.76rem;
  }
  .spoken-language-row {
    gap: 8px;
  }
  .spoken-language-row label {
    font-size: 0.68rem;
  }
  .spoken-language-row select {
    font-size: 0.74rem;
    padding-left: 8px;
  }
  #settings-dialog {
    max-height: calc(100dvh - 20px);
    padding-inline: 20px;
    border-radius: 20px;
  }
  .receiver-playback {
    flex-wrap: wrap;
  }
}

/* Alpha 0.6: touch is play; vertical swipes still scroll on small screens. */
.bear[role='button'] {
  cursor: pointer;
  touch-action: pan-y pinch-zoom;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  border-radius: 40%;
}
.bear[role='button']:focus-visible {
  outline: 3px dashed #395d50;
  outline-offset: 8px;
}
.touch-hint {
  text-align: center;
  font-size: 0.875rem;
  line-height: 1.5;
  margin: 10px 0 4px;
  color: #b9cec3;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
#touch-feedback {
  position: absolute;
  inset: 28% 12% 12%;
  pointer-events: none;
}
#touch-feedback span {
  position: absolute;
  opacity: 0;
  color: #a95567;
  font-size: 2rem;
  left: 18%;
  top: 60%;
}
#touch-feedback span:nth-child(2) {
  left: 72%;
  top: 38%;
  color: #766138;
}
#touch-feedback span:nth-child(3) {
  left: 58%;
  top: 52%;
}
.touch-pop #touch-feedback span {
  animation: touch-float 1.2s ease-out both;
}
.touch-pop #touch-feedback span:nth-child(2) {
  animation-delay: 0.1s;
}
.touch-pop #touch-feedback span:nth-child(3) {
  animation-delay: 0.2s;
}
.touch-pop[data-touch='feet'] .bear svg {
  animation: happy-feet 0.35s ease-in-out 3;
}
@keyframes touch-float {
  0% {
    opacity: 0;
    transform: translateY(8px) scale(0.7);
  }
  25% {
    opacity: 0.9;
  }
  100% {
    opacity: 0;
    transform: translateY(-65px) scale(1.15);
  }
}
@keyframes happy-feet {
  0%,
  100% {
    transform: rotate(-3deg) translateY(0);
  }
  50% {
    transform: rotate(3deg) translateY(-8px);
  }
}
.demo-mode #tablet .tablet-tools {
  bottom: 39px;
}
@media (max-width: 600px) {
  .demo-mode #tablet .tablet-tools {
    bottom: 38px;
  }
  .touch-hint {
    font-size: 0.875rem;
    margin-top: 7px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .touch-pop #touch-feedback span,
  .touch-pop[data-touch='feet'] .bear svg {
    animation: none;
  }
  .touch-pop #touch-feedback span {
    opacity: 0.75;
  }
}

/* Three friends share the same scene, gestures and speech controls. */
#bear > [data-animal-art] {
  display: none;
}
#bear[data-animal='bear'] > [data-animal-art='bear'],
#bear[data-animal='goose'] > [data-animal-art='goose'],
#bear[data-animal='frog'] > [data-animal-art='frog'] {
  display: block;
}
#bear[data-animal='goose'] .mouth {
  transform-origin: 210px 206px;
}
#bear[data-animal='frog'] .mouth {
  transform-origin: 210px 222px;
}
.animal-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.animal-choices button {
  display: grid;
  gap: 6px;
  place-items: center;
  padding: 12px 6px;
  background: #172f34;
  color: #c2d1cb;
  border: 1px solid #78938866;
  font-size: 0.875rem;
  font-weight: 500;
}
.animal-choices button > span:first-child {
  font-size: 2rem;
  line-height: 1.2;
}
.animal-choices button[aria-pressed='true'] {
  background: #eac493;
  color: #243637;
  border-color: #eac493;
  box-shadow: inset 0 0 0 2px #24363733;
}
.touch-pop[data-touch='feet'] #bear[data-animal='goose'] svg {
  animation: goose-waddle 0.4s ease-in-out 3;
}
.touch-pop[data-touch='feet'] #bear[data-animal='frog'] svg {
  animation: frog-hop 0.55s ease-in-out 2;
}
@keyframes goose-waddle {
  0%,
  100% {
    transform: rotate(-6deg);
  }
  50% {
    transform: rotate(6deg) translateY(-3px);
  }
}
@keyframes frog-hop {
  0%,
  100% {
    transform: translateY(0) scale(1.03, 0.97);
  }
  45% {
    transform: translateY(-22px) scale(0.98, 1.03);
  }
}
@media (prefers-reduced-motion: reduce) {
  .touch-pop[data-touch='feet'] #bear[data-animal] svg {
    animation: none;
  }
}

.bear.singing {
  animation: song-sway 1.1s ease-in-out infinite alternate;
}
@keyframes song-sway {
  from {
    transform: rotate(-4deg);
  }
  to {
    transform: rotate(4deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .bear.singing {
    animation: none;
  }
}
