:root {
  --bg-cream: #FDF8F2;
  --panel-beige: #F5ECE1;
  --panel-light: #FAF4EC;
  --border-stitch: #D8C5B0;
  --accent-terracotta: #D96B43;
  --accent-terracotta-dark: #B9532E;
  --accent-sage: #6B8E78;
  --accent-sage-dark: #52725E;
  --text-brown: #3E2F26;
  --text-muted: #7A6557;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Noto Sans JP', 'Inter', sans-serif;
  background-color: var(--bg-cream);
  color: var(--text-brown);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

.stitch-border {
  border: 1.5px dashed var(--border-stitch);
}

.stitch-card {
  background-color: var(--panel-beige);
  border: 1px solid #E5D6C5;
  box-shadow: 0 2px 8px rgba(62, 47, 38, 0.05);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: #E2D2C0;
  border-radius: 999px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-terracotta);
  border: 2px solid #FFFDF9;
  box-shadow: 0 1px 4px rgba(62, 47, 38, 0.28);
  cursor: pointer;
  transition: transform 0.12s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.12);
}

::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}
::-webkit-scrollbar-track {
  background: #EFE4D6;
  border-radius: 6px;
}
::-webkit-scrollbar-thumb {
  background: #C9B39C;
  border-radius: 6px;
  border: 2px solid #EFE4D6;
}
::-webkit-scrollbar-thumb:hover {
  background: #B39A80;
}

.stitch-token {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  margin-right: 4px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.12s ease, transform 0.1s ease, box-shadow 0.12s ease, outline 0.1s ease;
  white-space: nowrap;
  border: 1px solid transparent;
}

.stitch-single {
  width: 30px;
  padding: 0;
  text-align: center;
}

.stitch-group {
  padding: 0 8px;
}

.stitch-token:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(62, 47, 38, 0.16);
  border-color: var(--accent-terracotta);
}

.hl-self {
  outline: 2.5px solid #D96B43 !important;
  outline-offset: 1px;
  z-index: 5;
}
.hl-parent {
  outline: 2.5px solid #2D7A9C !important;
  outline-offset: 1px;
  background-color: #DDF0F8 !important;
  z-index: 4;
}
.hl-child {
  outline: 2.5px solid #4A8B5C !important;
  outline-offset: 1px;
  background-color: #DFF2E4 !important;
  z-index: 4;
}

.st-x { background-color: #FFFDF9; color: #3E2F26; border-color: #DFCBB7; }
.st-v { background-color: #FCE6DC; color: #B64922; border-color: #EBB8A4; }
.st-a { background-color: #E2EFE6; color: #3A664B; border-color: #B7D3C0; }
.st-w { background-color: #FBE0EC; color: #9E3363; border-color: #E8B2CA; }
.st-m { background-color: #E2ECF7; color: #2D5A88; border-color: #B4CBE4; }
.st-repeat { background-color: #F7EFE5; color: #4A382D; border-color: #D4BFA8; }

.fixed-tool-btn {
  width: 126px;
  justify-content: center;
}

.spin-btn {
  width: 22px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  line-height: 1;
  background: #FFFDF9;
  border: 1px solid #D6C2AD;
  color: #5C473B;
  cursor: pointer;
  transition: background-color 0.1s, opacity 0.1s;
}
.spin-btn:hover:not(:disabled) {
  background: #F2E2D0;
  color: #D96B43;
}
.spin-btn:active:not(:disabled) {
  background: #E5CEB5;
}
.spin-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  background: #EFE7DD;
}

.vertical-slider-wrap {
  width: 28px;
  height: 176px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.vertical-row-slider {
  width: 168px !important;
  height: 6px !important;
  transform: rotate(-90deg);
  transform-origin: center;
  background: #E2D2C0;
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
}
