:root {
  --ui-ink: #2f2f3a;
  --ui-warm: #e95f7c;
  --ui-sky: #79cde8;
  --ui-shadow: 0 20px 46px rgba(16, 19, 32, 0.22);

  --accent-pink: #f11f84;
  --accent-violet: #7f2fff;
  --panel-bg: #f6f6f8;
  --panel-line: #e8b7e8;
  --ink-strong: #4d1a90;
  --ink-soft: #7a33dc;
  --chip-bg: #f5cf27;
  --tool-blue: #0fa3de;
  --tool-fuchsia: #e92897;
  --tool-purple: #8b33ef;
  --tool-orange: #f26f00;
}

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

body {
  font-family: "Baloo 2", "Nunito", "Trebuchet MS", "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #d4e4f8 0%, #ebd9ea 100%);
  overflow: hidden;
}

body::before {
  display: none;
}

#canvas-container {
  position: fixed;
  inset: 0;
  display: block;
}

.hidden {
  display: none !important;
}

#interact-hint {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 42%;
  z-index: 12;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 18px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
  min-width: 44px;
  text-align: center;
}

#interact-hint.hidden {
  display: none;
}

/* Top quest bar */
#ui-top {
  position: fixed;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 24;
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 0 6px;
  box-sizing: border-box;
  pointer-events: none;
}

.quest-card {
  width: min(94vw, 560px);
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid #d8cdee;
  background: #f6f5f9;
  box-shadow: 0 4px 10px rgba(17, 12, 40, 0.14);
  align-items: stretch;
  gap: 10px;
  pointer-events: auto;
}

.quest-head {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

.quest-head > div {
  text-align: center;
}

.quest-orb {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  color: #fff;
  background: linear-gradient(150deg, #7d95ff, #c667ed);
}

.quest-label {
  font-size: 0.88rem;
  line-height: 1;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #9857fb;
}

.quest-main {
  font-size: 1.9rem;
  line-height: 0.95;
  color: #5d2396;
  font-weight: 800;
}

/* Left controls */
#tool-dock {
  position: fixed;
  top: 14px;
  left: 20px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  z-index: 25;
}

.tool-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.tool-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 2px solid rgba(223, 247, 255, 0.9);
  color: #fff;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #30b7ec, #0598d6);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  transition: transform 0.18s ease, filter 0.2s ease;
}

.tool-btn:hover,
.tool-btn:focus-visible {
  transform: translateY(-2px) scale(1.03);
  filter: brightness(1.08);
  outline: none;
}

.tool-btn.friends {
  background: linear-gradient(180deg, #ef4aa6, #d72490);
}

.tool-btn.settings {
  background: linear-gradient(180deg, #a75df8, #8b3eee);
}

.tool-btn.help {
  background: linear-gradient(180deg, #ff8e2f, #ee6e00);
}

.tool-icon {
  font-size: 28px;
  line-height: 1;
  color: #ffffff;
  font-variation-settings: 'FILL' 0, 'wght' 450, 'GRAD' 0, 'opsz' 24;
}

.tool-key {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #d6e8ff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

/* Panels */
#ui-panels {
  position: fixed;
  inset: 0;
  z-index: 23;
  pointer-events: none;
  display: flex;
  justify-content: flex-start;
  padding: 82px 18px 18px;
  box-sizing: border-box;
}

.floating-panel {
  pointer-events: auto;
  width: min(96vw, 580px);
  max-height: calc(100vh - 110px);
  overflow: auto;
  background: var(--panel-bg);
  border: 5px solid #2f9bed;
  border-radius: 30px;
  box-shadow: 0 18px 44px rgba(2, 7, 28, 0.4);
  padding: 18px;
  animation: panelPop 0.22s ease both;
}

#friends-panel {
  border-color: #f16bc6;
}

#settings-panel {
  border-color: #c97cf7;
}

#help-panel,
#weather-panel {
  border-color: #2f9bed;
}

#weather-panel {
  width: min(96vw, 560px);
  border-width: 6px;
  border-radius: 32px;
  padding: 20px;
  background: #f3f4f7;
}

.panel-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.panel-title-row h2 {
  margin: 0;
  font-size: 1.9rem;
  line-height: 1;
  font-weight: 800;
  color: #512495;
}

#weather-panel .panel-title-row {
  margin-bottom: 12px;
}

#weather-panel .panel-title-row h2 {
  color: #5c2499;
}

.panel-close {
  width: 50px;
  height: 50px;
  border: 0;
  border-radius: 50%;
  font-size: 2rem;
  line-height: 1;
  color: #f31f90;
  background: #efd9e8;
  cursor: pointer;
}

#weather-panel .panel-close {
  width: 54px;
  height: 54px;
  font-size: 2.1rem;
  background: #d2e5f4;
  color: #2083cf;
}

.panel-badge {
  margin: 0 0 14px;
  display: inline-block;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 1.1rem;
  color: #6d56b3;
  background: #dcd8eb;
  font-weight: 700;
}

#weather-panel .panel-badge {
  margin: 0 0 16px;
  padding: 8px 20px;
  color: #3364d1;
  background: #d9e7f7;
}

.panel-note {
  margin: 0 0 14px;
  font-size: 1.05rem;
  line-height: 1.3;
  color: #6f20dd;
}

#weather-panel .panel-note {
  margin: 0 0 18px;
  color: #6a1ed5;
}

.weather-options {
  display: grid;
  gap: 14px;
}

.weather-option {
  display: grid;
  grid-template-columns: 92px 1fr;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 20px;
  border: 3px solid #d0d4dc;
  background: #ebeff5;
  text-align: left;
  color: #4f1f96;
  cursor: pointer;
}

.weather-option strong {
  display: block;
  font-size: 1.7rem;
  line-height: 1;
  font-weight: 800;
  color: #56239a;
}

.weather-option small {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  color: #6f20dd;
}

.option-icon {
  width: 72px;
  height: 72px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  font-size: 2.6rem;
  background: #ffb100;
}

.weather-option.active {
  background: #dfe8f3;
  border-color: #58bdf9;
}

.weather-option.locked {
  opacity: 1;
  background: #eef0f4;
  border-color: #d0d4dc;
  cursor: not-allowed;
}

.weather-option.locked .option-icon {
  background: #bcc1cc;
}

.friends-list {
  display: grid;
  gap: 10px;
}

.friend-card {
  display: grid;
  grid-template-columns: 76px 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 18px;
  border: 2px solid #ed9bd2;
  background: #f2ebf3;
}

.friend-card.locked {
  border-color: #d0d1d8;
  background: #ececef;
}

.friend-avatar {
  width: 76px;
  height: 76px;
  border-radius: 16px;
  object-fit: cover;
  background: #c5c8d0;
}

.friend-name {
  margin: 0;
  font-size: 1.5rem;
  color: #592095;
  line-height: 1;
}

.friend-desc {
  margin: 3px 0 0;
  font-size: 1rem;
  color: #6c20d6;
  line-height: 1.25;
}

.friend-weather {
  margin-top: 8px;
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  border: 2px solid #e2c23f;
  background: #f5eabf;
  color: #7d5c25;
  font-size: 0.9rem;
}

.friend-weather.locked {
  border-color: #c7ccd6;
  background: #e0e3ea;
  color: #6b7385;
}

.setting-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 10px;
  border-radius: 16px;
  background: #ece7f2;
}

.setting-row h3 {
  margin: 0;
  color: #5a2398;
  font-size: 1.4rem;
  line-height: 1.1;
}

.setting-row p {
  margin: 4px 0 0;
  color: #7425df;
  font-size: 0.98rem;
  line-height: 1.3;
}

.volume-control {
  display: grid;
  justify-items: end;
  gap: 8px;
  min-width: 180px;
}

.volume-slider {
  width: 180px;
  height: 10px;
  border-radius: 999px;
  border: 2px solid #d1b5f8;
  background: linear-gradient(90deg, #f050a8 0%, #a446ef 52%, #4ea6ff 100%);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.7), 0 2px 8px rgba(74, 34, 120, 0.16);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: transparent;
}

.volume-slider::-webkit-slider-thumb {
  width: 20px;
  height: 20px;
  margin-top: -8px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  background: linear-gradient(140deg, #ef4aa6, #8f45f5);
  box-shadow: 0 2px 8px rgba(66, 25, 110, 0.35);
  appearance: none;
  -webkit-appearance: none;
}

.volume-slider::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  border: none;
  background: transparent;
}

.volume-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  background: linear-gradient(140deg, #ef4aa6, #8f45f5);
  box-shadow: 0 2px 8px rgba(66, 25, 110, 0.35);
}

.volume-value {
  font-size: 0.9rem;
  font-weight: 800;
  color: #5e239f;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid #d5b9fa;
  background: linear-gradient(120deg, #f4e6ff, #ebe3fb);
}

.switch input {
  display: none;
}

.switch span {
  display: block;
  width: 64px;
  height: 38px;
  border-radius: 999px;
  background: #cad0da;
  position: relative;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #fff;
  transition: left 0.2s ease;
}

.switch input:checked + span {
  background: linear-gradient(120deg, #8f45f5, #e740a2);
}

.switch input:checked + span::after {
  left: 30px;
}

.save-settings {
  width: 100%;
  border: 0;
  border-radius: 18px;
  padding: 10px;
  font-size: 1.18rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(120deg, #8f45f5, #ed2c96);
  cursor: pointer;
}

.help-block {
  padding: 12px;
  border-radius: 18px;
  margin-bottom: 10px;
  border: 2px solid #edb3da;
  background: #efe9f4;
}

.help-block h3 {
  margin: 0 0 6px;
  font-size: 1.45rem;
  color: #562094;
  line-height: 1.1;
}

.help-block p {
  margin: 5px 0;
  color: #6d20d7;
  font-size: 1rem;
  line-height: 1.3;
}

.help-block.controls {
  border-color: #8ecff8;
  background: #e3edf8;
}

.help-block.goal {
  border-color: #edb3da;
  background: #efe9f4;
}

.help-block.areas {
  border-color: #e8cc6a;
  background: #f3efdf;
}

.keycap {
  display: inline-block;
  min-width: 62px;
  text-align: center;
  padding: 3px 8px;
  border-radius: 12px;
  border: 2px solid #7fc2f5;
  background: #f4fbff;
  color: #7a29d8;
  font-size: 1.2rem;
  margin-right: 8px;
}

/* Intro overlay */
#blocker {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  /* slightly increased opacity for a stronger white overlay */
  background: linear-gradient(180deg, rgba(215, 232, 247, 0.65), rgba(243, 227, 239, 0.96));
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

#blocker.hidden {
  display: none;
}

.overlay-balloons {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.overlay-balloons .balloon {
  position: absolute;
  width: 56px;
  height: 74px;
  border-radius: 50% 50% 46% 46%;
  top: auto;
  bottom: -90px;
  opacity: 0.8;
  border: 0;
  box-shadow: none;
  animation: riseBalloon linear infinite;
}

.overlay-balloons .balloon::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -10px;
  width: 10px;
  height: 10px;
  background: inherit;
  transform: translateX(-50%) rotate(45deg);
  border-radius: 2px;
}

.overlay-balloons .balloon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 1px;
  height: 72px;
  background: rgba(255, 255, 255, 0.55);
  transform: translateX(-50%);
}

.overlay-balloons .balloon.b1 {
  left: 10%;
  animation-duration: 9.5s;
  animation-delay: -2.2s;
  background: #f893bf;
}

.overlay-balloons .balloon.b2 {
  left: 22%;
  animation-duration: 11.2s;
  animation-delay: -4.6s;
  background: #72d5d0;
}

.overlay-balloons .balloon.b3 {
  left: 70%;
  animation-duration: 10.6s;
  animation-delay: -3.2s;
  background: #f8df7f;
}

.overlay-balloons .balloon.b4 {
  left: 82%;
  animation-duration: 12.8s;
  animation-delay: -1.2s;
  background: #bdc8e5;
}

.overlay-balloons .balloon.b5 {
  left: 55%;
  animation-duration: 10.1s;
  animation-delay: -6.5s;
  background: #9ee2ca;
}

#instructions {
  position: relative;
  z-index: 1;
  width: min(94vw, 760px);
  max-height: none;
  padding: 18px 12px 10px;
  border-radius: 28px;
  color: var(--ui-ink);
  background: transparent;
  border: 0;
  box-shadow: none;
  pointer-events: auto;
  text-align: center;
  overflow: visible;
}

.instructions-view {
  display: grid;
  gap: 12px;
  justify-items: center;
}

.party-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.72;
  background-image:
    radial-gradient(circle at 10% 18%, rgba(239, 96, 175, 0.35) 0 5px, transparent 6px),
    radial-gradient(circle at 82% 14%, rgba(220, 125, 235, 0.4) 0 4px, transparent 5px),
    radial-gradient(circle at 88% 80%, rgba(255, 169, 203, 0.34) 0 6px, transparent 7px),
    radial-gradient(circle at 18% 82%, rgba(235, 166, 220, 0.34) 0 4px, transparent 5px);
}

#start-title {
  display: grid;
  gap: 4px;
  margin: 0;
  font-size: clamp(2.2rem, 7.3vw, 4.4rem);
  line-height: 0.95;
  text-shadow: 0 5px 12px rgba(90, 35, 134, 0.15);
  color: #ff0a82;
}

#start-title span:last-child {
  color: #7e28e6;
}

/* small credit line under the main title */
.title-credit {
  margin: 0;
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  color: #5b2aa8;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.welcome-line {
  margin-top: 12px;
  font-size: clamp(1.2rem, 3.8vw, 2rem);
  color: #a854ff;
  font-weight: 700;
}

.play-action {
  opacity: 0;
  pointer-events: none;
  position: absolute;
  inset: auto auto -9999px -9999px;
}

/* Pause modal */
#pause-overlay {
  position: fixed;
  inset: 0;
  z-index: 41;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 10, 20, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

#pause-overlay.hidden {
  display: none;
}

#pause-modal {
  width: min(92vw, 360px);
  padding: 18px 16px;
  border-radius: 20px;
  border: 2px solid #d8c7ff;
  background: #f6f5f9;
  text-align: center;
  box-shadow: 0 14px 26px rgba(12, 8, 26, 0.28);
}

.pause-title {
  margin: 0;
  font-size: 1.7rem;
  line-height: 1;
  color: #5d2396;
  font-weight: 800;
}

.pause-subtitle {
  margin: 8px 0 0;
  font-size: 1rem;
  font-weight: 700;
  color: #7c43d2;
}

/* Chat bubble */
#chat-bubble {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 2%;
  z-index: 28;
  width: 700px;
  max-width: 1020px;
  padding: 16px 88px;
  border-radius: 54px;
  border: 2px solid #d774ef;
  background: #f4f1f7;
  color: #4f1f99;
  box-shadow: 0 14px 24px rgba(18, 10, 36, 0.24);
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 20px;
  align-items: flex-start;
}

.chat-avatar-wrap {
  width: 100px;
  height: 100px;
  border-radius: 18px;
  background: linear-gradient(145deg, #e15bad, #9c34eb);
  display: grid;
  place-items: center;
  box-shadow: 0 10px 18px rgba(95, 50, 177, 0.28);
}

.chat-avatar {
  width: 88px;
  height: 88px;
  border-radius: 10px;
  object-fit: cover;
}

.chat-body {
  display: grid;
  gap: 10px;
}

.chat-name {
  margin: 0;
  font-size: 2rem;
  line-height: 1;
  color: #5a279f;
  font-weight: 800;
}

.chat-divider {
  width: 80px;
  height: 2px;
  background: #d968f5;
  border-radius: 999px;
}

.chat-text {
  margin: 0;
  font-size: 1.16rem;
  line-height: 1.35;
  color: #5f24af;
}

.chat-continue {
  margin: 5px 0 0;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.04rem;
  font-weight: 700;
  color: #6c2bc1;
}

.chat-key {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 12px;
  background: linear-gradient(120deg, #d852bb, #a844ef);
  color: #fff;
  font-weight: 800;
}

/* Pregame hiding */
body.pregame #ui-top,
body.pregame #tool-dock,
body.pregame #ui-panels {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Animations */
@keyframes riseBalloon {
  0% {
    transform: translateY(0);
  }

  100% {
    transform: translateY(-120vh);
  }
}

@keyframes panelPop {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes hintDrop {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */
@media (max-width: 900px) {
  #tool-dock {
    left: 10px;
    top: 10px;
    gap: 8px;
  }

  .tool-key {
    font-size: 0.68rem;
  }

  .quest-label {
    font-size: 0.95rem;
  }

  .quest-main {
    font-size: 1.45rem;
  }

  .chip-action {
    font-size: 0.92rem;
    padding: 7px 10px;
  }

  .chip-action .material-symbols-rounded {
    font-size: 1.22rem;
  }

  .volume-control {
    min-width: 128px;
  }

  .volume-slider {
    width: 128px;
  }

  .quest-orb {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  #ui-panels {
    padding-top: 70px;
  }

  .floating-panel {
    width: min(97vw, 560px);
    max-height: calc(100vh - 84px);
  }

  .panel-title-row h2 {
    font-size: 2.2rem;
  }

  .panel-close {
    width: 42px;
    height: 42px;
    font-size: 1.4rem;
  }

  .panel-badge {
    font-size: 1rem;
  }

  .panel-note,
  .friend-desc,
  .help-block p,
  .setting-row p,
  .weather-option small {
    font-size: 1.04rem;
  }

  .friend-name,
  .setting-row h3,
  .help-block h3,
  .weather-option strong {
    font-size: 1.5rem;
  }

  .option-icon {
    width: 48px;
    height: 48px;
    font-size: 1.55rem;
    border-radius: 14px;
  }

  #weather-panel .panel-title-row h2 {
    font-size: 2.35rem;
  }

  #weather-panel .panel-badge {
    font-size: 1.15rem;
  }

  #weather-panel .panel-note {
    font-size: 1.18rem;
  }

  #weather-panel .weather-option {
    grid-template-columns: 56px 1fr;
    padding: 10px 12px;
  }

  #weather-panel .weather-option .option-icon {
    width: 46px;
    height: 46px;
    font-size: 1.55rem;
    border-radius: 14px;
  }

  #weather-panel .weather-option strong {
    font-size: 1.85rem;
  }

  #weather-panel .weather-option small {
    font-size: 1.18rem;
  }

  #chat-bubble {
    grid-template-columns: 72px 1fr;
    padding: 16px 16px 14px;
    border-radius: 22px;
    border-width: 4px;
    gap: 12px;
    bottom: 3%;
  }

  .chat-avatar-wrap {
    width: 72px;
    height: 72px;
    border-radius: 14px;
  }

  .chat-avatar {
    width: 42px;
    height: 42px;
  }

  .chat-name {
    font-size: 1.45rem;
  }

  .chat-text {
    font-size: 1rem;
    line-height: 1.35;
  }

  .chat-continue {
    font-size: 0.9rem;
    gap: 8px;
  }

  .chat-key {
    padding: 5px 10px;
  }
}
