:root {
  --bg: #ffffff;
  --text: #1a1a1a;
  --text-light: #5f6368;
  --accent: #1a73e8;
  --border: #dfe1e5;
  --tag-bg: #f1f3f4;
  --card-bg: #f8f9fa;
}

:root.dark {
  --bg: #1a1a1a;
  --text: #e8eaed;
  --text-light: #9aa0a6;
  --accent: #8ab4f8;
  --border: #3c4043;
  --tag-bg: #303134;
  --card-bg: #202124;
}

body {
  font-family: 'Noto Serif JP', serif;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  transition: background 0.3s ease, color 0.3s ease;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* トップ画面 */
.top-container {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px; box-sizing: border-box;
}
.logo {
  font-family: 'Corben', serif; font-size: 80px; font-weight: 700;
  color: var(--accent); margin-bottom: 40px; letter-spacing: -1px; text-align: center;
}
.search-area { width: 100%; max-width: 650px; min-height: 120px; }

.mode-toggle {
  position: fixed; top: 20px; right: 20px; cursor: pointer;
  padding: 8px 16px; border-radius: 20px;
  border: 1px solid var(--border); background: var(--bg);
  color: var(--text); font-size: 13px; font-weight: 700;
  z-index: 9999; transition: all 0.2s;
}
.mode-toggle:hover { background: var(--tag-bg); }

/* 個別ページヘッダー */
.page-header {
  border-bottom: 1px solid var(--border); padding: 15px 30px;
  display: flex; align-items: center; gap: 30px; flex-wrap: wrap;
}
.page-logo {
  font-family: 'Corben', serif; font-size: 32px; font-weight: 700;
  color: var(--accent); letter-spacing: -0.5px;
}
.page-search-bar { flex: 1; min-width: 300px; max-width: 600px; }

/* メインコンテンツ */
main { max-width: 800px; margin: 50px auto; padding: 0 25px; min-height: 400px; }

.item-yomi { font-size: 16px; color: var(--text-light); margin-bottom: 5px; }
h1 {
  font-size: 42px; border-bottom: 1px solid var(--accent);
  padding-bottom: 10px; margin: 0 0 15px 0; word-break: break-word; line-height: 1.3;
}

.meta-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 25px; align-items: center;}
.badge {
  background: var(--tag-bg); padding: 4px 10px; border-radius: 4px;
  font-size: 13px; font-family: sans-serif;
}
.instance-of { border: 1px solid var(--accent); color: var(--accent); background: transparent; }
.aliases { font-size: 14px; color: var(--text-light); }

/* 画像ありレイアウト用 */
.content-wrapper { display: flex; gap: 30px; flex-wrap: wrap; }
.text-content { flex: 1; min-width: 300px; }
.image-box {
  width: 250px; flex-shrink: 0; background: var(--card-bg);
  border: 1px solid var(--border); padding: 10px; border-radius: 8px;
  text-align: center; height: fit-content; margin-bottom: 30px;
}
.image-box img { max-width: 100%; height: auto; border-radius: 4px; }

/* 本文 */
.short-content { font-size: 1.35em; line-height: 1.9; margin-bottom: 35px; }

.detail-box {
  display: none; margin-top: 20px; line-height: 1.9; font-size: 1.15em;
  border-top: 1px dashed var(--border); padding-top: 30px;
}

.show-btn {
  background: transparent; color: var(--accent); border: 2px solid var(--accent);
  padding: 12px 28px; border-radius: 30px; cursor: pointer;
  font-family: 'Corben', serif; font-size: 16px; transition: all 0.2s;
}
.show-btn:hover { background: var(--accent); color: var(--bg); }

.links-section {
  margin-top: 40px; padding: 20px; background: var(--card-bg);
  border-radius: 8px; font-size: 0.95em;
}
.links-section ul { margin: 10px 0 0 0; padding-left: 20px; }
.links-section li { margin-bottom: 8px; }

.date-info { text-align: right; font-size: 13px; color: var(--text-light); margin-top: 30px; }

footer { text-align: center; padding: 60px 20px; color: var(--text-light); font-size: 15px; font-family: 'Corben', serif; }

/* Google検索窓 カスタマイズ */
.gsc-control-cse { padding: 0 !important; border: none !important; background: transparent !important; }
.gsc-input-box { height: 50px !important; border-radius: 25px !important; border: 1px solid var(--border) !important; background: transparent !important; }
input.gsc-input { font-family: 'Noto Serif JP', serif !important; font-size: 18px !important; color: var(--text) !important; background: transparent !important; }
button.gsc-search-button { height: 50px !important; border-radius: 0 25px 25px 0 !important; }

@media (max-width: 768px) {
  .logo { font-size: 50px; }
  .page-header { padding: 15px 20px; gap: 15px; }
  .page-search-bar { min-width: 100%; }
  h1 { font-size: 32px; }
  .image-box { width: 100%; margin-bottom: 20px; }
  .content-wrapper { flex-direction: column-reverse; gap: 10px; }
}