:root {
  color-scheme: light;
  font-family: "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif;
  font-synthesis: none;
  color: #fffdf9;
  background: #527da7;
  --ink: #282033;
  --ivory: #fffbf6;
  --gutter: clamp(22px, 4.5vw, 88px);
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible {
  outline: 2px solid #6445a0;
  outline-offset: 3px;
}
.sound-button:focus-visible { outline-color: white; }

.room {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: auto minmax(220px, 1fr) auto;
  min-height: 100vh;
  min-height: 100svh;
  overflow: clip;
  background: #6585ad;
}

.room::before, .room::after {
  position: absolute;
  content: "";
  z-index: -1;
  inset: 0;
  pointer-events: none;
}
.room::before {
  background: url("dream-sky.jpg") center 53% / cover no-repeat;
  filter: saturate(.82);
  animation: sky-drift 125s ease-in-out infinite alternate;
}
@keyframes sky-drift {
  from { transform: scale(1.032) translate(-.5%, .35%); }
  to { transform: scale(1.056) translate(.65%, -.55%); }
}
.room:has(.is-paused)::before { animation-play-state: paused; }
.room::after {
  background:
    radial-gradient(ellipse at 0% 0%, rgba(19,41,83,.65), transparent 62%),
    linear-gradient(180deg, rgba(31,32,70,.12), transparent 44%, rgba(52,38,85,.08) 75%, rgba(37,27,66,.25));
}

.room-header {
  padding: max(clamp(26px, 5vh, 54px), env(safe-area-inset-top)) var(--gutter) 0;
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,252,246,.44);
}

.wordmark {
  margin: 0;
  line-height: 1;
}
.wordmark img {
  display: block;
  width: clamp(174px, 22vw, 292px);
  height: auto;
}
.sound-button {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid #ffffffa6;
  background: rgba(34,30,62,.38);
  color: white;
}
.sound-button:hover { background: rgba(34,30,62,.54); }
.sound-button svg, .send-button svg { display: block; width: 22px; height: 22px; }
.sound-button .sound-on, .sound-button[aria-pressed="true"] .sound-off { display: none; }
.sound-button[aria-pressed="true"] .sound-on { display: inline; }

.description {
  margin: 13px 0 0 2px;
  color: white;
  font-size: clamp(12px, 1vw, 15px);
  font-weight: 500;
  line-height: 1.65;
  letter-spacing: .115em;
  text-shadow: 0 1px 5px #30314e88;
}

.scene {
  position: relative;
  isolation: isolate;
  margin: 0 max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left));
}
.avatars, .phrases { position: absolute; inset: 0; pointer-events: none; }
.avatar {
  position: absolute;
  inset: 0 auto auto 0;
  width: var(--size);
  aspect-ratio: 1;
  translate: -50% -50%;
  will-change: transform;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  appearance: none;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: transparent;
  cursor: grab;
}
.avatar:focus-visible { outline: 3px solid white; box-shadow: 0 0 0 5px #534465; }
.avatar[data-dragging] { z-index: 1; cursor: grabbing; }
.avatar[data-holding] .avatar-frame { animation-play-state: paused; }
.avatar--rabbit { --size: clamp(73px, 7.6vw, 113px); }
.avatar--seal { --size: clamp(82px, 8.8vw, 134px); }
.avatar--cat { --size: clamp(66px, 6.6vw, 102px); }
.avatar--chick { --size: clamp(52px, 4.8vw, 75px); }
.avatar--bear { --size: clamp(58px, 5.5vw, 85px); }
.avatar--personal { --size: clamp(70px, 7vw, 104px); }

.avatar-frame {
  display: block;
  position: relative;
  width: 100%; height: 100%;
  overflow: hidden;
  border: 1px solid #fffc;
  border-radius: 50%;
  background: radial-gradient(circle at 25% 10%, #fffd, #fffa 16%, #fff5 48%, #ebdefc7d 78%, #dfefffaa);
  box-shadow: inset 1px 2px 5px #fff9, inset -2px -3px 6px #c7c0ef55, 0 5px 15px -8px #3c28506b;
}
@keyframes buoyancy {
  0%, 100% { transform: translateY(-3px); }
  50% { transform: translateY(3px); }
}
.avatar-frame { animation: buoyancy var(--bob, 11s) ease-in-out var(--delay, -2s) infinite; }
.avatar--rabbit { --bob: 8.7s; --delay: -4s; }
.avatar--seal { --bob: 13s; --delay: -6.4s; }
.avatar--cat { --bob: 10.4s; --delay: -1.6s; }
.avatar--chick { --bob: 7.9s; --delay: -2.9s; }
.avatar--bear { --bob: 12.3s; --delay: -8s; }
.is-paused .avatar-frame { animation-play-state: paused; }
.avatar-frame::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  background: radial-gradient(ellipse at 27% 12%, #fffb, transparent 14%),
    radial-gradient(ellipse at 68% 95%, #fbe9ffa1, transparent 19%);
}
.avatar-art { display: block; width: 100%; height: 100%; }

.bubble {
  position: absolute;
  inset: var(--y) auto auto var(--x);
  translate: -50% -50%;
  width: max-content;
  max-width: min(252px, 76%);
  padding: 10px 19px;
  border: 1px solid rgba(255,255,255,.74);
  border-radius: 26px 29px 25px 28px;
  background: var(--fill, #fff9f4e8);
  color: #3c3146;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: clamp(14px, 1.18vw, 18px);
  font-weight: 600;
  line-height: 1.52;
  letter-spacing: .055em;
  overflow-wrap: anywhere;
  text-wrap: balance;
  box-shadow: 0 4px 14px -8px #59436550;
  opacity: 0;
}
.bubble[data-tint="sky"] { --fill: #f4fbffed; }
.bubble[data-tint="lilac"] { --fill: #fcf6ffeb; }
.bubble.is-floating { animation: surface var(--lifetime) linear both; }
.is-paused .bubble.is-floating { animation-play-state: paused; }
@keyframes surface {
  0% { opacity: 0; filter: blur(5px); transform: translateY(12px) scale(.97); }
  23% { opacity: 1; filter: blur(0); transform: translateY(2px) scale(1); }
  65% { opacity: 1; filter: blur(0); transform: translateY(-5px) scale(1); }
  100% { opacity: 0; filter: blur(4px); transform: translateY(-20px) scale(1.015); }
}

.room-footer {
  position: relative;
  z-index: 1;
  width: min(466px, calc(100% - 36px));
  margin: 12px auto max(clamp(20px, 4.2vh, 46px), env(safe-area-inset-bottom));
}
.composer {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 1px solid #fff;
  border-radius: 99px;
  color: var(--ink);
  background: #fffcfaf7;
  box-shadow: 0 9px 28px -10px rgba(57,34,71,.36);
}
.image-button, .send-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  gap: 8px;
  min-width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .025em;
}
.image-button { color: #3c3342; background: transparent; padding: 0 12px; }
.image-button:hover { background: #eee6f3; }
.image-button .avatar-art { width: 22px; height: 22px; border-radius: 50%; }
.input-divider { height: 21px; width: 1px; flex: none; background: #56425b33; }
.phrase-input {
  flex: 1; min-width: 0; width: 100%; height: 44px;
  padding: 0 7px;
  border: 0; border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
}
.phrase-input::placeholder { color: #75687c; font-size: 13px; }
.send-button { width: 44px; padding: 0; background: var(--ink); color: white; }
.send-button:hover:not(:disabled) { background: #573e62; }
.send-button:disabled { background: #483c50; color: #fff; cursor: default; }

.picture-icon {
  position: relative; width: 18px; height: 16px; flex: none;
  border: 1.5px solid currentColor; border-radius: 4px; overflow: hidden;
}
.picture-icon::before, .picture-icon::after { content: ""; position: absolute; }
.picture-icon::before { width: 3px; height: 3px; border-radius: 50%; left: 3px; top: 2px; background: currentColor; }
.picture-icon::after {
  width: 10px; height: 10px; right: 0; bottom: -6px;
  border: 1.5px solid currentColor; border-radius: 2px; transform: rotate(-45deg);
}

.room-status {
  position: absolute;
  left: 50%; bottom: calc(100% + 8px);
  translate: -50% 0;
  width: max-content; max-width: 100%;
  margin: 0; padding: 6px 12px;
  border-radius: 12px;
  background: #fffcf6f2; color: var(--ink);
  font-size: 12px; text-align: center;
}
.room-status:empty { display: none; }

@media (max-width: 640px) {
  .room { grid-template-rows: auto minmax(238px, 1fr) auto; }
  .room::before { background-position: 53% center; }
  .room::after {
    background: linear-gradient(155deg, #243f65a8, transparent 49%),
      linear-gradient(0deg, #4336624d, transparent 33%);
  }
  .room-header { padding-top: max(14px, env(safe-area-inset-top)); }
  .masthead { padding-bottom: 8px; }
  .description { font-size: 11px; margin-top: 9px; letter-spacing: .05em; }
  .room-footer { margin-top: 6px; }
  .bubble { padding: 8px 13px; max-width: min(216px, 72%); font-size: 13px; }
  .avatar--rabbit { --size: 66px; }
  .avatar--seal { --size: 74px; }
  .avatar--cat { --size: 58px; }
  .avatar--chick { --size: 46px; }
  .avatar--bear { --size: 50px; }
  .avatar--personal { --size: 63px; }
  .image-button { padding-inline: 9px; }
}

@media (max-width: 390px) {
  .image-button { gap: 6px; margin-inline: 4px; }
  .image-button, .send-button { padding: 0; }
}
@media (max-width: 355px) {
  .image-label { display: none; }
  .image-button { margin: 0; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .room { grid-template-rows: auto minmax(152px, 1fr) auto; }
  .room-header { padding-top: 8px; }
  .masthead { padding-bottom: 3px; }
  .wordmark img { width: 146px; }
  .description { margin-top: 3px; font-size: 11px; }
  .room-footer { margin: 4px auto max(7px, env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  .avatar { will-change: auto; }
  .room::before, .avatar-frame { animation: none; }
  .bubble.is-floating { animation-name: quiet-surface; }
}
@keyframes quiet-surface {
  0%, 100% { opacity: 0; }
  18%, 72% { opacity: 1; }
}

.header-tools { display: flex; align-items: center; gap: 8px; }
.camera-button {
  width: 44px; height: 44px; padding: 11px; display: grid; place-items: center;
  color: white; background: #28243b48; border: 1px solid #ffffff9c; border-radius: 50%;
}
.camera-button svg { width: 21px; height: 21px; }
.image-button {
  padding: 0; margin: 0; width: 44px; height: 44px; overflow: hidden;
  color: #514754; background: #eeeaf0; font-size: 25px; font-weight: 400; line-height: 1;
}
.image-button .avatar-art { width: 100%; height: 100%; object-fit: cover; }
.fine-print {
  width: fit-content; max-width: 100%; margin: 7px auto 0; padding: 0 5px 0 14px;
  display: flex; align-items: center; gap: 2px; border-radius: 18px;
  background: #312741bd; color: #fffdf8; font-size: 11px; line-height: 1.55;
}
.info-button {
  padding: 0; width: 32px; min-height: 32px; flex: none; color: inherit;
  background: transparent; border: 0; font: italic 17px Georgia, serif;
}
dialog {
  position: fixed; inset: auto 0 max(24px, env(safe-area-inset-bottom)) 0;
  width: min(362px,calc(100% - 28px)); max-height: calc(100dvh - 28px);
  margin: auto; padding: 26px 24px 22px; overflow-y: auto;
  border: 1px solid #fff9; border-radius: 25px; color: #3a3342;
  background: #fffaf8; box-shadow: 0 12px 50px -20px #30274180;
}
dialog::backdrop { background: #20192e46; }
dialog h2 { margin: 0 38px 17px 0; font-size: 18px; font-weight: 600; letter-spacing: .04em; }
dialog p { font-size: 13px; line-height: 1.8; }
.close-dialog {
  position: absolute; top: 8px; right: 8px; width: 44px; height: 44px;
  padding: 0; border: none; border-radius: 50%; color: #6b606f; background: transparent; font-size: 22px;
}
.animal-label { margin-bottom: 7px; color: #665b69; }
.animal-choices { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 20px; }
.animal-choices button {
  width: clamp(44px,12vw,54px); height: clamp(44px,12vw,54px); overflow: hidden;
  border: 1px solid #ddd2e1; border-radius: 50%; background: #f0e8f3; padding: 1px;
}
.animal-choices button[aria-pressed="true"] { outline: 2px solid #705778; outline-offset: 1px; }
.panel-action, .subtle-action {
  width: 100%; min-height: 44px; padding: 10px; border: 0; border-radius: 17px;
  font-size: 14px; line-height: 1.5; text-align: center; text-decoration: none;
}
.panel-action { display: block; background: #eae3ed; color: #45334e; }
.subtle-action { color: #6d586e; background: transparent; }
.member-status { margin: 10px 0 0; }
.member-status:empty { display: none; }
#photo-dialog { inset: 0; height: fit-content; }
.souvenir { width: 100%; border-radius: 12px; margin-bottom: 12px; display: block; }
@media (max-width: 410px) {
  .fine-print { font-size: 11px; }
  .fine-print span { text-wrap: balance; }
  .room-footer { margin-bottom: max(10px,env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: no-preference) {
  .avatar--personal { animation: arrive .8s ease-out both; }
  @keyframes arrive { from { opacity: 0; } to { opacity: 1; } }
}
