:root {
  color-scheme: light;
  --blue: #5f8bd9;
  --blue-dark: #4874bd;
  --ink: #34383d;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  display: grid;
  min-height: 100svh;
  place-items: center;
  overflow: hidden;
  background: #dcdee0;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button { font: inherit; }

.player {
  position: relative;
  isolation: isolate;
  width: 960px;
  height: 600px;
  overflow: hidden;
  background: #d8dcde;
  box-shadow: 0 10px 36px rgba(23, 29, 35, 0.18);
}

.background,
.shade {
  position: absolute;
  inset: 0;
}

.background {
  z-index: -4;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.shade {
  z-index: -3;
  background: linear-gradient(90deg, rgba(255,255,255,.10), transparent 62%);
}

.character {
  position: absolute;
  z-index: -2;
  right: -13%;
  bottom: -0.7%;
  width: 69.5%;
  height: 91.5%;
  object-fit: contain;
  object-position: right bottom;
}

.mood {
  position: absolute;
  z-index: 8;
  top: 20px;
  right: 22px;
  display: flex;
  align-items: center;
  gap: 6px;
  width: 153px;
  height: 31px;
}

.mood-face {
  display: grid;
  flex: 0 0 29px;
  width: 29px;
  height: 29px;
  place-items: center;
  border-radius: 50%;
  background: #f7c64b;
  font-size: 17px;
  line-height: 1;
}

.mood-track {
  flex: 1;
  height: 11px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 99px;
  background: rgba(39, 43, 47, .58);
}

.mood-fill {
  display: block;
  width: 39%;
  height: 100%;
  border-radius: inherit;
  transition: width 260ms ease, background-color 260ms ease;
}

.mood-fill.angry { background: #ff681d; }
.mood-fill.unhappy { background: #ff7d28; }
.mood-fill.puzzled { background: #f0a133; }
.mood-fill.normal { background: #e6b73f; }
.mood-fill.happy { background: #81bd56; }

.top-answer {
  position: absolute;
  z-index: 5;
  top: 26px;
  left: 16px;
  display: flex;
  width: 632px;
  min-height: 40px;
  align-items: center;
  gap: 13px;
  padding: 8px 13px;
  border-radius: 10px;
  background: rgba(255,255,255,.63);
  color: rgba(52, 56, 61, .67);
  font-size: 15px;
  line-height: 1.24;
  box-shadow: 0 2px 12px rgba(28,34,40,.06);
}

.top-answer .number,
.reply .number {
  display: grid;
  flex: 0 0 21px;
  width: 21px;
  height: 21px;
  place-items: center;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.top-answer .number { opacity: .73; }

.speech {
  position: absolute;
  z-index: 5;
  top: 118px;
  right: 360px;
  width: max-content;
  max-width: 584px;
  min-width: 110px;
  padding: 11px 16px 12px;
  border-radius: 11px;
  background: rgba(255,255,255,.92);
  color: #30363b;
  font-size: 16px;
  line-height: 1.25;
  box-shadow: 0 4px 18px rgba(31,37,43,.08);
}

.speech::after {
  content: "";
  position: absolute;
  right: -16px;
  bottom: 0;
  width: 0;
  height: 0;
  border-top: 13px solid transparent;
  border-left: 18px solid rgba(255,255,255,.92);
}

.responses {
  position: absolute;
  z-index: 5;
  bottom: 17px;
  left: 16px;
  display: grid;
  width: 632px;
  gap: 6px;
}

.reply {
  display: flex;
  width: 100%;
  min-height: 41px;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border: 0;
  border-radius: 10px;
  background: rgba(255,255,255,.91);
  color: #343a40;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 3px 12px rgba(31,37,43,.08);
  transition: background-color 120ms ease, opacity 120ms ease;
}

.reply:hover { background: #e5edfb; }
.reply.selected { background: #d4e0f4; }
.reply:disabled { cursor: default; }

.message-card {
  position: absolute;
  z-index: 5;
  bottom: 17px;
  left: 16px;
  width: 620px;
  min-height: 196px;
  padding: 34px 40px 28px;
  border-radius: 10px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 7px 24px rgba(28,34,40,.12);
}

.message-card.opening { min-height: 253px; }

.message-card p {
  margin: 0;
  font-size: 20px;
  line-height: 1.42;
}

.message-actions {
  display: flex;
  gap: 10px;
  margin-top: 27px;
}

.primary,
.secondary {
  min-height: 40px;
  padding: 9px 20px;
  border-radius: 9px;
  font-weight: 700;
  cursor: pointer;
}

.primary {
  border: 0;
  background: var(--blue);
  color: #fff;
}

.primary:hover { background: var(--blue-dark); }

.secondary {
  border: 1px solid #b9c0c8;
  background: #fff;
  color: #454c54;
}

.gala-logo {
  position: absolute;
  z-index: 7;
  right: 12px;
  bottom: 12px;
  width: 192px;
  height: auto;
  opacity: .5;
  pointer-events: none;
  user-select: none;
}

.modal {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(34,39,45,.48);
}

.modal-card {
  width: min(510px, 100%);
  padding: 30px 33px 28px;
  border-radius: 10px;
  background: rgba(255,255,255,.98);
  box-shadow: 0 18px 55px rgba(19,25,31,.28);
}

.modal-card h1 {
  margin: 0 0 12px;
  font-size: 27px;
}

.modal-card p {
  margin: 0 0 23px;
  font-size: 16px;
  line-height: 1.45;
}

.modal-actions { display: flex; gap: 10px; }

[hidden] { display: none !important; }

button:focus-visible {
  outline: 3px solid #1d66c9;
  outline-offset: 2px;
}

@media (max-width: 640px) {
  body {
    display: block;
    overflow: hidden;
  }

  .player {
    width: 100vw;
    height: 100dvh;
    min-height: 100svh;
    transform: none !important;
    box-shadow: none;
  }

  .background {
    object-position: 53% center;
  }

  .shade {
    background:
      linear-gradient(180deg, rgba(255,255,255,.17), transparent 31%),
      linear-gradient(0deg, rgba(255,255,255,.12), transparent 42%);
  }

  .character {
    right: auto;
    bottom: 0;
    left: 50%;
    width: 205%;
    height: 87%;
    transform: translateX(-50%);
    object-position: center bottom;
  }

  .mood {
    top: max(12px, env(safe-area-inset-top));
    right: auto;
    left: 12px;
    width: 141px;
  }

  .top-answer {
    display: none !important;
  }

  .speech {
    top: calc(54px + env(safe-area-inset-top));
    right: auto;
    left: 12px;
    width: calc(100% - 58px);
    max-width: none;
    min-width: 0;
    max-height: none;
    overflow: visible;
    font-size: 15px;
  }

  .responses {
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 12px;
    width: auto;
    max-height: 39svh;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }

  .responses.multiple {
    height: 45svh;
    max-height: none;
    grid-auto-rows: max-content;
    align-content: start;
  }

  .responses.long-options {
    height: 45svh;
  }

  .responses.single {
    height: auto;
    max-height: 39svh;
  }

  .reply {
    height: auto;
    min-height: 48px;
    flex-shrink: 0;
    align-items: flex-start;
    padding: 9px 11px;
    background: rgba(255,255,255,.96);
    font-size: 14px;
    line-height: 1.3;
  }

  .reply > span:last-child {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .message-card {
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 12px;
    width: auto;
    min-height: 0;
    max-height: 41svh;
    overflow-y: auto;
    padding: 22px 20px 20px;
  }

  .message-card.opening {
    min-height: 35svh;
  }

  .message-card p {
    font-size: 17px;
    line-height: 1.4;
  }

  .message-actions {
    margin-top: 19px;
  }

  .gala-logo {
    z-index: 7;
    top: max(15px, env(safe-area-inset-top));
    right: 12px;
    bottom: auto;
    width: 96px;
  }

  .modal-card {
    padding: 25px 23px 23px;
  }
}

@media (max-width: 640px) and (max-height: 700px) {
  .speech {
    top: calc(54px + env(safe-area-inset-top));
    max-height: none;
  }

  .responses { max-height: 42svh; }
  .responses.multiple { height: 48svh; }
  .responses.long-options { height: 48svh; }
  .message-card { max-height: 44svh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}
