html,
body {
  overscroll-behavior: none;
}

.play {
  height: 100%;
  display: grid;
  grid-template-columns: auto minmax(240px, 310px);
  grid-template-rows: minmax(0, 1fr) auto auto minmax(0, 1fr) auto;
  justify-content: center;
  align-items: center;
  column-gap: clamp(24px, 4vw, 56px);
  row-gap: 14px;
  padding: 92px max(24px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
}

.stage {
  display: contents;
}

.play > .mascot-box {
  grid-column: 2;
  grid-row: 2;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.play > .mascot-box img {
  width: clamp(76px, 13vh, 110px);
}

.play > .mascot-box .bubble {
  margin-bottom: 0;
  width: 100%;
  max-width: none;
  min-height: 84px;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: clamp(18px, 2.6vh, 22px);
  line-height: 1.25;
}

.play > .mascot-box .bubble::after {
  left: calc(50% - 12px);
  bottom: auto;
  top: -12px;
  border: 12px solid transparent;
  border-bottom-color: var(--card);
  border-top: 0;
}

.clock {
  --s: min(calc(100vh - 186px), calc(100vw - 420px), 640px);
  grid-column: 1;
  grid-row: 1 / 5;
  width: var(--s);
  height: var(--s);
  filter: drop-shadow(0 10px 0 rgba(61, 58, 92, 0.1)) drop-shadow(0 20px 26px rgba(61, 58, 92, 0.16));
  transition: transform 0.25s ease;
}

.clock.wobble {
  animation: shake 0.45s ease;
}

.clock.right {
  transform: scale(1.04) rotate(-3deg);
}

.clock .rim {
  fill: var(--lav-deep);
}

.clock .face {
  fill: #fff;
}

.clock .tick {
  stroke: #cfcce4;
  stroke-width: 1.6;
  stroke-linecap: round;
}

.clock .tick.big {
  stroke: var(--ink-soft);
  stroke-width: 3.2;
}

.clock text {
  font-size: 21px;
  font-weight: 800;
  fill: var(--ink);
  text-anchor: middle;
  dominant-baseline: central;
}

.clock text.main {
  fill: var(--lav-deep);
  font-size: 24px;
}

.clock .hand,
.clock .ghost line {
  transform-box: view-box;
  transform-origin: 120px 120px;
}

.clock .hand line {
  stroke-linecap: round;
}

.clock .hand.hour line {
  stroke: var(--pink-deep);
  stroke-width: 11;
}

.clock .hand.minute line {
  stroke: var(--sky-deep);
  stroke-width: 7;
}

.clock .knob {
  display: none;
  stroke: #fff;
  stroke-width: 3;
}

.clock .hand.hour .knob {
  fill: var(--pink-deep);
}

.clock .hand.minute .knob {
  fill: var(--sky-deep);
}

.clock .hub {
  fill: var(--ink);
  stroke: #fff;
  stroke-width: 3;
}

.clock .ghost {
  display: none;
}

.clock .ghost line {
  stroke-linecap: round;
  stroke-dasharray: 2 9;
  opacity: 0.75;
}

.clock #ghost-h {
  stroke: var(--pink-deep);
  stroke-width: 9;
}

.clock #ghost-m {
  stroke: var(--sky-deep);
  stroke-width: 6;
}

.clock.show-ghost .ghost {
  display: block;
}

.play[data-mode="read"] .clock .hand {
  transition: transform 0.7s cubic-bezier(0.3, 1.3, 0.5, 1);
}

.play[data-mode="set"] .clock {
  touch-action: none;
  cursor: grab;
}

.play[data-mode="set"] .clock.dragging {
  cursor: grabbing;
}

.play[data-mode="set"] .clock .knob {
  display: block;
}

.side {
  grid-column: 2;
  grid-row: 3;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.options,
.setter {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: clamp(10px, 2vh, 18px);
}

.options[hidden],
.setter[hidden] {
  display: none;
}

.opt {
  position: relative;
  height: clamp(66px, 11vh, 92px);
  border-radius: 999px;
  background: #fff;
  border: 6px solid var(--c, var(--sky-deep));
  font-size: clamp(34px, 5.6vh, 48px);
  font-weight: 800;
  line-height: 1;
  box-shadow: var(--shadow);
  animation: pop-in 0.4s cubic-bezier(0.2, 1.4, 0.4, 1) backwards;
  transition: transform 0.12s ease, opacity 0.2s ease;
}

@media (hover: hover) {
  .opt:hover {
    transform: translateY(-3px);
  }
}

.opt:active {
  transform: translateY(4px);
}

.opt kbd {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 34px;
  height: 34px;
  margin-top: -17px;
  border-radius: 50%;
  background: var(--c, var(--sky-deep));
  color: #fff;
  font: inherit;
  font-size: 20px;
  display: grid;
  place-items: center;
}

.opt.nope {
  animation: shake 0.45s ease;
  opacity: 0.45;
}

.opt.hint {
  background: var(--butter);
  border-color: var(--butter-deep);
  animation: glow 1s ease-in-out infinite;
}

.opt.right {
  background: #f1fff7;
  border-color: var(--mint-deep);
  color: var(--mint-deep);
  transform: scale(1.06);
}

.digital {
  padding: 10px 16px;
  border-radius: 30px;
  background: var(--ink);
  color: var(--butter);
  font-size: clamp(54px, 10vh, 84px);
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
  letter-spacing: 2px;
  box-shadow: var(--shadow);
}

.digital.enter-in {
  animation: pop-in 0.4s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.digital.right {
  background: var(--mint-deep);
  color: #fff;
}

.setter .big-btn {
  min-width: 0;
}

.keys-tip {
  text-align: center;
  font-size: clamp(15px, 1.8vw, 18px);
  font-weight: 700;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.7);
  border-radius: 18px;
  padding: 6px 12px;
}

.foot {
  grid-column: 1 / -1;
  grid-row: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2vw, 24px);
}

.chip {
  padding: 4px 16px;
  border-radius: 999px;
  color: #fff;
  font-size: clamp(15px, 1.9vw, 20px);
  font-weight: 800;
  white-space: nowrap;
}

.chip.hour {
  background: var(--pink-deep);
}

.chip.minute {
  background: var(--sky-deep);
}

.round-dots {
  display: flex;
  gap: 10px;
}

.round-dots i {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
}

.round-dots i.now {
  box-shadow: 0 0 0 4px var(--butter-deep);
}

.round-dots i.ok {
  background: var(--butter-deep);
}

#start .panel {
  max-width: 720px;
  padding: 22px 32px 32px;
}

#start .panel .mascot {
  width: clamp(90px, 16vh, 140px);
}

#start .panel p {
  margin-bottom: 16px;
}

.mode-row {
  display: inline-flex;
  gap: 8px;
  padding: 8px;
  margin-bottom: 20px;
  border-radius: 999px;
  background: var(--lav);
}

.mode-btn {
  min-width: 170px;
  min-height: 64px;
  padding: 8px 26px;
  border-radius: 999px;
  background: transparent;
  font-size: clamp(20px, 2.8vw, 26px);
  font-weight: 800;
  color: var(--ink-soft);
  transition: background 0.15s ease, color 0.15s ease;
}

.mode-btn.on {
  background: var(--lav-deep);
  color: #fff;
  box-shadow: 0 5px 0 #8268d6;
}

#start .btn-row {
  gap: 14px;
}

#start .btn-row .big-btn {
  min-width: 170px;
  padding: 14px 22px;
  font-size: clamp(20px, 2.6vw, 26px);
}

.big-btn.warm {
  background: var(--peach-deep);
  box-shadow: 0 8px 0 #e07f5a, 0 16px 30px rgba(224, 127, 90, 0.35);
}

.big-btn.warm:active {
  box-shadow: 0 2px 0 #e07f5a, 0 6px 16px rgba(224, 127, 90, 0.3);
}

@media (orientation: portrait) {
  .play {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    justify-items: center;
    row-gap: 14px;
    padding: 86px max(20px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  }
  .play > .mascot-box {
    grid-column: 1;
    grid-row: 1;
    flex-direction: row;
    width: 100%;
    max-width: 720px;
    gap: 10px;
  }
  .play > .mascot-box img {
    width: clamp(72px, 11vw, 104px);
    flex: none;
  }
  .play > .mascot-box .bubble {
    width: auto;
    flex: 1;
    min-height: 76px;
    font-size: clamp(19px, 2.7vw, 26px);
  }
  .play > .mascot-box .bubble::after {
    left: -12px;
    top: calc(50% - 12px);
    border: 12px solid transparent;
    border-right-color: var(--card);
    border-left: 0;
  }
  .clock {
    --s: min(calc(100vw - 48px), calc(100vh - 440px));
    grid-column: 1;
    grid-row: 2;
  }
  .side {
    grid-column: 1;
    grid-row: 3;
    max-width: 760px;
    min-height: 100px;
  }
  .options,
  .setter {
    flex-direction: row;
    align-items: center;
    gap: clamp(10px, 2vw, 20px);
  }
  .opt {
    flex: 1;
    height: clamp(84px, 9vh, 100px);
    font-size: clamp(34px, 5vw, 46px);
  }
  .digital {
    flex: 1;
    font-size: clamp(54px, 8vw, 76px);
  }
  .setter .big-btn {
    flex: 1;
    min-height: 88px;
  }
  .keys-tip {
    display: none;
  }
  .foot {
    grid-row: 4;
  }
}
