* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "MS PGothic", "Hiragino Kaku Gothic ProN", sans-serif;
  background: #0d7b37;
  color: #111;
  display: grid;
  place-items: center;
  padding: 14px;
}

.board {
  width: min(1200px, 96vw);
  margin: 0 auto;
}

.panel {
  background: #fffacd;
  border: 6px solid #ff9f00;
  border-radius: 38px;
  padding: 26px 30px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.12);
}

h1 {
  margin: 0;
  color: #ff2f00;
  text-shadow: 2px 2px 0 #ffd400;
  font-size: clamp(2rem, 4.6vw, 4rem);
  line-height: 1;
}

.desc {
  margin: 10px 0 18px;
  font-size: clamp(1.2rem, 2.7vw, 2.1rem);
  font-weight: 700;
}

.time-wrap {
  display: flex;
  height: 56px;
  margin-bottom: 24px;
  user-select: none;
}

.time-label {
  width: 140px;
  background: #0e6cdf;
  color: #fff;
  display: grid;
  place-items: center;
  border: 4px solid #2d8df6;
  border-right: 0;
  font-weight: 700;
  font-size: clamp(1.5rem, 3.2vw, 2.5rem);
}

.time-cells {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  background: #fff;
}

.tcell {
  border: 4px solid #2d8df6;
  border-left-width: 0;
  background: #56b6ff;
}

.time-cells .tcell:last-child {
  border-right-width: 4px;
}

.tcell.empty {
  background: #eef2f6;
}

.game-wrap {
  display: grid;
  grid-template-columns: 1fr 140px;
  gap: 22px;
  align-items: center;
}

.center-stage {
  min-height: 390px;
  border-radius: 26px;
  border: 4px solid #f0e3b4;
  background: #fff;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

#crumb-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

#target {
  width: min(78vw, 430px);
  aspect-ratio: 1 / 1;
  border: 0;
  cursor: pointer;
  background: transparent url("./assets/illustkun-06411-20220107-a.png") center / contain no-repeat;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 2;
}

#target:disabled {
  filter: saturate(0.75);
  cursor: default;
}

.bite {
  position: absolute;
  width: 98px;
  height: 98px;
  border-radius: 50%;
  background: #fff;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 120ms ease, transform 120ms ease;
}

.bite-1 { top: 10%; right: 10%; }
.bite-2 { top: 30%; right: -3%; }
.bite-3 { bottom: 16%; right: -2%; }
.bite-4 { bottom: -4%; right: 30%; }
.bite-5 { bottom: 4%; left: 16%; }
.bite-6 { bottom: 30%; left: -4%; }
.bite-7 { top: 12%; left: 4%; }
.bite-8 { top: -5%; left: 34%; }
.bite-9 { top: 30%; left: 22%; }
.bite-10 { top: 26%; right: 24%; }
.bite-11 { bottom: 26%; left: 28%; }
.bite-12 { bottom: 30%; right: 30%; }

.bite.on {
  opacity: 1;
  transform: scale(1);
}

#target.empty {
  background: none;
}

.crumb {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffe6b3, #efae52 70%, #cf8227);
  box-shadow: 0 1px 0 rgba(120, 70, 20, 0.28);
  animation: crumb-burst 420ms ease-out forwards;
}

@keyframes crumb-burst {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(var(--tx), var(--ty)) scale(0.45);
    opacity: 0;
  }
}

.korasho-wrap {
  position: absolute;
  right: 7%;
  bottom: 17%;
  width: clamp(100px, 19vw, 170px);
  aspect-ratio: 1 / 1;
  z-index: 3;
  pointer-events: none;
}

#korasho-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  position: relative;
  z-index: 2;
  transform-origin: 50% 100%;
  transition: transform 140ms linear;
}

.start-btn {
  margin-top: 12px;
  border: 3px solid #215dc7;
  background: linear-gradient(#4a93ff, #1f72f3);
  color: #fff;
  font-size: 1.3rem;
  font-weight: 700;
  padding: 8px 26px;
  border-radius: 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.start-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.start-btn:active:not(:disabled) {
  transform: translateY(1px);
}

#message {
  margin: 12px 0 0;
  font-size: 1.25rem;
  font-weight: 700;
}

.gauge-wrap {
  display: grid;
  justify-items: center;
  gap: 10px;
  min-width: 120px;
}

.gauge-values {
  height: 320px;
  width: 36px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 2rem;
  font-weight: 700;
  color: #2d3142;
}

.gauge-track {
  width: 62px;
  height: 320px;
  border: 4px solid #8d96ad;
  border-radius: 30px;
  background: #f8fbff;
  position: relative;
  overflow: hidden;
}

#gauge-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0%;
  background: linear-gradient(#ffe58a, #ffca4f);
}

.gauge-label {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
}

@media (max-width: 900px) {
  .panel {
    padding: 16px 14px;
    border-radius: 22px;
  }

  .game-wrap {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .gauge-wrap {
    grid-template-columns: auto auto auto;
    grid-auto-flow: column;
    justify-content: center;
    align-items: end;
    column-gap: 10px;
  }

  .gauge-values {
    height: 200px;
    font-size: 1.4rem;
  }

  .gauge-track {
    height: 200px;
  }

  .gauge-label {
    font-size: 1.3rem;
  }

  .center-stage {
    min-height: 300px;
  }

  .korasho-wrap {
    right: 4%;
    bottom: 20%;
    width: clamp(82px, 24vw, 132px);
  }

  #message {
    font-size: 1rem;
  }
}

@media (max-width: 620px) {
  .time-label {
    width: 94px;
    font-size: 1.1rem;
  }

  .time-wrap {
    height: 40px;
    margin-bottom: 14px;
  }

  .tcell,
  .time-label {
    border-width: 2px;
  }

  .time-cells .tcell:last-child {
    border-right-width: 2px;
  }

  .desc {
    font-size: 1rem;
    margin-bottom: 10px;
  }

  h1 {
    font-size: 1.7rem;
  }

  #target {
    width: min(78vw, 300px);
  }

  .bite {
    width: 72px;
    height: 72px;
  }
}
