:root {
  --bg: #fff8ee;
  --surface: #ffffff;
  --text: #2b2240;
  --muted: #6f6787;
  --line: #efe2d0;
  --ink: #2b2240;          /* ボタンの枠線・影の色 */
  --accent: #6c4cf5;
  --accent-soft: #efeaff;
  --head-from: #6c4cf5;
  --head-to: #ff5c93;
  --head-text: #ffffff;
  --row-hover: #fff3e0;

  /* 分類タグ・関係ラベルの色(文字色 / 背景色) */
  --c0: #c2185b; --c0-bg: #ffe3ee;
  --c1: #0b7a6b; --c1-bg: #d9f7f0;
  --c2: #1d63c9; --c2-bg: #e1eeff;
  --c3: #9a5b00; --c3-bg: #fff0c7;
  --c4: #5b3fd6; --c4-bg: #ece6ff;
  --c5: #c4410f; --c5-bg: #ffe6d6;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #19152a;
    --surface: #231e38;
    --text: #f1edff;
    --muted: #aaa3c4;
    --line: #3a3354;
    --ink: #0c0918;
    --accent: #a58dff;
    --accent-soft: #352c5c;
    --head-from: #4b32c0;
    --head-to: #c23a72;
    --row-hover: #2c2645;

    --c0: #ff8fb8; --c0-bg: #4a2236;
    --c1: #5fe0c6; --c1-bg: #173d38;
    --c2: #8cbcff; --c2-bg: #1f3355;
    --c3: #ffd36b; --c3-bg: #463717;
    --c4: #bfaeff; --c4-bg: #352c5c;
    --c5: #ffab7f; --c5-bg: #4a2a1a;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "M PLUS Rounded 1c", system-ui, -apple-system, "Segoe UI", "Hiragino Maru Gothic ProN", "Yu Gothic UI", "Meiryo", sans-serif;
  font-size: 15px;
  line-height: 1.65;
}
a { color: var(--accent); font-weight: 700; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* ヘッダー:グラデーション+水玉の飾り */
.site-header {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 88% 20%, rgba(255, 255, 255, .22) 0 46px, transparent 47px),
    radial-gradient(circle at 96% 85%, rgba(255, 214, 90, .55) 0 26px, transparent 27px),
    radial-gradient(circle at 78% 95%, rgba(255, 255, 255, .15) 0 18px, transparent 19px),
    linear-gradient(120deg, var(--head-from), var(--head-to));
  color: var(--head-text);
  padding: 28px 0 26px;
  border-radius: 0 0 28px 28px;
}
.site-header h1 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: .02em; }
.site-header .badge {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(255, 255, 255, .22);
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 999px;
  padding: 2px 12px;
}
.lead { margin: 6px 0 0; font-size: 14px; opacity: .92; max-width: 640px; }
.site-header a { color: var(--head-text); }

/* ヘッダー上部のページ切り替え */
.site-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; position: relative; }
.site-nav a {
  font-size: 13px;
  text-decoration: none;
  padding: 3px 14px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, .6);
}
.site-nav a:hover, .site-nav a[aria-current="page"] { background: #fff; color: var(--head-from); border-color: #fff; }

/* 銘柄ページ */
.crumbs { font-size: 13px; color: var(--muted); margin: 18px 0 0; }
.company-head { margin: 10px 0 0; }
.company-head .code { margin: 0; font-size: 13px; }
.company-head h2 { margin: 0; font-size: 26px; font-weight: 800; }
.theme-tags { margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.theme-tag { margin: 0; font-size: 12px; padding: 2px 12px; color: var(--accent); background: var(--accent-soft); }
.theme-tag small { margin-left: 6px; font-size: 11px; opacity: .8; }
.stats { list-style: none; display: flex; flex-wrap: wrap; gap: 12px; padding: 0; margin: 14px 0 0; }
.stats li {
  background: var(--surface);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  border-radius: 16px;
  padding: 6px 18px;
  min-width: 120px;
}
.stats b { display: block; font-size: 24px; font-weight: 800; color: var(--accent); line-height: 1.3; }
.stats span { font-size: 12px; font-weight: 700; color: var(--muted); }
.section { margin: 32px 0 0; }
.section h2 { font-size: 19px; font-weight: 800; margin: 0 0 4px; }
.section h2::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--head-to);
  box-shadow: 14px 0 0 #ffd65a;
  vertical-align: middle;
  margin-right: 22px;
}
a.company-name { color: var(--text); text-decoration-color: var(--line); text-underline-offset: 3px; }
a.company-name:hover { color: var(--accent); text-decoration-color: currentColor; }

/* このサイトについて */
.about {
  background: var(--surface);
  border: 2px solid var(--line);
  border-left: 8px solid #ffd65a;
  border-radius: 18px;
  padding: 14px 20px;
  margin: 24px 0 0;
  /* 説明文だけ、やさしい丸ゴシックにする */
  font-family: "Zen Maru Gothic", "M PLUS Rounded 1c", system-ui, "Yu Gothic UI", "Meiryo", sans-serif;
}
.about h2 { font-size: 17px; font-weight: 700; margin: 0 0 4px; }
.about p { font-size: 14px; margin: 6px 0; }
.about details { margin-top: 8px; }
.about + .filters { margin-top: 16px; }
.about summary { cursor: pointer; font-size: 14px; font-weight: 700; color: var(--accent); }
.legend { display: grid; grid-template-columns: max-content 1fr; gap: 8px 14px; margin: 10px 0 4px; font-size: 13px; }
.legend dt { margin: 0; }
.legend dd { margin: 0; color: var(--muted); }
@media (max-width: 720px) {
  .legend { grid-template-columns: 1fr; gap: 2px; }
  .legend dd { margin-bottom: 8px; }
}

/* ぽってりボタン */
.themes { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0 6px; }
.themes button, .seg button {
  font: inherit;
  font-weight: 700;
  border: 2px solid var(--ink);
  background: var(--surface);
  color: var(--text);
  padding: 6px 16px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform .08s, box-shadow .08s;
}
.themes button:hover, .seg button:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.themes button:active, .seg button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.themes button.on { background: var(--accent); color: #fff; }
.seg button.on { background: #ffd65a; color: #2b2240; }
.note { color: var(--muted); font-size: 13px; margin: 6px 0 14px; }

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
}
.seg { display: flex; gap: 8px; padding-bottom: 3px; }
.filters label { display: flex; flex-direction: column; font-size: 12px; font-weight: 700; color: var(--muted); gap: 3px; }
.filters label.grow { flex: 1 1 200px; }
.filters select, .filters input {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 5px 10px;
  min-width: 0;
  max-width: 100%;
}
.filters select:focus, .filters input:focus { outline: none; border-color: var(--accent); }
.meta { color: var(--muted); font-size: 13px; margin: 14px 4px 8px; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 2px solid var(--line); border-radius: 18px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 2px dashed var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--accent); background: var(--accent-soft); font-weight: 800; white-space: nowrap; border-bottom: 0; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: var(--row-hover); }
tbody tr:last-child td { border-bottom: 0; }
td.date, td.code, .code { font-variant-numeric: tabular-nums; white-space: nowrap; }
td.date { color: var(--muted); font-size: 13px; }
td.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 800; }
.code { color: var(--muted); font-weight: 700; }
.company-name { font-weight: 700; }

/* 分類タグ(分類ごとに色が変わる) */
.tag { display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 0 9px; color: var(--muted); background: var(--bg); }
.cat-0 { color: var(--c0); background: var(--c0-bg); }
.cat-1 { color: var(--c1); background: var(--c1-bg); }
.cat-2 { color: var(--c2); background: var(--c2-bg); }
.cat-3 { color: var(--c3); background: var(--c3-bg); }
.cat-4 { color: var(--c4); background: var(--c4-bg); }
.cat-5 { color: var(--c5); background: var(--c5-bg); }

/* 関係ラベル(種類ごとに色が変わる) */
.rel { display: inline-block; font-size: 12px; font-weight: 700; white-space: nowrap; padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.rel-target { color: var(--c0); background: var(--c0-bg); }
.rel-holder { color: var(--c4); background: var(--c4-bg); }
.rel-self   { color: var(--c1); background: var(--c1-bg); }
.rel-tob    { color: var(--c3); background: var(--c3-bg); }
.rel-issuer { color: var(--c2); background: var(--c2-bg); }
.sub { display: block; font-size: 12px; color: var(--muted); }

/* 原本リンクはボタン風に */
td a.open {
  display: inline-block;
  white-space: nowrap;
  font-size: 12px;
  text-decoration: none;
  color: var(--accent);
  border: 2px solid var(--accent);
  border-radius: 999px;
  padding: 1px 10px;
}
td a.open:hover { background: var(--accent); color: #fff; }
.empty { margin: 0; padding: 28px; text-align: center; color: var(--muted); font-weight: 700; }

.companies { margin: 36px 0; }
.companies h2, .doc h2 { font-weight: 800; }
.companies h2 { font-size: 19px; margin: 0; }
.companies h2::before, .doc h2::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--head-to);
  box-shadow: 14px 0 0 #ffd65a;
  vertical-align: middle;
  margin-right: 22px;
}

.site-footer { background: var(--surface); border-top: 2px solid var(--line); padding: 18px 0 32px; color: var(--muted); font-size: 13px; }
.site-footer p { margin: 4px 0; overflow-wrap: anywhere; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 10px !important; font-size: 14px; }
.doc p { overflow-wrap: anywhere; }

.doc { background: var(--surface); border: 2px solid var(--line); border-radius: 18px; padding: 8px 24px 18px; margin: 24px 0 36px; }
.doc h2 { font-size: 17px; margin: 24px 0 6px; }
.doc p, .doc li { font-size: 14px; }

/* スマホ幅では書類一覧をカード状に並べる */
@media (max-width: 720px) {
  .site-header h1 { font-size: 23px; }
  table.docs thead { display: none; }
  table.docs tr { display: block; padding: 12px 14px; border-bottom: 2px dashed var(--line); }
  table.docs tr:last-child { border-bottom: 0; }
  table.docs td { display: block; padding: 2px 0; border: 0; }
}
