/* World Log Stylesheet - Unified Static Theme */
:root {
  --bg: #f3f6fa;
  --surface: #ffffff;
  --surface-dark: #0f172a;
  --surface-dark-2: #111827;
  --text: #111827;
  --muted: #526071;
  --muted-dark: #cbd5e1;
  --line: #dfe6ee;
  --blue: #2563eb;
  --blue-soft: #eff6ff;
  --blue-light: #93c5fd;
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 8px;
  --max: 1120px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: Arial, Helvetica, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.65;
}

.container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
}

/* ヘッダー */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand-logo {
  text-decoration: none;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-main {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.08em;
}

.site-nav {
  display: flex;
  gap: 18px;
}

.nav-link {
  color: #475569;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  transition: color 0.2s;
}

.nav-link:hover, .nav-link.active {
  color: var(--blue);
}

/* メインコンテンツ */
.main-content {
  padding: 36px 0 80px;
}

/* ヒーロー＆検索領域 */
.hero-section {
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.28), transparent 34%),
    linear-gradient(135deg, #0f172a 0%, #111827 62%, #172554 100%);
  color: #ffffff;
  border-radius: 28px;
  padding: 54px 48px;
  box-shadow: var(--shadow);
  margin-bottom: 34px;
}

.hero-badge {
  display: inline-block;
  color: var(--blue-light);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.hero-title {
  font-size: clamp(32px, 5vw, 52px);
  margin: 0 0 12px;
  color: #ffffff;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.hero-description {
  color: var(--muted-dark);
  font-size: 17px;
  max-width: 760px;
  margin: 0 0 32px;
  line-height: 1.6;
}

.hidden {
  display: none !important;
}

/* 検索カード */
.search-card {
  background: rgba(17, 24, 39, 0.88);
  border: 1px solid #334155;
  border-radius: 20px;
  padding: 28px 32px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
}

.form-grid {
  display: grid;
  grid-template-columns: 200px 1fr 1fr;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-size: 13px;
  font-weight: 700;
  color: #e2e8f0;
  margin-bottom: 6px;
}

.field-help {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 4px;
}

.optional {
  color: #94a3b8;
  font-weight: 400;
}

.form-control {
  height: 48px;
  padding: 0 14px;
  border: 1px solid #334155;
  border-radius: var(--radius-md);
  font-size: 15px;
  background-color: #0f172a;
  color: #ffffff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control::placeholder {
  color: #94a3b8;
}

.form-control option {
  background-color: #0f172a;
  color: #ffffff;
}

.form-control:focus {
  outline: none;
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.25);
}

.form-actions {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
}

.btn-primary {
  height: 48px;
  padding: 0 28px;
  background-color: var(--blue);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.2s, transform 0.1s;
}

.btn-primary:hover {
  background-color: #1d4ed8;
}

.btn-primary:active {
  transform: scale(0.98);
}

.search-icon {
  width: 18px;
  height: 18px;
}

/* キーワードセクション */
.keyword-section {
  margin-top: 28px;
  padding: 28px 32px;
  background: rgba(17, 24, 39, 0.6);
  border: 1px solid #334155;
  border-radius: 20px;
}

.keyword-section .eyebrow {
  color: var(--blue-light);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.keyword-section-title-wrapper {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.keyword-section-title-wrapper h2 {
  margin: 0;
  color: #ffffff;
  font-size: clamp(22px, 3.5vw, 28px);
  line-height: 1.2;
}

.total-logs-badge {
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: var(--blue-light);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.keyword-section p {
  margin: 0;
  color: var(--muted-dark);
  font-size: 14px;
}

.top-keyword-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.keyword-ranking-grid {
  margin-top: 24px;
}

.top-keyword-card {
  display: flex;
  min-height: 112px;
  padding: 18px;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid #334155;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.top-keyword-card:hover {
  transform: translateY(-3px);
  border-color: #60a5fa;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.3);
}

.top-keyword-rank {
  color: #60a5fa;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.compare-link-note {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  color: #cbd5e1;
  font-size: 13px;
  text-align: right;
}

.compare-link-note a {
  color: #93c5fd;
  font-weight: 700;
  text-decoration: none;
}

.compare-link-note a:hover {
  color: #ffffff;
  text-decoration: underline;
}

.top-keyword-name {
  margin-top: 12px;
  color: #ffffff;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.35;
}

.top-keyword-count {
  margin-top: auto;
  padding-top: 10px;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 700;
}

.empty-keywords {
  margin-top: 24px;
  padding: 20px;
  background: rgba(15, 23, 42, 0.4);
  border: 1px dashed #334155;
  border-radius: var(--radius-md);
  color: var(--muted-dark);
  text-align: center;
  font-size: 14px;
}

/* World Log explanation */
.about-world-log-section {
  margin-top: 34px;
  padding: 38px 34px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.about-world-log-section .eyebrow {
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.about-world-log-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.about-world-log-card {
  padding: 24px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.about-world-log-card h3 {
  margin: 0 0 10px;
  color: var(--surface-dark);
  font-size: 18px;
  line-height: 1.35;
}

.about-world-log-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.about-world-log-card p + p {
  margin-top: 12px;
}

.about-world-log-tools {
  margin-top: 20px;
  padding: 26px 28px;
  background: var(--blue-soft);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-md);
}

.about-world-log-tools > h3 {
  margin: 0;
  color: var(--surface-dark);
  font-size: 20px;
}

.tool-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 28px;
  margin-top: 18px;
}

.tool-summary-item strong {
  display: block;
  margin-bottom: 4px;
  color: var(--blue);
  font-size: 14px;
  font-weight: 800;
}

.tool-summary-item p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

/* プレースホルダー */
.placeholder-card {
  margin-top: 34px;
  padding: 48px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  text-align: center;
  color: var(--muted);
}

.placeholder-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.placeholder-card h3 {
  color: var(--surface-dark);
  margin: 0 0 8px;
}

/* 検索結果セクション */
.results-section {
  margin-top: 34px;
}

.results-section.hidden {
  display: none;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 16px;
}

.results-meta {
  font-size: 15px;
  font-weight: 700;
  color: var(--surface-dark);
}

/* 操作バー (Toolbar) */
.results-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
}

.results-toolbar.hidden {
  display: none;
}

.results-toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.results-toolbar-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

.results-select {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s;
}

.results-select:focus {
  outline: none;
  border-color: var(--blue);
}

.results-container {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ページネーション */
.pagination {
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.pagination.hidden {
  display: none;
}

.pagination-button {
  min-width: 120px;
  height: 42px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--surface-dark);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition:
    border-color 0.2s,
    color 0.2s,
    background-color 0.2s;
}

.pagination-button:hover:not(:disabled) {
  border-color: var(--blue);
  color: var(--blue);
  background-color: var(--blue-soft);
}

.pagination-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.pagination-status {
  min-width: 110px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

/* 検索結果カード */
.result-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 24px 28px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.result-card:hover {
  border-color: var(--blue-light);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.result-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.result-subject-badge {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue);
  background: var(--blue-soft);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
}

.result-date-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.result-action-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--surface-dark);
  line-height: 1.4;
  margin: 12px 0 16px;
  letter-spacing: -0.01em;
}

.result-body-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.result-field-row {
  font-size: 14px;
  display: flex;
  align-items: baseline;
  gap: 16px;
}

.result-field-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  width: 155px;
  white-space: nowrap;
  flex-shrink: 0;
}

.result-field-value {
  color: var(--text);
  font-weight: 600;
}

.tag-list {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.tag-entity {
  background: #f1f5f9;
  color: #475569;
}

/* ボタンとDetailsの横並びアクションバー */
.result-card-footer {
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.btn-ai-search {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 800;
  color: #ffffff;
  background-color: var(--surface-dark);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background-color 0.2s;
}

.btn-ai-search:hover {
  background-color: var(--blue);
}

.result-details-accordion {
  display: inline-block;
}

.result-details-summary {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: color 0.2s, background-color 0.2s;
}

.result-details-summary:hover {
  color: var(--blue);
  background-color: var(--blue-soft);
}

.result-details-content-wrapper {
  margin-top: 12px;
  padding: 16px 20px;
  background-color: #f8fafc;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
}

.detail-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.detail-row-label {
  font-weight: 700;
  color: var(--muted);
  width: 100px;
  flex-shrink: 0;
}

/* プロジェクト案内セクション (2列×2段 表示へ修正) */
.projects-section {
  margin-top: 34px;
  padding: 38px 34px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.section-heading h2 {
  margin: 0 0 10px;
  color: var(--surface-dark);
  font-size: clamp(26px, 4vw, 36px);
  line-height: 1.2;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.project-card {
  display: block;
  padding: 24px;
  color: inherit;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.project-card:hover {
  transform: translateY(-3px);
  border-color: var(--blue-light);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.08);
}

.project-label {
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.project-card h3 {
  margin: 14px 0 10px;
  color: var(--surface-dark);
  font-size: 20px;
  line-height: 1.35;
}

.project-card p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14px;
}

.project-link {
  color: var(--blue);
  font-size: 14px;
  font-weight: 800;
}

/* Support */
.support-section {
  margin-top: 34px;
  padding: 30px 34px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  text-align: center;
}

.support-section h2 {
  margin: 0 0 10px;
  color: var(--surface-dark);
  font-size: 24px;
}

.support-section p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
}

.support-button {
  display: inline-block;
  padding: 11px 20px;
  color: #ffffff;
  background: var(--blue);
  border-radius: 10px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
}

.support-button:hover {
  background: #1d4ed8;
}

/* フッター */
.site-footer {
  padding: 34px 0 44px;
  color: #64748b;
  font-size: 13px;
}

.footer-inner {
  text-align: center;
}

.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 14px;
}

.footer-links a {
  color: inherit;
  text-decoration: none;
  font-weight: 700;
}

.footer-links a:hover {
  color: var(--blue);
}

/* PDF / 印刷 */
.btn-share-search,
.btn-export-pdf {
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.btn-share-search {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

.btn-share-search:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.btn-export-pdf {
  border: 1px solid var(--surface-dark);
  background: var(--surface-dark);
  color: #ffffff;
}

.btn-export-pdf:hover {
  background: var(--blue);
  border-color: var(--blue);
}

.print-summary {
  display: none;
}

.print-disclaimer {
  margin-top: 10px;
  font-size: 9pt;
  color: #475569;
  font-style: italic;
}

@media print {
  @page {
    size: A4;
    margin: 14mm;
  }

  body {
    background: #ffffff;
    color: #111827;
    font-size: 10pt;
  }

  .site-header,
  .hero-section,
  .projects-section,
  .support-section,
  .site-footer,
  .results-header,
  .placeholder-card,
  .pagination {
    display: none !important;
  }

  .main-content,
  .container,
  .results-section {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
  }

  .results-section.hidden {
    display: block;
  }

  .print-summary {
    display: block;
    margin: 0 0 16px;
    padding: 0 0 12px;
    border-bottom: 2px solid #111827;
  }

  .print-summary h1 {
    margin: 0 0 10px;
    font-size: 20pt;
    line-height: 1.2;
  }

  .print-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 18px;
    font-size: 9.5pt;
  }

  .results-container {
    gap: 10px;
  }

  .result-card {
    break-inside: avoid;
    page-break-inside: avoid;
    box-shadow: none;
    border: 1px solid #cbd5e1;
    padding: 14px 16px;
  }

  .result-card:hover {
    box-shadow: none;
  }

  .result-card-top {
    margin-bottom: 6px;
  }

  .result-action-title {
    margin: 8px 0 10px;
    font-size: 14pt;
  }

  .result-body-grid {
    gap: 6px;
    margin-bottom: 10px;
  }

  .result-field-row {
    gap: 10px;
    font-size: 9pt;
  }

  .result-field-label {
    width: 125px;
    font-size: 8pt;
  }

  .tag {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #111827;
    font-size: 8pt;
  }

  .result-card-footer {
    padding-top: 8px;
  }

  .result-actions-bar {
    justify-content: flex-start;
  }

  .result-details-accordion,
  .result-details-content-wrapper {
    display: none !important;
  }

  .btn-ai-search {
    padding: 0;
    background: transparent;
    color: #1d4ed8;
    font-size: 9pt;
    text-decoration: underline;
  }

  .btn-ai-search::before {
    content: "";
  }
}

/* レスポンシブ対応 */
@media (max-width: 820px) {
  .hero-section {
    padding: 42px 28px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .about-world-log-section {
    padding: 30px 24px;
  }

  .about-world-log-grid,
  .tool-summary-grid {
    grid-template-columns: 1fr;
  }

  .top-keyword-grid {
    grid-template-columns: 1fr;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  .results-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .results-toolbar {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .results-toolbar-group {
    justify-content: space-between;
  }

  .results-select {
    flex-grow: 1;
  }

  .pagination {
    width: 100%;
    gap: 10px;
  }

  .pagination-button {
    min-width: 0;
    flex: 1;
    padding: 0 10px;
  }

  .pagination-status {
    min-width: 90px;
  }

  .result-card-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .result-field-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .result-field-label {
    width: auto;
  }

  .result-actions-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .btn-ai-search {
    width: 100%;
    justify-content: center;
  }

  .result-details-summary {
    text-align: center;
  }

  .compare-link-note {
    justify-content: center;
    text-align: center;
  }

  .form-actions {
    justify-content: stretch;
  }

  .form-actions .btn-primary {
    width: 100%;
    justify-content: center;
  }
}
