.tool-main-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  max-width: 620px;
  margin: 0 auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  box-shadow: var(--shadow-base);

  --color-white: #fff;
  --color-cw: #22c55e;
  --color-warning: #f59e0b;
}

.crown-top-row {
  display: flex;
  gap: 1rem;
  align-items: stretch;
}

.crown-visual {
  background: var(--bg-page);
  border-radius: 0.75rem;
  padding: 0.375rem 0.5rem;
  border: 1px solid var(--border-base);
  flex: 0 0 45%;
  display: flex;
  align-items: center;
}

.crown-svg {
  width: 100%;
  height: auto;
  display: block;
}

.crown-tube {
  fill: var(--crown-tube-fill, #b8b8c4);
  stroke: var(--crown-tube-stroke, #9898a4);
  stroke-width: 1;
}

.theme-dark .crown-tube {
  --crown-tube-fill: #484858;
  --crown-tube-stroke: #606070;
}

.crown-stem {
  fill: var(--crown-stem-fill, #a8a8b4);
  stroke: var(--crown-stem-stroke, #888898);
  stroke-width: 0.8;
}

.theme-dark .crown-stem {
  --crown-stem-fill: #505060;
  --crown-stem-stroke: #686878;
}

.crown-head {
  fill: var(--crown-head-fill, #c8c8d4);
  stroke: var(--crown-head-stroke, #888898);
  stroke-width: 1;
}

.theme-dark .crown-head {
  --crown-head-fill: #555568;
  --crown-head-stroke: #707080;
}

.crown-notch {
  fill: var(--crown-notch-fill, #b0b0be);
}

.theme-dark .crown-notch {
  --crown-notch-fill: #404050;
}

.crown-stem,
.crown-head {
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.arrow-cw,
.arrow-ccw {
  transition: opacity 0.3s ease;
}

.arrow-bg {
  fill: var(--bg-surface);
  stroke: var(--border-base);
  stroke-width: 1;
  opacity: 0.9;
}

.arrow-path {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
}

.arrow-head {
  stroke: none;
}

.arrow-text {
  font-size: 8px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: central;
}

.arrow-cw .arrow-path,
.arrow-cw .arrow-head {
  stroke: var(--color-cw);
  fill: var(--color-cw);
}

.arrow-cw .arrow-text {
  fill: var(--color-cw);
}

.arrow-ccw .arrow-path,
.arrow-ccw .arrow-head {
  stroke: var(--color-warning);
  fill: var(--color-warning);
}

.arrow-ccw .arrow-text {
  fill: var(--color-warning);
}

.crown-side {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  justify-content: center;
}

.movement-selector {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.selector-label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--text-dimmed);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.movement-select {
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border-base);
  border-radius: 0.5rem;
  background: var(--bg-page);
  color: var(--text-base);
  font-size: 0.75rem;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 10l5 5 5-5z' fill='%23888'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.35rem center;
  background-size: 0.875rem;
  padding-right: 1.4rem;
}

.movement-select:focus {
  border-color: var(--accent);
}

.pos-bar {
  display: flex;
  gap: 0.3rem;
}

.pos-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  padding: 0.35rem 0.3rem;
  border: 1.5px solid var(--border-base);
  border-radius: 0.5rem;
  background: var(--bg-page);
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1;
  min-width: 0;
}

.pos-chip:hover {
  border-color: var(--accent);
}

.pos-chip.active {
  border-color: var(--accent);
  background: var(--accent);
}

.chip-num {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-dimmed);
  line-height: 1;
  transition: color 0.2s;
}

.pos-chip.active .chip-num {
  color: var(--color-white);
}

.chip-label {
  font-size: 0.5rem;
  font-weight: 600;
  color: var(--text-dimmed);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: color 0.2s;
}

.pos-chip.active .chip-label {
  color: var(--color-white);
}

.position-panel {
  background: var(--bg-page);
  border: 1px solid var(--border-base);
  border-radius: 0.75rem;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid var(--border-base);
}

.position-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.position-badge {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--color-white);
  font-size: 0.6875rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.position-name {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-base);
}

.pull-btn {
  background: none;
  border: 1px solid var(--border-base);
  border-radius: 0.375rem;
  color: var(--text-dimmed);
  cursor: pointer;
  padding: 0.3rem;
  display: flex;
  transition: all 0.2s;
}

.pull-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.panel-body {
  padding: 0.75rem 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.panel-desc {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-base);
  line-height: 1.45;
}

.panel-detail {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-dimmed);
  line-height: 1.45;
}

.panel-attributes {
  display: flex;
  gap: 0.75rem;
}

.attribute-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.5rem;
  background: var(--bg-surface);
  border-radius: 0.375rem;
  border: 1px solid var(--border-base);
}

.attr-icon {
  color: var(--text-dimmed);
  display: flex;
}

.attr-label {
  font-size: 0.625rem;
  color: var(--text-dimmed);
  font-weight: 600;
}

.attr-value {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--accent);
}

.panel-note {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  padding: 0.4rem 0.625rem;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 0.5rem;
  font-size: 0.6875rem;
  color: var(--color-warning);
  line-height: 1.4;
}

.panel-note svg {
  flex-shrink: 0;
  margin-top: 0.1rem;
}

@media (max-width: 520px) {
  .tool-main-card {
    padding: 1rem;
    gap: 0.75rem;
  }

  .crown-top-row {
    flex-direction: column;
  }

  .crown-visual {
    flex: none;
    width: 100%;
  }

  .panel-attributes {
    flex-wrap: wrap;
  }
}
