body {
  font-family: sans-serif;
  max-width: 800px;
  margin: 2em auto;
  padding: 1em;
  background: #f9f9f9;
}

h1, h2, h3 {
  color: #333;
}

textarea {
  width: 100%;
  padding: 10px;
  font-family: monospace;
  font-size: 16px;
  box-sizing: border-box;
  margin-bottom: 1em;
}

button {
  padding: 8px 16px;
  font-size: 1em;
  cursor: pointer;
}

#outputArea {
  margin-top: 1em;
  background: #fff;
  border: 1px solid #ccc;
  padding: 1em;
  white-space: pre-wrap;
}

.ioc {
  font-weight: bold;
  padding: 0 2px;
  border-radius: 3px;
}

.ioc.ipv4 { background: #d0ebff; color: #0c4f88; }
.ioc.ipv6 { background: #e3fcef; color: #236e4a; }
.ioc.domain { background: #fff3bf; color: #856404; }
.ioc.email { background: #f8d7da; color: #721c24; }
.ioc.hash { background: #e8daef; color: #4a235a; }
.ioc.url { background: #d4edda; color: #155724; }
.ioc.filePath { background: #cce5ff; color: #004085; }
.ioc.registryKey { background: #f5c6cb; color: #721c24; }
.ioc.bitcoin { background: #fff3cd; color: #856404; }
.ioc.cve { background: #d1ecf1; color: #0c5460; }
.ioc.mitre { background: #d6d8db; color: #383d41; }
.ioc.flag { background: #ffe6e6; color: #cc0000; }

#fileDropArea {
  border: 2px dashed #ccc;
  padding: 1em;
  text-align: center;
  margin-bottom: 1em;
  background: #fcfcfc;
  transition: background-color 0.3s, border-color 0.3s;
}

#fileDropArea.dragover {
  background-color: #e0f7fa;
  border-color: #00bcd4;
}

.fileLabel {
  color: #006de3;
  cursor: pointer;
  text-decoration: underline;
}

#testToggle {
  margin: 1em 0 0.5em;
  font-size: 0.9em;
  color: #444;
}

#testLoader {
  margin: 0.5em 0 1em;
  font-size: 0.9em;
  color: #444;
}

#testLoader select,
#testLoader button {
  font-size: 0.9em;
  padding: 5px 10px;
  margin-right: 6px;
}

#statsArea ul {
  list-style: disc;
  padding-left: 1.2em;
}

#statsArea li {
  margin-bottom: 4px;
  font-size: 0.95em;
}

/* ヘッダーとダークモードボタン */
.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1em;
}

.dark-mode-toggle {
  background: transparent;
  border: 2px solid #666;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.2em;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dark-mode-toggle:hover {
  background: #f0f0f0;
  transform: scale(1.1);
}

/* ダークモードスタイル */
html.dark-mode body {
  background: #1a1a1a;
  color: #e0e0e0;
}

html.dark-mode h1,
html.dark-mode h2,
html.dark-mode h3 {
  color: #e0e0e0;
}

html.dark-mode textarea {
  background: #2a2a2a;
  color: #e0e0e0;
  border: 1px solid #444;
}

html.dark-mode button {
  background: #333;
  color: #e0e0e0;
  border: 1px solid #555;
}

html.dark-mode button:hover {
  background: #444;
}

html.dark-mode #outputArea {
  background: #2a2a2a;
  border: 1px solid #444;
  color: #e0e0e0;
}

html.dark-mode #fileDropArea {
  background: #2a2a2a;
  border-color: #555;
}

html.dark-mode #fileDropArea.dragover {
  background-color: #1e3a4a;
  border-color: #00acc1;
}

html.dark-mode .fileLabel {
  color: #4fc3f7;
}

html.dark-mode #testToggle,
html.dark-mode #testLoader {
  color: #b0b0b0;
}

html.dark-mode .dark-mode-toggle {
  border-color: #e0e0e0;
}

html.dark-mode .dark-mode-toggle:hover {
  background: #333;
}

html.dark-mode .dark-mode-icon::before {
  content: '☀️';
}

.dark-mode-icon::before {
  content: '🌙';
}

/* ダークモード用IOCハイライト */
html.dark-mode .ioc.ipv4 { background: #1e3a5f; color: #64b5f6; }
html.dark-mode .ioc.ipv6 { background: #14442e; color: #66bb6a; }
html.dark-mode .ioc.domain { background: #5d4e37; color: #ffb74d; }
html.dark-mode .ioc.email { background: #3c1414; color: #ef5350; }
html.dark-mode .ioc.hash { background: #2b0c52; color: #ba68c8; }
html.dark-mode .ioc.url { background: #18521c; color: #81c784; }
html.dark-mode .ioc.filePath { background: #0d417b; color: #64b5f6; }
html.dark-mode .ioc.registryKey { background: #7c0d48; color: #f48fb1; }
html.dark-mode .ioc.bitcoin { background: #8d3200; color: #ffb74d; }
html.dark-mode .ioc.cve { background: #005457; color: #4dd0e1; }
html.dark-mode .ioc.mitre { background: #424242; color: #bdbdbd; }
html.dark-mode .ioc.flag { background: #5d1a1a; color: #ff6b6b; }

/* フッター */
.app-footer {
  margin-top: 3em;
  padding: 1em 0;
  border-top: 1px solid #ddd;
  text-align: center;
}

html.dark-mode .app-footer {
  border-top-color: #444;
}

.footer {
  font-size: 0.9em;
  color: #666;
}

html.dark-mode .footer {
  color: #999;
}

.footer a {
  color: #006de3;
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

html.dark-mode .footer a {
  color: #4fc3f7;
}

/* エクスポートセクション */
.export-controls {
  margin: 1em 0;
  padding: 1em;
  background: #f0f0f0;
  border-radius: 5px;
  display: flex;
  gap: 10px;
  align-items: center;
}

html.dark-mode .export-controls {
  background: #2a2a2a;
}

#exportFormat {
  padding: 6px 12px;
  font-size: 0.95em;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: white;
}

html.dark-mode #exportFormat {
  background: #333;
  color: #e0e0e0;
  border-color: #555;
}

#downloadButton {
  padding: 8px 16px;
  font-size: 0.95em;
  background: #208637;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}

#downloadButton:hover {
  background: #218838;
}

html.dark-mode #downloadButton {
  background: #2e7d32;
}

html.dark-mode #downloadButton:hover {
  background: #2e7d32;
}

/* グラフコンテナ */
#chartContainer {
  margin: 1em 0;
  padding: 1em;
  background: white;
  border: 1px solid #ddd;
  border-radius: 5px;
  text-align: center;
}

html.dark-mode #chartContainer {
  background: #2a2a2a;
  border-color: #444;
}

#iocChart {
  max-width: 100%;
  height: auto;
}

/* ホワイトリストセクション */
#whitelistSection {
  margin: 2em 0;
  padding: 1em;
  background: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 5px;
}

html.dark-mode #whitelistSection {
  background: #2a2a2a;
  border-color: #444;
}

#whitelistSection h2 {
  margin-top: 0;
  margin-bottom: 1em;
}

.whitelist-controls {
  margin-bottom: 1em;
}

.whitelist-input-group {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

#whitelistInput {
  min-width: 0;
  flex: 1;
  padding: 8px;
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

html.dark-mode #whitelistInput {
  background: #333;
  color: #e0e0e0;
  border-color: #555;
}

#addWhitelistButton {
  padding: 8px 16px;
  font-size: 14px;
  background: #0071eb;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

#addWhitelistButton:hover {
  background: #0056b3;
}

html.dark-mode #addWhitelistButton {
  background: #0056b3;
}

html.dark-mode #addWhitelistButton:hover {
  background: #004085;
}

.whitelist-toggle {
  margin: 10px 0;
}

.whitelist-toggle label {
  cursor: pointer;
  font-size: 14px;
}

.whitelist-display {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 10px;
  background: white;
}

html.dark-mode .whitelist-display {
  background: #1a1a1a;
  border-color: #444;
}

.whitelist-empty {
  color: #666;
  text-align: center;
  margin: 10px 0;
  font-style: italic;
}

html.dark-mode .whitelist-empty {
  color: #999;
}

.whitelist-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px;
  margin-bottom: 5px;
  background: #f0f0f0;
  border-radius: 3px;
}

html.dark-mode .whitelist-item {
  background: #333;
}

.whitelist-item span {
  flex: 1;
  font-family: monospace;
  font-size: 13px;
}

.remove-btn {
  min-width: 44px;
  min-height: 32px;
  background: #b92535;
  color: white;
  border: none;
  border-radius: 3px;
  padding: 2px 8px;
  cursor: pointer;
  font-size: 14px;
}

.remove-btn:hover {
  background: #c82333;
}

.filtered-count {
  color: #da2839;
  font-size: 0.9em;
}

/* ヘッダーボタン */
.header-buttons {
  display: flex;
  gap: 10px;
  align-items: center;
}

.help-button {
  background: transparent;
  border: 2px solid #666;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.2em;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.help-button:hover {
  background: #f0f0f0;
  transform: scale(1.1);
}

html.dark-mode .help-button {
  border-color: #e0e0e0;
}

html.dark-mode .help-button:hover {
  background: #333;
}

/* 言語切り替えボタン。英語のほうが語が長いので折り返さず幅を許す */
.lang-toggle {
  background: transparent;
  border: 2px solid #666;
  border-radius: 20px;
  min-height: 40px;
  padding: 0 14px;
  font-size: 0.9em;
  color: #333;
  cursor: pointer;
  transition: background 0.3s ease;
  white-space: nowrap;
}

.lang-toggle:hover {
  background: #f0f0f0;
}

html.dark-mode .lang-toggle {
  border-color: #e0e0e0;
  color: #e0e0e0;
}

html.dark-mode .lang-toggle:hover {
  background: #333;
}

/* モーダル */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

.modal-content {
  background: white;
  border-radius: 8px;
  width: 100%;
  max-width: 800px;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s ease-out;
}

html.dark-mode .modal-content {
  background: #2a2a2a;
  color: #e0e0e0;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px 15px;
  border-bottom: 1px solid #ddd;
}

html.dark-mode .modal-header {
  border-bottom-color: #444;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5em;
}

.close-button {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.close-button:hover {
  background: #f0f0f0;
  color: #333;
}

html.dark-mode .close-button {
  color: #bbb;
}

html.dark-mode .close-button:hover {
  background: #444;
  color: #e0e0e0;
}

.modal-body {
  padding: 25px;
  overflow-y: auto;
  max-height: calc(80vh - 100px);
}

/* ヘルプコンテンツ */
.help-section {
  margin-bottom: 2em;
}

.help-section h3 {
  color: #333;
  margin-bottom: 0.8em;
  border-bottom: 2px solid #007bff;
  padding-bottom: 0.3em;
}

html.dark-mode .help-section h3 {
  color: #e0e0e0;
  border-bottom-color: #4fc3f7;
}

.help-section h4 {
  color: #555;
  margin: 1em 0 0.5em;
  font-size: 1.1em;
}

html.dark-mode .help-section h4 {
  color: #ccc;
}

.help-section ul, .help-section ol {
  margin: 0.5em 0;
  padding-left: 1.5em;
}

.help-section li {
  margin-bottom: 0.3em;
  line-height: 1.5;
  /* URLやBitcoinアドレスは狭い画面で折り返せず、320pxではみ出していた */
  overflow-wrap: break-word;
  min-width: 0;
}

.ioc-types {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5em;
  margin: 1em 0;
}

/* min-width が auto のままだと、列が中身の最小幅まで広がって狭い画面ではみ出す */
.ioc-type-group {
  min-width: 0;
}

.ioc-type-group ul {
  margin: 0.5em 0;
}

.ioc-sample {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: monospace;
  font-size: 0.9em;
  font-weight: bold;
  margin-right: 0.5em;
  min-width: 80px;
}

/* IOCサンプルの色（実際のIOCハイライトと同じ） */
.ioc-sample.ipv4 { background: #d0ebff; color: #0c4f88; }
.ioc-sample.ipv6 { background: #e3fcef; color: #236e4a; }
.ioc-sample.domain { background: #fff3bf; color: #856404; }
.ioc-sample.email { background: #f8d7da; color: #721c24; }
.ioc-sample.hash { background: #e8daef; color: #4a235a; }
.ioc-sample.url { background: #d4edda; color: #155724; }
.ioc-sample.filePath { background: #cce5ff; color: #004085; }
.ioc-sample.registryKey { background: #f5c6cb; color: #721c24; }
.ioc-sample.bitcoin { background: #fff3cd; color: #856404; }
.ioc-sample.cve { background: #d1ecf1; color: #0c5460; }
.ioc-sample.mitre { background: #d6d8db; color: #383d41; }
.ioc-sample.flag { background: #ffe6e6; color: #cc0000; }

/* ダークモード用IOCサンプル */
html.dark-mode .ioc-sample.ipv4 { background: #1e3a5f; color: #64b5f6; }
html.dark-mode .ioc-sample.ipv6 { background: #14442e; color: #66bb6a; }
html.dark-mode .ioc-sample.domain { background: #5d4e37; color: #ffb74d; }
html.dark-mode .ioc-sample.email { background: #3c1414; color: #ef5350; }
html.dark-mode .ioc-sample.hash { background: #2b0c52; color: #ba68c8; }
html.dark-mode .ioc-sample.url { background: #18521c; color: #81c784; }
html.dark-mode .ioc-sample.filePath { background: #0d417b; color: #64b5f6; }
html.dark-mode .ioc-sample.registryKey { background: #7c0d48; color: #f48fb1; }
html.dark-mode .ioc-sample.bitcoin { background: #8d3200; color: #ffb74d; }
html.dark-mode .ioc-sample.cve { background: #005457; color: #4dd0e1; }
html.dark-mode .ioc-sample.mitre { background: #424242; color: #bdbdbd; }
html.dark-mode .ioc-sample.flag { background: #5d1a1a; color: #ff6b6b; }

/* タブコンテナ */
.tab-container {
  margin: 1em 0;
}

.tab-buttons {
  display: flex;
  border-bottom: 2px solid #ddd;
  margin-bottom: 1em;
  overflow-x: auto;
}

html.dark-mode .tab-buttons {
  border-bottom-color: #444;
}

.tab-button {
  background: none;
  border: none;
  padding: 12px 20px;
  cursor: pointer;
  font-size: 14px;
  color: #666;
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.tab-button:hover {
  color: #006de3;
  background: #f8f9fa;
}

.tab-button.active {
  color: #006de3;
  border-bottom-color: #006de3;
  font-weight: bold;
}

html.dark-mode .tab-button {
  color: #bbb;
}

html.dark-mode .tab-button:hover {
  color: #4fc3f7;
  background: #333;
}

html.dark-mode .tab-button.active {
  color: #4fc3f7;
  border-bottom-color: #4fc3f7;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* 分析結果スタイル */
.analysis-summary, .timeline-summary {
  display: flex;
  gap: 1em;
  margin-bottom: 1.5em;
}

.stat-card {
  background: #f8f9fa;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 1em;
  text-align: center;
  min-width: 120px;
}

html.dark-mode .stat-card {
  background: #333;
  border-color: #555;
}

.stat-card h4 {
  margin: 0 0 0.5em;
  font-size: 0.9em;
  color: #666;
}

html.dark-mode .stat-card h4 {
  color: #bbb;
}

.stat-value {
  font-size: 1.5em;
  font-weight: bold;
  color: #006de3;
}

html.dark-mode .stat-value {
  color: #4fc3f7;
}

/* 相関関係リスト */
.correlations-list {
  display: flex;
  flex-direction: column;
  gap: 1em;
}

.correlation-item {
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 1em;
  transition: all 0.3s ease;
}

.correlation-item:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

html.dark-mode .correlation-item {
  background: #333;
  border-color: #555;
}

.correlation-item.high {
  border-left: 4px solid #dc3545;
}

.correlation-item.medium {
  border-left: 4px solid #ffc107;
}

.correlation-item.low {
  border-left: 4px solid #28a745;
}

.correlation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5em;
}

.correlation-type {
  font-weight: bold;
  color: #333;
}

html.dark-mode .correlation-type {
  color: #e0e0e0;
}

.strength-badge {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.8em;
  font-weight: bold;
}

.strength-badge.high {
  background: #b92535;
  color: white;
}

.strength-badge.medium {
  background: #ffc107;
  color: #333;
}

.strength-badge.low {
  background: #208637;
  color: white;
}

.ioc-pair {
  display: flex;
  align-items: center;
  gap: 0.5em;
  margin: 0.5em 0;
  flex-wrap: wrap;
}

.ioc-item {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.9em;
  font-weight: bold;
}

.relation-symbol {
  font-size: 1.2em;
  color: #666;
  margin: 0 0.5em;
}

html.dark-mode .relation-symbol {
  color: #bbb;
}

.context {
  margin-top: 0.5em;
  color: #666;
  font-style: italic;
}

html.dark-mode .context {
  color: #bbb;
}

/* タイムライン */
.timeline-container {
  display: flex;
  flex-direction: column;
  gap: 1em;
}

.timeline-group {
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 1em;
}

html.dark-mode .timeline-group {
  background: #333;
  border-color: #555;
}

.timeline-group.critical {
  border-left: 4px solid #dc3545;
}

.timeline-group.high {
  border-left: 4px solid #fd7e14;
}

.timeline-group.medium {
  border-left: 4px solid #ffc107;
}

.timeline-group.low {
  border-left: 4px solid #28a745;
}

.timeline-header {
  display: flex;
  align-items: center;
  gap: 1em;
  margin-bottom: 1em;
  flex-wrap: wrap;
}

.timeline-time {
  font-weight: bold;
  font-family: monospace;
}

.severity-badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.8em;
  font-weight: bold;
  text-transform: uppercase;
}

.severity-badge.critical {
  background: #b92535;
  color: white;
}

.severity-badge.high {
  background: #b64700;
  color: white;
}

.severity-badge.medium {
  background: #ffc107;
  color: #333;
}

.severity-badge.low {
  background: #208637;
  color: white;
}

.event-count {
  color: #666;
  font-size: 0.9em;
}

html.dark-mode .event-count {
  color: #bbb;
}

.timeline-events {
  display: flex;
  flex-direction: column;
  gap: 0.8em;
}

.timeline-event {
  background: #f8f9fa;
  border-radius: 6px;
  padding: 0.8em;
}

html.dark-mode .timeline-event {
  background: #2a2a2a;
}

.event-line {
  font-size: 0.8em;
  color: #666;
  margin-bottom: 0.3em;
}

html.dark-mode .event-line {
  color: #bbb;
}

.event-iocs {
  display: flex;
  gap: 0.3em;
  margin: 0.3em 0;
  flex-wrap: wrap;
}

.ioc-tag {
  padding: 2px 6px;
  border-radius: 3px;
  font-family: monospace;
  font-size: 0.8em;
  font-weight: bold;
}

.event-context {
  font-family: monospace;
  font-size: 0.8em;
  color: #333;
  margin-top: 0.3em;
}

html.dark-mode .event-context {
  color: #ccc;
}

/* 詳細統計 */
.detailed-stats {
  display: flex;
  flex-direction: column;
  gap: 2em;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1em;
  margin-top: 1em;
}

.summary-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1em;
  background: #f8f9fa;
  border-radius: 8px;
  text-align: center;
}

html.dark-mode .summary-item {
  background: #333;
}

.summary-item .label {
  font-size: 0.9em;
  color: #666;
  margin-bottom: 0.5em;
}

html.dark-mode .summary-item .label {
  color: #bbb;
}

.summary-item .value {
  font-size: 1.3em;
  font-weight: bold;
  color: #333;
}

html.dark-mode .summary-item .value {
  color: #e0e0e0;
}

.value.risk-critical {
  color: #b92535;
}

.value.risk-high {
  color: #b64700;
}

.value.risk-medium {
  color: #856404;
}

.value.risk-low {
  color: #17662a;
}

.distribution-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
  margin-top: 1em;
}

.distribution-item {
  display: flex;
  align-items: center;
  gap: 1em;
  padding: 0.5em;
  background: #f8f9fa;
  border-radius: 4px;
}

html.dark-mode .distribution-item {
  background: #333;
}

.type-label {
  min-width: 100px;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: monospace;
  font-size: 0.9em;
  font-weight: bold;
}

.percentage {
  min-width: 50px;
  font-weight: bold;
}

.unique-ratio {
  color: #666;
  font-size: 0.9em;
}

html.dark-mode .unique-ratio {
  color: #bbb;
}

.repeated-iocs {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
  margin-top: 1em;
}

.repeated-item {
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.5em;
  background: #f8f9fa;
  border-radius: 4px;
}

html.dark-mode .repeated-item {
  background: #333;
}

.count-badge {
  background: #0071eb;
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.8em;
  font-weight: bold;
}

.risks-list {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
  margin-top: 1em;
}

.risk-item {
  display: flex;
  align-items: center;
  gap: 1em;
  padding: 0.8em;
  border-radius: 6px;
  border-left: 4px solid;
}

.risk-item.high {
  background: #fff5f5;
  border-left-color: #dc3545;
}

.risk-item.medium {
  background: #fffbf0;
  border-left-color: #ffc107;
}

.risk-item.low {
  background: #f0f9f0;
  border-left-color: #28a745;
}

html.dark-mode .risk-item.high {
  background: #2a1a1a;
}

html.dark-mode .risk-item.medium {
  background: #2a2416;
}

html.dark-mode .risk-item.low {
  background: #1a2a1a;
}

.risk-level {
  font-weight: bold;
  text-transform: uppercase;
  min-width: 80px;
}

.no-data {
  text-align: center;
  color: #666;
  font-style: italic;
  padding: 2em;
}

html.dark-mode .no-data {
  color: #bbb;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  .modal-overlay {
    padding: 10px;
  }
  
  .modal-content {
    max-height: 90vh;
  }
  
  .modal-body {
    padding: 20px;
  }
  
  .ioc-types {
    grid-template-columns: 1fr;
  }
  
  .header-container {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }
  
  .header-buttons {
    justify-content: center;
  }
  
  .tab-buttons {
    flex-wrap: wrap;
  }
  
  .analysis-summary, .timeline-summary {
    flex-direction: column;
  }
  
  .summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }
  
  .correlation-header, .timeline-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5em;
  }
  
  .ioc-pair {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* 入力・キーボード操作・狭い画面の保護 */
[hidden] {
  display: none !important;
}

body.modal-open {
  overflow: hidden;
}

:focus-visible {
  outline: 3px solid #006de3;
  outline-offset: 3px;
}

html.dark-mode :focus-visible {
  outline-color: #4fc3f7;
}

#outputArea pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.export-controls, .whitelist-input-group {
  flex-wrap: wrap;
}

#sampleSelector {
  max-width: 100%;
}

.context, .event-context, .ioc-item, .whitelist-item span {
  overflow-wrap: anywhere;
  min-width: 0;
}

#statsArea > ul {
  columns: 2;
}

html.dark-mode .filtered-count, html.dark-mode .limit-warning {
  color: #ffb3bc;
}

.limit-warning {
  color: #a31727;
}

@media (max-width: 480px) {
  #statsArea > ul {
    columns: 1;
  }

  .distribution-item {
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
