/* ==========================================================================
   知識アップデート図鑑 - Stylesheet
   Design Concept: Museum x Field Guide x Modern Web Interface
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Custom Properties (Variables)
   -------------------------------------------------------------------------- */
:root {
  /* Color Palette - Neutral */
  --color-bg: #f8fafc;
  --color-bg-alt: #f1f5f9;
  --color-surface: #ffffff;
  --color-surface-hover: #f8fafc;
  --color-border: #e2e8f0;
  --color-border-dark: #cbd5e1;

  /* Typography Colors */
  --color-text-main: #0f172a;
  --color-text-muted: #64748b;
  --color-text-light: #94a3b8;

  /* Primary Brand Accent */
  --color-primary: #1e3a8a;       /* Deep Academy Navy */
  --color-primary-light: #2563eb; /* Bright Blue */
  --color-primary-bg: #eff6ff;    /* Light Tint */
  --color-accent: #d97706;        /* Warm Amber */

  /* Subject Accent Colors */
  --sub-history: #9a3412;   /* Terracotta / Crimson */
  --sub-physics: #1d4ed8;   /* Deep Blue */
  --sub-chemistry: #059669; /* Emerald Green */
  --sub-biology: #15803d;   /* Forest Green */
  --sub-earth: #854d0e;     /* Ochre Brown */
  --sub-space: #4c1d95;     /* Deep Purple */
  --sub-health: #0284c7;    /* Teal Cyan */
  --sub-general: #475569;   /* Slate */

  /* Old vs Current Theme Colors (CRITICAL CONCEPT) */
  /* Old: Sepia / Aged Parchment tone */
  --old-view-bg: #faf6ed;
  --old-view-border: #e6dccb;
  --old-view-title: #78350f;
  --old-view-text: #451a03;
  --old-view-badge: #fef3c7;

  /* Current: Fresh / Modern Clean tone */
  --current-view-bg: #f0fdf4;
  --current-view-border: #bbf7d0;
  --current-view-title: #14532d;
  --current-view-text: #064e3b;
  --current-view-badge: #dcfce7;

  /* Update Types Badges Background & Text */
  --type-rejected-bg: #fef2f2;
  --type-rejected-color: #991b1b;
  --type-rejected-border: #fecaca;

  --type-revised-bg: #eff6ff;
  --type-revised-color: #1e40af;
  --type-revised-border: #bfdbfe;

  --type-reinterpretation-bg: #fdf4ff;
  --type-reinterpretation-color: #86198f;
  --type-reinterpretation-border: #f5d0fe;

  --type-convention-bg: #f0fdfa;
  --type-convention-color: #115e59;
  --type-convention-border: #99f6e4;

  --type-myth-bg: #fff7ed;
  --type-myth-color: #c2410c;
  --type-myth-border: #ffedd5;

  --type-uncertain-bg: #fefce8;
  --type-uncertain-color: #854d0e;
  --type-uncertain-border: #fef08a;

  --type-textbook-bg: #f0f9ff;
  --type-textbook-color: #0369a1;
  --type-textbook-border: #bae6fd;

  /* Typography */
  --font-sans: 'Zen Kaku Gothic New', 'YakuHanJP', system-ui, -apple-system, sans-serif;
  --font-serif: 'Shippori Mincho', 'YakuHanJP', Georgia, serif;

  /* Layout & Spacing */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.12);

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* --------------------------------------------------------------------------
   2. Base & Reset
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg);
  color: var(--color-text-main);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

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

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

.sp-only { display: none; }
.pc-only { display: inline; }
@media (max-width: 768px) {
  .sp-only { display: inline; }
  .pc-only { display: none; }
}

/* --------------------------------------------------------------------------
   3. Header
   -------------------------------------------------------------------------- */
.site-header {
  background-color: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-text-main);
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.25rem;
}
.site-logo:hover {
  text-decoration: none;
  opacity: 0.9;
}
.logo-icon {
  font-size: 1.5rem;
}
.logo-badge {
  font-family: var(--font-sans);
  font-size: 0.65rem;
  font-weight: 700;
  background-color: var(--color-primary-bg);
  color: var(--color-primary);
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-primary-light);
  margin-left: 0.25rem;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-main);
  background-color: var(--color-bg-alt);
  transition: var(--transition-fast);
  white-space: nowrap;
}
.nav-btn:hover {
  background-color: var(--color-border);
}
.nav-btn-accent {
  background-color: var(--color-primary-bg);
  color: var(--color-primary);
  border: 1px solid var(--color-primary-light);
  font-weight: 700;
}
.nav-btn-accent:hover {
  background-color: #dbeafe;
}

.badge-new {
  font-size: 0.65rem;
  background-color: var(--color-accent);
  color: white;
  padding: 0.1rem 0.35rem;
  border-radius: var(--radius-full);
}

@media (max-width: 640px) {
  .site-header { height: auto; padding: 0.5rem 0; }
  .header-inner { flex-direction: column; gap: 0.5rem; height: auto; }
  .logo-title { font-size: 1.1rem; }
  .nav-btn { padding: 0.35rem 0.6rem; font-size: 0.8rem; }
}

/* --------------------------------------------------------------------------
   4. Hero Section & Database Total Badge
   -------------------------------------------------------------------------- */
.hero-section {
  position: relative;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
  color: white;
  padding: 3.5rem 1.25rem 4.5rem;
  text-align: center;
  overflow: hidden;
}

.hero-bg-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.08;
  background-image: radial-gradient(#ffffff 1px, transparent 1px);
  background-size: 24px 24px;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 880px;
  margin: 0 auto;
}

.hero-header-badges {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.hero-tagline {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #93c5fd;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.1);
  padding: 0.3rem 0.85rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.total-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 700;
  background: #f59e0b;
  color: #78350f;
  padding: 0.3rem 0.9rem;
  border-radius: var(--radius-full);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}
.total-count-badge strong {
  font-size: 1.15rem;
  color: #451a03;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: #15803d;
  border-radius: 50%;
  display: inline-block;
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(21, 128, 61, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(21, 128, 61, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(21, 128, 61, 0); }
}

.hero-title {
  font-family: var(--font-serif);
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 1.25rem;
  letter-spacing: -0.02em;
}

.highlight-text {
  color: #fbbf24;
  position: relative;
  display: inline-block;
}

.hero-subtext {
  font-size: 1rem;
  color: #cbd5e1;
  margin-bottom: 2.25rem;
  line-height: 1.8;
}

@media (max-width: 768px) {
  .hero-section { padding: 2.5rem 1rem 3.5rem; }
  .hero-title { font-size: 1.85rem; }
  .hero-subtext { font-size: 0.9rem; margin-bottom: 1.75rem; }
}

/* Search Box */
.search-box-wrapper {
  max-width: 680px;
  margin: 0 auto;
}

.search-input-group {
  position: relative;
  display: flex;
  align-items: center;
  background-color: white;
  border-radius: var(--radius-full);
  padding: 0.35rem 0.5rem 0.35rem 1.25rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
  border: 3px solid rgba(255, 255, 255, 0.2);
  transition: var(--transition-normal);
}
.search-input-group:focus-within {
  border-color: #60a5fa;
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.4);
}

.search-icon {
  font-size: 1.25rem;
  margin-right: 0.75rem;
  color: var(--color-text-muted);
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1.05rem;
  color: var(--color-text-main);
  background: transparent;
  padding: 0.5rem 0;
}
.search-input::placeholder {
  color: #94a3b8;
}

.clear-search-btn {
  background-color: #e2e8f0;
  color: #475569;
  border-radius: 50%;
  width: 1.75rem;
  height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  margin-right: 0.5rem;
  transition: var(--transition-fast);
}
.clear-search-btn:hover {
  background-color: #cbd5e1;
}

.search-quick-tags {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1rem;
  font-size: 0.85rem;
}

.quick-tag-label {
  color: #94a3b8;
  font-weight: 500;
}

.quick-tag-btn {
  background: rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: var(--transition-fast);
}
.quick-tag-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

/* --------------------------------------------------------------------------
   5. Main Section Layout
   -------------------------------------------------------------------------- */
.main-content {
  padding-top: 2.5rem;
  padding-bottom: 5rem;
}

.section-header-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.section-title-sm {
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-text-icon {
  font-size: 0.875rem;
  color: var(--color-primary-light);
  font-weight: 600;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}
.btn-text-icon:hover {
  background-color: var(--color-primary-bg);
}

/* --------------------------------------------------------------------------
   6. Pickup Card ("今日の知識アップデート")
   -------------------------------------------------------------------------- */
.today-update-section {
  margin-bottom: 3rem;
}

.today-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr;
  transition: var(--transition-normal);
}
.today-card:hover {
  box-shadow: var(--shadow-lg);
}

.today-card-header {
  background: linear-gradient(to right, #1e3a8a, #2563eb);
  color: white;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.today-subject-badge {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
}

.today-item-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 700;
}

.today-card-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Old vs Current Comparison Visual Box */
.comparison-box-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: center;
}

@media (max-width: 768px) {
  .comparison-box-grid {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }
  .today-card-body { padding: 1rem; }
}

.comparison-card {
  padding: 1.15rem 1.35rem;
  border-radius: var(--radius-md);
  position: relative;
}

/* Old Card (Sepia / Parchment) */
.comparison-card-old {
  background-color: var(--old-view-bg);
  border: 1px solid var(--old-view-border);
  color: var(--old-view-text);
  box-shadow: inset 0 0 10px rgba(120, 53, 15, 0.03);
}

.card-tag-old {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  background-color: var(--old-view-badge);
  color: var(--old-view-title);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.4rem;
}

.comparison-card-old .card-view-text {
  font-family: var(--font-serif);
  font-size: 0.975rem;
  line-height: 1.6;
}

/* Center Arrow */
.comparison-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--color-primary-light);
  font-weight: 900;
  font-size: 1.4rem;
}

.arrow-pc { display: inline; }
.arrow-sp { display: none; }

.arrow-sub {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  font-weight: 700;
  margin-top: 0.1rem;
  letter-spacing: 0.05em;
}

@media (max-width: 768px) {
  .comparison-arrow {
    flex-direction: row;
    gap: 0.35rem;
    padding: 0.35rem 0;
    font-size: 1.1rem;
  }
  .arrow-pc { display: none; }
  .arrow-sp { display: inline; font-size: 1.2rem; }
  .arrow-sub {
    margin-top: 0;
    font-size: 0.75rem;
  }
}

/* Current Card (Modern Fresh Green) */
.comparison-card-current {
  background-color: var(--current-view-bg);
  border: 1px solid var(--current-view-border);
  color: var(--current-view-text);
  box-shadow: inset 0 0 10px rgba(20, 83, 45, 0.03);
}

.card-tag-current {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  background-color: var(--current-view-badge);
  color: var(--current-view-title);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.4rem;
}

.comparison-card-current .card-view-text {
  font-size: 0.975rem;
  font-weight: 500;
  line-height: 1.6;
}

.today-summary-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--color-border);
  padding-top: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.today-why-text {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  flex: 1;
}

/* --------------------------------------------------------------------------
   7. Feature Banners
   -------------------------------------------------------------------------- */
.features-section {
  margin-bottom: 3rem;
}

.feature-banners-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.feature-banner {
  background-color: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  padding: 1.25rem;
  cursor: pointer;
  transition: var(--transition-normal);
  position: relative;
  overflow: hidden;
}
.feature-banner:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.banner-tag {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  display: inline-block;
  margin-bottom: 0.4rem;
}

.feature-banner-not-myth {
  border-left: 5px solid #2563eb;
}
.feature-banner-not-myth .banner-tag {
  background-color: #dbeafe;
  color: #1e40af;
}

.feature-banner-textbook {
  border-left: 5px solid #d97706;
}
.feature-banner-textbook .banner-tag {
  background-color: #fef3c7;
  color: #92400e;
}

.feature-banner-debated {
  border-left: 5px solid #7c3aed;
}
.feature-banner-debated .banner-tag {
  background-color: #ede9fe;
  color: #5b21b6;
}

.banner-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.banner-desc {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 0.85rem;
}

.banner-link {
  font-size: 0.825rem;
  font-weight: 700;
  color: var(--color-primary-light);
}

/* --------------------------------------------------------------------------
   8. Filter Controls Section
   -------------------------------------------------------------------------- */
.filter-controls-section {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 60px;
  z-index: 90;
  transition: box-shadow 0.2s ease;
}

@media (max-width: 768px) {
  .filter-controls-section {
    top: 50px;
    padding: 1rem;
  }
}

.filter-group {
  margin-bottom: 1.25rem;
}

.filter-group-header {
  margin-bottom: 0.5rem;
}

.filter-group-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-text-main);
}

/* Chips Scroll Container (Optimized for Mobile Swipe) */
.chips-scroll-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

@media (max-width: 768px) {
  .chips-scroll-container {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
  }
  .filter-chip { scroll-snap-align: start; flex-shrink: 0; }
}

.filter-chip {
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.825rem;
  font-weight: 500;
  background-color: var(--color-bg-alt);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  transition: var(--transition-fast);
  white-space: nowrap;
}
.filter-chip:hover {
  background-color: var(--color-border);
  color: var(--color-text-main);
}
.filter-chip.active {
  background-color: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(30, 58, 138, 0.3);
}

/* Sub filter row (Era & Sort) */
.sub-filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

.sub-filter-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.select-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.custom-select {
  padding: 0.4rem 1.75rem 0.4rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-dark);
  background-color: white;
  font-size: 0.85rem;
  color: var(--color-text-main);
  outline: none;
  cursor: pointer;
}
.custom-select:focus {
  border-color: var(--color-primary-light);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.btn-reset-filters {
  font-size: 0.825rem;
  color: #ef4444;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
}
.btn-reset-filters:hover {
  background-color: #fef2f2;
}

/* Status Bar & Total Count Highlight */
.filter-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--color-border);
  font-size: 0.875rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.result-count {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.result-count strong {
  font-size: 1.15rem;
  color: var(--color-primary);
}
.result-count strong.highlight-num {
  color: #2563eb;
  font-size: 1.25rem;
}

.active-chips-list {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.active-filter-tag {
  background-color: #e0f2fe;
  color: #0369a1;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

/* --------------------------------------------------------------------------
   9. Update Type Badges
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.3;
}

.type-badge-rejected {
  background-color: var(--type-rejected-bg);
  color: var(--type-rejected-color);
  border: 1px solid var(--type-rejected-border);
}
.type-badge-revised {
  background-color: var(--type-revised-bg);
  color: var(--type-revised-color);
  border: 1px solid var(--type-revised-border);
}
.type-badge-reinterpretation {
  background-color: var(--type-reinterpretation-bg);
  color: var(--type-reinterpretation-color);
  border: 1px solid var(--type-reinterpretation-border);
}
.type-badge-convention {
  background-color: var(--type-convention-bg);
  color: var(--type-convention-color);
  border: 1px solid var(--type-convention-border);
}
.type-badge-myth {
  background-color: var(--type-myth-bg);
  color: var(--type-myth-color);
  border: 1px solid var(--type-myth-border);
}
.type-badge-uncertain {
  background-color: var(--type-uncertain-bg);
  color: var(--type-uncertain-color);
  border: 1px solid var(--type-uncertain-border);
}
.type-badge-textbook_change {
  background-color: var(--type-textbook-bg);
  color: var(--type-textbook-color);
  border: 1px solid var(--type-textbook-border);
}

/* Certainty Badges */
.certainty-badge {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  font-weight: 600;
}
.certainty-established { background-color: #dcfce7; color: #15803d; }
.certainty-strong { background-color: #e0f2fe; color: #0369a1; }
.certainty-debated { background-color: #fef9c3; color: #a16207; }
.certainty-unknown { background-color: #f3f4f6; color: #4b5563; }

/* Subject Badges */
.subject-chip {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  color: white;
}
.subject-japanese { background-color: #047857; }
.subject-economics { background-color: #0d9488; }
.subject-psychology_edu { background-color: #6d28d9; }
.subject-it_tech { background-color: #2563eb; }
.subject-legal { background-color: #4338ca; }
.subject-history_jp { background-color: var(--sub-history); }
.subject-history_world { background-color: #c2410c; }
.subject-physics { background-color: var(--sub-physics); }
.subject-chemistry { background-color: var(--sub-chemistry); }
.subject-biology { background-color: var(--sub-biology); }
.subject-earth { background-color: var(--sub-earth); }
.subject-earth_space { background-color: var(--sub-space); }
.subject-space { background-color: var(--sub-space); }
.subject-health { background-color: var(--sub-health); }
.subject-society { background-color: #475569; }

/* --------------------------------------------------------------------------
   10. Items Grid Cards (Main Display)
   -------------------------------------------------------------------------- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

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

.update-card {
  background-color: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
  cursor: pointer;
  position: relative;
}
.update-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary-light);
}

.card-header-bar {
  padding: 0.65rem 1.15rem;
  background-color: var(--color-bg-alt);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-category-text {
  font-size: 0.775rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.card-body-content {
  padding: 1.15rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.card-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text-main);
  line-height: 1.4;
}

/* Card Visual Comparison (昔 vs 今) */
.card-comparison-mini {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.2rem;
}

.mini-box {
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  line-height: 1.45;
}

.mini-box-old {
  background-color: var(--old-view-bg);
  border: 1px solid var(--old-view-border);
  color: var(--old-view-text);
}
.mini-label-old {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--old-view-title);
  display: block;
  margin-bottom: 0.15rem;
}

.mini-arrow {
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-primary-light);
  line-height: 1;
  font-weight: 700;
}

.mini-box-current {
  background-color: var(--current-view-bg);
  border: 1px solid var(--current-view-border);
  color: var(--current-view-text);
}
.mini-label-current {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--current-view-title);
  display: block;
  margin-bottom: 0.15rem;
}

.card-footer-bar {
  padding: 0.65rem 1.15rem;
  background-color: var(--color-surface);
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.775rem;
  color: var(--color-text-muted);
}

.card-detail-link {
  font-weight: 700;
  color: var(--color-primary-light);
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3.5rem 1.25rem;
  background: white;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--color-border-dark);
}
.empty-icon { font-size: 2.75rem; margin-bottom: 0.75rem; }
.empty-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 0.5rem; }
.empty-desc { color: var(--color-text-muted); margin-bottom: 1.25rem; }

.btn-primary {
  background-color: var(--color-primary);
  color: white;
  padding: 0.55rem 1.35rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.9rem;
  transition: var(--transition-fast);
}
.btn-primary:hover {
  background-color: var(--color-primary-light);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}
.btn-block { width: 100%; text-align: center; }

/* --------------------------------------------------------------------------
   11. Dialogs & Modals (Universal Cross-Browser Modal Fix)
   -------------------------------------------------------------------------- */
body.modal-open {
  touch-action: pan-y;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

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

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1;
}

.modal-dialog {
  position: relative;
  z-index: 2;
  padding: 0;
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
  max-width: 680px;
  width: 100%;
  background: white;
  overflow: hidden;
  max-height: 82vh;
  max-height: calc(82dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
}

.modal-dialog.modal-detail-dialog {
  max-width: 860px;
}

.modal-content {
  background: white;
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 1.25rem 1.5rem 0.75rem;
  padding-right: 4rem; /* Space for close button */
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.modal-body-scrollable {
  overflow-y: auto;
  padding: 1.5rem;
  padding-top: 3.5rem; /* Space for close button when no header */
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.modal-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background-color: #f1f5f9;
  color: var(--color-text-main);
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: var(--transition-fast);
  box-shadow: 0 2px 5px rgba(0,0,0,0.12);
  border: 1px solid var(--color-border-dark);
  cursor: pointer;
}
.modal-close-btn:hover, .modal-close-btn:focus {
  background-color: #e2e8f0;
  color: var(--color-primary);
  outline: 2px solid var(--color-primary-light);
}

@media (max-width: 768px) {
  .modal-overlay {
    padding: 0.5rem;
  }
  .modal-dialog {
    max-width: 100%;
    max-height: 84vh;
    max-height: calc(84dvh - env(safe-area-inset-top, 0px));
    border-radius: var(--radius-md);
  }
  .modal-header {
    padding: 1rem 1rem 0.65rem;
    padding-right: 3.5rem;
  }
  .modal-body-scrollable {
    padding: 1rem 1rem 1.25rem;
    padding-top: 3.25rem;
  }
  .modal-close-btn {
    top: 0.75rem;
    right: 0.75rem;
    width: 2.25rem;
    height: 2.25rem;
  }
}

.modal-badge {
  font-size: 0.75rem;
  font-weight: 700;
  background-color: var(--color-primary-bg);
  color: var(--color-primary);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
}

.modal-title {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  margin-top: 0.4rem;
  margin-bottom: 0.5rem;
}

.modal-desc-text {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: 1.25rem;
}

.article-body h3 {
  font-size: 1.1rem;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--color-primary);
}

.article-body p {
  margin-bottom: 1rem;
  color: #334155;
  font-size: 0.925rem;
}

.about-types-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 1rem 0;
}

.about-types-list li {
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.future-note {
  background-color: var(--color-bg-alt);
  padding: 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  border-left: 4px solid var(--color-primary-light);
}

/* Era Simulator Specific Styles */
.era-sim-form {
  background-color: var(--color-bg-alt);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.custom-select-lg {
  padding: 0.65rem 1rem;
  font-size: 0.95rem;
  width: 100%;
}

.divider {
  border: none;
  border-top: 1px dashed var(--color-border);
  margin: 1.25rem 0;
}

.sim-result-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 0.25rem;
}

.sim-result-sub {
  font-size: 0.825rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}

.sim-items-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sim-item-card {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  cursor: pointer;
  transition: var(--transition-fast);
}
.sim-item-card:hover {
  border-color: var(--color-primary-light);
  box-shadow: var(--shadow-sm);
}

/* --------------------------------------------------------------------------
   12. Detail View Modal specific styles (博物館・図鑑風 プレミアムカードデザイン)
   -------------------------------------------------------------------------- */
.modal-detail-dialog {
  border-top: 5px solid var(--color-primary);
}

.detail-header-enhanced {
  border-bottom: 2px solid var(--color-bg-alt);
  padding-bottom: 1.25rem;
  margin-bottom: 1.5rem;
}

.detail-tags-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.detail-title-enhanced {
  font-family: var(--font-serif);
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--color-text-main);
  letter-spacing: -0.01em;
}

.detail-summary-text {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  margin-top: 0.65rem;
  padding: 0.6rem 0.85rem;
  background-color: var(--color-bg);
  border-left: 3px solid var(--color-primary-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  line-height: 1.6;
}

/* 比較対比セクション (昔 vs 今) */
.detail-comparison-wrapper {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1.25rem;
  align-items: stretch;
  margin-bottom: 1.75rem;
}

@media (max-width: 768px) {
  .detail-comparison-wrapper {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }
}

.detail-card-enhanced {
  padding: 1.25rem;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  position: relative;
}

/* 昔の理解: 羊皮紙・古書調スタイル */
.detail-card-old-enhanced {
  background-color: #faf6ed;
  border: 1px dashed #e6dccb;
  box-shadow: inset 0 0 12px rgba(120, 53, 15, 0.03);
}

.card-header-badge {
  font-size: 0.825rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.old-badge {
  color: #78350f;
  border-bottom: 1px dashed #d97706;
  padding-bottom: 0.35rem;
}

.old-badge .period-text {
  font-weight: 500;
  font-size: 0.775rem;
  color: #92400e;
}

.view-text-enhanced {
  font-size: 1rem;
  line-height: 1.7;
  flex: 1;
}

.detail-card-old-enhanced .view-text-enhanced {
  font-family: var(--font-serif);
  color: #451a03;
}

/* 矢印ディバイダー */
.detail-arrow-divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
}

.arrow-circle {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 900;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35);
}

.arrow-label {
  font-size: 0.65rem;
  font-weight: 900;
  color: var(--color-primary);
  letter-spacing: 0.08em;
  margin-top: 0.35rem;
}

@media (max-width: 768px) {
  .detail-arrow-divider {
    flex-direction: row;
    gap: 0.5rem;
    padding: 0.25rem 0;
  }
  .arrow-circle {
    width: 2rem;
    height: 2rem;
    font-size: 1rem;
  }
}

/* 現在の理解: クリーンで鮮やかなモダンカードスタイル */
.detail-card-current-enhanced {
  background-color: #f0fdf4;
  border: 2px solid #86efac;
  box-shadow: 0 4px 16px rgba(22, 101, 52, 0.08);
}

.current-badge {
  color: #14532d;
  border-bottom: 1px dashed #22c55e;
  padding-bottom: 0.35rem;
}

.current-badge .period-text {
  font-weight: 500;
  font-size: 0.775rem;
  color: #166534;
}

.detail-card-current-enhanced .view-text-enhanced {
  color: #064e3b;
  font-weight: 600;
}

/* なぜ変わった？ 強調カード */
.why-changed-card {
  background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%);
  border: 1px solid #bae6fd;
  border-left: 5px solid #0284c7;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(3, 105, 161, 0.06);
}

.why-changed-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.why-icon {
  font-size: 1.25rem;
  background: #e0f2fe;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.why-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0369a1;
}

.why-text {
  font-size: 0.95rem;
  line-height: 1.75;
  color: #334155;
}

/* メタ情報 & タグ */
.meta-box-styled {
  background: white;
  border: 1px solid var(--color-border);
  padding: 1rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.meta-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 0.25rem;
}

.meta-desc {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

.detail-tags-footer {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--color-border);
}

.tags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
}

.tag-pill {
  font-size: 0.775rem;
  font-weight: 600;
  background-color: var(--color-primary-bg);
  color: var(--color-primary-light);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(37, 99, 235, 0.15);
}

/* Horizontal Timeline UI */
.horizontal-timeline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  position: relative;
  margin: 1.25rem 0 0.5rem;
  padding: 0 0.5rem;
}
.horizontal-timeline::before {
  content: '';
  position: absolute;
  top: 11px;
  left: 20px;
  right: 20px;
  height: 3px;
  background-color: var(--color-border-dark);
  z-index: 1;
}

.timeline-step {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 1;
}

.timeline-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: white;
  border: 4px solid var(--color-primary-light);
  margin-bottom: 0.4rem;
}

.timeline-year {
  font-size: 0.775rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 0.2rem;
}

.timeline-desc {
  font-size: 0.775rem;
  color: var(--color-text-muted);
  line-height: 1.35;
  max-width: 130px;
}

@media (max-width: 640px) {
  .horizontal-timeline {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding-left: 1.5rem;
  }
  .horizontal-timeline::before {
    top: 10px;
    left: 11px;
    bottom: 10px;
    width: 3px;
    height: auto;
    right: auto;
  }
  .timeline-step {
    flex-direction: row;
    align-items: flex-start;
    gap: 0.75rem;
    text-align: left;
  }
  .timeline-dot { margin-bottom: 0; flex-shrink: 0; }
  .timeline-desc { max-width: none; }
}

/* Metadata Row (Type & Certainty) */
.detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.meta-box {
  background: white;
  border: 1px solid var(--color-border);
  padding: 0.85rem;
  border-radius: var(--radius-md);
}

.meta-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-text-muted);
  margin-bottom: 0.3rem;
  display: block;
}

/* Sources Area */
.sources-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.source-item {
  font-size: 0.825rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* --------------------------------------------------------------------------
   13. Enhanced Phase 5 Features (Quiz, Era Section, Footer)
   -------------------------------------------------------------------------- */

/* Era Section (あなたが中学生だった頃) */
.era-interactive-section {
  background: linear-gradient(135deg, #fdfbf7 0%, #f5efe6 100%);
  border: 1px solid #e6dccb;
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow-sm);
}

.era-section-header {
  margin-bottom: 1.5rem;
}

.era-badge {
  display: inline-block;
  background: #d97706;
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
}

.era-section-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-text-main);
  margin-bottom: 0.5rem;
}

.era-section-desc {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.era-input-controls {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.era-input-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.era-label {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--color-text-main);
}

.era-year-input {
  width: 120px;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-weight: 700;
}

.era-year-unit {
  font-weight: 700;
  color: var(--color-text-muted);
}

.era-submit-btn {
  padding: 0.55rem 1.25rem;
}

.quick-era-buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.quick-era-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-text-muted);
}

.quick-era-chip {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-full);
  padding: 0.25rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: #334155;
  cursor: pointer;
  transition: var(--transition-fast);
}

.quick-era-chip:hover {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.era-inline-results {
  border-top: 2px dashed #cbd5e1;
  padding-top: 1.5rem;
  margin-top: 1rem;
}

.era-results-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: #1e3a8a;
  margin-bottom: 1rem;
}

.era-sub-title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e3a8a;
  margin-bottom: 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid #cbd5e1;
}

.era-notice-banner {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.era-empty-text {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  padding: 0.75rem;
  background: white;
  border-radius: var(--radius-md);
  border: 1px dashed var(--color-border);
}

/* Era Scope Badges */
.era-scope-textbook { background: #dbeafe; color: #1e40af; font-size: 0.7rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 4px; }
.era-scope-school { background: #e0e7ff; color: #3730a3; font-size: 0.7rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 4px; }
.era-scope-belief { background: #fef3c7; color: #92400e; font-size: 0.7rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 4px; }
.era-scope-consensus { background: #dcfce7; color: #166534; font-size: 0.7rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 4px; }
.era-scope-media { background: #f3e8ff; color: #6b21a8; font-size: 0.7rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 4px; }
.era-scope-daily { background: #f1f5f9; color: #475569; font-size: 0.7rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 4px; }

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

.sim-item-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 1rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.sim-item-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.sim-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.sim-detail-link {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-primary);
}

.sim-card-title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text-main);
  margin-bottom: 0.5rem;
}

.sim-box {
  font-size: 0.825rem;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.4rem;
  line-height: 1.4;
}

.sim-box-old {
  background: #faf6ed;
  color: #78350f;
  border: 1px solid #e6dccb;
}

.sim-box-current {
  background: #f0fdf4;
  color: #14532d;
  border: 1px solid #bbf7d0;
}

/* Quiz Section (3問クイズ) */
.quiz-interactive-section {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow-sm);
}

.quiz-header-badge {
  display: inline-block;
  background: #2563eb;
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
}

.quiz-section-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 700;
  color: #1e3a8a;
  margin-bottom: 0.5rem;
}

.quiz-section-desc {
  font-size: 0.9rem;
  color: #3b82f6;
  margin-bottom: 1.25rem;
}

.quiz-card {
  background: white;
  border: 1px solid #93c5fd;
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}

.quiz-progress-bar-wrapper {
  margin-bottom: 1.25rem;
}

.quiz-progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 700;
  color: #1e40af;
  margin-bottom: 0.35rem;
}

.quiz-progress-track {
  height: 8px;
  background: #e0f2fe;
  border-radius: 4px;
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  background: #2563eb;
  transition: width 0.3s ease;
}

.quiz-statement-box {
  background: #f8fafc;
  border-left: 4px solid #2563eb;
  padding: 1.25rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin-bottom: 1.5rem;
}

.quiz-q-prefix {
  font-size: 0.8rem;
  font-weight: 700;
  color: #64748b;
  display: block;
  margin-bottom: 0.4rem;
}

.quiz-statement-text {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

.quiz-question-prompt {
  font-size: 1rem;
  color: #1e40af;
}

.quiz-action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 500px) {
  .quiz-action-buttons {
    grid-template-columns: 1fr;
  }
}

.btn-quiz-ans {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
  border: 2px solid transparent;
}

.btn-quiz-true {
  background: #f0fdf4;
  color: #166534;
  border-color: #86efac;
}

.btn-quiz-true:hover:not(:disabled) {
  background: #dcfce7;
  border-color: #22c55e;
  transform: translateY(-2px);
}

.btn-quiz-false {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fca5a5;
}

.btn-quiz-false:hover:not(:disabled) {
  background: #fee2e2;
  border-color: #ef4444;
  transform: translateY(-2px);
}

.btn-quiz-ans:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.quiz-btn-symbol {
  font-size: 1.5rem;
}

.quiz-feedback-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: 1.25rem;
}

.quiz-result-header {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
}

.result-correct {
  background: #dcfce7;
  color: #14532d;
  border: 1px solid #86efac;
}

.result-incorrect {
  background: #fee2e2;
  color: #7f1d1d;
  border: 1px solid #fca5a5;
}

.result-icon {
  font-size: 1.15rem;
  font-weight: 900;
  margin-right: 0.5rem;
}

.quiz-explanation-body {
  margin-bottom: 1.25rem;
}

.exp-title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.exp-comparison {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  margin-bottom: 0.65rem;
}

.exp-badge-old {
  background: #fef3c7;
  color: #92400e;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-weight: 700;
}

.exp-badge-current {
  background: #dcfce7;
  color: #166534;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-weight: 700;
}

.exp-why {
  font-size: 0.875rem;
  color: #475569;

}

.quiz-feedback-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.quiz-result-card {
  text-align: center;
}

.quiz-result-score-banner {
  padding: 1.5rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
}

.score-perfect {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  color: #14532d;
}

.score-good {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  color: #1e40af;
}

.score-try {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #78350f;
}

.result-score-num {
  font-size: 1.75rem;
  font-weight: 900;
  display: block;
  margin-bottom: 0.5rem;
}

.result-score-msg {
  font-size: 1.1rem;
  font-weight: 700;
}

.result-card-desc {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}

.quiz-result-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Production Footer
   -------------------------------------------------------------------------- */
.site-footer {
  background-color: #0f172a;
  color: #cbd5e1;
  padding: 3.5rem 0 2rem;
  border-top: 1px solid #1e293b;
}

.footer-inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2.5rem;
  margin-bottom: 2rem;
}

@media (max-width: 768px) {
  .footer-inner {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

.footer-logo-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.footer-logo-icon {
  font-size: 1.5rem;
}

.footer-logo-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: white;
}

.footer-logo-sub {
  font-size: 0.75rem;
  color: #94a3b8;
}

.footer-catchphrase {
  font-size: 0.95rem;
  color: #60a5fa;
  margin-bottom: 0.25rem;
}

.footer-subcatch {
  font-size: 0.85rem;
  color: #94a3b8;
  margin-bottom: 0.75rem;
}

.footer-description {
  font-size: 0.825rem;
  color: #94a3b8;
  line-height: 1.6;
}

.footer-heading {
  font-size: 0.95rem;
  font-weight: 700;
  color: white;
  margin-bottom: 1rem;
  border-bottom: 2px solid #334155;
  padding-bottom: 0.4rem;
}

.footer-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.footer-nav-list a, .footer-btn-link {
  color: #cbd5e1;
  text-decoration: none;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  text-align: left;
  transition: color 0.2s;
}

.footer-nav-list a:hover, .footer-btn-link:hover {
  color: white;
  text-decoration: underline;
}

.footer-creator-block p {
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.footer-creator-block a {
  color: #60a5fa;
  text-decoration: none;
}

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

.copyright-line {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 700;
}

.footer-contact-wrapper {
  margin-top: 0.75rem;
}

.btn-footer-contact {
  display: inline-block;
  background-color: #2563eb;
  color: #ffffff !important;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-md, 6px);
  text-decoration: none !important;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.btn-footer-contact:hover {
  background-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
  transform: translateY(-1px);
}

.footer-bottom-notice {
  border-top: 1px solid #1e293b;
  padding-top: 1.25rem;
  font-size: 0.775rem;
  color: #64748b;
  line-height: 1.5;
}

/* Accessibility & Reduced Motion */
:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

@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;
  }
}

/* Load More Button */
.load-more-wrapper {
  text-align: center;
  margin-top: 2rem;
  margin-bottom: 2.5rem;
}

.btn-load-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: var(--color-surface);
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
  padding: 0.85rem 2.25rem;
  border-radius: var(--radius-full, 9999px);
  font-weight: 700;
  font-size: 0.975rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.btn-load-more:hover {
  background-color: var(--color-primary);
  color: #ffffff;
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* Toast Notification */
.toast-notification {
  position: fixed;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background-color: #0f172a;
  color: #ffffff;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius-full, 9999px);
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-notification.is-show {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

/* Detail Modal: Copy Link & Related Items */
.detail-header-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.btn-copy-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background-color: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full, 9999px);
  font-size: 0.825rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-copy-link:hover {
  background-color: #e2e8f0;
  color: #0f172a;
  border-color: #94a3b8;
}

.related-items-block {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 2px dashed var(--color-border);
}

.related-items-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text-main);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.related-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.related-item-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.related-item-card:hover {
  border-color: var(--color-primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.related-item-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

.related-item-card-title {
  font-size: 0.925rem;
  font-weight: 700;
  color: var(--color-text-main);
  line-height: 1.35;
}


