:root {
  color-scheme: light;
  --primary: #4a4a70;
  --secondary: #d4f2f7;
  --tertiary: #b585bc;
  --mint: #2affc3;
  --neutral: #5e5454;
  --paper: #fff;
  --soft: #f7f7f7;
  font-family: Comfortaa, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--primary);
  background: var(--paper);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #fff;
}

button {
  border: 0;
  font: inherit;
  cursor: pointer;
}

main {
  overflow: hidden;
}

.player-frame {
  display: grid;
  grid-template-columns: minmax(660px, 1062px);
  justify-content: center;
  align-items: start;
  min-height: 100vh;
  padding: 0 15px;
}

.game-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(420px, 1fr) 80px 80px;
  width: min(100%, 1062px);
  height: min(822px, 100vh);
  min-height: 620px;
  margin: 0 auto;
  color: var(--primary);
}

.stage {
  position: relative;
  display: block;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(212, 242, 247, .42), rgba(242, 212, 247, .42)),
    #f8f8f8;
}

#avatar {
  width: min(100%, 100vh);
  height: min(100%, calc(100vw - 240px));
  max-width: 822px;
  max-height: 822px;
  aspect-ratio: 1;
  display: block;
  background: #f2f3f4;
}

#avatar.real-hidden {
  display: none;
}

.real-stage {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  width: 822px;
  height: 822px;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  background: #f2f3f4;
}

.real-stage-inner {
  position: absolute;
  left: 0;
  top: 0;
  width: 600px;
  height: 600px;
  transform: scale(var(--real-scale, 1));
  transform-origin: top left;
}

.real-layer {
  position: absolute;
  display: block;
  pointer-events: none;
  user-select: none;
}

.stage-tools {
  position: absolute;
  z-index: 20;
  display: flex;
  gap: 10px;
  pointer-events: auto;
}

.stage-tools.top {
  top: 18px;
  left: 18px;
  bottom: auto;
}

.stage-tools.bottom {
  top: 18px;
  right: 18px;
  left: auto;
  bottom: auto;
  max-width: calc(100% - 132px);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.tool-button,
.round-tool {
  background: rgba(55, 62, 65, .89);
  color: #fff;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .18);
}

.tool-button {
  min-width: 80px;
  min-height: 40px;
  border-radius: 6px;
  padding: 0 18px;
  font-weight: 700;
}

.round-tool {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
}

.rail {
  position: relative;
  display: flex;
  min-width: 0;
  height: 100%;
  background: #f3f3f3;
  border-left: 1px solid rgba(74, 74, 112, .06);
}

.rail-scroll {
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 10px 26px;
  scrollbar-width: thin;
}

.rail-scroll::-webkit-scrollbar {
  width: 6px;
}

.rail-scroll::-webkit-scrollbar-thumb {
  background: rgba(100, 100, 100, .35);
  border-radius: 999px;
}

.rail button {
  position: relative;
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin: 0 auto 15px;
  border-radius: 50%;
  background: #fff;
  color: var(--primary);
  box-shadow: 0 2px 7px rgba(0, 0, 0, .16);
}

.rail button::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 4px solid transparent;
}

.rail button[aria-pressed="true"]::after,
.rail button[aria-selected="true"]::after {
  border-color: var(--mint);
}

.thumb-img {
  width: 53px;
  height: 53px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.thumb-img.real {
  object-fit: contain;
}

.category-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 900;
  background: linear-gradient(135deg, #d4f2f7, #f2d4f7);
  color: var(--primary);
}

.thumb-img.contain {
  object-fit: contain;
  background: #f5f5f5;
}

.color-row {
  display: grid;
  grid-template-columns: repeat(2, 28px);
  justify-content: center;
  gap: 9px;
  margin: 0 auto 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(74, 74, 112, .1);
}

.rail .color-chip {
  width: 28px;
  height: 28px;
  margin: 0;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .18), inset 0 0 0 1px rgba(0, 0, 0, .12);
}

.rail .color-chip::after {
  inset: -4px;
  border-width: 3px;
}

.swatch-dot {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1);
}

@media (max-width: 1180px) {
  .player-frame {
    grid-template-columns: 1fr;
    padding-inline: 0;
  }
}

@media (max-width: 760px) {
  .game-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(360px, calc(100vw - 20px)) 92px 92px;
    height: auto;
    min-height: 0;
  }

  .stage {
    min-height: 360px;
  }

  #avatar {
    width: min(100vw, 620px);
    height: auto;
  }

  .real-stage {
    width: min(100vw, 620px);
    height: min(100vw, 620px);
  }

  .rail {
    height: 92px;
    border-left: 0;
    border-top: 1px solid rgba(74, 74, 112, .08);
  }

  .rail-scroll {
    display: flex;
    gap: 15px;
    padding: 13px 14px;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .rail button {
    flex: 0 0 auto;
    margin: 0;
  }

  .stage-tools.top {
    top: 14px;
    left: 14px;
  }

  .stage-tools.bottom {
    top: 14px;
    right: 14px;
    left: 14px;
    max-width: calc(100% - 28px);
  }
}
