/* --- 1. アイランド・ヘッダー全体のレイアウト --- */
.bb-tool-island { 
  margin: -60px auto 80px; 
  padding: 40px; 
  background: #fff; 
  border-radius: 12px; 
  box-shadow: 0 30px 60px rgba(0,0,0,.1); 
  border: 1px solid #edf2f7; 
  max-width: 1080px; 
  box-sizing: border-box; 
}

.bb-tool-header { margin-bottom: 24px; }
.bb-tool-title { font-size: 24px; font-weight: 900; color: #1a202c; margin-bottom: 8px; }
.bb-tool-intro { font-size: 14px; color: #718096; line-height: 1.6; }

/* --- 2. ツールバー（操作用） --- */
.editor-toolbar { 
  display: flex; 
  gap: 8px; 
  padding: 12px; 
  background: #f8fafc; 
  border: 1px solid #e2e8f0; 
  border-radius: 8px 8px 0 0;
  align-items: center; 
}

.btn-tool {
  height: 36px;
  padding: 0 16px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  transition: all 0.2s;
}
.btn-tool:hover { background: #f1f5f9; border-color: #94a3b8; }

/* --- 3. 2カラム・エディタコンテナ --- */
.editor-container { 
  display: flex; 
  border: 1px solid #e2e8f0; 
  border-radius: 0 0 8px 8px; 
  overflow: hidden; 
  height: 600px; /* 分析用に少し高さを確保 */
}

.editor-pane { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* 左：入力エリア */
.pane-edit { background: #fff; border-right: 1px solid #e2e8f0; }
.pane-label { 
  padding: 8px 16px; 
  font-size: 10px; 
  font-weight: 800; 
  letter-spacing: 0.1em; 
  color: #94a3b8; 
  border-bottom: 1px solid rgba(0,0,0,0.05); 
}

#checker-input {
  flex: 1;
  padding: 24px;
  border: none;
  outline: none;
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 14px;
  line-height: 1.6;
  resize: none;
}

/* 右：診断パネル */
.pane-diag { background: #f8fafc; }

.diag-wrapper {
  padding: 24px;
  overflow-y: auto;
  height: 100%;
}

/* --- 4. 診断パーツのスタイリング --- */

/* サマリー（H1有無・階層状態） */
.diag-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}
.diag-stat {
  background: #fff;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

/* アラート表示（エラー・成功） */
.diag-alerts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.alert-item {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
}
.alert-error { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.alert-success { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }

/* 階層ツリー構造 */
.diag-tree { display: flex; flex-direction: column; gap: 6px; }
.tree-item {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  background: #fff;
  border: 1px solid #edf2f7;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

/* 階層ごとの字下げとアクセント */
.tree-item.level-1 { margin-left: 0; border-left: 4px solid #6366f1; background: #f5f3ff; }
.tree-item.level-2 { margin-left: 20px; border-left: 4px solid #a855f7; }
.tree-item.level-3 { margin-left: 40px; border-left: 4px solid #ec4899; }
.tree-item.level-4 { margin-left: 60px; border-left: 4px solid #94a3b8; }
.tree-item.level-5 { margin-left: 80px; border-left: 4px solid #cbd5e1; }
.tree-item.level-6 { margin-left: 100px; border-left: 4px solid #e2e8f0; }

.tag-badge {
  font-size: 10px;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  color: #64748b;
  min-width: 28px;
  text-align: center;
}

.error-marker { color: #ef4444; margin-left: auto; font-size: 16px; }

/* ステータスバー */
.editor-status-bar { 
  padding: 10px 16px; 
  background: #f8fafc; 
  border-top: 1px solid #e2e8f0; 
  font-size: 11px; 
  font-weight: 700; 
  color: #94a3b8; 
}

/* --- 5. レスポンシブ対応 --- */
@media (max-width: 768px) {
  .bb-tool-island { padding: 16px; margin: -80px 0 40px; }
  .editor-container { flex-direction: column; height: auto; }
  #checker-input { height: 300px; }
  .pane-diag { border-left: none; border-top: 2px solid #e2e8f0; }
  .diag-tree { gap: 4px; }
  .tree-item { font-size: 12px; }
}

/* --- 満点時のスコアカード --- */
.diag-score-card {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: #fff;
  padding: 24px 16px;
  border-radius: 12px;
  text-align: center;
  margin-bottom: 20px;
  box-shadow: 0 10px 20px rgba(34, 197, 94, 0.2);
  animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.score-number {
  font-size: 42px;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 4px;
}

.score-number::after {
  content: '点';
  font-size: 16px;
  margin-left: 4px;
}

.score-text {
  font-size: 13px;
  font-weight: 700;
  opacity: 0.9;
}

/* 登場時のアニメーション */
@keyframes popIn {
  0% { transform: scale(0.9); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}