* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #e8ecf1;
  display: flex;
  justify-content: center;
  padding: 30px 16px;
  min-height: 100vh;
}

.container {
  background: #f5f7fa;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  max-width: 860px;
  width: 100%;
  padding: 28px 32px 32px;
}

.seesaw-area {
  position: relative;
  background: #e2e8ee;
  border-radius: 12px;
  height: 420px;
  overflow: hidden;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.seesaw-wrapper {
  position: relative;
  width: 100%;
  height: 370px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 50px;
}

.pivot {
  position: absolute;
  bottom: 130px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 22px solid transparent;
  border-right: 22px solid transparent;
  border-bottom: 32px solid #4a5568;
  z-index: 10;
}

.plank-group {
  position: absolute;
  bottom: 158px;
  left: 50%;
  transform: translateX(-50%) rotate(0deg);
  transform-origin: center bottom;
  width: 600px;
  height: 200px;
  transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  z-index: 5;
  pointer-events: none;
}

.plank {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 14px;
  background: linear-gradient(180deg, #8b7355 0%, #6d5a3f 50%, #5c4a33 100%);
  border-radius: 7px;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
}

.plank:hover {
  filter: brightness(1.08);
}

.ground {
  width: 100%;
  height: 80px;
  background: linear-gradient(180deg, #7b8fa1 0%, #6b8090 100%);
  border-radius: 0 0 12px 12px;
  flex-shrink: 0;
}

.seesaw-object {
  position: absolute;
  bottom: 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  pointer-events: auto;
  transform: translateX(-50%);
  z-index: 8;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition:
    filter 0.15s,
    box-shadow 0.15s;
  user-select: none;
}

.seesaw-object:hover {
  filter: brightness(1.2);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.seesaw-object:hover::after {
  content: "✕";
  position: absolute;
  top: -6px;
  right: -6px;
  width: 16px;
  height: 16px;
  background: #e74c3c;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.info-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  justify-content: center;
}

.info-card {
  flex: 1;
  min-width: 120px;
  background: #ffffff;
  border: 1.5px solid #dde2e8;
  border-radius: 10px;
  padding: 14px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition:
    border-color 0.3s,
    box-shadow 0.3s;
}

.info-card:hover {
  border-color: #b0bec5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.info-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: #6b7a8d;
  text-transform: uppercase;
}

.info-value {
  font-size: 21px;
  font-weight: 700;
  color: #2c3e50;
}

@keyframes dropIn {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(-80px) scale(0.4);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

@keyframes removeOut {
  0% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-40px) scale(0.3);
  }
}

.seesaw-object {
  animation: dropIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.button-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}

.action-btn {
  background: #34495e;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.1s,
    opacity 0.2s;
}

.action-btn:hover {
  background: #2c3e50;
}

.action-btn:active {
  transform: scale(0.97);
}

.action-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.action-btn:disabled:hover {
  background: #34495e;
}

.shortcut-hints {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-bottom: 18px;
}

.hint-item {
  font-size: 12px;
  color: #8e99a4;
  display: flex;
  align-items: center;
  gap: 5px;
}

.hint-item kbd {
  display: inline-block;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 700;
  color: #555;
  background: #f0f0f0;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: 0 1px 0 #bbb;
  font-family: inherit;
}

.drop-log {
  background: #ffffff;
  border-radius: 10px;
  border: 1.5px solid #dde2e8;
  max-height: 200px;
  overflow-y: auto;
  padding: 8px 0;
}

.drop-log:empty {
  display: none;
}

.log-entry {
  padding: 10px 20px;
  font-size: 13px;
  color: #3a4a5c;
  border-left: 3px solid #5b9bd5;
  margin: 4px 16px;
  animation: fadeIn 0.3s ease;
}

.log-entry.removed {
  border-left-color: #e74c3c;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.log-entry .log-emoji {
  margin-right: 6px;
}

.drop-log::-webkit-scrollbar {
  width: 6px;
}

.drop-log::-webkit-scrollbar-thumb {
  background: #c1c9d3;
  border-radius: 3px;
}

.sound-btn.muted {
  background: #7f8c8d;
}

.balance-indicator {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #27ae60, #2ecc71);
  color: #fff;
  padding: 8px 22px;
  border-radius: 20px;
  font-size: 15px;
  font-weight: 700;
  z-index: 20;
  box-shadow: 0 4px 16px rgba(39, 174, 96, 0.35);
  transition:
    opacity 0.4s,
    transform 0.4s;
  pointer-events: none;
}

.balance-indicator.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(-10px);
}

.balance-indicator.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  animation: balancePulse 1.5s ease-in-out infinite;
}

@keyframes balancePulse {
  0%,
  100% {
    box-shadow: 0 4px 16px rgba(39, 174, 96, 0.35);
  }
  50% {
    box-shadow: 0 4px 28px rgba(39, 174, 96, 0.6);
  }
}

.distance-ruler {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 14px;
  pointer-events: none;
  z-index: 6;
}

.ruler-tick {
  position: absolute;
  bottom: 100%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

.ruler-tick-line {
  width: 1px;
  background: rgba(74, 85, 104, 0.35);
}

.ruler-tick-line.major {
  height: 10px;
}

.ruler-tick-line.minor {
  height: 5px;
}

.ruler-tick-label {
  font-size: 8px;
  font-weight: 600;
  color: rgba(74, 85, 104, 0.55);
  margin-top: 1px;
  white-space: nowrap;
}

.ruler-tick.center .ruler-tick-line {
  background: rgba(74, 85, 104, 0.6);
  width: 2px;
  height: 14px;
}

.ruler-tick.center .ruler-tick-label {
  color: rgba(74, 85, 104, 0.8);
  font-size: 9px;
}

.test-panel {
  background: #ffffff;
  border: 1.5px solid #dde2e8;
  border-radius: 10px;
  margin-bottom: 16px;
  overflow: hidden;
}

.test-panel-toggle {
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 700;
  color: #2c3e50;
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.test-panel-toggle::-webkit-details-marker {
  display: none;
}

.test-panel-toggle::after {
  content: "▸";
  margin-left: auto;
  transition: transform 0.2s;
  font-size: 12px;
  color: #8e99a4;
}

.test-panel[open] .test-panel-toggle::after {
  transform: rotate(90deg);
}

.test-panel-content {
  padding: 0 20px 16px;
}

.test-panel-torque-info {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px;
  background: #f0f4f8;
  border-radius: 8px;
}

.torque-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.torque-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #6b7a8d;
  text-transform: uppercase;
}

.torque-value {
  font-size: 18px;
  font-weight: 700;
  color: #2c3e50;
  font-variant-numeric: tabular-nums;
}

.test-panel-form {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.test-panel-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 100px;
}

.test-panel-field label {
  font-size: 11px;
  font-weight: 600;
  color: #6b7a8d;
}

.test-panel-field input,
.test-panel-field select {
  padding: 8px 10px;
  border: 1.5px solid #dde2e8;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  color: #2c3e50;
  background: #fff;
  outline: none;
  transition: border-color 0.2s;
}

.test-panel-field input:focus,
.test-panel-field select:focus {
  border-color: #5b9bd5;
}

.test-panel-place-btn {
  background: #2980b9 !important;
  white-space: nowrap;
}

.test-panel-place-btn:hover {
  background: #2471a3 !important;
}

.test-panel-obj-list {
  margin-top: 12px;
  font-size: 12px;
  color: #4a5568;
  max-height: 120px;
  overflow-y: auto;
}

.test-panel-obj-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  background: #f7f9fb;
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}

.test-panel-obj-item .obj-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.test-panel-obj-item .obj-info {
  flex: 1;
}

.test-panel-obj-item .obj-torque {
  font-weight: 700;
  color: #2c3e50;
}

@media (max-width: 700px) {
  .container {
    padding: 18px 12px 22px;
  }
  .info-bar {
    gap: 8px;
  }
  .info-card {
    min-width: 80px;
    padding: 10px 6px;
  }
  .info-value {
    font-size: 17px;
  }
  .plank-group {
    width: 360px;
  }
  .shortcut-hints {
    gap: 10px;
  }
  .button-row {
    gap: 8px;
  }
  .action-btn {
    padding: 8px 14px;
    font-size: 13px;
  }
  .test-panel-torque-info {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 10px;
  }
  .torque-value {
    font-size: 15px;
  }
  .torque-label {
    font-size: 9px;
  }
  .test-panel-form {
    flex-direction: column;
    gap: 10px;
  }
  .test-panel-field {
    min-width: 100%;
  }
  .test-panel-place-btn {
    width: 100%;
  }
  .test-panel-content {
    padding: 0 14px 14px;
  }
  .test-panel-toggle {
    padding: 10px 14px;
    font-size: 13px;
  }
}
