:root {
  --red-a: #ff8fa8;
  --red-b: #ffd7de;
  --blue-a: #6ec3ff;
  --blue-b: #d7f0ff;
  --yellow-a: #ffe066;
  --yellow-b: #fff6cf;
  --green-a: #77d98b;
  --green-b: #d9f7d8;
  --empty-a: #fff;
  --empty-b: #eef7ff;
  --brown: #7a4a2b
}

* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation
}

html {
  margin: 0;
  height: 100%
}

body {
  margin: 0;
  height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  background: #f2f2f2;
  display: flex;
  justify-content: center;
  align-items: center
}

.container {
  position: relative;
  margin: 0 auto;
  background: #fff;
  border: 2px solid #333;
  width: 100%;
  max-width: 1196px;
  height: 540px;
  display: flex;
  flex-direction: column
}

.game-header {
  position: absolute;
  inset: 0 0 auto;
  z-index: 10;
  height: 56px;
  padding: 8px 18px;
  background: transparent;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center
}

.header-score {
  justify-self: start;
  color: #7a4a2b;
  font-size: clamp(13px, 1.8vw, 17px);
  font-weight: 900;
  text-shadow: 0 1px 2px #fff
}

.header-title {
  justify-self: center;
  color: #ff5f86;
  font-size: clamp(16px, 2.3vw, 24px);
  font-weight: 900;
  white-space: nowrap;
  text-shadow: 2px 2px #fff, 0 3px #ffd1dc
}

.game-header .quit-btn {
  justify-self: end
}

.game-main {
  position: relative;
  flex: 1;
  height: 100%;
  overflow: hidden;
  display: grid;
  place-items: center;
  color: var(--brown);
  background: radial-gradient(circle at 15% 10%, #ffffffaa 0 40px, transparent 41px), radial-gradient(circle at 80% 20%, #ffffff88 0 30px, transparent 31px), linear-gradient(180deg, #8fd0ff, #eaf8ff)
}

.game-main button {
  font-family: inherit
}

.app {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center
}

.panel {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #fffaf1;
  border: 4px solid #fff;
  outline: 3px solid #ffd9a0;
  outline-offset: -3px
}

.hidden {
  display: none !important
}

#start-screen {
  padding: 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center
}

.title-main {
  font-size: clamp(28px, 5vw, 46px);
  font-weight: 900;
  color: #ff6f91;
  text-shadow: 3px 3px #fff, 0 6px #ffd1dc;
  letter-spacing: 2px
}

.title-sub {
  margin-top: 8px;
  font-size: clamp(14px, 2.2vw, 20px);
  color: #5c8ad0;
  font-weight: 700
}

.hero-row {
  display: flex;
  gap: 6vw;
  margin: 22px 0 10px;
  font-size: clamp(40px, 6vw, 64px)
}

.start-btn {
  margin-top: 16px;
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 900;
  color: #fff;
  background: linear-gradient(#ff9db3, #ff6f91);
  border: 0;
  border-radius: 100px;
  padding: 14px 50px;
  box-shadow: 0 8px #d84d6c;
  cursor: pointer
}

.start-btn:active {
  transform: translateY(6px);
  box-shadow: 0 2px #d84d6c
}

#game-screen {
  padding: 64px 0 0;
  border: 0;
  outline: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  overflow: auto
}

.quit-btn {
  font-size: 15px;
  font-weight: 800;
  color: var(--brown);
  background: #fff2da;
  border: 3px solid #ffd9a0;
  border-radius: 100px;
  padding: 4px 16px;
  cursor: pointer
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff2da;
  border-radius: 100px;
  padding: 5px 20px;
  font-size: 15px;
  font-weight: 800;
  color: #e2760c;
  margin: 0 0 6px
}

.progress-dots {
  font-size: 18px;
  letter-spacing: 5px;
  color: #ff6f91
}

#playArea {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px
}

.puzzle-area {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(360px, 480px) minmax(280px, 1fr);
  align-items: stretch;
  justify-content: center;
  gap: 0
}

.col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  min-height: 340px
}

.left-col {
  padding: 0 28px;
  gap: 40px;
  border-right: 3px dashed #cfe6ff
}

.right-col {
  padding: 0 28px;
  gap: 40px
}

.syrup-col {
  padding: 0 28px;
  gap: 40px;
  border-left: 3px dashed #cfe6ff
}

.section-label {
  position: relative;
  top: 10px;
  font-size: 16px;
  font-weight: 800;
  background: #ffe27a;
  border-radius: 100px;
  padding: 3px 18px;
  box-shadow: 0 3px #e8c34a;
  text-align: center
}

.sample-box {
  position: relative;
  top: 50px;
  display: flex;
  align-items: center;
  background: #f2fbff;
  border-radius: 18px;
  padding: 12px 24px;
  border: 3px dashed #a9d8ff
}

.right-col > .main-kakigori {
  position: relative;
  top: 50px
}

.syrup-col > .bottles-row {
  position: relative;
  top: 50px
}

.kakigori-wrap,
.ice-stack {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center
}

.ice-layer {
  position: relative;
  border-radius: 50% 50% 18% 18%/60% 60% 18% 18%;
  box-shadow: inset 0 -6px 10px #0000000f, inset 0 4px 8px #ffffffb3;
  transition: background .25s
}

.cup {
  position: relative;
  background: linear-gradient(#cdeeff, #8fc7f5);
  border: 3px solid #ffffffcc
}

.main-kakigori .top {
  width: 120px;
  height: 64px;
  margin-bottom: -28px;
  z-index: 3
}

.main-kakigori .mid {
  width: 160px;
  height: 70px;
  margin-bottom: -30px;
  z-index: 2
}

.main-kakigori .bottom {
  width: 200px;
  height: 74px;
  margin-bottom: -10px;
  z-index: 1
}

.main-kakigori .cup {
  width: 168px;
  height: 70px;
  clip-path: polygon(8% 0, 92% 0, 80% 100%, 20% 100%)
}

.sample-kakigori .top {
  width: 96px;
  height: 52px;
  margin-bottom: -22px;
  z-index: 3
}

.sample-kakigori .mid {
  width: 128px;
  height: 56px;
  margin-bottom: -24px;
  z-index: 2
}

.sample-kakigori .bottom {
  width: 160px;
  height: 60px;
  margin-bottom: -8px;
  z-index: 1
}

.sample-kakigori .cup {
  width: 134px;
  height: 56px;
  clip-path: polygon(8% 0, 92% 0, 80% 100%, 20% 100%)
}

.cherry {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 18px;
  z-index: 4
}

.sample-kakigori .cherry {
  font-size: 18px;
  top: -12px
}

.color-empty {
  background: repeating-linear-gradient(135deg, var(--empty-a) 0 10px, var(--empty-b) 10px 20px)
}

.color-red {
  background: repeating-linear-gradient(135deg, var(--red-a) 0 10px, var(--red-b) 10px 20px)
}

.color-blue {
  background: repeating-linear-gradient(135deg, var(--blue-a) 0 10px, var(--blue-b) 10px 20px)
}

.color-yellow {
  background: repeating-linear-gradient(135deg, var(--yellow-a) 0 10px, var(--yellow-b) 10px 20px)
}

.color-green {
  background: repeating-linear-gradient(135deg, var(--green-a) 0 10px, var(--green-b) 10px 20px)
}

.drop-target.drag-over {
  filter: brightness(1.08);
  outline: 3px solid #ffb703;
  outline-offset: 2px
}

.message-area {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none
}

.message {
  font-size: clamp(26px, 4vw, 40px);
  font-weight: 900;
  padding: 18px 36px;
  border: 4px solid #fff;
  border-radius: 100px;
  box-shadow: 0 10px 30px #0003;
  animation: pop .45s
}

.message.ok {
  background: #fff3b0;
  color: #e2760c;
  box-shadow: 0 4px #f0c94a
}

.message.ng {
  background: #ffe0e6;
  color: #e2437a;
  box-shadow: 0 4px #f3aebf
}

.bottles-row {
  display: grid;
  grid-template-columns: repeat(2, 100px);
  gap: 14px;
  align-items: start;
  justify-content: center
}

.bottle {
  width: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: grab;
  touch-action: none
}

.bottle-body {
  width: 52px;
  height: 66px;
  border-radius: 12px 12px 18px 18px;
  border: 3px solid #fff;
  box-shadow: 0 5px #0000001f;
  position: relative;
  overflow: hidden
}

.bottle-body:after {
  content: "";
  position: absolute;
  top: 6px;
  left: 6px;
  width: 12px;
  height: 60%;
  background: #ffffff8c;
  border-radius: 8px
}

.bottle-cap {
  width: 27px;
  height: 14px;
  background: var(--brown);
  border-radius: 4px;
  margin-bottom: -2px
}

.bottle-label {
  margin-top: 5px;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap
}

.bottle.dragging {
  opacity: .35
}

.drag-ghost {
  position: fixed;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 4px 10px #00000040;
  pointer-events: none;
  z-index: 999;
  transform: translate(-50%, -50%)
}

.drag-hint {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1000;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  font-size: 46px;
  line-height: 1;
  filter: drop-shadow(0 4px 3px #0005);
  pointer-events: none;
  transform: translate(-100px, -100px)
}

.drag-hint::before {
  content: "";
  position: absolute;
  inset: 1px;
  z-index: -1;
  border-radius: 50%;
  background: #fff9;
  box-shadow: 0 0 0 5px #ffcf4099
}
#completeArea {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 8px
}

.complete-emoji {
  font-size: 40px
}

.complete-title {
  font-size: 28px;
  font-weight: 900;
  color: #ff6f91
}

.complete-sub {
  font-size: 16px;
  font-weight: 700;
  color: #5c8ad0
}

@keyframes pop {
  0% {
    transform: scale(.5);
    opacity: 0
  }

  70% {
    transform: scale(1.12)
  }

  100% {
    transform: scale(1)
  }
}

@keyframes shake {

  20%,
  60% {
    transform: translateX(-8px)
  }

  40%,
  80% {
    transform: translateX(8px)
  }
}

.shake {
  animation: shake .4s
}

@media(max-width:800px) {
  .puzzle-area {
    grid-template-columns: 180px 200px 180px
  }

  .left-col,
  .right-col,
  .syrup-col {
    padding-left: 10px;
    padding-right: 10px
  }

  .main-kakigori .top {
    width: 96px;
    height: 52px;
    margin-bottom: -22px
  }

  .main-kakigori .mid {
    width: 128px;
    height: 56px;
    margin-bottom: -24px
  }

  .main-kakigori .bottom {
    width: 160px;
    height: 60px;
    margin-bottom: -8px
  }

  .main-kakigori .cup {
    width: 134px;
    height: 56px
  }

  .sample-kakigori .top {
    width: 76px;
    height: 42px;
    margin-bottom: -18px
  }

  .sample-kakigori .mid {
    width: 102px;
    height: 46px;
    margin-bottom: -20px
  }

  .sample-kakigori .bottom {
    width: 128px;
    height: 48px;
    margin-bottom: -6px
  }

  .sample-kakigori .cup {
    width: 108px;
    height: 45px
  }
}

@media(max-width:600px) {
  .game-header {
    height: 50px;
    padding: 6px 10px
  }

  .header-title {
    font-size: 14px
  }

  .header-score {
    font-size: 11px
  }

  .game-header .quit-btn {
    padding: 3px 10px;
    font-size: 11px
  }

  .puzzle-area {
    min-width: 560px
  }

  .left-col {
    border-right: 0
  }

  .syrup-col {
    border-left: 0
  }

  #game-screen {
    align-items: flex-start
  }

  .progress-row {
    align-self: center
  }
}