:root {
  --bg: #f4f4f1;
  --bg-soft: #ecece8;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-strong: #ffffff;
  --text: #111216;
  --text-muted: #54575f;
  --border: rgba(17, 18, 22, 0.14);
  --border-strong: rgba(17, 18, 22, 0.24);

  --primary: #d4c82b;
  --primary-strong: #9e951a;
  --accent: #4f545e;
  --accent-soft: #f4efaf;

  --cat-sds: #7e57c2;
  --cat-social: #f28c28;
  --cat-ds: #2f80ed;
  --cat-pace: #e53935;

  --kubun-intro: #15803d;
  --kubun-basic: #0f766e;
  --kubun-advanced: #b45309;
  --kubun-seminar: #7c3aed;
  --kubun-common: #6b7280;

  --zemi-lab: #1d4ed8;
  --zemi-zemi: #059669;
  --zemi-mid: #ca8a04;

  --zemi-social: #f28c28;
  --zemi-stats: #2f80ed;
  --zemi-ai: #7e57c2;

  --grade-aplus: #1d4ed8;
  --grade-a: #059669;
  --grade-b: #ca8a04;
  --grade-c: #ea580c;
  --grade-f: #dc2626;

  --radius-sm: 12px;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(17, 18, 22, 0.08);
  --shadow-lg: 0 28px 60px rgba(17, 18, 22, 0.16);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Noto Sans JP", "Hiragino Sans", sans-serif;
  color: var(--text);
  line-height: 1.75;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% -8%, rgba(212, 200, 43, 0.22), transparent 38%),
    radial-gradient(circle at 92% 8%, rgba(158, 161, 168, 0.2), transparent 42%),
    linear-gradient(180deg, #f8f8f5 0%, #efefeb 100%);
  -webkit-font-smoothing: antialiased;
}

body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  pointer-events: none;
}

body::before {
  width: 360px;
  height: 360px;
  left: -140px;
  top: 18%;
  background: rgba(212, 200, 43, 0.12);
  filter: blur(2px);
}

body::after {
  width: 420px;
  height: 420px;
  right: -180px;
  bottom: 14%;
  background: rgba(79, 84, 94, 0.1);
  filter: blur(2px);
}

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

a:hover {
  text-decoration: underline;
}

.container {
  max-width: 1260px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.78);
}

.topbar-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 0;
}

.brand-home {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  flex: 1 1 320px;
  min-width: 0;
}

.brand-home:hover {
  text-decoration: none;
}

.site-logo {
  height: 54px;
  width: auto;
  display: block;
}

.brand-kicker {
  letter-spacing: 0.12em;
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--text-muted);
}

.brand-title {
  font-size: clamp(1rem, 2vw, 1.3rem);
  font-weight: 800;
  line-height: 1.35;
}

.brand-link {
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  background: var(--surface);
  font-size: 0.83rem;
  font-weight: 700;
  color: var(--primary-strong);
}

/* ---- Hamburger button ---- */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
}

.hamburger-line {
  display: block;
  width: 24px;
  height: 2.5px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.25s;
}

.hamburger.open .hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger.open .hamburger-line:nth-child(2) {
  opacity: 0;
}

.hamburger.open .hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.topbar-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: flex-end;
  flex: 1 1 560px;
  min-width: 0;
}

.topnav-link {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.46rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  transition: background-color 0.18s, border-color 0.18s, color 0.18s;
  white-space: nowrap;
}

.topnav-link:hover {
  text-decoration: none;
  background: #f3f0cb;
  border-color: #d4c82b;
}

.topnav-link.active {
  background: linear-gradient(135deg, #f7f2b5 0%, #ece7a0 100%);
  border-color: #d4c82b;
  color: #35393f;
}

/* ---- Nav Dropdown ---- */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.46rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  background: none;
  cursor: pointer;
  transition: background-color 0.18s, border-color 0.18s;
  white-space: nowrap;
  font-family: inherit;
}

.nav-dropdown-toggle:hover,
.nav-dropdown.open .nav-dropdown-toggle {
  background: #f3f0cb;
  border-color: #d4c82b;
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 0.3rem);
  min-width: 160px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  box-shadow: var(--shadow-lg);
  padding: 0.35rem;
  z-index: 40;
}

.nav-dropdown.open .nav-dropdown-menu {
  display: block;
}

.nav-dropdown-menu a {
  display: block;
  padding: 0.5rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  border-radius: 8px;
  transition: background-color 0.15s;
}

.nav-dropdown-menu a:hover {
  text-decoration: none;
  background: #f3f0cb;
}

.portal-main {
  display: grid;
  gap: 1rem;
  padding-top: 1.15rem;
  padding-bottom: 2rem;
}

.portal-hero {
  position: relative;
  overflow: hidden;
}

.portal-hero::after {
  content: "";
  position: absolute;
  width: 280px;
  height: 280px;
  right: -110px;
  top: -90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 200, 43, 0.22), transparent 62%);
  pointer-events: none;
}

.hero-kicker {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  font-weight: 800;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.portal-title {
  font-size: clamp(1.45rem, 3.2vw, 2.1rem);
  line-height: 1.35;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.portal-sub {
  max-width: 72ch;
  color: var(--text-muted);
}

.portal-meta {
  margin-top: 0.8rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: 1px solid #d4c82b;
  border-radius: 999px;
  padding: 0.32rem 0.68rem;
  background: #f7f2b5;
  color: #3b3f46;
  font-size: 0.75rem;
  font-weight: 700;
}

.directory-section {
  display: grid;
  gap: 0.9rem;
}

.directory-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  flex-wrap: wrap;
}

.directory-title {
  font-size: 1.15rem;
  line-height: 1.35;
  font-weight: 800;
}

.directory-caption {
  color: var(--text-muted);
  font-size: 0.86rem;
}

.directory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.85rem;
}

.directory-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 1rem;
  display: grid;
  gap: 0.45rem;
  min-height: 190px;
}

.directory-card-linkbox {
  color: inherit;
  text-decoration: none;
  transition: transform 0.16s, box-shadow 0.16s, border-color 0.16s;
}

.directory-card-linkbox:hover {
  text-decoration: none;
  transform: translateY(-2px);
  border-color: #d4c82b;
  box-shadow: var(--shadow-lg);
}

.directory-card.disabled {
  background: linear-gradient(180deg, #fbfdff 0%, #f8fafc 100%);
}

.directory-label {
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.directory-card h3 {
  font-size: 1.04rem;
  line-height: 1.35;
}

.directory-card p {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.card-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.22rem 0.62rem;
  font-size: 0.72rem;
  font-weight: 700;
}

.status-badge.live {
  color: #3e4407;
  background: #f4efaf;
  border: 1px solid #d4c82b;
}

.status-badge.soon {
  color: #92400e;
  background: #ffedd5;
  border: 1px solid #fed7aa;
}

.portal-card-link {
  justify-self: start;
  border: 1px solid #d4c82b;
  border-radius: 999px;
  padding: 0.42rem 0.78rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #3b3f46;
  background: #f7f2b5;
}

.portal-card-link:hover {
  text-decoration: none;
  background: #f0e97d;
}

.portal-note p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.45rem;
}

.wiki-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1rem;
  padding-top: 1.15rem;
  padding-bottom: 2rem;
}

.wiki-sidebar {
  position: sticky;
  top: 4.9rem;
  align-self: start;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
  padding: 1rem;
  animation: slide-up 0.5s ease-out both;
}

.sidebar-title {
  color: var(--text-muted);
  font-size: 0.74rem;
  letter-spacing: 0.11em;
  font-weight: 800;
  margin-bottom: 0.65rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.34rem;
}

.nav-link {
  font-size: 0.9rem;
  color: #1f2937;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 0.45rem 0.58rem;
  font-weight: 600;
  transition: background-color 0.18s, border-color 0.18s, color 0.18s;
}

.nav-link:hover {
  text-decoration: none;
  background: #f7f2b5;
  border-color: #d4c82b;
}

.nav-link.active {
  background: linear-gradient(135deg, #f7f2b5 0%, #ece7a0 100%);
  border-color: #d4c82b;
  color: #35393f;
}

.wiki-main {
  display: grid;
  gap: 1rem;
}

.section {
  scroll-margin-top: 6rem;
}

.article-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
  padding: 1.35rem;
  animation: slide-up 0.6s ease-out both;
}

.article-head {
  margin-bottom: 0.85rem;
}

.article-title {
  font-size: clamp(1.38rem, 3.2vw, 2rem);
  line-height: 1.35;
  font-weight: 800;
  letter-spacing: 0.01em;
  margin-bottom: 0.36rem;
}

.article-sub {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.intro-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.7rem;
}

.intro-text p + p {
  margin-top: 0.72rem;
}

.infobox {
  display: none;
  border: 1px solid #d4c82b;
  border-radius: 14px;
  padding: 0.9rem;
  background: linear-gradient(180deg, #fbf8d8 0%, #f4efaf 100%);
}

.infobox-title {
  font-size: 0.94rem;
  font-weight: 800;
  margin-bottom: 0.52rem;
}

.infobox-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.3rem 0.8rem;
  font-size: 0.84rem;
}

.infobox-list dt {
  color: #4a4f57;
  font-weight: 700;
}

.section-title {
  display: inline-block;
  margin-bottom: 1rem;
  font-size: 1.24rem;
  font-weight: 800;
  padding-bottom: 0.32rem;
  border-bottom: 2px solid var(--primary);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: center;
  margin-bottom: 0.82rem;
}

.search-input {
  flex: 1 1 280px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.66rem 0.95rem;
  font-size: 0.92rem;
  background: var(--surface-strong);
}

.search-input:focus,
.filter-select:focus {
  outline: none;
  border-color: #d4c82b;
  box-shadow: 0 0 0 4px rgba(212, 200, 43, 0.22);
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.filter-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.cat-btn {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.35rem 0.72rem;
  cursor: pointer;
  transition: transform 0.16s, border-color 0.16s, background-color 0.16s;
}

.cat-btn:hover {
  transform: translateY(-1px);
  border-color: #d4c82b;
  background: #f9f6d2;
}

.cat-btn.active {
  color: #fff;
  border-color: transparent;
}

.cat-btn[data-cat="sds"].active { background: var(--cat-sds); }
.cat-btn[data-cat="social"].active { background: var(--cat-social); }
.cat-btn[data-cat="ds"].active { background: var(--cat-ds); }
.cat-btn[data-cat="pace"].active { background: var(--cat-pace); }

.filter-select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.44rem 0.6rem;
  font-size: 0.82rem;
  background: #fff;
}

.result-count {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 0.8rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.9rem;
}

.loading {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  padding: 2.2rem 0;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: linear-gradient(160deg, #ffffff 0%, #f5f4eb 100%);
  box-shadow: 0 6px 18px rgba(2, 6, 23, 0.06);
  padding: 1rem;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  animation: slide-up 0.45s ease-out both;
  animation-delay: var(--stagger, 0s);
}

.card:hover {
  transform: translateY(-3px);
  border-color: #d4c82b;
  box-shadow: var(--shadow-lg);
}

.card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.36rem;
  margin-bottom: 0.18rem;
}

.card-cat {
  display: inline-block;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.16rem 0.55rem;
  border-radius: 999px;
}

.card-cat.cat-sds, .modal-cat.cat-sds { background: var(--cat-sds); }
.card-cat.cat-social, .modal-cat.cat-social { background: var(--cat-social); }
.card-cat.cat-ds, .modal-cat.cat-ds { background: var(--cat-ds); }
.card-cat.cat-pace, .modal-cat.cat-pace { background: var(--cat-pace); }

.card-kubun,
.modal-kubun {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.14rem 0.55rem;
  border: 1.5px solid;
  background: rgba(255, 255, 255, 0.45);
}

.modal-kubun {
  font-size: 0.74rem;
  margin-bottom: 0.45rem;
}

.kubun-intro { color: var(--kubun-intro); border-color: var(--kubun-intro); }
.kubun-basic { color: var(--kubun-basic); border-color: var(--kubun-basic); }
.kubun-advanced { color: var(--kubun-advanced); border-color: var(--kubun-advanced); }
.kubun-seminar { color: var(--kubun-seminar); border-color: var(--kubun-seminar); }
.kubun-common { color: var(--kubun-common); border-color: var(--kubun-common); }

/* Course flags */
.card-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.4rem;
}
.card-flag,
.modal-flag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
  line-height: 1.3;
}
.flag-teacher { background: #fff3cd; color: #856404; }
.flag-auto    { background: #d1ecf1; color: #0c5460; }
.flag-lottery { background: #f8d7da; color: #721c24; }
.modal-flag {
  font-size: 0.72rem;
  padding: 0.16rem 0.55rem;
  margin-bottom: 0.3rem;
}

.card-name {
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.45;
}

.card-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.card-difficulty {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.45rem;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.difficulty-label {
  margin-right: 0.2rem;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 2px;
}

.dot.filled {
  background: var(--accent);
}

.dot.empty {
  background: rgba(0, 0, 0, 0.15);
}

.card-grade-mini {
  display: flex;
  overflow: hidden;
  border-radius: 999px;
  height: 5px;
  margin-top: auto;
  padding-top: 0.5rem;
}

.card-grade-mini > span {
  height: 5px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 6, 23, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  position: relative;
  width: min(92vw, 690px);
  max-height: 86vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow-lg);
  padding: 1.8rem;
  transform: translateY(16px);
  transition: transform 0.24s;
}

.modal-overlay.open .modal {
  transform: translateY(0);
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text);
}

.modal-cat {
  display: inline-block;
  color: #fff;
  border-radius: 999px;
  padding: 0.2rem 0.62rem;
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 0.42rem;
}

.modal-name {
  font-size: 1.35rem;
  line-height: 1.35;
  font-weight: 800;
  margin-bottom: 0.75rem;
}

.modal-info {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.3rem 0.95rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.modal-info dt {
  white-space: nowrap;
  color: var(--text-muted);
  font-weight: 600;
}

.modal-desc {
  padding: 0.88rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f7f7f1;
  margin-bottom: 0.95rem;
  font-size: 0.9rem;
}

.grade-section-title {
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 0.45rem;
}

.grade-bar {
  display: flex;
  height: 32px;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0.45rem;
}

.grade-segment {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  min-width: 0;
}

.grade-segment.g-aplus { background: var(--grade-aplus); }
.grade-segment.g-a { background: var(--grade-a); }
.grade-segment.g-b { background: var(--grade-b); }
.grade-segment.g-c { background: var(--grade-c); }
.grade-segment.g-f { background: var(--grade-f); }

.grade-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  font-size: 0.77rem;
}

.grade-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.grade-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

/* ========== Zemi Type Badges ========== */
.zemi-type-lab  { background: var(--zemi-lab); color: #fff; }
.zemi-type-zemi { background: var(--zemi-zemi); color: #fff; }
.zemi-type-mid  { background: var(--zemi-mid); color: #fff; }

.cat-btn[data-cat="lab"].active  { background: var(--zemi-lab); }
.cat-btn[data-cat="zemi"].active { background: var(--zemi-zemi); }
.cat-btn[data-cat="mid"].active  { background: var(--zemi-mid); }

/* ========== Zemi Field Badges ========== */
.zemi-field-social { background: var(--zemi-social); color: #fff; }
.zemi-field-stats  { background: var(--zemi-stats); color: #fff; }
.zemi-field-ai     { background: var(--zemi-ai); color: #fff; }

.cat-btn[data-cat="social"].active { background: var(--zemi-social); }
.cat-btn[data-cat="stats"].active  { background: var(--zemi-stats); }
.cat-btn[data-cat="ai"].active     { background: var(--zemi-ai); }

/* ========== Zemi Card Stats ========== */
.zemi-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.35rem;
}

.zemi-stat {
  display: inline-flex;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg-soft);
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
}

.zemi-stat-applicants {
  background: #fff3cd;
  color: #856404;
  font-weight: 700;
}

.zemi-stat-passed {
  background: #d4edda;
  color: #155724;
  font-weight: 700;
}

.zemi-content-preview {
  margin-top: 0.35rem;
  font-size: 0.84rem;
  line-height: 1.5;
}

/* ========== Zemi Visual Bars ========== */
.zemi-visual-bars {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fafaf6;
}

.zemi-bar-item {
  display: grid;
  gap: 0.3rem;
}

.zemi-bar-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
}

.zemi-bar-value {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: right;
}

/* 形態 spectrum bar */
.zemi-spectrum-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 12px;
}

.zemi-spectrum-end {
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.zemi-spectrum-end.left { color: var(--zemi-zemi); }
.zemi-spectrum-end.right { color: var(--zemi-lab); }

.zemi-spectrum-bar {
  position: relative;
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(5,150,105,0.3), rgba(202,138,4,0.3) 50%, rgba(29,78,216,0.3));
}

.zemi-spectrum-end.active {
  font-size: 0.82rem;
  font-weight: 800;
}

.zemi-spectrum-end.left.active { color: var(--zemi-zemi); }
.zemi-spectrum-end.right.active { color: var(--zemi-lab); }

.zemi-spectrum-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2.5px solid #fff;
  z-index: 1;
}

.zemi-spectrum-marker.marker-zemi { background: var(--zemi-zemi); }
.zemi-spectrum-marker.marker-mid  { background: var(--zemi-mid); }
.zemi-spectrum-marker.marker-lab  { background: var(--zemi-lab); }

.zemi-spectrum-marker-label {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
  color: var(--text);
}

/* 活動時間 range bar */
.zemi-range-wrap {
  position: relative;
}

.zemi-range-bar {
  position: relative;
  height: 14px;
  border-radius: 999px;
  background: var(--bg-soft);
  overflow: hidden;
}

.zemi-range-fill {
  position: absolute;
  top: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #f59e0b, #ef4444);
  min-width: 6px;
}

.zemi-range-ticks {
  position: relative;
  height: 18px;
  margin-top: 2px;
}

.zemi-range-tick {
  position: absolute;
  transform: translateX(-50%);
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* 院進検討率 bar */
.zemi-pct-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.zemi-pct-bar {
  flex: 1;
  height: 14px;
  border-radius: 999px;
  background: var(--bg-soft);
  overflow: hidden;
}

.zemi-pct-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #60a5fa, #3b82f6);
  transition: width 0.4s ease;
}

.zemi-pct-value {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text);
  min-width: 3em;
  text-align: right;
}

.no-grade-data {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.section-guide {
  background: var(--surface);
}

.guide-content {
  max-width: 76ch;
  font-size: 0.95rem;
}

.guide-content h1 {
  font-size: 1.32rem;
  margin: 1.75rem 0 0.7rem;
}

.guide-content h2 {
  font-size: 1.14rem;
  margin: 1.52rem 0 0.55rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.28rem;
}

.guide-content h3 {
  font-size: 1rem;
  margin: 1.3rem 0 0.45rem;
}

.guide-content p {
  margin-bottom: 0.78rem;
}

.guide-content ul {
  margin: 0.45rem 0 0.95rem 1.35rem;
}

.guide-content li {
  margin-bottom: 0.3rem;
}

.guide-content blockquote {
  border-left: 3px solid var(--primary);
  border-radius: 0 8px 8px 0;
  background: #f7f4ce;
  padding: 0.5rem 0.9rem;
  margin: 0.8rem 0;
}

.guide-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.35rem 0;
}

.guide-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.9rem 0;
  font-size: 0.84rem;
}

.guide-content th,
.guide-content td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.55rem;
  text-align: left;
}

.guide-content th {
  background: #f7f4ce;
}

.guide-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.image-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin: 0.9rem 0;
}

.image-grid figure {
  margin: 0;
}

.image-grid figure img {
  width: 100%;
  display: block;
}

@media (max-width: 480px) {
  .image-grid {
    grid-template-columns: 1fr;
  }
}

.field-desc-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.55rem 1.1rem;
  font-size: 0.92rem;
  margin-top: 1rem;
}

.field-desc-list dt {
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  padding-top: 0.1rem;
}

.field-desc-list dd {
  margin: 0;
  line-height: 1.6;
}

.source-list {
  margin-left: 1.15rem;
  display: grid;
  gap: 0.42rem;
}

/* ========== NEWS + Twitter Section ========== */
.news-twitter-section {
  scroll-margin-top: 6rem;
}

.news-twitter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.news-panel,
.twitter-panel {
  min-height: 0;
}

.news-list {
  list-style: none;
  display: grid;
  gap: 0;
}

.news-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.6rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

.news-item:last-child {
  border-bottom: none;
}

.news-date {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}

.news-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 0.12rem 0.48rem;
  flex-shrink: 0;
}

.news-badge.new {
  color: #fff;
  background: #ef4444;
}

.news-text {
  flex: 1;
  min-width: 0;
}

.twitter-embed-wrap {
  border-radius: 12px;
  overflow: hidden;
}

.x-profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.3rem;
  padding: 1.5rem 1rem;
}

.x-profile-icon {
  font-size: 2.4rem;
  line-height: 1;
  font-weight: 800;
}

.x-profile-name {
  font-size: 1.1rem;
  font-weight: 800;
}

.x-profile-handle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.x-profile-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  max-width: 32ch;
  line-height: 1.6;
}

.x-profile-btn {
  display: inline-block;
  margin-top: 0.8rem;
  border: 1px solid #d4c82b;
  border-radius: 999px;
  padding: 0.5rem 1.2rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: #3b3f46;
  background: #f7f2b5;
  transition: background 0.18s;
}

.x-profile-btn:hover {
  text-decoration: none;
  background: #f0e97d;
}

@media (max-width: 720px) {
  .news-twitter-grid {
    grid-template-columns: 1fr;
  }
}

/* ========== Column Cards ========== */
.column-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.9rem;
}

.column-card {
  text-decoration: none;
  color: inherit;
}

.column-card:hover {
  text-decoration: none;
}

.column-tag {
  background: var(--accent);
}

.cat-btn.active .column-tag {
  background: var(--accent);
}

.column-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.5rem;
}

.column-card-date {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}

.column-card-author {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ========== Column Article ========== */
.column-article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.column-article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.column-article-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  padding: 0.14rem 0.55rem;
}

.column-article-body p,
.column-article-body ul,
.column-article-body blockquote,
.column-article-body table {
  margin-bottom: 0.85rem;
}

.column-article-body h3 {
  margin-top: 1.1rem;
  margin-bottom: 0.4rem;
  font-size: 1.02rem;
}

.column-article-body ul {
  padding-left: 1.4rem;
}

.column-article-body li {
  margin-bottom: 0.3rem;
  line-height: 1.65;
}

.column-article-body blockquote {
  border-left: 3px solid var(--primary);
  padding: 0.75rem 1rem;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
}

.column-article-body blockquote p:last-child {
  margin-bottom: 0;
}

.column-article-body details {
  margin-bottom: 0.5rem;
}

.column-article-body details summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  padding: 0.3rem 0;
}

.column-article-body details summary:hover {
  color: var(--text);
}

.column-article-body details[open] summary {
  margin-bottom: 0.3rem;
}

.column-article-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.column-article-body th,
.column-article-body td {
  padding: 0.6rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.column-article-body th {
  background: var(--bg-soft);
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.column-article-body tbody tr:hover {
  background: var(--bg-soft);
}

.column-back-link {
  display: inline-block;
  margin-top: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.42rem 0.78rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}

.column-back-link:hover {
  text-decoration: none;
  border-color: #d4c82b;
  background: #f7f2b5;
}

.footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
  padding: 1.2rem 0 1.6rem;
}

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .topbar-inner {
    align-items: flex-start;
  }

  .topbar-menu {
    width: 100%;
    justify-content: flex-start;
  }

  .wiki-layout {
    grid-template-columns: 1fr;
  }

  .wiki-sidebar {
    position: static;
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .intro-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .site-logo {
    height: 44px;
  }

  .topbar-inner {
    flex-wrap: wrap;
    align-items: center;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .brand-home {
    flex: 1;
    min-width: 0;
  }

  .hamburger {
    display: flex;
    flex-shrink: 0;
  }

  .brand-block {
    overflow: hidden;
  }

  .brand-unofficial {
    display: none;
  }

  .brand-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topbar-menu {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem 0;
    border-top: 1px solid var(--border);
  }

  .topbar-menu.open {
    display: flex;
  }

  .topbar-menu .topnav-link {
    border-radius: 0.5rem;
    padding: 0.6rem 0.85rem;
  }

  .nav-dropdown {
    display: contents;
  }

  .nav-dropdown-toggle {
    display: none;
  }

  .nav-dropdown-menu {
    display: contents;
  }

  .nav-dropdown-menu a {
    padding: 0.6rem 0.85rem;
    border-radius: 0.5rem;
    font-size: 0.82rem;
    font-weight: 700;
  }

  .directory-head {
    align-items: flex-start;
  }

  .article-section {
    padding: 1.05rem;
  }

  .article-head {
    margin-bottom: 0.5rem;
  }

  .article-title {
    font-size: 1.25rem;
  }

  .infobox {
    display: none;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
  }

  .search-input {
    flex: unset;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
  }

  .filter-group {
    gap: 0.35rem;
  }

  .cat-btn {
    font-size: 0.72rem;
    padding: 0.25rem 0.55rem;
  }

  .filter-select {
    padding: 0.35rem 0.5rem;
    font-size: 0.78rem;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .modal {
    padding: 1.2rem;
  }

  .modal-info {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }

  .modal-info dt {
    margin-top: 0.45rem;
    font-weight: 700;
  }

  .field-desc-list {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }

  .field-desc-list dt {
    margin-top: 0.55rem;
  }
}
