:root {
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #111;
  background: #f7f7f7;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f7f7f7;
}

button,
input {
  font: inherit;
}

.page {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 24px;
}

.header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.header h1 {
  margin: 0 0 6px;
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.1;
}

.header p {
  margin: 0;
  color: #666;
  font-size: 14px;
}

.stage-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 18px;
  align-items: stretch;
}

.stage {
  position: relative;
  height: min(72vh, 760px);
  min-height: 0;
  border: 1px solid #ddd;
  border-radius: 18px;
  background: #fff;
  overflow: hidden;
  touch-action: none;
}

canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  cursor: ew-resize;
  user-select: none;
}

.drag-hint {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  pointer-events: none;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid #e2e2e2;
  color: #666;
  font-size: 12px;
  backdrop-filter: blur(8px);
}

.panel {
  border: 1px solid #ddd;
  border-radius: 18px;
  background: #fff;
  padding: 18px;
}

.panel-block + .panel-block {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid #eee;
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 15px;
}

.readout {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
  font-size: 13px;
  color: #666;
}

.readout strong {
  color: #111;
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  width: 100%;
}

.note {
  margin: 10px 0 0;
  color: #666;
  font-size: 12px;
  line-height: 1.6;
}

.move-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

button {
  border: 1px solid #d6d6d6;
  background: #fff;
  color: #111;
  border-radius: 10px;
  padding: 9px 12px;
  cursor: pointer;
}

button:hover {
  background: #f4f4f4;
}
button:active {
  transform: translateY(1px);
}

button.secondary {
  white-space: nowrap;
}

.move {
  font-weight: 700;
  font-size: 14px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 9px 0;
  font-size: 13px;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 14px;
  color: #777;
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 860px) {
  .stage-wrap {
    grid-template-columns: 1fr;
  }
  .stage {
    height: 68vh;
    min-height: 0;
  }
  .panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }
  .panel-block + .panel-block {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }
}

@media (max-width: 620px) {
  .page {
    width: min(100% - 18px, 1200px);
    padding-top: 16px;
  }
  .header {
    align-items: center;
  }
  .header p {
    font-size: 12px;
  }
  .panel {
    grid-template-columns: 1fr;
  }
  .stage {
    height: 62vh;
    min-height: 0;
    border-radius: 14px;
  }
  .footer {
    flex-direction: column;
  }
}
