html, body {
  margin: 0;
  overflow: hidden;
}

.stage {
  box-sizing: border-box;
  min-height: 100vh;
  display: grid;
  place-items: center;
  margin: 0;
  background: #ff4d1f;
  font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
  padding: clamp(8px, 4vw, 24px);
}

.hd {
  --c-i: #a6ced3;
  --d-i: #429da9;
  --c-o: #d3c9a6;
  --d-o: #a99342;
  --c-t: #c6a6d3;
  --d-t: #8a42a9;
  --c-s: #a6d3b1;
  --d-s: #42a95b;
  --c-z: #d3a6aa;
  --d-z: #a9424a;
  --c-j: #a6b4d3;
  --d-j: #4261a9;
  --c-l: #d3baa6;
  --d-l: #a97042;
  --grid-line: rgba(23, 20, 26, 0.1);
  --okc: #4cd4a6;
  --noc: #ffd23f;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 430px;
}

.hd__hint {
  margin: 0;
  font-weight: 700;
  font-size: clamp(10px, 2.8vw, 12px);
  line-height: 1.35;
  color: #17141a;
}

.hd__row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.hd__field {
  position: relative;
  overflow: hidden;
  flex: 0 0 auto;
  width: clamp(150px, 42vw, 208px);
  height: clamp(208px, 60vw, 236px);
  border-radius: 16px;
  background: rgba(23, 20, 26, 0.06);
  box-shadow: inset 0 0 0 1px rgba(23, 20, 26, 0.16);
  cursor: pointer;
  touch-action: manipulation;
}

.hd__field:focus-visible {
  outline: 2px solid #17141a;
  outline-offset: 2px;
}

.hd__cv {
  display: block;
  width: 100%;
  height: 100%;
}

.hd__side {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 4px;
}

.hd__k {
  align-self: flex-start;
  padding: 4px 8px;
  border-radius: 4px;
  background: #17141a;
  color: #ffd23f;
  font-weight: 800;
  font-size: clamp(9px, 2.4vw, 11px);
  letter-spacing: 0.06em;
}

.hd__hold {
  position: relative;
  margin-top: 4px;
  height: clamp(48px, 14vw, 64px);
  border-radius: 8px;
  background: rgba(23, 20, 26, 0.05);
  box-shadow: inset 0 0 0 1px rgba(23, 20, 26, 0.18);
  overflow: hidden;
}

.hd__hold canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.hd__hold.is-locked {
  box-shadow: inset 0 0 0 2px rgba(23, 20, 26, 0.55);
}

.hd__swapN {
  margin-top: 8px;
  font-weight: 800;
  font-size: clamp(20px, 5vw, 28px);
  line-height: 1;
  color: #17141a;
  font-variant-numeric: tabular-nums;
}

.hd__unit {
  font-weight: 600;
  font-size: clamp(9px, 2.4vw, 11px);
  color: rgba(23, 20, 26, 0.82);
}

.hd__log {
  position: relative;
  flex: 1;
  min-height: 0;
  margin-top: 4px;
  height: 12px;
  border-radius: 4px;
  background: rgba(23, 20, 26, 0.05);
  overflow: hidden;
}

.hd__log canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

@media (max-width: 340px) {
  .hd {
    gap: 4px;
  }
  .hd__field {
    width: 92px;
    height: 116px;
  }
  .hd__hold {
    height: 40px;
    margin-top: 0;
  }
  .hd__swapN {
    font-size: 16px;
    margin-top: 4px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .hd.is-still .hd__field {
    cursor: default !important;
  }
}
