:root {
  color-scheme: light;
  --ink: #243049;
  --panel: rgba(255, 255, 255, 0.9);
  --shadow: 0 18px 42px rgba(34, 92, 126, 0.2);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-family: ui-rounded, "SF Pro Rounded", "Comic Sans MS", system-ui, sans-serif;
  background:
    radial-gradient(circle at 14% 16%, rgba(255, 224, 99, 0.75) 0 9%, transparent 9.5%),
    radial-gradient(circle at 86% 14%, rgba(255, 139, 188, 0.54) 0 10%, transparent 10.5%),
    radial-gradient(circle at 82% 86%, rgba(103, 221, 176, 0.58) 0 11%, transparent 11.5%),
    linear-gradient(135deg, #7ee7ff 0%, #ddfbff 38%, #ffc8e2 72%, #fff0a8 100%);
}

button {
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

.game-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 196px;
  gap: 16px;
  width: min(1188px, calc(100vw - 28px));
  height: min(820px, calc(100vh - 28px));
  margin: 14px auto;
}

.stage {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-width: 0;
  overflow: hidden;
  border: 4px solid rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.34)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.38) 0 22px, rgba(255, 255, 255, 0.08) 22px 44px);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  color: white;
  background: #1b8fc9;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.14);
  font-size: 1.8rem;
}

h1 {
  margin: 0;
  font-size: clamp(1.42rem, 2.7vw, 2.25rem);
  line-height: 1;
  letter-spacing: 0;
}

p {
  min-height: 1.3em;
  margin: 4px 0 0;
  color: #2e6790;
  font-size: 1rem;
  font-weight: 850;
}

.meter {
  display: grid;
  grid-template-columns: auto 124px auto;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
  font-weight: 950;
  white-space: nowrap;
}

.meter-track {
  width: 124px;
  height: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: #d2e7ee;
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.12);
}

.meter-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #20b8ff, #35c873, #ffd33d, #ff70ad);
  transition: width 180ms ease;
}

.profile-picker {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 52px;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 10px;
  background: rgba(255, 255, 255, 0.52);
}

.profile-arrow {
  display: grid;
  place-items: center;
  height: 44px;
  border-radius: 8px;
  color: white;
  background: #ff70ad;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.16), 0 4px 0 rgba(45, 44, 70, 0.14);
  font-size: 2rem;
  font-weight: 950;
  line-height: 1;
}

.profile-card {
  display: grid;
  justify-items: center;
  min-width: 0;
  padding: 7px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 -3px 0 rgba(45, 44, 70, 0.08);
}

.profile-card strong,
.profile-card span {
  overflow: hidden;
  max-width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-card strong {
  font-size: 1.05rem;
  font-weight: 950;
}

.profile-card span {
  margin-top: 1px;
  color: #2e6790;
  font-size: 0.82rem;
  font-weight: 850;
}

.play-area {
  position: relative;
  min-height: 0;
}

#showerCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

.splash-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.splash {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--splash-color);
  box-shadow: inset -4px -5px 0 rgba(255, 255, 255, 0.38);
  animation: splash-pop 780ms ease-out forwards;
}

@keyframes splash-pop {
  to {
    opacity: 0;
    transform: translate(var(--splash-x), var(--splash-y)) scale(0.28);
  }
}

.controls {
  display: grid;
  grid-template-rows: auto auto auto;
  align-content: start;
  gap: 12px;
  min-width: 0;
}

.tool-grid,
.wash-targets,
.actions {
  padding: 10px;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.tool-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.tool-button {
  display: grid;
  place-items: center;
  min-height: 68px;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.1), 0 4px 0 rgba(45, 44, 70, 0.16);
  font-weight: 950;
  transition: transform 140ms ease, background 140ms ease;
}

.tool-button span {
  font-size: 1.65rem;
  line-height: 1;
}

.tool-button strong {
  font-size: 0.8rem;
}

.tool-button.active {
  color: white;
  background: #1b8fc9;
  transform: translateY(2px);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18), 0 2px 0 rgba(45, 44, 70, 0.16);
}

.wash-targets,
.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.target-button,
.actions button {
  min-height: 44px;
  border-radius: 8px;
  color: white;
  background: #35c873;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.16), 0 4px 0 rgba(45, 44, 70, 0.14);
  font-weight: 950;
}

.target-button:nth-child(2),
.target-button:nth-child(5) {
  background: #20b8ff;
}

.target-button:nth-child(3),
.actions button:first-child {
  background: #ff70ad;
}

.target-button:nth-child(4),
.actions button:nth-child(2) {
  background: #ff8a3d;
}

.target-button:nth-child(6) {
  background: #6b5cff;
}

@media (max-width: 760px) {
  body {
    overflow: auto;
  }

  .game-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(470px, 1fr) auto;
    width: calc(100vw - 16px);
    height: auto;
    min-height: calc(100vh - 16px);
    margin: 8px auto;
  }

  .stage {
    min-height: 470px;
  }

  .topbar {
    flex-wrap: wrap;
    padding: 9px 10px;
  }

  h1 {
    font-size: clamp(1.16rem, 6vw, 1.55rem);
  }

  p {
    font-size: 0.86rem;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .meter {
    grid-template-columns: auto 84px auto;
  }

  .meter-track {
    width: 84px;
  }

  .profile-picker {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    gap: 7px;
    padding: 7px 8px;
  }

  .profile-arrow {
    height: 40px;
  }

  .profile-card {
    padding: 6px 8px;
  }

  .controls {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .tool-grid,
  .wash-targets {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tool-button {
    min-height: 62px;
  }

  .target-button,
  .actions button {
    min-width: 0;
  }
}
