:root {
  color-scheme: light;
  --ink: #202029;
  --panel: rgba(255, 255, 255, 0.9);
  --shadow: 0 18px 42px rgba(38, 36, 70, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  font-family: ui-rounded, "SF Pro Rounded", "Comic Sans MS", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 16%, rgba(255, 210, 63, 0.8) 0 9%, transparent 9.5%),
    radial-gradient(circle at 88% 10%, rgba(53, 183, 255, 0.68) 0 11%, transparent 11.5%),
    radial-gradient(circle at 84% 88%, rgba(141, 222, 99, 0.58) 0 10%, transparent 10.5%),
    linear-gradient(135deg, #ffe772 0%, #ff8ca8 36%, #73ddf8 70%, #91e777 100%);
}

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

.game-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 188px;
  gap: 16px;
  width: min(1180px, 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;
  border: 4px solid rgba(255, 255, 255, 0.88);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.36)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.32) 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.66);
  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;
  font-size: 28px;
  background: #ef4d7a;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.12);
}

h1 {
  margin: 0;
  font-size: clamp(1.45rem, 3vw, 2.3rem);
  line-height: 1;
}

p {
  margin: 4px 0 0;
  min-height: 1.3em;
  font-size: 1rem;
  font-weight: 800;
  color: #6a3c7d;
}

.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.78);
  font-weight: 900;
  white-space: nowrap;
}

.meter-track {
  width: 124px;
  height: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: #d8e7f1;
  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, #2fc5ff, #8dde63, #ffd23f, #ff5c8a);
  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.5);
}

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

.profile-card {
  display: grid;
  justify-items: center;
  min-width: 0;
  padding: 7px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
  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: #6a3c7d;
  font-size: 0.82rem;
  font-weight: 850;
}

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

#salonCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: none;
  touch-action: none;
}

.floating-bits {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.bit {
  position: absolute;
  width: 12px;
  height: 5px;
  border-radius: 999px;
  animation: tumble 900ms ease-out forwards;
}

@keyframes tumble {
  to {
    transform: translate(var(--x), 120px) rotate(430deg);
    opacity: 0;
  }
}

.controls {
  display: grid;
  grid-template-rows: auto auto auto auto 1fr;
  gap: 12px;
  min-width: 0;
}

.control-group,
.swatches,
.style-pad,
.accessories,
.actions {
  padding: 10px;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

.tool-button {
  display: grid;
  place-items: center;
  min-height: 74px;
  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: 2rem;
  line-height: 1;
}

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

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

.swatches {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.swatch {
  aspect-ratio: 1;
  min-width: 0;
  border-radius: 8px;
  background: var(--swatch);
  border: 4px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 0 rgba(45, 44, 70, 0.16);
}

.swatch.active {
  outline: 4px solid #202029;
  outline-offset: 2px;
}

.style-pad,
.accessories,
.actions {
  display: grid;
  gap: 9px;
}

.style-pad,
.accessories {
  grid-template-columns: 1fr 1fr;
}

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

.style-pad button:nth-child(2) {
  background: #00a880;
}

.style-pad button:nth-child(3) {
  background: #f06449;
}

.style-pad button:nth-child(4) {
  background: #247ba0;
}

.accessories button {
  background: #d94f90;
  touch-action: none;
  user-select: none;
}

.accessories button:nth-child(2) {
  background: #2a85ff;
}

.actions {
  align-content: end;
}

.actions button {
  background: #ef4d7a;
}

.actions button:nth-child(2) {
  background: #364156;
}

.accessory-ghost {
  position: fixed;
  z-index: 20;
  display: grid;
  place-items: center;
  width: 88px;
  height: 44px;
  border-radius: 8px;
  color: white;
  font-size: 0.9rem;
  font-weight: 950;
  pointer-events: none;
  transform: translate(-50%, -50%) rotate(-8deg);
  box-shadow: 0 12px 26px rgba(32, 32, 41, 0.24), inset 0 -5px 0 rgba(0, 0, 0, 0.16);
}

.accessory-ghost.clip {
  background: #d94f90;
}

.accessory-ghost.tie {
  background: #2a85ff;
  border-radius: 999px;
}

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

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

  .stage {
    min-height: 470px;
  }

  .topbar {
    padding: 9px 10px;
  }

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

  .profile-arrow {
    height: 40px;
  }

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

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

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

  .meter-track {
    width: 84px;
  }

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

  .control-group,
  .swatches,
  .style-pad,
  .accessories,
  .actions {
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    grid-template-columns: none;
  }

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

  .swatch {
    min-height: 46px;
  }
}
