* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #f8f9fa; color: #1a1a2e; }

header {
  background: #1a1a2e; color: #fff;
  padding: 18px 32px; display: flex; align-items: center; justify-content: space-between;
}
header h1 { font-size: 1.2rem; font-weight: 700; }
header p { font-size: 0.75rem; color: #9ca3af; margin-top: 2px; }

.container { max-width: 1080px; margin: 0 auto; padding: 28px 16px; }

/* 検索パネル */
.search-panel {
  background: #fff; border-radius: 12px; padding: 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07); margin-bottom: 24px;
}
.search-panel h2 { font-size: 0.9rem; color: #6b7280; margin-bottom: 14px; }

.company-row {
  display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px;
}
.row-label {
  font-size: 0.85rem; font-weight: 700; width: 22px; padding-top: 11px; flex-shrink: 0;
}
.search-col { position: relative; flex: 1; min-width: 0; }
.search-row { display: flex; gap: 8px; }
.search-row input {
  flex: 1; padding: 10px 14px; border: 1.5px solid #ddd; border-radius: 8px;
  font-size: 0.95rem; outline: none; transition: border-color 0.2s; min-width: 0;
}
.search-row input:focus { border-color: #2563eb; }
.btn-sm {
  padding: 10px 14px; color: #fff; border: none; border-radius: 8px;
  font-size: 0.85rem; cursor: pointer; white-space: nowrap; flex-shrink: 0;
}
.dropdown {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 100;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1); margin-top: 4px; display: none;
}
.dropdown.open { display: block; }
.dropdown-item {
  padding: 10px 14px; cursor: pointer; display: flex;
  justify-content: space-between; align-items: center; font-size: 0.9rem;
}
.dropdown-item:hover { background: #eff6ff; }
.dropdown-item .code { font-size: 0.75rem; color: #9ca3af; }
.company-badge {
  display: flex; align-items: center; justify-content: space-between;
  border: 1.5px solid; border-radius: 8px; padding: 10px 14px;
  font-size: 0.95rem; font-weight: 600;
}
.company-badge button { background: none; border: none; cursor: pointer; font-size: 1rem; color: #9ca3af; }

/* 市場バッジ */
.market-badge {
  display: inline-block; font-size: 0.62rem; font-weight: 800;
  padding: 2px 5px; border-radius: 3px; margin-right: 5px; vertical-align: middle;
  letter-spacing: 0.02em;
}
.market-JP { background: #dbeafe; color: #1d4ed8; }
.market-US { background: #dcfce7; color: #15803d; }

.price-col { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.price-input {
  width: 130px; padding: 10px 10px; border: 1.5px solid #ddd; border-radius: 8px;
  font-size: 0.9rem; outline: none; transition: border-color 0.2s;
}
.price-input:focus { border-color: #2563eb; }
.price-input:disabled { background: #f3f4f6; color: #9ca3af; }
.price-unit { font-size: 0.8rem; color: #9ca3af; }

.btn-remove {
  padding: 9px 10px; background: none; border: 1px solid #e5e7eb; color: #9ca3af;
  border-radius: 8px; font-size: 0.8rem; cursor: pointer; flex-shrink: 0; transition: all 0.15s;
}
.btn-remove:hover { background: #fee2e2; border-color: #fca5a5; color: #dc2626; }

.btn-add {
  width: 100%; padding: 10px; border: 1.5px dashed #d1d5db; background: none;
  border-radius: 8px; font-size: 0.9rem; color: #6b7280; cursor: pointer; margin-top: 4px;
  transition: all 0.15s;
}
.btn-add:hover { border-color: #2563eb; color: #2563eb; background: #eff6ff; }

/* 設定パネル（APIキー） */
.settings-toggle {
  font-size: 0.78rem; color: #9ca3af; background: none; border: none;
  cursor: pointer; padding: 4px 0; display: flex; align-items: center; gap: 5px;
  margin-top: 14px; transition: color 0.15s;
}
.settings-toggle:hover { color: #374151; }
.settings-panel {
  margin-top: 10px; padding: 14px 16px; background: #f9fafb;
  border-radius: 8px; border: 1px solid #e5e7eb; display: none;
}
.settings-panel.open { display: block; }
.settings-panel p { font-size: 0.75rem; color: #6b7280; margin-bottom: 10px; line-height: 1.5; }
.settings-row { display: flex; gap: 8px; align-items: center; }
.model-row { margin-top: 10px; }
.model-row label { font-size: 0.75rem; color: #6b7280; display: block; margin-bottom: 5px; }
.model-select {
  width: 100%; padding: 8px 10px; border: 1.5px solid #ddd; border-radius: 6px;
  font-size: 0.83rem; background: #fff; outline: none; cursor: pointer;
  transition: border-color 0.2s;
}
.model-select:focus { border-color: #4f46e5; }
.model-fetch-status { font-size: 0.72rem; color: #9ca3af; margin-top: 4px; }
.settings-row input {
  flex: 1; padding: 8px 12px; border: 1.5px solid #ddd; border-radius: 6px;
  font-size: 0.85rem; font-family: monospace; outline: none; transition: border-color 0.2s;
}
.settings-row input:focus { border-color: #4f46e5; }
.btn-xs {
  padding: 8px 12px; border: 1px solid #e5e7eb; background: #fff;
  border-radius: 6px; font-size: 0.8rem; cursor: pointer; white-space: nowrap; transition: background 0.15s;
}
.btn-xs:hover { background: #f3f4f6; }
.btn-xs.primary { background: #4f46e5; color: #fff; border-color: #4f46e5; }
.btn-xs.primary:hover { background: #4338ca; }
.api-status { font-size: 0.72rem; margin-top: 8px; }
.api-status.set { color: #16a34a; }
.api-status.unset { color: #9ca3af; }

.search-actions { margin-top: 16px; display: flex; gap: 10px; align-items: center; }
.btn-primary {
  padding: 12px 32px; background: #1a1a2e; color: #fff; border: none;
  border-radius: 8px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: background 0.2s;
}
.btn-primary:hover { background: #2d2d4e; }
.btn-primary:disabled { background: #9ca3af; cursor: not-allowed; }
.status-msg { font-size: 0.85rem; color: #6b7280; display: flex; align-items: center; gap: 8px; }
.spinner {
  width: 16px; height: 16px; border: 2px solid #ddd; border-top-color: #2563eb;
  border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

#result { display: none; }

/* サマリーカード */
.summary-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.summary-card {
  border-radius: 12px; padding: 20px; color: #fff;
  display: flex; justify-content: space-between; align-items: flex-start;
}
.summary-card .name { font-size: 1rem; font-weight: 700; }
.summary-card .rating { font-size: 0.78rem; color: rgba(255,255,255,0.75); margin-top: 4px; }
.summary-card .price-info { font-size: 0.72rem; color: rgba(255,255,255,0.9); margin-top: 6px; }
.wiki-toggle { background: none; border: 1px solid rgba(255,255,255,0.35); color: rgba(255,255,255,0.8); font-size: 0.68rem; padding: 2px 8px; border-radius: 10px; cursor: pointer; margin-top: 6px; display: none; }
.wiki-desc { font-size: 0.71rem; color: rgba(255,255,255,0.85); margin-top: 6px; line-height: 1.5; display: none; }
.score-badge {
  text-align: center; background: rgba(255,255,255,0.15); border-radius: 50%;
  width: 64px; height: 64px; flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.score-badge .num { font-size: 1.45rem; font-weight: 800; }
.score-badge .denom { font-size: 0.6rem; opacity: 0.8; }

.section {
  background: #fff; border-radius: 12px; padding: 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07); margin-bottom: 24px;
}
.section h3 { font-size: 1rem; font-weight: 700; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 2px solid #f3f4f6; }

/* チェックリスト */
.check-table { width: 100%; border-collapse: collapse; }
.check-table th { font-size: 0.8rem; color: #6b7280; font-weight: 700; padding: 8px 12px; text-align: center; white-space: nowrap; }
.check-table th.left { text-align: left; }
.check-table td { padding: 10px 12px; border-top: 1px solid #f3f4f6; font-size: 0.88rem; vertical-align: middle; }
.check-table td.label { font-weight: 500; }
.check-table td.center { text-align: center; }
.check-table .detail { font-size: 0.72rem; color: #9ca3af; margin-top: 2px; }
.mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%; font-weight: 700; font-size: 0.9rem;
}
.mark.ok { background: #dcfce7; color: #16a34a; }
.mark.tri { background: #fef9c3; color: #ca8a04; }
.mark.ng { background: #fee2e2; color: #dc2626; }
.mark.unk { background: #f3f4f6; color: #9ca3af; }
.mark.ai  { background: #ede9fe; color: #7c3aed; width: auto; min-width: 44px; padding: 0 7px; font-size: 0.65rem; border-radius: 10px; white-space: nowrap; }
.check-table tr:hover td { background: #f9fafb; }

/* 総合判定バッジ */
.verdict-row { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.verdict-card {
  flex: 1; min-width: 160px; border-radius: 10px; padding: 12px 16px;
  display: flex; align-items: center; gap: 12px; border: 1.5px solid;
}
.verdict-score { font-size: 1.6rem; font-weight: 800; line-height: 1; white-space: nowrap; }
.verdict-score .denom { font-size: 0.85rem; font-weight: 500; }
.verdict-label { font-size: 0.88rem; font-weight: 700; }
.verdict-sub { font-size: 0.72rem; margin-top: 2px; opacity: 0.85; }
.v-excellent { background: #dcfce7; color: #15803d; border-color: #86efac; }
.v-good      { background: #dbeafe; color: #1d4ed8; border-color: #93c5fd; }
.v-normal    { background: #fef9c3; color: #ca8a04; border-color: #fde047; }
.v-caution   { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }

/* レーダー総合スコア */
.radar-totals { display: flex; justify-content: center; gap: 28px; margin-top: 16px; flex-wrap: wrap; }
.radar-total-item { text-align: center; }
.radar-total-num { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.radar-total-lbl { font-size: 0.7rem; color: #6b7280; margin-top: 3px; }

/* シミュレーションフローカード */
.sim-flow-grid { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.sim-flow-card { flex: 1; min-width: 200px; background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 10px; padding: 14px 16px; }
.sim-flow-company { font-size: 0.75rem; font-weight: 700; color: #374151; margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.sim-flow-step { background: #fff; border: 1px solid #e5e7eb; border-radius: 6px; padding: 8px 12px; margin-bottom: 4px; }
.sim-flow-step-lbl { font-size: 0.65rem; color: #9ca3af; margin-bottom: 2px; }
.sim-flow-step-val { font-size: 1.1rem; font-weight: 700; color: #111827; }
.sim-flow-step.highlight { background: #eff6ff; border-color: #bfdbfe; }
.sim-flow-step.highlight .sim-flow-step-val { color: #1d4ed8; font-size: 1.25rem; }
.sim-flow-step.result { background: #f0fdf4; border-color: #bbf7d0; }
.sim-flow-step.result .sim-flow-step-val { color: #15803d; }
.sim-flow-step.warn { background: #fff7ed; border-color: #fed7aa; }
.sim-flow-arrow { text-align: center; font-size: 0.68rem; color: #6b7280; padding: 2px 0; line-height: 1.3; }
.sim-detail-toggle { font-size: 0.72rem; color: #6b7280; cursor: pointer; border: none; background: none; padding: 4px 0; text-decoration: underline; }

/* チャートグループラベル */
.chart-group-label {
  grid-column: 1 / -1; font-size: 0.72rem; font-weight: 700; color: #6b7280;
  padding: 8px 4px 2px; border-top: 1px solid #e5e7eb; letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* 指標・シミュレーション共通テーブル */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { font-size: 0.8rem; font-weight: 700; padding: 8px 14px; text-align: right; border-bottom: 2px solid #f3f4f6; white-space: nowrap; }
.data-table th.left { text-align: left; color: #6b7280; font-weight: 600; }
.data-table td { padding: 10px 14px; border-top: 1px solid #f3f4f6; font-size: 0.9rem; text-align: right; }
.data-table td.lbl { text-align: left; color: #374151; font-weight: 500; }
.data-table tr.sep td { padding: 3px; background: #f9fafb; border: none; }
.data-table tr:not(.sep):hover td { background: #f9fafb; }
.val-pos { color: #16a34a; font-weight: 700; }
.val-neg { color: #dc2626; font-weight: 700; }
.val-mid { color: #ca8a04; font-weight: 700; }

/* デュポン */
.dupont-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.dupont-legend { display: flex; gap: 16px; margin-top: 14px; justify-content: center; flex-wrap: wrap; }
.dupont-legend span { font-size: 0.78rem; display: flex; align-items: center; gap: 5px; }
.leg { width: 12px; height: 12px; border-radius: 2px; display: inline-block; }

/* チャートグリッド */
.chart-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.chart-box { background: #f9fafb; border-radius: 8px; padding: 16px; }
.chart-box h4 { font-size: 0.82rem; color: #555; margin-bottom: 10px; }
.chart-grid .chart-box canvas { max-height: 160px; }
.chart-legend { display: flex; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.chart-legend span { font-size: 0.75rem; display: flex; align-items: center; gap: 4px; }

/* インラインチャート（チェックリスト直下） */
.chart-row td { padding: 4px 16px 14px; background: #f8fafc; border-bottom: 1px solid #e5e7eb; }
.inline-chart { max-height: 160px; display: block; }
.inline-chart-wrap { padding: 6px 0 2px; }
.inline-chart-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 7px; font-size: 0.72rem; color: #374151; align-items: center; }
.inline-chart-legend span { display: flex; align-items: center; gap: 4px; }
.cl-row { cursor: pointer; }
.cl-row:hover td { background: #f0f9ff !important; }
.cl-row.cl-active td { background: #e0f2fe !important; }
.cl-arrow { display: inline-block; font-size: 0.6rem; color: #9ca3af; margin-left: 6px; transition: transform 0.15s; vertical-align: middle; }
.cl-row.cl-active .cl-arrow { transform: rotate(90deg); }

/* AI解釈 */
.ai-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.ai-card { border: 1.5px solid #e5e7eb; border-radius: 10px; padding: 16px; }
.ai-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.ai-card-name { font-weight: 700; font-size: 0.95rem; }
.btn-ai {
  padding: 7px 14px; border: none; border-radius: 6px; font-size: 0.82rem;
  cursor: pointer; color: #fff; background: #4f46e5; transition: background 0.15s; white-space: nowrap;
}
.btn-ai:hover { background: #4338ca; }
.btn-ai:disabled { background: #9ca3af; cursor: not-allowed; }
.ai-result { font-size: 0.85rem; line-height: 1.75; color: #374151; white-space: pre-wrap; }
.ai-hint { font-size: 0.78rem; color: #9ca3af; font-style: italic; }
.ai-loading { font-size: 0.82rem; color: #9ca3af; display: flex; align-items: center; gap: 6px; }

.note { font-size: 0.72rem; color: #9ca3af; margin-top: 16px; text-align: center; }

.btn-print {
  padding: 9px 18px; background: #fff; color: #1a1a2e; border: 1.5px solid #1a1a2e;
  border-radius: 8px; font-size: 0.85rem; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; gap: 6px; transition: all 0.15s;
}
.btn-print:hover { background: #f3f4f6; }

@media print {
  @page { size: A4; margin: 12mm 10mm; }

  header, footer, .search-panel, #printBtnWrap, #upgradeBanner,
  .btn-ai, .settings-toggle, .settings-panel, .modal-overlay { display: none !important; }

  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  body { background: #fff; }
  #result { display: block !important; }
  .container { max-width: 100%; padding: 0; margin: 0; }

  .section { box-shadow: none !important; border: 1px solid #e5e7eb; break-inside: avoid; margin-bottom: 14px; }
  .summary-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); margin-bottom: 14px; }
  .summary-card { break-inside: avoid; }

  #chartSection { break-before: page; }

  .chart-grid { grid-template-columns: 1fr 1fr; }
  .chart-box { break-inside: avoid; }

  .dupont-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

  .ai-grid { grid-template-columns: 1fr; }
  .ai-card { break-inside: avoid; }
  .ai-result { white-space: pre-wrap; font-size: 0.8rem; }
}

/* 認証 */
.btn-auth {
  padding: 8px 18px; border-radius: 7px; font-size: 0.85rem; font-weight: 600;
  cursor: pointer; border: none; transition: background 0.15s; white-space: nowrap;
}
.btn-login  { background: #fff; color: #1a1a2e; }
.btn-login:hover { background: #e5e7eb; }
.btn-logout { background: rgba(255,255,255,0.15); color: #fff; border: 1px solid rgba(255,255,255,0.3); }
.btn-logout:hover { background: rgba(255,255,255,0.25); }
.user-info  { font-size: 0.78rem; color: #9ca3af; margin-right: 8px; }

.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  z-index: 500; align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: #fff; border-radius: 14px; padding: 32px 28px;
  width: 360px; max-width: 92vw; box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-box h2 { font-size: 1.1rem; margin-bottom: 6px; }
.modal-box p  { font-size: 0.78rem; color: #6b7280; margin-bottom: 20px; }
.modal-tabs   { display: flex; gap: 0; margin-bottom: 20px; border-bottom: 2px solid #f3f4f6; }
.modal-tab {
  flex: 1; padding: 8px; font-size: 0.88rem; font-weight: 600; background: none;
  border: none; cursor: pointer; color: #9ca3af; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all 0.15s;
}
.modal-tab.active { color: #1a1a2e; border-bottom-color: #1a1a2e; }
.modal-field { margin-bottom: 14px; }
.modal-field label { font-size: 0.78rem; color: #374151; display: block; margin-bottom: 4px; }
.modal-field input {
  width: 100%; padding: 10px 12px; border: 1.5px solid #ddd; border-radius: 8px;
  font-size: 0.9rem; outline: none; transition: border-color 0.2s;
}
.modal-field input:focus { border-color: #1a1a2e; }
.btn-modal-submit {
  width: 100%; padding: 12px; background: #1a1a2e; color: #fff; border: none;
  border-radius: 8px; font-size: 0.95rem; font-weight: 700; cursor: pointer;
  transition: background 0.15s; margin-top: 4px;
}
.btn-modal-submit:hover { background: #2d2d4e; }
.btn-modal-submit:disabled { background: #9ca3af; cursor: not-allowed; }
.btn-google {
  width: 100%; padding: 11px; background: #fff; color: #3c4043; border: 1px solid #dadce0;
  border-radius: 8px; font-size: 0.92rem; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: background 0.15s; margin-bottom: 16px;
}
.btn-google:hover { background: #f8f9fa; }
.auth-divider {
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px; color: #9ca3af; font-size: 0.78rem;
}
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: #e5e7eb; }
.modal-error { font-size: 0.78rem; color: #dc2626; margin-top: 10px; min-height: 18px; }
.modal-close {
  position: absolute; top: 14px; right: 16px; background: none; border: none;
  font-size: 1.2rem; cursor: pointer; color: #9ca3af;
}

/* 機能ロック */
.locked-section { position: relative; }
.lock-overlay {
  position: absolute; inset: 0; background: rgba(255,255,255,0.88);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 12px; z-index: 10; gap: 10px;
}
.lock-overlay p { font-size: 0.9rem; font-weight: 600; color: #374151; }
.sim-blur {
  filter: blur(5px); user-select: none; cursor: pointer;
  display: inline-block; transition: opacity 0.2s;
}
.sim-blur:hover { opacity: 0.7; }
.btn-upgrade {
  padding: 10px 24px; background: #1a1a2e; color: #fff; border: none;
  border-radius: 8px; font-size: 0.88rem; font-weight: 700; cursor: pointer;
}
.upgrade-banner {
  background: linear-gradient(135deg, #1e3a5f 0%, #1a1a2e 100%);
  color: #fff; border-radius: 12px; padding: 20px 24px;
  margin-bottom: 24px; display: flex; align-items: center;
  justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.upgrade-banner h4 { font-size: 1rem; margin-bottom: 8px; color: #fbbf24; }
.upgrade-banner ul { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 20px; }
.upgrade-banner li { font-size: 0.82rem; color: #cbd5e1; }
.upgrade-banner li::before { content: '✓ '; color: #34d399; font-weight: 700; }
.btn-upgrade-banner {
  padding: 12px 28px; background: #fbbf24; color: #1a1a2e; border: none;
  border-radius: 8px; font-size: 0.9rem; font-weight: 800; cursor: pointer;
  white-space: nowrap; flex-shrink: 0;
}
.btn-upgrade-banner:hover { background: #f59e0b; }

.ranking-card {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
  padding: 14px 16px; cursor: pointer; transition: box-shadow 0.15s, transform 0.1s;
  display: flex; align-items: center; gap: 12px;
}
.ranking-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.1); transform: translateY(-2px); }
.ranking-rank {
  font-size: 1.3rem; font-weight: 800; color: #9ca3af; min-width: 32px; text-align: center;
}
.ranking-rank.top3 { color: #d97706; }
.ranking-info { flex: 1; min-width: 0; }
.ranking-name { font-weight: 700; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ranking-score { font-size: 1.1rem; font-weight: 800; color: #1e40af; white-space: nowrap; }
.ranking-bar-wrap { width: 56px; background: #f3f4f6; border-radius: 4px; height: 8px; overflow: hidden; }
.ranking-bar { height: 100%; border-radius: 4px; background: linear-gradient(90deg, #3b82f6, #1d4ed8); }
.ranking-market { font-size: 0.7rem; color: #6b7280; }

.btn-share-x {
  display: inline-block; padding: 4px 10px; background: #000; color: #fff;
  border-radius: 6px; font-size: 0.75rem; font-weight: 700; text-decoration: none;
  line-height: 1.6; transition: background 0.15s;
}
.btn-share-x:hover { background: #333; }

.watchlist-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 0;
  border-bottom: 1px solid #f3f4f6;
}
.watchlist-item:last-child { border-bottom: none; }
.watchlist-item-name { flex: 1; font-size: 0.9rem; font-weight: 600; cursor: pointer; color: #1d4ed8; }
.watchlist-item-name:hover { text-decoration: underline; }
.watchlist-remove { background: none; border: none; color: #9ca3af; font-size: 1.1rem; cursor: pointer; padding: 0 4px; }
.watchlist-remove:hover { color: #ef4444; }
.btn-watchlist-add {
  display: inline-block; padding: 4px 10px; background: #f3f4f6; color: #374151;
  border: 1px solid #d1d5db; border-radius: 6px; font-size: 0.75rem; font-weight: 600;
  cursor: pointer; transition: background 0.15s;
}
.btn-watchlist-add:hover { background: #e5e7eb; }
.btn-watchlist-add.added { background: #dbeafe; color: #1d4ed8; border-color: #93c5fd; }
.btn-watchlist { background: rgba(255,255,255,0.12); color: #fff; border: 1px solid rgba(255,255,255,0.25); }
.btn-watchlist:hover { background: rgba(255,255,255,0.2); }

.btn-all-companies {
  padding: 5px 14px; background: #f3f4f6; color: #374151;
  border: 1px solid #d1d5db; border-radius: 20px; font-size: 0.8rem;
  font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn-all-companies:hover { background: #e5e7eb; }
.company-chip {
  padding: 8px 12px; background: #f9fafb; border: 1px solid #e5e7eb;
  border-radius: 8px; font-size: 0.82rem; cursor: pointer; text-align: left;
  transition: background 0.12s, border-color 0.12s;
}
.company-chip:hover { background: #dbeafe; border-color: #93c5fd; color: #1d4ed8; }

.ai-why-icon {
  display: inline-block; margin-left: 4px; font-size: 0.75rem;
  color: #9ca3af; cursor: help; vertical-align: middle;
}
.ai-why-icon:hover { color: #6b7280; }

@media (max-width: 640px) {
  header { padding: 12px 16px; }
  header h1 { font-size: 1rem; }

  .container { padding: 16px 12px; }
  .search-panel { padding: 16px; }

  .company-row { flex-wrap: wrap; gap: 8px; }
  .search-col { width: 100%; }
  .price-col {
    width: 100%; margin-left: 32px; flex-direction: row !important;
    align-items: center !important;
  }
  .price-input { width: 100%; font-size: 1rem; }

  /* iOSオートズーム防止（16px未満でズームが発生） */
  .search-row input { font-size: 1rem; }
  input, select, textarea { font-size: 1rem !important; }

  .dropdown { font-size: 0.95rem; }
  .dropdown-item { padding: 13px 14px; }

  .search-actions { flex-wrap: wrap; }
  .btn-primary { width: 100%; text-align: center; }
  .btn-remove { padding: 9px 12px; }
}

/* フッター */
.site-footer {
  text-align: center; border-top: 1px solid #e5e7eb;
  padding: 28px 16px 36px; margin-top: 8px;
}
.footer-dev {
  font-size: 0.82rem; color: #374151; margin-bottom: 6px; line-height: 1.7;
}
.footer-dev a { color: #2563eb; text-decoration: underline; }
.footer-update { color: #6b7280; font-size: 0.78rem; }
.footer-sister {
  font-size: 0.75rem; color: #94a3b8; margin-bottom: 6px;
}
.footer-sister a { color: #94a3b8; text-decoration: none; }
.footer-sister a:hover { text-decoration: underline; }
.footer-attr { font-size: 0.72rem; color: #9ca3af; margin-bottom: 16px; }
.footer-links { font-size: 0.78rem; color: #9ca3af; }
.footer-links a, .footer-links span { color: #9ca3af; text-decoration: underline; cursor: pointer; margin: 0 6px; }
.footer-links a:hover { color: #6b7280; }

/* FAQモーダル */
.faq-modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.faq-modal-overlay.open { display: flex; }
.faq-modal-box {
  background: #fff;
  border-radius: 12px;
  padding: 32px;
  max-width: 560px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}
.faq-modal-box h2 { font-size: 1rem; margin-bottom: 20px; color: #1a1a2e; }
.faq-modal-box h3 { font-size: 0.85rem; color: #374151; margin: 20px 0 8px; }
.faq-modal-box p, .faq-modal-box li { font-size: 0.82rem; color: #4b5563; line-height: 1.7; }
.faq-modal-box ul { padding-left: 18px; margin: 0; }
.faq-modal-box table { width: 100%; border-collapse: collapse; font-size: 0.8rem; margin-top: 8px; }
.faq-modal-box table td { padding: 6px 8px; border-bottom: 1px solid #e5e7eb; color: #4b5563; vertical-align: top; }
.faq-modal-box table td:first-child { color: #374151; font-weight: 600; white-space: nowrap; width: 38%; }
.faq-tabs { display: flex; gap: 4px; margin-bottom: 20px; }
.faq-tab {
  padding: 6px 14px; border: 1px solid #e5e7eb; border-radius: 6px;
  font-size: 0.8rem; cursor: pointer; background: #f9fafb; color: #6b7280;
}
.faq-tab.active { background: #1a1a2e; color: #fff; border-color: #1a1a2e; }
.faq-section { display: none; }
.faq-section.active { display: block; }
