:root {
  color-scheme: light;
  font-family: ui-rounded, "Avenir Next", system-ui, sans-serif;
  font-synthesis: none;
  color: #29355b;
  background: #eef5fd;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
button:focus-visible, input:focus-visible { outline: 3px solid #6654ab; outline-offset: 4px; }
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.cloud-game {
  --cloud-color: #a48bdf;
  --cloud-light: #e0d0ff;
  --cloud-shadow: #7b60bd;
  --main-ink: #29355b;
  --muted-ink: #4c5b7d;
  --primary: #554393;
  min-height: 100svh;
  padding: 0 24px 36px;
  background:
    radial-gradient(ellipse at 50% -18%, #f8fcff 12%, transparent 63%),
    linear-gradient(154deg, #e8f5fd, #f2effc 90%);
}

.game-header, .game-content { max-width: 980px; margin-inline: auto; }
.game-header {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.game-brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  flex: none;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #6251a1;
  background: #f6f0ff;
  border: 1px solid #e7ddf8;
  border-radius: 14px;
}
h1, h2, p { margin: 0; }
.game-brand h1 {
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  font-weight: 760;
  line-height: 1.15;
  letter-spacing: -.045em;
}
.info-button {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid #dce4f0;
  border-radius: 99px;
  background: #ffffffb8;
  color: var(--muted-ink);
  font-weight: 650;
  font-size: .875rem;
}
.info-button:hover { background: white; }
.game-content { display: grid; gap: 14px; }

.sky-scene {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 14px 22px 22px;
  border: 1px solid #cfdff3;
  border-radius: 30px;
  background:
    radial-gradient(ellipse at 50% 45%, #f9fcff 7%, #f1f8ff80 40%, transparent 73%),
    linear-gradient(165deg, #d5ecfc 0%, #e8f0ff 69%, #edf0ff 100%);
}
.sky-glow {
  position: absolute;
  z-index: -1;
  inset: -47% -8% -68%;
  opacity: .68;
  background: repeating-radial-gradient(ellipse at center, transparent 0, transparent 15%, #fff8 15.15%, #fff8 15.3%, transparent 15.45%, transparent 17%);
  transform: scaleY(.85);
  pointer-events: none;
}
.sky-wisp {
  position: absolute;
  z-index: -1;
  height: 52px;
  width: 206px;
  opacity: .72;
  background: #fff;
  border-radius: 100%;
  filter: blur(15px);
  pointer-events: none;
}
.sky-wisp-left { top: 46%; left: -4%; transform: rotate(-13deg); }
.sky-wisp-right { top: 28%; right: -1%; transform: rotate(12deg); }
.chosen-color {
  position: absolute;
  z-index: 1;
  top: 16px;
  right: 17px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid #fff;
  border-radius: 99px;
  color: var(--main-ink);
  background: #fffdf5d9;
  font-size: .875rem;
  font-weight: 720;
}
.chosen-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--cloud-color);
  box-shadow: inset 0 0 0 1px #29355b20;
}

.cloud-space {
  display: grid;
  position: relative;
  place-items: center;
  min-height: 214px;
}
.cloud-floor {
  position: absolute;
  z-index: -1;
  top: 82%;
  width: min(37%, 270px);
  height: 19px;
  border-radius: 50%;
  background: #7788ba29;
  filter: blur(11px);
}
.cloud-character {
  position: relative;
  width: min(348px, 80%);
  aspect-ratio: 1.76;
  animation: float-cloud 7s ease-in-out infinite;
}
.cloud-body { position: absolute; inset: 0; filter: drop-shadow(0 15px 13px #556eac31); }
.cloud-body::before, .cloud-body::after {
  position: absolute;
  inset: 0;
  content: "";
  mask:
    radial-gradient(ellipse closest-side, #000 98%, #0000 100%) 33% 1% / 46% 84% no-repeat,
    radial-gradient(ellipse closest-side, #000 98%, #0000 100%) 77% 40% / 38% 73% no-repeat,
    radial-gradient(ellipse closest-side, #000 98%, #0000 100%) 99% 80% / 31% 53% no-repeat,
    radial-gradient(ellipse closest-side, #000 98%, #0000 100%) 2% 76% / 37% 58% no-repeat,
    radial-gradient(ellipse closest-side, #000 98%, #0000 100%) 50% 98% / 91% 56% no-repeat;
}
.cloud-body::before {
  background:
    radial-gradient(ellipse at 39% 19%, #fff8, transparent 37%),
    radial-gradient(ellipse at 78% 31%, #fff4, transparent 30%),
    linear-gradient(172deg, var(--cloud-light) 10%, var(--cloud-light) 32%, var(--cloud-color) 75%, var(--cloud-shadow) 104%);
}
.cloud-body::after {
  opacity: .55;
  background: radial-gradient(ellipse at 46% 37%, transparent 57%, color-mix(in srgb, var(--cloud-shadow), transparent 55%) 94%);
}
.cloud-face {
  position: absolute;
  z-index: 1;
  top: 51%;
  left: 33%;
  width: 33%;
  height: 19%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16%;
}
.cloud-eye {
  position: relative;
  width: 15%;
  height: 62%;
  border-radius: 50%;
  background: #363655;
  box-shadow: 0 3px 1px #fff5;
}
.cloud-eye::before {
  content: "";
  position: absolute;
  top: 18%;
  left: 26%;
  width: 28%;
  height: 24%;
  border-radius: 50%;
  background: #fff;
}
.cloud-smile {
  align-self: end;
  width: 29%;
  height: 45%;
  border: 0 solid #363655;
  border-bottom-width: clamp(3px, .6vw, 5px);
  border-radius: 0 0 55% 55%;
}
.cloud-cheeks {
  position: absolute;
  left: 22%;
  top: 64%;
  width: 55%;
  height: 11%;
  background:
    radial-gradient(ellipse closest-side, #f783a9b0, #ee7da02f 75%, transparent) left center / 25% 100% no-repeat,
    radial-gradient(ellipse closest-side, #f783a9b0, #ee7da02f 75%, transparent) right center / 25% 100% no-repeat;
}
[data-state="speaking"] .cloud-smile {
  background: #363655;
  border-radius: 46%;
  animation: talk-cloud .87s ease-in-out infinite alternate;
}
[data-state="listening"] .cloud-eye { height: 70%; }
@keyframes float-cloud { 50% { transform: translateY(-7px); } }
@keyframes talk-cloud { from { transform: scaleY(.75); } to { transform: scaleY(1.17); } }

.dialogue-bubbles {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 10px;
  max-width: 650px;
  margin-inline: auto;
}
.reply-bubble, .heard-bubble {
  position: relative;
  width: fit-content;
  max-width: 100%;
  min-width: min(280px, 100%);
  padding: 12px 20px;
  border: 1px solid #d8e3f5;
  border-radius: 18px;
  background: #fff;
  color: var(--main-ink);
  box-shadow: 0 6px 17px #5e74ae10;
}
.reply-bubble { text-align: center; font-weight: 620; font-size: clamp(1rem, 3.5vw, 1.19rem); }
.reply-bubble::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  bottom: calc(100% - 6px);
  left: calc(50% - 7px);
  transform: rotate(45deg);
  background: #fff;
  border-top: 1px solid #d8e3f5;
  border-left: 1px solid #d8e3f5;
}
.reply-bubble p, .heard-bubble p { position: relative; line-height: 1.5; overflow-wrap: anywhere; }
.heard-bubble {
  justify-self: end;
  margin-bottom: 5px;
  padding: 9px 14px 12px;
  border-color: #e2d8f2;
  background: #fbf7ff;
}
.heard-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.heard-heading span { color: #554a75; font-size: .875rem; font-weight: 720; }
.heard-heading button {
  min-height: 36px;
  padding: 0 7px;
  color: #554393;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: .875rem;
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.heard-heading button:hover { background: #ede5fa; }

.talk-panel, .palette-panel {
  border: 1px solid #e0e7f3;
  border-radius: 25px;
  background: #ffffffed;
  box-shadow: 0 7px 25px #596fa60b;
}
.talk-panel {
  display: grid;
  grid-template-columns: minmax(250px, .92fr) minmax(300px, 1.08fr);
  gap: 22px;
  align-items: center;
  padding: 16px 20px;
}
.voice-controls { display: grid; gap: 7px; }
.voice-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 58px; }
.action-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 9px;
  min-height: 50px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 15px;
  font-weight: 735;
  white-space: nowrap;
}
.action-button svg { flex: none; }
.primary-button { color: white; background: #554393; }
.primary-button:hover { background: #493782; }
.talk-button { flex: 0 0 144px; min-height: 58px; }
.play-voice-button { min-width: 134px; }
.secondary-button { color: #51407e; background: #f5effc; border-color: #e6dcf5; }
.secondary-button:hover { background: #eee5fa; }
.voice-status { min-height: 20px; color: var(--muted-ink); font-size: .895rem; line-height: 1.45; }
.setup-panel {
  display: grid;
  gap: 8px;
  margin: 3px 0;
  padding: 9px 12px;
  border: 1px solid #e7ddf4;
  border-radius: 12px;
  color: var(--muted-ink);
  background: #f8f5fc;
  font-size: .895rem;
  line-height: 1.45;
}
.setup-panel progress { width: 100%; height: 7px; accent-color: var(--primary); }
.chat-form { display: flex; align-items: center; gap: 8px; min-width: 0; }
.chat-form input {
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid #d9deed;
  border-radius: 15px;
  color: var(--main-ink);
  background: #f7f9fe;
}
.chat-form input::placeholder { color: #536181; opacity: 1; }
.send-button { color: #394978; background: #e9effd; border-color: #dce6f9; }
.send-button:hover:enabled { background: #dfe8fa; }

.palette-panel { padding: 12px 17px 15px; }
.palette-panel h2 {
  padding: 0 4px;
  margin-bottom: 8px;
  font-size: 1rem;
  font-weight: 740;
}
.palette { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 4px; }
.swatch {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 6px;
  min-width: 0;
  min-height: 69px;
  padding: 4px 0;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--main-ink);
  background: transparent;
  font-weight: 650;
  font-size: .875rem;
  line-height: 1.1;
}
.swatch:hover { background: #f2f5fb; }
.swatch[aria-pressed="true"] { border-color: #e1d7f4; background: #f2ecfc; }
.swatch-dot {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid #29355b30;
  border-radius: 50%;
  background: var(--swatch-color);
  box-shadow: inset 0 3px 0 #fff3;
}
.swatch[aria-pressed="true"] .swatch-dot { outline: 2px solid #675298; outline-offset: 2px; }
.swatch[aria-pressed="true"] .swatch-dot::after {
  width: 11px;
  height: 6px;
  content: "";
  transform: translateY(-1px) rotate(-44deg);
  border: solid #292047;
  border-width: 0 0 2px 2px;
}

.privacy-dialog {
  width: min(520px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  padding: 24px;
  border: 1px solid #e1d9f0;
  border-radius: 23px;
  color: #29355b;
  background: #fff;
  box-shadow: 0 24px 80px #1d294335;
}
.privacy-dialog::backdrop { background: #29355b66; }
.privacy-dialog h2 { font-size: 1.35rem; }
.privacy-dialog p { margin-top: 12px; line-height: 1.55; }
.privacy-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.no-script { padding: 24px; text-align: center; }

@media (max-width: 1020px) {
  .palette { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .cloud-game { padding: 0 12px 24px; }
  .game-header { min-height: 67px; }
  .game-brand { gap: 7px; }
  .brand-mark { width: 34px; height: 34px; border-radius: 11px; }
  .brand-mark svg { width: 21px; height: 21px; }
  .info-button { padding-inline: 9px; gap: 5px; }
  .game-content { gap: 10px; }
  .sky-scene { padding: 23px 12px 15px; border-radius: 23px; }
  .chosen-color { top: 9px; right: 9px; padding: 5px 9px; }
  .cloud-space { min-height: 167px; }
  .cloud-character { width: min(310px, 78%); }
  .cloud-floor { width: 56%; }
  .reply-bubble { padding: 11px 12px; }
  .talk-panel { grid-template-columns: minmax(0, 1fr); gap: 13px; padding: 13px; }
  .palette-panel { padding-inline: 10px; }
  .palette { gap: 3px; }
}

@media (max-width: 520px) {
  .palette { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 420px) {
  .send-button { padding-inline: 11px; gap: 5px; }
  .send-button svg { width: 17px; }
}

@media (max-width: 360px) {
  .game-header { gap: 7px; }
  .game-brand { min-width: 0; gap: 6px; }
  .game-brand h1 { font-size: 1.1rem; overflow-wrap: anywhere; }
  .info-button { padding-inline: 7px; }
  .palette { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .cloud-character, [data-state="speaking"] .cloud-smile { animation: none; }
}
