/* ─────────────────────────────────────────
   GAKUYA — 音楽辞典 共通スタイル（クリーン版）
   ───────────────────────────────────────── */

:root {
  --ink:    #1a1410;
  --paper:  #f5f0e8;
  --cream:  #ede8dc;
  --rust:   #800000;
  --gold:   #b8953a;
  --muted:  #7a7060;
  --border: #d4cfc0;
}

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

body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Noto Serif JP', serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Paper texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 100;
  opacity: 0.4;
}

/* ═════════════════════════════════════════
   NAVIGATION & HEADER
   ═════════════════════════════════════════ */

.navbar {
  padding: 0.8rem 2rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  border-bottom: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--paper);
  z-index: 999;
  width: 100%;
  animation: fadeIn 0.6s ease both;
}

.nav-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.4rem;
  letter-spacing: 0.1em;
  color: var(--ink);
  text-decoration: none;
  margin-right: auto;
}
.nav-logo-text > span { color: var(--rust); }
.nav-logo-mark { height: 28px; width: auto; display: block; }

.hamburger {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
  position: relative;
  z-index: 1001;
  transition: all 0.3s;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 1px;
  background: var(--ink);
  transition: all 0.3s;
}
.hamburger.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ─── Navbar Search (individual term pages) ─── */

.navbar-search-wrap {
  flex: 1;
  position: relative;
  max-width: 360px;
  margin: 0 1.5rem 0 auto;
}

.navbar-search-input {
  width: 100%;
  padding: 0.38rem 0.9rem;
  border: 1px solid var(--border);
  background: var(--cream);
  font-family: 'Noto Serif JP', serif;
  font-size: 0.8rem;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.navbar-search-input:focus { border-color: var(--rust); }
.navbar-search-input::placeholder { color: var(--muted); font-style: italic; }

.navbar-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--paper);
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  max-height: 360px;
  overflow-y: auto;
  display: none;
  z-index: 1100;
}
.navbar-suggestions.visible { display: block; }

.suggestion-item {
  display: flex;
  flex-direction: column;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--ink);
  gap: 0.25rem;
  transition: background 0.15s;
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover,
.suggestion-item.active { background: var(--cream); }

.sug-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.95rem;
  font-style: italic;
  color: var(--rust);
}
.sug-reading {
  font-family: 'Noto Serif JP', serif;
  font-size: 0.8rem;
  color: var(--ink);
  font-weight: 500;
}
.sug-cat {
  font-family: 'Space Mono', monospace;
  font-size: 0.6rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.no-result {
  padding: 1.2rem 1rem;
  text-align: center;
  font-family: 'Noto Serif JP', serif;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Sidebar menu */
.sidebar {
  display: block;
  position: fixed;
  top: 0;
  right: 0;
  transform: translateX(100%);
  width: 280px;
  height: 100vh;
  background: var(--paper);
  border-left: 1px solid var(--border);
  z-index: 1000;
  overflow-y: auto;
  transition: transform 0.3s ease;
  padding: 5rem 1.5rem 3rem;
}
.sidebar.open { transform: translateX(0); }

.sidebar-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.4rem;
  color: var(--muted);
  padding: 0.4rem;
  transition: color 0.2s;
  z-index: 1001;
}
.sidebar-close:hover { color: var(--rust); }

.sidebar-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.3rem;
  letter-spacing: 0.1em;
  color: var(--ink);
  text-decoration: none;
  display: block;
  margin-bottom: 1.5rem;
  padding: 0.5rem 0;
}

.sidebar-group {
  margin-bottom: 1.5rem;
}

.sidebar-label {
  font-family: 'Space Mono', monospace;
  font-size: 0.55rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--rust);
  margin-bottom: 0.4rem;
}

.sidebar a {
  display: block;
  padding: 0.5rem 0;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.9rem;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: color 0.2s;
}
.sidebar a:hover { color: var(--rust); }

/* Overlay for sidebar */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 999;
  pointer-events: none;
}
.nav-overlay.open {
  display: block;
  pointer-events: auto;
}

/* ═════════════════════════════════════════
   HERO SECTION (Top Page)
   ═════════════════════════════════════════ */

.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8.5rem 2.5rem 6rem;
  min-height: 60vh;
  text-align: center;
}

.hero-logo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(4rem, 12vw, 8rem);
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--ink);
  margin-bottom: 0.1rem;
  text-decoration: none;
  display: block;
  opacity: 0;
  animation: fadeUp 0.8s 0.1s ease forwards;
}
.hero-logo span { color: var(--rust); }

.hero-tagline {
  font-family: 'Space Mono', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 3rem;
  opacity: 0;
  animation: fadeUp 0.8s 0.25s ease forwards;
}

/* ═════════════════════════════════════════
   SEARCH BOX (Hero Section)
   ═════════════════════════════════════════ */

.search-box {
  width: 100%;
  max-width: 520px;
  display: flex;
  align-items: center;
  position: relative;
  border: 1px solid var(--border);
  background: var(--cream);
  transition: box-shadow 0.2s, border-color 0.2s;
  opacity: 0;
  animation: fadeUp 0.8s 0.35s ease forwards;
}
.search-box:focus-within {
  box-shadow: 0 2px 16px rgba(128,0,0,0.08);
  border-color: var(--rust);
}

.search-input {
  flex: 1;
  padding: 1rem 1.2rem;
  background: none;
  border: none;
  outline: none;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink);
}
.search-input::placeholder {
  color: var(--border);
  font-style: italic;
}

.search-clear {
  padding: 0 1rem;
  font-size: 0.7rem;
  color: var(--muted);
  cursor: pointer;
  display: none;
  background: none;
  border: none;
  transition: color 0.2s;
}
.search-clear:hover { color: var(--rust); }

.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0.5rem;
  background: var(--paper);
  border: 1px solid var(--border);
  border-top: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  max-height: 400px;
  overflow-y: auto;
  display: none;
  z-index: 1000;
}
.search-suggestions.visible { display: block; }

.suggestion-item {
  display: flex;
  flex-direction: column;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.2s;
}
.suggestion-item:hover,
.suggestion-item.active {
  background: var(--cream);
}
.suggestion-item:last-child {
  border-bottom: none;
}

.sug-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.95rem;
  font-style: italic;
  color: var(--rust);
  margin-bottom: 0.2rem;
}
.sug-reading {
  font-family: 'Noto Serif JP', serif;
  font-size: 0.8rem;
  color: var(--ink);
  margin-bottom: 0.1rem;
}
.sug-cat {
  font-family: 'Space Mono', monospace;
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.no-result {
  padding: 1rem;
  text-align: center;
  font-family: 'Noto Serif JP', serif;
  font-size: 0.9rem;
  color: var(--muted);
}

mark {
  background: var(--cream);
  color: var(--rust);
  font-weight: 600;
  padding: 0 0.2em;
}

/* ═════════════════════════════════════════
   BROWSE LINK
   ═════════════════════════════════════════ */

.browse-link {
  margin-top: 2rem;
  font-family: 'Space Mono', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 2px;
  transition: color 0.2s, border-color 0.2s;
  opacity: 0;
  animation: fadeUp 0.8s 0.5s ease forwards;
}
.browse-link:hover { color: var(--rust); border-color: var(--rust); }

/* ═════════════════════════════════════════
   ALL TERMS MODAL
   ═════════════════════════════════════════ */

.all-terms-modal {
  position: fixed;
  inset: 0;
  background: var(--paper);
  z-index: 500;
  overflow-y: auto;
  padding: 6rem 2rem 3rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s, visibility 0.3s;
}
.all-terms-modal.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.all-terms-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 960px;
  margin: 0 auto 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.all-terms-title {
  font-family: 'Space Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.all-terms-close {
  font-family: 'Space Mono', monospace;
  font-size: 0.6rem;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  letter-spacing: 0.1em;
  transition: color 0.2s;
}
.all-terms-close:hover { color: var(--rust); }

/* ─── Alphabet Tabs ─── */
.alpha-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 2rem auto 3rem;
  padding: 1rem;
  background: transparent;
  max-width: 960px;
  opacity: 0;
  animation: fadeUp 0.7s 0.2s ease forwards;
}

.alpha-tab {
  font-family: 'Space Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  padding: 0.5rem 1rem;
  border: 1.5px solid var(--border);
  color: var(--ink);
  background: var(--cream);
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  text-transform: uppercase;
  font-weight: 600;
  border-radius: 20px;
  white-space: nowrap;
}
.alpha-tab:hover {
  border-color: var(--rust);
  color: var(--rust);
  background: var(--paper);
  font-weight: 700;
}
.alpha-tab.disabled {
  opacity: 0.3;
  color: #ccc;
  border-color: #ddd;
  background: #f5f5f5;
  cursor: not-allowed;
  pointer-events: none;
  font-weight: 400;
}

/* ─── Terms List ─── */
.terms-list {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1rem;
}

.az-section { margin-bottom: 2.5rem; }

.az-letter {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--rust);
  margin-bottom: 0.8rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--rust);
}

.term-row {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--ink);
  transition: background 0.15s;
  position: relative;
}
.term-row::before {
  content: '';
  position: absolute;
  left: -1rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: transparent;
  transition: background 0.2s;
}
.term-row:hover { background: var(--cream); }
.term-row:hover::before { background: var(--rust); }

.row-name {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  min-width: 140px;
}
.row-reading {
  font-family: 'Space Mono', monospace;
  font-size: 0.55rem;
  color: var(--muted);
  min-width: 100px;
}
.row-cat {
  font-family: 'Space Mono', monospace;
  font-size: 0.55rem;
  color: var(--muted);
  text-transform: uppercase;
}

/* ═════════════════════════════════════════
   CATEGORY PAGES (Main content)
   ═════════════════════════════════════════ */

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 8.5rem 2.5rem 6rem;
}

.category-section {
  max-width: 960px;
  margin: 0 auto;
  padding: 8rem 2rem 4rem;
}

/* ─── Category Header (Index Pages) ─── */
.category-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
  margin-bottom: 3rem;
  opacity: 0;
  animation: fadeUp 0.7s 0.1s ease forwards;
}
.category-title-group {
  flex: 1;
  min-width: 0;
}
.category-header h1 {
  font-family: 'Cormorant Garamond', 'Noto Serif JP', serif;
  font-size: clamp(2.5rem, 8vw, 6rem);
  font-weight: 300;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 1rem 0;
  padding: 0;
  width: 100%;
}
.category-subtitle {
  font-family: 'Noto Serif JP', serif;
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}
.back-to-top {
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: var(--rust);
  text-decoration: none;
  white-space: nowrap;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  background: var(--cream);
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.back-to-top:hover {
  background: var(--rust);
  border-color: var(--rust);
  color: var(--paper);
}

/* ─── Term Header ─── */
.term-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 2rem;
  margin-bottom: 3rem;
  opacity: 0;
  animation: fadeUp 0.7s 0.1s ease forwards;
}
.term-header > div:first-child {
  min-width: 0;  /* grid の1fr列で min-width 0 を設定（重要） */
}
.term-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.8rem;
}
.term-category {
  font-family: 'Space Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--rust);
  border: 1px solid var(--rust);
  padding: 0.2rem 0.6rem;
  border-radius: 2px;
}
.term-origin {
  font-family: 'Space Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: var(--muted);
}

h1 {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(2.5rem, 8vw, 6rem);
  font-weight: 300;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0;
  padding: 0;
  width: 100%;
  white-space: normal;
  word-break: break-word;
  overflow: visible;
  max-width: 100%;
}
h1 em { font-style: normal; color: var(--rust); }

.pronunciation {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  font-style: italic;
  color: var(--muted);
  margin-top: 0.6rem;
}
.katakana-reading {
  font-family: 'Noto Serif JP', serif;
  font-size: 0.95rem;
  color: var(--rust);
  margin-top: 0.3rem;
  font-weight: 500;
}

/* ─── Badge ─── */
.badge {
  text-align: center;
  border: 1px solid var(--border);
  padding: 1.2rem 1.5rem;
  background: var(--cream);
}
.badge-main {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  font-weight: 300;
  font-style: italic;
  color: var(--ink);
  display: block;
  line-height: 1.2;
}
.badge-label {
  font-family: 'Space Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.3rem;
  display: block;
}

/* ─── Divider ─── */
.divider {
  width: 100%;
  height: 1px;
  background: var(--border);
  margin: 3rem 0;
  opacity: 0;
  animation: fadeIn 0.5s 0.3s ease forwards;
}

/* ─── Content Sections ─── */
.section-label {
  font-family: 'Space Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
}
.core-def {
  opacity: 0;
  animation: fadeUp 0.7s 0.2s ease forwards;
}
.definition-main {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  font-weight: 300;
  line-height: 1.5;
  color: var(--ink);
  max-width: 700px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  margin: 3rem 0;
  opacity: 0;
  animation: fadeUp 0.7s 0.3s ease forwards;
}
.col-section h3 {
  font-family: 'Space Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
}
.col-section p {
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--ink);
  font-weight: 300;
}

/* ─── Character Grid ─── */
.character-section {
  margin: 3rem 0;
  opacity: 0;
  animation: fadeUp 0.7s 0.35s ease forwards;
}
.character-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  margin-top: 1.5rem;
}
.character-card {
  background: var(--paper);
  padding: 1.5rem;
  transition: background 0.2s;
}
.character-card:hover { background: var(--cream); }
.character-symbol {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.5rem;
  font-style: italic;
  color: var(--rust);
  display: block;
  margin-bottom: 0.5rem;
}
.character-name {
  font-family: 'Space Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 0.5rem;
}
.character-desc {
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--ink);
  font-weight: 300;
}

/* ─── Notation Grid ─── */
.notation-section {
  margin: 3rem 0;
  opacity: 0;
  animation: fadeUp 0.7s 0.35s ease forwards;
}
.notation-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  margin-top: 1.5rem;
}
.notation-card {
  background: var(--paper);
  padding: 2rem 1.5rem;
  transition: background 0.2s;
}
.notation-card:hover { background: var(--cream); }
.notation-type {
  font-family: 'Space Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
  display: block;
}
.notation-visual { display: flex; align-items: center; margin-bottom: 1rem; }
.notation-text-symbol {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem;
  font-style: italic;
  color: var(--rust);
}
.hairpin-svg { margin: 0.5rem 0; display: block; }
.notation-label {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  font-weight: 300;
  color: var(--ink);
  margin-bottom: 0.5rem;
}
.notation-desc {
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--ink);
  font-weight: 300;
}
.notation-pros {
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border);
  font-family: 'Space Mono', monospace;
  font-size: 0.62rem;
  color: var(--muted);
  line-height: 1.7;
}

/* ─── Works Grid ─── */
.works-section {
  margin: 3rem 0;
  opacity: 0;
  animation: fadeUp 0.7s 0.5s ease forwards;
}
.works-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  margin-top: 1.5rem;
}
.work-card {
  background: var(--paper);
  padding: 1.2rem;
  transition: background 0.2s;
}
.work-card:hover { background: var(--cream); }
.work-composer {
  font-family: 'Space Mono', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.work-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1rem;
  font-style: italic;
  line-height: 1.3;
  color: var(--ink);
  margin-bottom: 0.3rem;
}
.work-detail {
  font-family: 'Space Mono', monospace;
  font-size: 0.55rem;
  color: var(--muted);
}

/* ─── Spectrum (Tempo pages) ─── */
.spectrum-section {
  margin: 3rem 0;
  opacity: 0;
  animation: fadeUp 0.7s 0.45s ease forwards;
}
.spectrum-label {
  font-family: 'Space Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
}
.spectrum {
  display: flex;
  align-items: stretch;
  gap: 2px;
  height: 80px;
}
.spectrum-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  cursor: default;
  transition: transform 0.2s;
}
.spectrum-item:hover { transform: translateY(-2px); }

/* スペクトラムバー — クリッカブル */
a.spectrum-bar-link {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s;
}
a.spectrum-bar-link:hover {
  transform: translateY(-2px);
}
a.spectrum-bar-link:hover .spectrum-bar {
  background: var(--gold);
}

.spectrum-bar {
  width: 100%;
  background: var(--border);
  border-radius: 1px 1px 0 0;
  transition: background 0.2s;
}
.spectrum-item.active .spectrum-bar { background: var(--rust); }
.spectrum-item:hover .spectrum-bar { background: var(--gold); }

.spectrum-link {
  text-decoration: none;
  color: var(--muted);
  transition: color 0.2s;
}
.spectrum-link:hover {
  color: var(--rust);
}
.spectrum-name {
  font-family: 'Space Mono', monospace;
  font-size: 0.5rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  white-space: nowrap;
  margin-top: 4px;
}
.spectrum-item.active 
.spectrum-link {
  text-decoration: none;
  color: var(--muted);
  transition: color 0.2s;
}
.spectrum-link:hover {
  color: var(--rust);
}
.spectrum-name { color: var(--rust); font-weight: bold; }

/* Metro dots */
.metro-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 0.8rem;
}
.metro-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--rust);
  animation: pulse 0.52s ease-in-out infinite alternate;
}
.metro-dot:nth-child(2) { animation-delay: 0.26s; background: var(--gold); }
.metro-dot:nth-child(3) { animation-delay: 0.52s; background: var(--border); }

/* ─── Related Tags ─── */
.related-section {
  margin: 3rem 0;
  opacity: 0;
  animation: fadeUp 0.7s 0.55s ease forwards;
}
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.tag {
  font-family: 'Space Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.tag:hover { border-color: var(--rust); color: var(--rust); background: var(--cream); }
.tag[href="#"] { opacity: 0.38; cursor: default; pointer-events: none; }

/* ─── Term Visual ─── */
.term-visual {
  width: 100%;
  max-width: 600px;
  height: auto;
  margin: 2rem 0;
  padding: 1rem;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 2px;
  opacity: 0;
  animation: fadeUp 0.7s 0.3s ease forwards;
}

/* ═════════════════════════════════════════
   FOOTER
   ═════════════════════════════════════════ */

footer {
  border-top: 1px solid var(--border);
  padding: 2rem 2.5rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  opacity: 0;
  animation: fadeIn 0.5s 0.7s ease forwards;
}

.footer-text {
  font-family: 'Space Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
}
.footer-text:first-child { text-align: left; }
.footer-text:last-child { text-align: right; }
.footer-mark { justify-self: center; }

.footer-mark {
  height: 22px;
  width: 22px;
  max-width: 22px;
  max-height: 22px;
  opacity: 0.5;
  flex-shrink: 0;
}

/* ═════════════════════════════════════════
   ANIMATIONS
   ═════════════════════════════════════════ */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes pulse {
  from { transform: scale(0.6); opacity: 0.4; }
  to   { transform: scale(1);   opacity: 1; }
}

/* ─── Tempo Navigation ─── */
.tempo-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 3rem 0 1rem;
  padding: 1.2rem 0;
  border-top: 1px solid var(--border);
}

.tempo-nav-prev,
.tempo-nav-next {
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-decoration: none;
  padding: 0.6rem 1.2rem;
  border: 1px solid var(--border);
  transition: all 0.2s;
  white-space: nowrap;
}
.tempo-nav-prev:hover,
.tempo-nav-next:hover {
  color: var(--rust);
  border-color: var(--rust);
  background: var(--cream);
}

.tempo-nav-label {
  font-family: 'Space Mono', monospace;
  font-size: 0.5rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--border);
}

.tempo-nav-spacer {
  width: 80px;
  display: inline-block;
}

/* ═════════════════════════════════════════
   RESPONSIVE DESIGN
   ═════════════════════════════════════════ */

@media (max-width: 768px) {
  .hero { padding: 7rem 1.5rem 4rem; min-height: 50vh; }
  .category-section { padding: 7rem 1.5rem 3rem; }
  main { padding: 7rem 1.5rem 4rem; }

  .two-col { grid-template-columns: 1fr; gap: 2rem; }
  .works-grid { grid-template-columns: 1fr 1fr; }
  .character-grid { grid-template-columns: 1fr; }
  .notation-grid { grid-template-columns: 1fr; }
  .term-header { grid-template-columns: 1fr; }
  .category-header { flex-direction: column; gap: 1.5rem; }
  .back-to-top { padding-top: 0.5rem; }

  .spectrum { height: 72px; }
  
.spectrum-link {
  text-decoration: none;
  color: var(--muted);
  transition: color 0.2s;
}
.spectrum-link:hover {
  color: var(--rust);
}
.spectrum-name {
    font-size: 0.42rem;
    margin-top: 4px;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    white-space: nowrap;
    max-width: none;
    line-height: 1;
  }
  .spectrum-item { min-width: 20px; }

  .term-visual { margin: 1.5rem 0; padding: 0.8rem; }

  footer { grid-template-columns: 1fr; gap: 0.5rem; text-align: center; }
  .footer-text:first-child, .footer-text:last-child { text-align: center; }
  .footer-mark { width: 18px; height: 18px; max-width: 18px; max-height: 18px; justify-self: center; }
}

@media (max-width: 640px) {
  .hero { padding: 6.5rem 1.2rem 2rem; min-height: 45vh; }
  .hero-logo { font-size: clamp(3rem, 12vw, 4.5rem); }
  .hero-tagline { font-size: 0.55rem; margin-bottom: 2rem; }

  .search-box { max-width: 100%; }
  .search-input { font-size: 0.95rem; padding: 0.9rem 1rem; }

  .browse-link { font-size: 0.5rem; margin-top: 1.5rem; padding: 0.75rem 0.75rem 0.5rem; touch-action: manipulation; }

  .category-section { padding: 6rem 1rem 2rem; }
  main { padding: 6rem 1rem 2rem; }

  .all-terms-modal { padding: 5rem 1rem 2rem; }
  .all-terms-header { margin: 0 auto 1.5rem; }

  .alpha-tabs { margin: 1.5rem auto 2rem; padding: 0.5rem; }
  .alpha-tab { font-size: 0.6rem; padding: 0.4rem 0.8rem; }

  .az-section { margin-bottom: 1.8rem; }
  .az-letter { font-size: 1.2rem; margin-bottom: 0.6rem; }

  .row-name { font-size: 0.95rem; min-width: 100px; }
  .row-reading { display: none; }

  h1 { font-size: clamp(2rem, 8vw, 3rem); }

  .term-header { padding: 1rem; }
  .category-header { flex-direction: column; align-items: flex-start; }
  .back-to-top { padding-top: 0.5rem; }

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

  .term-visual { padding: 0.6rem; margin: 1rem 0; }

  .navbar {
    padding: 0.7rem 1.2rem 0.5rem;
    flex-wrap: wrap;
    gap: 0.4rem 0;
  }
  .nav-logo { order: 1; flex: 1; font-size: 1.2rem; margin-right: 0; }
  .nav-logo-mark { height: 22px; }
  .hamburger { order: 2; }

  .navbar-search-wrap {
    order: 3;
    flex: 1 1 100%;
    max-width: none;
    margin: 0;
  }
  .navbar-search-input {
    font-size: 16px;
    padding: 0.5rem 0.8rem;
    touch-action: manipulation;
  }
  .navbar-suggestions { top: calc(100% + 2px); }

  body.has-navbar-search main { padding-top: 8rem; }

  .sidebar { width: 240px; padding: 4rem 1.2rem 2rem; }
}

@media (max-width: 480px) {
  .hero { padding: 5.5rem 1rem 1.5rem; min-height: 40vh; }
  .hero-logo { font-size: clamp(2.5rem, 10vw, 3.5rem); }

  h1 { font-size: clamp(2rem, 7vw, 3rem); }

  .category-section { padding: 5.5rem 0.8rem 1.5rem; }
  main { padding: 5.5rem 0.8rem 1.5rem; }
  body.has-navbar-search main { padding-top: 9rem; }

  .definition-main { font-size: 1.1rem; }

  .search-input { font-size: 0.9rem; }

  .term-visual { padding: 0.5rem; }

  .navbar-search-input { font-size: 16px; padding: 0.5rem 0.7rem; touch-action: manipulation; }

  footer { padding: 1rem; font-size: 0.5rem; }
  .footer-mark { width: 16px; height: 16px; max-width: 16px; max-height: 16px; justify-self: center; }
}


/* テクスチャーオーバーレイの調整 */
body.jazz-theme::before {
  opacity: 0.15;
}

/* ナビゲーション */
body.jazz-theme .navbar {
  background: linear-gradient(135deg, #0f1419 0%, #1a1f35 100%);
  border-bottom-color: #3a3f52;
}

body.jazz-theme .nav-logo {
  color: #f5e6d3;
}

body.jazz-theme .nav-logo-mark {
  filter: invert(1);
}

body.jazz-theme .nav-logo-text > span {
  color: #d4af37;
}

body.jazz-theme .hamburger span {
  background: #f5e6d3;
}

/* サイドバー */
body.jazz-theme .sidebar {
  background: linear-gradient(180deg, #0f1419 0%, #1a1f35 100%);
  border-left-color: #3a3f52;
}

body.jazz-theme .sidebar-title {
  color: #f5e6d3;
}

body.jazz-theme .sidebar-label {
  color: #d4af37;
}

body.jazz-theme .sidebar a {
  color: #e8d9c3;
  border-bottom-color: #2a3040;
}

body.jazz-theme .sidebar a:hover {
  color: #d4af37;
}

body.jazz-theme .sidebar-close {
  color: #9d9999;
}

body.jazz-theme .sidebar-close:hover {
  color: #d4af37;
}

/* オーバーレイ */
body.jazz-theme .nav-overlay {
  background: rgba(0, 0, 0, 0.6);
}

/* 主要コンテンツセクション */
body.jazz-theme .category-section,
body.jazz-theme main {
  background: #0f1419;
}

body.jazz-theme .divider {
  background: linear-gradient(90deg, transparent, #3a3f52, transparent);
}

/* ターム表示 */
body.jazz-theme .term-header {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.05) 0%, rgba(0, 0, 0, 0) 100%);
  border: 1px solid #3a3f52;
}

body.jazz-theme .term-category {
  color: #d4af37;
  border: 1px solid #3a3f52;
  background: rgba(212, 175, 55, 0.1);
}

body.jazz-theme h1 {
  color: #f5e6d3;
}

body.jazz-theme h2,
body.jazz-theme h3 {
  color: #d4af37;
}

body.jazz-theme p,
body.jazz-theme a {
  color: #e8d9c3;
}

body.jazz-theme a {
  text-decoration: none;
  border-bottom: 1px solid #3a3f52;
}

body.jazz-theme a:hover {
  color: #d4af37;
  border-bottom-color: #d4af37;
}

/* アルファタブ */
body.jazz-theme .alpha-tabs {
  border-bottom: 1px solid #3a3f52;
}

body.jazz-theme .alpha-tab {
  color: #9d9999;
  border: 1px solid #3a3f52;
}

body.jazz-theme .alpha-tab:hover,
body.jazz-theme .alpha-tab.active {
  color: #d4af37;
  border-color: #d4af37;
  background: rgba(212, 175, 55, 0.1);
}

/* ターム行 */
body.jazz-theme .term-row {
  border: 1px solid #2a3040;
  background: rgba(212, 175, 55, 0.02);
  transition: all 0.3s;
}

body.jazz-theme .term-row:hover {
  background: rgba(212, 175, 55, 0.08);
  border-color: #d4af37;
}

body.jazz-theme .row-name {
  color: #d4af37;
  font-weight: 600;
}

body.jazz-theme .row-reading {
  color: #e8d9c3;
}

body.jazz-theme .row-desc {
  color: #9d9999;
}

/* コア定義セクション */
body.jazz-theme .core-def {
  background: rgba(212, 175, 55, 0.05);
  border: 1px solid #3a3f52;
  border-left: 3px solid #d4af37;
}

body.jazz-theme .definition-main {
  color: #e8d9c3;
}

/* 二列セクション */
body.jazz-theme .two-col .col-section {
  background: rgba(212, 175, 55, 0.03);
  border: 1px solid #2a3040;
  border-left: 3px solid #d4af37;
}

body.jazz-theme .col-section h3 {
  color: #d4af37;
}

body.jazz-theme .col-section p {
  color: #e8d9c3;
}

/* セクションラベル */
body.jazz-theme .section-label {
  color: #d4af37;
  border-bottom-color: #3a3f52;
}

/* 関連セクション */
body.jazz-theme .related-section {
  border-top: 1px solid #3a3f52;
}

/* タグ */
body.jazz-theme .tag {
  color: #e8d9c3;
  border: 1px solid #3a3f52;
  background: rgba(212, 175, 55, 0.05);
}

body.jazz-theme .tag:hover {
  color: #d4af37;
  border-color: #d4af37;
  background: rgba(212, 175, 55, 0.15);
}

/* SVG 図解 */
body.jazz-theme svg {
  filter: invert(0.1);
}

/* フッター */
body.jazz-theme footer {
  background: linear-gradient(180deg, #0f1419 0%, #1a1f35 100%);
  border-top: 1px solid #3a3f52;
  color: #9d9999;
}

body.jazz-theme .footer-mark {
  filter: invert(1);
}

/* 検索ボックス */
body.jazz-theme .search-input {
  background: #1a1f35;
  color: #f5e6d3;
  border: 1px solid #3a3f52;
}

body.jazz-theme .search-input::placeholder {
  color: #7a7a7a;
}

body.jazz-theme .search-clear {
  color: #9d9999;
}

body.jazz-theme .search-clear:hover {
  color: #d4af37;
}

/* 検索提案 */
body.jazz-theme .suggestions {
  background: #1a1f35;
  border: 1px solid #3a3f52;
}

body.jazz-theme .suggestion-item {
  color: #e8d9c3;
  border-bottom: 1px solid #2a3040;
}

body.jazz-theme .suggestion-item:hover,
body.jazz-theme .suggestion-item.active {
  background: rgba(212, 175, 55, 0.15);
  color: #d4af37;
}

body.jazz-theme .sug-name {
  color: #d4af37;
}

body.jazz-theme .sug-reading {
  color: #9d9999;
}

body.jazz-theme .sug-cat {
  color: #7a7a7a;
}

/* マークアップ */
body.jazz-theme mark {
  background: rgba(212, 175, 55, 0.3);
  color: #d4af37;
  padding: 2px 4px;
}

/* ボタン */
body.jazz-theme button {
  color: #f5e6d3;
}

body.jazz-theme button:hover {
  color: #d4af37;
}

/* ═════════════════════════════════════════
   D.C. BUTTON（ダ・カーポ インタラクティブボタン）
   ═════════════════════════════════════════ */

.dc-button-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 3rem auto;
  padding: 2rem 0;
  max-width: 960px;
}

.dc-button {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--rust);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(128, 0, 0, 0.06);
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--rust);
  letter-spacing: 0.05em;
}

.dc-button:hover {
  background: rgba(128, 0, 0, 0.04);
  border-color: var(--rust);
  box-shadow: 0 4px 16px rgba(128, 0, 0, 0.12);
  transform: scale(1.05);
}

.dc-button:active {
  transform: scale(0.98);
}

.dc-label {
  display: block;
  line-height: 1;
}

/* Responsiveデザイン */
@media (max-width: 640px) {
  .dc-button {
    width: 70px;
    height: 70px;
    font-size: 1.3rem;
  }

  .dc-button-container {
    margin: 2rem auto;
    padding: 1rem 0;
  }
}

/* ═════════════════════════════════════════
   FEEDBACK SECTION
   ═════════════════════════════════════════ */

.feedback-section {
  text-align: center;
  padding: 2rem 0 1rem;
  margin-top: 2rem;
  border-top: 1px solid var(--border);
}

.feedback-trigger {
  font-family: 'Space Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  background: none;
  border: 1px solid var(--border);
  padding: 0.6rem 1.2rem;
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 4px;
}

.feedback-trigger:hover {
  color: var(--rust);
  border-color: var(--rust);
}

/* モーダル背景 */
.feedback-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 2000;
}

.feedback-overlay.open {
  display: block;
}

/* モーダルコンテンツ */
.feedback-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2001;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.feedback-modal.open {
  display: flex;
}

.feedback-modal-content {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 100%;
  max-width: 500px;
  padding: 2rem;
  position: relative;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.feedback-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--muted);
  cursor: pointer;
  padding: 0.4rem;
}

.feedback-close:hover {
  color: var(--rust);
}

.feedback-modal-content h3 {
  font-family: 'Noto Serif JP', serif;
  font-size: 1.2rem;
  color: var(--ink);
  margin-bottom: 0.5rem;
}

.feedback-subtitle {
  font-family: 'Noto Serif JP', serif;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.feedback-options {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-bottom: 1.5rem;
}

.feedback-option {
  display: flex;
  align-items: center;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.95rem;
  color: var(--ink);
  cursor: pointer;
  gap: 0.6rem;
}

.feedback-option input[type="radio"] {
  cursor: pointer;
  accent-color: var(--rust);
}

#feedback-text {
  width: 100%;
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: 'Noto Serif JP', serif;
  font-size: 0.9rem;
  color: var(--ink);
  resize: vertical;
  margin-bottom: 1rem;
}

#feedback-text::placeholder {
  color: var(--muted);
}

.feedback-submit {
  width: 100%;
  padding: 0.8rem;
  background: var(--rust);
  color: var(--paper);
  border: none;
  border-radius: 4px;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.feedback-submit:hover {
  opacity: 0.9;
  box-shadow: 0 2px 8px rgba(128, 0, 0, 0.2);
}
