/* --- 1. 島（アイランド）レイアウト・基盤 --- */
.bb-tool-island {
  margin: -60px auto 80px; padding: 40px; background: #fff;
  border-radius: 24px; box-shadow: 0 20px 50px rgba(0,0,0,.08);
  border: 1px solid #f1f5f9; max-width: 1040px; position: relative; z-index: 10;
}
.tool-main-header { text-align: center; margin-bottom: 40px; }
.tool-main-title { font-size: 28px; font-weight: 800; color: #1e293b; margin-bottom: 8px; }
.tool-main-sub { color: #64748b; font-size: 15px; }

/* 2カラムレイアウト：PCで左右、スマホで上下に自動切替 */
.bb-grid-layout { display: grid; grid-template-columns: 1fr; gap: 32px; align-items: start; }
@media (min-width: 960px) {
  .bb-grid-layout { grid-template-columns: 1.2fr 0.8fr; }
}

/* --- 2. パネル・入力要素 --- */
.bb-panel { background: #f8fafc; padding: 32px; border-radius: 20px; border: 1px solid #f1f5f9; height: 100%; box-sizing: border-box; }
.tool-section { margin-bottom: 24px; }
.tool-section-label { 
  display: inline-block; padding: 4px 12px; background: #e0e7ff; color: #4338ca; 
  font-size: 12px; font-weight: 800; border-radius: 6px; margin-bottom: 16px; 
}
.bb-label { display: block; font-size: 13px; font-weight: 700; color: #475569; margin-bottom: 8px; }

/* 入力フォーム：スマホオートズーム防止のため16px以上を維持 */
.bb-input, .bb-select {
  width: 100%; padding: 12px 16px; border: 1px solid #cbd5e1; border-radius: 12px;
  background: #fff; font-size: 16px; transition: .2s; box-sizing: border-box;
  font-family: inherit;
}
/* テキストエリア・コード用フォント */
textarea.bb-input { font-family: 'Menlo', 'Consolas', 'Monaco', monospace; line-height: 1.6; resize: vertical; }
.bb-input:focus { border-color: #6366f1; outline: none; box-shadow: 0 0 0 4px rgba(99,102,241,0.1); }
.bb-hint { font-size: 11px; color: #94a3b8; margin-top: 6px; line-height: 1.5; }

/* --- 3. ツール固有の調整パーツ --- */
.gmq-mode-selector { display: flex; gap: 10px; margin-bottom: 20px; }
.mode-tab { flex: 1; position: relative; cursor: pointer; }
.mode-tab input { position: absolute; opacity: 0; }
.mode-tab span {
  display: block; padding: 12px; text-align: center; border: 2px solid #e2e8f0;
  border-radius: 12px; font-size: 13px; font-weight: 700; color: #64748b; transition: .2s;
}
.mode-tab input:checked + span { border-color: #6366f1; background: #f5f7ff; color: #4338ca; }

.gmq-config-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.config-item { display: flex; flex-direction: column; }
.bb-mini { font-size: 11px; color: #64748b; margin-bottom: 4px; display: block; }
.bb-color-picker { width: 100%; height: 44px; border: 1px solid #cbd5e1; border-radius: 10px; cursor: pointer; padding: 4px; background: #fff; }

/* --- 4. ボタン・アクション --- */
.btn--primary-action {
  background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%);
  color: #fff; border: none; padding: 16px; width: 100%;
  border-radius: 14px; font-weight: 800; font-size: 16px;
  cursor: pointer; transition: .3s;
  box-shadow: 0 4px 12px rgba(67, 56, 202, 0.2);
}
.btn--primary-action:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(67, 56, 202, 0.3); }
.btn--primary-action:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }

/* 下部アクションボタン：保存と共有/コピー */
.bb-action-group { display: grid; grid-template-columns: 1.2fr 1fr; gap: 12px; margin-top: 20px; }
.bb-btn-download, .bb-btn-copy {
  padding: 14px; border-radius: 12px; font-weight: 700; cursor: pointer; border: none; transition: .2s; font-size: 14px; text-align: center;
}
.bb-btn-download { background: #6366f1; color: #fff; }
.bb-btn-download:disabled { background: #cbd5e1; color: #94a3b8; cursor: not-allowed; }
.bb-btn-copy { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.bb-btn-copy:hover { background: #e2e8f0; }

/* --- 5. プレビュー・結果表示 --- */
.preview-card { background: #fff; padding: 24px; border-radius: 20px; border: 1px solid #e2e8f0; text-align: center; height: 100%; box-sizing: border-box; }
.qr-display {
  width: 100%; max-width: 240px; aspect-ratio: 1 / 1;
  margin: 0 auto; display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: #f8fafc; border-radius: 12px;
}
.qr-placeholder { font-size: 13px; color: #94a3b8; line-height: 1.6; }
.qr-display canvas, .qr-display img { max-width: 100% !important; height: auto !important; }
.bb-mini-code { font-family: monospace; font-size: 11px; background: #f8fafc; padding: 8px; border-radius: 6px; margin: 16px 0; color: #64748b; word-break: break-all; text-align: left; }

/* --- 6. スマートフォン最適化 --- */
@media (max-width: 768px) {
  .bb-tool-island { padding: 20px 16px; margin: -80px 0 40px; border-radius: 12px; border-left: none; border-right: none; }
  .bb-panel { padding: 20px 16px; }
  .bb-action-group { grid-template-columns: 1fr; } /* スマホではボタンを縦並びに */
  .tool-main-title { font-size: 22px; }
}

/* パンくずの1行省略表示対応 */
.bb-breadcrumb { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bb-breadcrumb span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* 必須マーク */
.bb-req { font-size: 11px; color: #ef4444; margin-left: 4px; vertical-align: top; }

/* 上下レイアウト用のコンテナ調整 */
.bb-tool-container {
  max-width: 900px; /* 縦長の場合は少し幅を絞ると読みやすくなります */
  margin: 0 auto;
}

/* テキストエリアの視認性向上 */
textarea.bb-input {
  font-size: 15px; /* 16pxだと大きすぎる場合、15px程度が長文には適しています */
  tab-size: 4;
}

/* 変換結果エリアの強調 */
#br-output {
  border-width: 2px;
  background-color: #fafbff;
}