/* --- 基本レイアウトの整理 --- */
:root {
  --bb-muted: #64748b;
  --bb-line: #e2e8f0;
  --bb-danger: #e11d48;
  --bb-warn: #d97706;
  --bb-ok: #059669;
}

.bb-tool-island {
  margin: -60px auto 40px;
  padding: 0;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
  border: 1px solid #edf2f7;
  max-width: 1150px;
  overflow: hidden;
  text-align: left;
  box-sizing: border-box;
  transition: border-color 0.4s ease;
}

/*.bb-tool-head { padding:35px 35px 15px; border-bottom: 1px solid #edf2f7; background: #fff; }
.bb-tool-title { font-size: 28px; font-weight: 900; margin: 0; }
.bb-tool-lead { margin-top: 10px; font-size: 16px; color: var(--bb-muted); }*/

.gate-hero {padding: 40px 20px 20px;background: #ffffff;}
.gate-hero__inner {max-width: 930px;margin: 0 auto;display: flex;align-items: center;justify-content: space-between;gap: 40px;}
.gate-hero__content {flex: 1;}
.gate-hero__label {font-size: 14px;font-weight: bold;    color: #007bff; margin-bottom: 8px;}
.gate-hero__title {    font-size: 32px;    line-height: 1.3;    margin-bottom: 20px;}
.gate-hero__title-sub {    font-weight: 700;    color: #6c757d;}
.gate-hero__description {    font-size: 15px;    line-height: 1.8;}
.gate-hero__note {    display: block;    margin-top: 10px;    font-size: 0.85em;    opacity: 0.8;}
.gate-hero__visual {    flex: 0 0 380px;    text-align: center;}
.gate-hero__visual img {    max-width: 100%;    height: auto;    border-radius: 8px;}

@media (max-width: 768px) {
.gate-hero {padding: 20px 20px 0;}
    .gate-hero__inner {        flex-direction: column;        text-align: center;        gap: 30px;    }
    .gate-hero__visual { flex: 0 0 auto; order: -1; width: 100%; max-width: 320px;}
    .gate-hero__title {        font-size: 24px;    }
}

.bb-tool-body { padding: 25px; display: flex; flex-direction: column; gap: 24px; }

/* --- パネル・入力 --- */
.bb-panel { border: 1px solid #edf2f7; border-radius: 12px; background: #fff; }

.bb-panel-h {
  padding: 12px 20px;
  border-bottom: 1px solid #edf2f7;
  display: flex;
  flex-direction: column; /* 基本は縦積み */
  align-items: flex-start;
  justify-content: center;
  gap: 12px;
  background: #f8fafc;
  border-radius: 12px 12px 0 0;
  min-height: 50px; /* 高さの安定 */
}

/* 結果セクションのヘッダーのみ、SPでも横並びを維持して端に寄せる */
#result-section .bb-panel-h {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

/* PCでは入力セクションも横並びに戻す */
@media (min-width: 640px) {
  .bb-panel-h {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.bb-panel-h b { font-size: 16px; line-height: 1; }
.bb-panel-b { padding: 25px; }
.bb-runbar { margin-top: 5px; }

/* --- actions / chip / select --- */
.bb-actions { 
  display: flex; 
  align-items: center; 
  gap: 10px; 
  flex-wrap: wrap; 
  width: 100%; 
}

@media (min-width: 640px) {
  .bb-actions { width: auto; }
}

.bb-btn {
  appearance: none; border: 1px solid #e2e8f0; background: #fff; color: #0f172a;
  padding: 9px 14px; border-radius: 10px; font-weight: 900; cursor: pointer; transition: 0.2s;
}
.bb-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08); }
.bb-btn--primary { background: #111; color: #fff; border: none; padding: 12px 18px; border-radius: 12px; letter-spacing: 0.02em; }

.bb-chip { 
  display: inline-flex; 
  align-items: center; 
  gap: 8px; 
  padding: 8px 14px; 
  border: 1px solid #e2e8f0; 
  border-radius: 999px; 
  background: #fff; 
  font-weight: 900; 
  color: #0f172a; 
  font-size: 12px;
  line-height: 1;
}

.bb-dot { width: 8px; height: 8px; border-radius: 999px; background: #9ca3af; display: inline-block; }
.bb-dot.ok { background: var(--bb-ok); }
.bb-dot.warn { background: var(--bb-warn); }
.bb-dot.bad { background: var(--bb-danger); }

.bb-select { border: 1px solid transparent; background: transparent; font-weight: 900; color: #0f172a; outline: none; cursor: pointer; padding: 2px 0; border-radius: 8px; }

/* --- textarea --- */
.bb-textarea {
  width: 100%; height: 260px; padding: 16px; border-radius: 10px; border: 1px solid #e2e8f0;
  background: #0f172a; color: #f1f5f9; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px; line-height: 1.6;
}

/* --- 判定サマリー（Lighthouse風改善版） --- */
.bb-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 24px;
  border-radius: 14px;
  margin-bottom: 20px;
  border: 2px solid transparent;
  text-align: center;
}

@media (min-width: 768px) {
  .bb-gate {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}
@media (max-width: 768px) {
.bb-tool-body { padding: 15px;}
.bb-panel-b {padding: 15px;}
.bb-tool-title {text-align: center;}
}

.summary-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  flex: 1;
}

@media (min-width: 640px) {
  .summary-main {
    flex-direction: row;
    align-items: center;
    text-align: left;
  }
}

.summary-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* 状態別の色設定 */
.status-fail { background: rgba(239, 68, 68, 0.05); border-color: rgba(239, 68, 68, 0.3); }
.status-caution { background: rgba(217, 119, 6, 0.05); border-color: rgba(217, 119, 6, 0.3); }
.status-pass { background: rgba(5, 150, 105, 0.05); border-color: rgba(5, 150, 105, 0.3); }

/* バッジ */
.bb-badge {
  font-size: 16px;
  font-weight: 900;
  padding: 20px 18px;
  border-radius: 10px;
  color: #fff;
  letter-spacing: 0.05em;
  flex-shrink: 0;
  min-width: 100px;
  text-align: center;
}
.bb-badge.bad { background: var(--bb-danger); box-shadow: 0 4px 12px rgba(225, 29, 72, 0.2); }
.bb-badge.warn { background: var(--bb-warn); box-shadow: 0 4px 12px rgba(217, 119, 6, 0.2); }
.bb-badge.ok { background: var(--bb-ok); box-shadow: 0 4px 12px rgba(5, 150, 105, 0.2); }

.main-msg { font-size: 18px; font-weight: 900; color: #0f172a; line-height: 1.4; }
.sub-msg { font-size: 13px; color: var(--bb-muted); font-weight: 800; }

/* --- 集計チップ --- */
.summary-stats {
  display: flex;
  gap: 8px;
  padding: 10px;
  flex-shrink: 0;
}

.bb-pill {
  padding: 7px 12px 5px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #eee;
  background: #fff;
}
.bb-pill.red { color: var(--bb-danger); }
.bb-pill.yellow { color: var(--bb-warn); }
.bb-pill.green { color: var(--bb-ok); }

/* --- 詳細リスト --- */
.bb-list { display: flex; flex-direction: column; gap: 16px;margin-top: 10px; }
.bb-issue { padding: 20px; border: 1px solid #e2e8f0; border-radius: 14px; background: #fff; }
.bb-issue .top { display: flex; align-items: center; gap: 12px; font-weight: 900; font-size: 15px; }
.bb-issue .body { margin-top: 10px; font-size: 14px; color: #334155; line-height: 1.6; }
.bb-issue .fix {
  margin-top: 12px; padding: 12px 16px; border-radius: 10px;
  background: #0b1020; color: #dbe7ff; border-left: 4px solid var(--bb-muted);
  font-size: 13px; font-family: monospace; line-height: 1.5;
}
/* 括弧内のテキストを少し薄くして、システムメッセージと区別する */
.bb-issue .body span.current-val {
  display: block;
  margin-top: 4px;
  color: var(--bb-muted);
  font-size: 0.9em;
  background: #f1f5f9;
  padding: 4px 8px;
  border-radius: 4px;
}

/* --- その他 --- */
.bb-details-green { margin-top: 30px; padding-top: 25px; border-top: 2px dashed #e2e8f0; }
.bb-details-green summary { font-weight: 900; color: var(--bb-muted); cursor: pointer; }
.empty-msg { text-align: center; padding: 40px; color: #94a3b8; font-weight: 800; }
.bb-hr { border: none; height: 1px; background: #e2e8f0; margin: 10px 0; }
.bb-note { font-size: 12px; color: var(--bb-muted); font-weight: 700; margin-top: 15px; }

.fix {
  white-space: pre-wrap;
}