/* ================================================================
   デジタル水墨画v2.0 - CSS
   Uses perfect-freehand (MIT License, © Steve Ruiz)
================================================================ */

.sumi-error {
  position: fixed;
  inset: 20px;
  background: #fff7ed;
  color: #9a3412;
  border: 2px solid #fb923c;
  border-radius: 12px;
  padding: 16px;
  z-index: 9999;
  font-weight: 700;
  font-size: 15px;
}

.sumi-container {
  width: 100%;
  height: calc(100vh - 120px);
  min-height: 400px;
  background: #111827;
  overflow: hidden;
  border-radius: 10px;
  box-sizing: border-box;
}

.sumi-grid {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 12px;
  height: 100%;
  padding: 12px;
  box-sizing: border-box;
}

/* パネル */
.sumi-panel {
  background: white;
  border-radius: 14px;
  padding: 18px 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.2);
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  box-sizing: border-box;
}

.sumi-title {
  font-size: 22px;
  font-weight: 900;
  color: #1f2937;
  letter-spacing: .02em;
  margin: 0;
}

.sumi-section {
  font-size: 13px;
  font-weight: 800;
  color: #6b7280;
  letter-spacing: .06em;
  padding-bottom: 5px;
  border-bottom: 2px solid #e5e7eb;
}

/* プリセットボタン */
.sumi-preset-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.sumi-preset-group.sumi-col2 {
  grid-template-columns: 1fr 1fr;
}

.sumi-preset-btn {
  border: 3px solid #e5e7eb;
  border-radius: 12px;
  background: white;
  color: #374151;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  padding: 14px 6px 10px;
  cursor: pointer;
  transition: all .15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  line-height: 1.2;
}

.sumi-preset-btn .sumi-icon {
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 26px;
}

.sumi-brush-line {
  display: block;
  width: 32px;
  background: currentColor;
  border-radius: 2px;
}

.sumi-preset-btn:hover  { border-color: #6366f1; background: #f5f3ff; }
.sumi-preset-btn:active { transform: scale(.96); }
.sumi-preset-btn.active { border-color: #1e3a5f; background: #1e3a5f; color: white; }

/* 操作ボタン */
.sumi-button-grid   { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sumi-button-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }

.sumi-button {
  border: 0;
  border-radius: 10px;
  padding: 12px 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
}
.sumi-button:hover  { transform: translateY(-1px); box-shadow: 0 4px 8px rgba(0,0,0,.1); }
.sumi-button:active { transform: scale(.97); }
.sumi-button-primary   { background: #6366f1; color: white; }
.sumi-button-primary:hover  { background: #5855eb; }
.sumi-button-danger    { background: #ef4444; color: white; }
.sumi-button-danger:hover   { background: #dc2626; }
.sumi-button-secondary { background: #e5e7eb; color: #374151; }
.sumi-button-secondary:hover { background: #d1d5db; }

/* フッター */
.sumi-footer {
  font-size: 10px;
  color: #9ca3af;
  text-align: center;
  line-height: 1.6;
  margin-top: auto;
}

/* キャンバス */
.sumi-canvas-container {
  position: relative;
  background: #f8fafc;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}

#sumi-main-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
  touch-action: none;
}

/* レスポンシブ */
@media (max-width: 768px) {
  .sumi-container { height: auto; }
  .sumi-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: auto;
  }
  .sumi-panel          { order: 2; }
  .sumi-canvas-container { order: 1; min-height: 55vh; }
}

/* 修正: SVGアイコン共通スタイル（文字なし・アイコンのみ） */
.sumi-btn-icon {
  width: 1.4em;
  height: 1.4em;
  vertical-align: middle;
  pointer-events: none;
  display: block;
  margin: 0 auto;
  /* primary/danger(白背景上)はデフォルト白 */
  filter: brightness(0) invert(1);
}
/* secondary は明るい背景なので黒アイコン */
.sumi-button-secondary .sumi-btn-icon {
  filter: brightness(0);
}
