/* ツールバー */
.toolbar-dock {
  background: var(--kaku-bg-secondary);
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 5px;
  z-index: 20;
}

/* 新ドックシステム有効時は旧ツールバーを非表示 */
.toolbar-dock.hidden {
  display: none !important;
}

.toolbar-dock__row {
  display: flex;
  align-items: center;
  gap: 5px;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
}

.toolbar-dock__group {
  display: flex;
  gap: 2px;
}

/* ツールボタン */
.tool-btn {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  background: transparent;
  border: none;
  color: var(--kaku-text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 4px;

  /* タッチ最適化 */
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.tool-btn.is-active,
.tool-btn.active {
  background: var(--kaku-accent-primary);
  color: var(--kaku-text-inverse) !important;
  box-shadow: 0 0 8px var(--kaku-accent-primary);
  border: 1px solid var(--kaku-accent-primary);
  font-weight: bold;
}

.tool-btn.is-active .material-symbols-outlined,
.tool-btn.active .material-symbols-outlined {
  color: var(--kaku-text-inverse) !important;
}

.tool-btn:not(.is-active):not(.active):hover {
  background: var(--kaku-bg-ghost);
}

.tool-btn:active {
  background: var(--kaku-accent-primary);
  color: var(--kaku-text-inverse) !important;
}

.tool-btn:active .material-symbols-outlined {
  color: var(--kaku-text-inverse) !important;
}

/* 横配置時のツールボタン調整 */
body.layout-left .tool-btn,
body.layout-right .tool-btn {
  width: 44px;
  font-size: 0.65rem;
  line-height: 1.1;
  padding: 2px;
  text-align: center;
}

/* 対称・補助線ボタンのラベル */
.tool-btn span {
  font-size: 0.65rem;
  line-height: 1.2;
  white-space: normal; /* 改行を許可(<br>のみ) */
  text-align: center;
}

/* ペンサイズボタン */
.size-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--kaku-border-light);
  background: transparent;
  color: var(--kaku-text-primary);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.7rem;
  flex-shrink: 0;
}

.size-btn.is-active,
.size-btn.active {
  background: var(--kaku-accent-primary);
  color: var(--kaku-text-inverse);
  border: 2px solid var(--kaku-accent-primary);
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.2);
  font-weight: bold;
  transform: scale(1.1);
}

.size-btn:active {
  background: var(--kaku-accent-primary);
  color: var(--kaku-text-inverse);
}

/* ペンサイズボタングループ */
.size-group {
  display: flex;
  gap: 2px;
  background: var(--kaku-bg-tertiary);
  padding: 2px;
  border-radius: 4px;
}

body.layout-left .size-group,
body.layout-right .size-group {
  flex-direction: column;
  width: 28px;
}

/* パレットコンテナ */
.palette-container {
  display: flex;
  align-items: center;
  gap: 5px;
}

#quickPalette {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  max-width: 200px;
  padding: 2px;
  scrollbar-width: none;
}

#quickPalette::-webkit-scrollbar {
  display: none;
}

.qp-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--kaku-border-light);
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.1s;
}

.qp-swatch:hover {
  transform: scale(1.1);
}

.qp-swatch:active {
  transform: scale(0.95);
}

/* 横配置時のパレット調整 */
body.layout-left #quickPalette,
body.layout-right #quickPalette {
  flex-direction: column;
  max-width: 100%;
  max-height: 300px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ヘッダー */
.header {
  height: 40px;
  background: var(--kaku-bg-secondary);
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 10px;
  border-bottom: 1px solid var(--border-color);
  z-index: 20;
}

.header-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-color);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s;
}

.header-btn:hover {
  background: var(--kaku-bg-tertiary);
}

.btn-primary {
  background: var(--accent-color);
  color: #fff;
  border: none;
  font-weight: bold;
}
