:root {
  --bg: #2c3a45;
  --bg2: #3e4e5a;
  --surface: #0f1b23;
  --surface2: #20303b;
  --surface3: #31424d;
  --border: rgba(206, 161, 122, 0.24);
  --border2: rgba(206, 161, 122, 0.46);
  --text: #e3e7e9;
  --text2: #c7cccf;
  --text3: #9fa9af;
  --accent: #cea17a;
  --accent-bg: rgba(206, 161, 122, 0.12);
  --accent2: #88b7a0;
  --accent2-bg: rgba(136, 183, 160, 0.12);
  --red: #d68b8b;
  --red-bg: rgba(214, 139, 139, 0.12);
  --purple: #b8a3da;
  --purple-bg: rgba(184, 163, 218, 0.12);
  --gold: #e1c46d;
  --gold-bg: rgba(225, 196, 109, 0.12);
  --shadow: 0 14px 36px rgba(0, 0, 0, 0.24);
}

/* Meyasubako app surface */
.btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.layout {
  max-width: 1120px;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 14px;
  margin-bottom: 10px;
}

.tab-pill {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text2);
  text-decoration: none;
  white-space: nowrap;
  background: rgba(15, 27, 35, 0.48);
}

.tab-pill:hover,
.tab-pill.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-bg);
}

.tab-pill[aria-disabled="true"] {
  opacity: 0.55;
}

.season-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(15, 27, 35, 0.82);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 6px;
}

.season-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.season-card h1 {
  font-family: 'Noto Serif JP', serif;
  font-size: 30px;
  line-height: 1.25;
  color: var(--text);
}

.season-card p {
  color: var(--text2);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid currentColor;
}

.status-badge.open {
  color: var(--accent2);
  background: var(--accent2-bg);
}

.status-badge.pending {
  color: var(--gold);
  background: var(--gold-bg);
}

.season-meta {
  display: grid;
  gap: 12px;
  align-content: start;
  padding-left: 18px;
  border-left: 1px solid var(--border);
}

.meta-label {
  display: block;
  color: var(--text3);
  font-size: 11px;
}

.season-meta strong,
.remaining-time {
  color: var(--text);
  font-size: 15px;
}

.season-empty,
.empty-state {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 18px;
  color: var(--text2);
  background: rgba(255, 255, 255, 0.03);
}

.ranking-section {
  margin-top: 12px;
}

.ranking-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.ranking-head h2 {
  font-family: 'Noto Serif JP', serif;
  color: var(--accent);
  font-size: 20px;
}

#ranking-list {
  display: grid;
  gap: 10px;
}

.proposal-row {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) 150px;
  gap: 14px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(15, 27, 35, 0.72);
}

.rank-cell {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 3px;
  color: var(--accent);
}

.rank-number {
  font-family: 'Noto Serif JP', serif;
  font-size: 30px;
  line-height: 1;
  font-weight: 700;
}

.rank-label {
  font-size: 12px;
}

.proposal-body {
  min-width: 0;
}

.proposal-body h2 {
  font-size: 18px;
  line-height: 1.35;
  color: var(--text);
  margin-bottom: 4px;
}

.proposal-body p {
  color: var(--text2);
  margin-bottom: 6px;
}

.proposal-url {
  display: inline-block;
  max-width: 100%;
  color: var(--accent2);
  overflow-wrap: anywhere;
  margin-bottom: 7px;
}

.proposal-author {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text3);
  font-size: 12px;
}

.proposal-author img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

.proposal-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.vote-count {
  color: var(--text2);
  font-size: 13px;
}

.vote-count strong {
  color: var(--accent);
  font-size: 18px;
}

.vote-action.active {
  color: #10161b;
  background: var(--accent2);
  border-color: var(--accent2);
}

.proposal-modal textarea {
  width: 100%;
  resize: vertical;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(15, 27, 35, 0.82);
  color: var(--text);
  font: inherit;
}

.optional-fields {
  margin-top: 10px;
}

.optional-fields summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 13px;
  margin-bottom: 10px;
}

.duplicate-box {
  display: grid;
  gap: 8px;
  margin: 10px 0;
  padding: 12px;
  border: 1px solid var(--border2);
  border-radius: 8px;
  background: var(--accent-bg);
}

.duplicate-box p {
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
}

.duplicate-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border-radius: 6px;
  background: rgba(15, 27, 35, 0.5);
}

.duplicate-item strong,
.duplicate-item span {
  display: block;
}

.duplicate-item strong {
  color: var(--text);
}

.duplicate-item span {
  color: var(--text3);
  font-size: 12px;
}

.admin-panel {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(180px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.admin-panel h2 {
  grid-column: 1 / -1;
  color: var(--gold);
  font-size: 13px;
}

.admin-panel input,
.admin-panel select,
.admin-proposal-actions select {
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(15, 27, 35, 0.86);
  color: var(--text);
  font: inherit;
  padding: 5px 8px;
}

.admin-proposal-actions {
  display: grid;
  gap: 5px;
  justify-items: end;
}

.admin-proposal-actions select {
  width: 100%;
  max-width: 150px;
  font-size: 11px;
}

.archive-section {
  margin-bottom: 24px;
}

.archive-grid {
  display: grid;
  gap: 10px;
}

.archive-card,
.archive-season {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(15, 27, 35, 0.72);
}

.archive-card {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px;
}

.archive-card h2 {
  font-size: 18px;
}

.archive-card p,
.archive-card span {
  color: var(--text3);
  font-size: 12px;
}

.stamp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  min-height: 38px;
  border: 2px solid currentColor;
  color: #d24b37;
  font-family: 'Noto Serif JP', serif;
  font-weight: 700;
  transform: rotate(-8deg);
  background: rgba(210, 75, 55, 0.08);
}

.stamp.executed {
  color: #d24b37;
}

.stamp.passed {
  color: var(--gold);
}

.archive-season {
  margin-bottom: 8px;
  overflow: hidden;
}

.archive-season summary {
  cursor: pointer;
  padding: 12px 14px;
  color: var(--accent);
}

.archive-ranking {
  display: grid;
  border-top: 1px solid var(--border);
}

.archive-rank-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 80px auto;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(206, 161, 122, 0.12);
}

.archive-rank-row:last-child {
  border-bottom: 0;
}

.archive-rank-row span,
.archive-rank-row em {
  color: var(--text3);
  font-size: 12px;
  font-style: normal;
}

@media (max-width: 760px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 10px 14px;
  }

  .header-right {
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
  }

  .layout {
    padding: 1rem;
  }

  .season-card {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .season-meta {
    border-left: 0;
    border-top: 1px solid var(--border);
    padding-left: 0;
    padding-top: 14px;
  }

  .season-card h1 {
    font-size: 24px;
  }

  .ranking-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .proposal-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .rank-cell {
    justify-content: flex-start;
  }

  .proposal-actions {
    justify-items: stretch;
  }

  .proposal-actions .btn {
    width: 100%;
  }

  .duplicate-item {
    grid-template-columns: 1fr;
  }

  .admin-panel {
    grid-template-columns: 1fr;
  }

  .admin-proposal-actions {
    justify-items: stretch;
  }

  .admin-proposal-actions select {
    max-width: none;
  }

  .archive-rank-row {
    grid-template-columns: 1fr;
  }
}

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

body {
  font-family: 'Noto Sans JP', sans-serif;
  background:
    radial-gradient(circle at top, rgba(206, 161, 122, 0.12), transparent 30%),
    linear-gradient(135deg, var(--bg) 0%, var(--bg2) 100%);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.7;
}

/* Header */
.site-header {
  background: linear-gradient(90deg, var(--bg) 0%, var(--bg2) 100%);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 10px 24px rgba(0,0,0,0.14);
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.site-home-link {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: transform 0.15s, opacity 0.15s;
}

.site-home-link:hover {
  transform: translateY(-1px);
  opacity: 0.92;
}

.site-home-link img {
  display: block;
  width: 36px;
  height: 36px;
}

.site-logo {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-family: 'Noto Serif JP', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  min-width: 0;
  white-space: nowrap;
  text-decoration: none;
  letter-spacing: 0.02em;
}

.site-logo-main {
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-logo-sub {
  color: var(--text2);
  font-weight: 400;
  font-size: 14px;
}

.search-wrap {
  flex: 1;
  max-width: 380px;
  position: relative;
}
.search-wrap input {
  width: 100%;
  padding: 7px 12px 7px 34px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(15, 27, 35, 0.72);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.search-wrap input:focus { border-color: var(--accent); }
.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  pointer-events: none;
}

.header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.btn {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text2);
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--border2); background: rgba(255,255,255,0.08); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: #b7865f; border-color: #b7865f; color: #10161b; }
.btn-twitch { background: #6441a5; color: #fff; border-color: #6441a5; font-size: 12px; padding: 6px 12px; }
.btn-twitch:hover { background: #5535a0; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.is-hidden { display: none !important; }
.btn-danger {
  color: var(--text3);
  border-color: transparent;
  background: transparent;
}
.btn-danger:hover {
  color: var(--red);
  border-color: var(--red-bg);
  background: var(--red-bg);
}
.action-link {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  line-height: 1;
  padding: 3px 0;
  transition: color 0.1s;
}
.action-link:hover { color: var(--red); }
.link-button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text2);
}
.user-chip img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.sub-badge {
  font-size: 10px;
  background: var(--purple-bg);
  color: var(--purple);
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 500;
}
.admin-badge {
  font-size: 10px;
  background: var(--gold-bg);
  color: var(--gold);
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 500;
}
.status-note { font-size: 11px; color: var(--text3); }

/* Layout */
.layout {
  display: flex;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
  gap: 1.5rem;
  align-items: flex-start;
}

/* Sidebar */
.sidebar {
  width: 180px;
  min-width: 180px;
  background: rgba(15, 27, 35, 0.88);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  position: sticky;
  top: 88px;
  box-shadow: var(--shadow);
}
.sidebar-head {
  padding: 10px 14px;
  font-size: 11px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}
.cat-item {
  appearance: none;
  width: 100%;
  background: transparent;
  border: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 14px;
  font-size: 13px;
  color: var(--text2);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
  user-select: none;
  text-align: left;
  font-family: inherit;
}
.cat-item:last-child { border-bottom: none; }
.cat-item:hover { background: var(--surface2); }
.cat-item.active { background: var(--accent-bg); color: var(--accent); font-weight: 500; }
.cat-count { font-size: 11px; color: var(--text3); background: rgba(255,255,255,0.05); padding: 1px 6px; border-radius: 10px; }
.cat-item.active .cat-count { background: var(--accent); color: #10161b; }

/* Main */
.main { flex: 1; min-width: 0; }

.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 1rem;
}
.main-header h2 { font-size: 14px; color: var(--text3); font-weight: 400; }
.main-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sort-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sort-wrap-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sort-wrap label {
  font-size: 11px;
  color: var(--text3);
  white-space: nowrap;
}
.sort-wrap select {
  appearance: none;
  border: 1px solid var(--border);
  background: rgba(15, 27, 35, 0.72);
  color: var(--text2);
  font: inherit;
  font-size: 12px;
  line-height: 1.2;
  padding: 7px 28px 7px 10px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  min-width: 116px;
}
.sort-wrap select:focus {
  outline: none;
  border-color: var(--accent);
}
.sort-direction-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: rgba(15, 27, 35, 0.72);
  color: var(--text2);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  min-width: 38px;
  padding: 8px 10px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
}
.sort-direction-btn:hover {
  border-color: var(--border2);
  background: rgba(255,255,255,0.06);
}
.sort-direction-btn.active {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: var(--border2);
}
.mobile-controls {
  display: none;
  margin-bottom: 0.9rem;
}
.mobile-controls-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 0.65rem;
}
.mobile-caption {
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.mobile-controls-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.mobile-categories {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.mobile-categories::-webkit-scrollbar { display: none; }
.cat-chip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(15, 27, 35, 0.72);
  color: var(--text2);
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}
.cat-chip.active {
  color: #10161b;
  background: var(--accent);
  border-color: var(--accent);
}
.cat-chip .cat-count {
  background: rgba(255,255,255,0.06);
}
.cat-chip.active .cat-count {
  background: rgba(16, 22, 27, 0.16);
  color: #10161b;
}

/* Term card */
.term-card {
  background: linear-gradient(135deg, rgba(9, 23, 31, 0.96), rgba(34, 48, 59, 0.94));
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-bottom: 12px;
  overflow: hidden;
  transition: border-color 0.15s;
  box-shadow: var(--shadow);
}
.term-card:hover { border-color: var(--border2); }

.term-header {
  appearance: none;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 14px 16px 10px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.term-title-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.term-copy { min-width: 0; }
.term-title {
  font-family: 'Noto Serif JP', serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}
.term-reading { font-size: 12px; color: var(--text3); }
.term-cat {
  font-size: 11px;
  background: rgba(255,255,255,0.05);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  white-space: nowrap;
}
.term-summary {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text2);
  line-height: 1.55;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(72ch, 100%);
}
.term-summary.is-empty {
  color: var(--text3);
  font-style: normal;
}
.term-card.open .term-summary { display: none; }
.term-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.comment-count-badge {
  font-size: 11px;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 3px;
}
.toggle-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  padding: 5px 10px;
  color: var(--text2);
  cursor: pointer;
  font: inherit;
  line-height: 1;
  font-size: 11px;
  border-radius: 999px;
  white-space: nowrap;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.toggle-btn:hover {
  color: var(--text);
  border-color: var(--border2);
  background: rgba(255,255,255,0.06);
}

.term-body { display: none; border-top: 1px solid var(--border); }
.term-card.open .term-body { display: block; }
.comments-area-compact { padding-top: 0; }
.term-edit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.term-edit-label {
  font-size: 11px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.term-edit-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.term-edit-select {
  min-width: 164px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(15, 27, 35, 0.72);
  color: var(--text2);
  font: inherit;
  font-size: 12px;
}
.term-edit-select:focus {
  outline: none;
  border-color: var(--accent);
}
.inline-note {
  font-size: 12px;
  color: var(--text3);
  padding: 8px 0;
}
.inline-note.is-empty { font-style: normal; }

/* Comments */
.comments-area { padding: 12px 16px; }

.comment {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.comment:last-child { border-bottom: none; }
.comment.collapsed { opacity: 0.5; }

.comment-avatar img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.comment-avatar-placeholder {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--text3); flex-shrink: 0;
}

.comment-content { flex: 1; min-width: 0; }
.comment-body-text {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.7;
  font-style: normal;
  margin-bottom: 6px;
}
.comment-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.comment-author { font-size: 11px; color: var(--text3); }
.vote-wrap { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.comment-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.vote-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text3);
  transition: all 0.1s;
  font-family: inherit;
  min-width: 28px;
}
.vote-btn:hover { border-color: var(--border2); background: var(--surface2); }
.vote-btn.up.active { background: var(--accent2-bg); color: var(--accent2); border-color: var(--accent2); }
.vote-btn.down.active { background: var(--red-bg); color: var(--red); border-color: var(--red); }
.vote-score { font-size: 12px; color: var(--text3); min-width: 20px; text-align: center; }
.vote-score.positive { color: var(--accent2); }
.vote-score.negative { color: var(--red); }

.collapsed-notice {
  padding: 8px 0;
  font-size: 12px;
  color: var(--text3);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.show-collapsed { font-size: 12px; color: var(--accent); background: none; border: none; cursor: pointer; font-family: inherit; padding: 0; }

/* Add comment */
.add-comment-area {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}
.add-comment-locked {
  font-size: 12px;
  color: var(--text3);
  text-align: center;
  padding: 8px;
}
.add-comment-locked a { color: var(--accent); text-decoration: none; }
.comment-input-wrap {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.comment-input-wrap textarea {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
  outline: none;
  line-height: 1.6;
  transition: border-color 0.15s;
}
.comment-input-wrap textarea:focus { border-color: var(--accent); }
.comment-input-wrap textarea::placeholder { color: var(--text3); font-style: italic; }

/* Modal */
.modal-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-bg.open { display: flex; }
.modal {
  background: linear-gradient(135deg, rgba(15, 27, 35, 0.98), rgba(44, 58, 69, 0.98));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.5rem;
  width: 100%;
  max-width: 480px;
  margin: 1rem;
}
.modal h3 { font-family: 'Noto Serif JP', serif; font-size: 17px; font-weight: 700; margin-bottom: 1rem; color: var(--text); }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 12px; color: var(--text3); margin-bottom: 4px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
.form-group input, .form-group select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.form-group input:focus, .form-group select:focus { border-color: var(--accent); }
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 1.25rem; }

/* Toast */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--accent);
  color: #10161b;
  padding: 10px 16px;
  border-radius: 4px;
  font-size: 13px;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.2s;
  pointer-events: none;
  z-index: 300;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* Empty */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text3);
  font-size: 14px;
}

@media (max-width: 640px) {
  body { font-size: 15px; }
  .sidebar { display: none; }
  .layout { padding: 0.9rem; }
  .site-header {
    padding: 0.8rem 1rem 0.95rem;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    min-height: auto;
  }
  .site-brand {
    max-width: calc(100% - 20px);
  }
  .site-home-link {
    width: 30px;
    height: 30px;
  }
  .site-home-link img {
    width: 30px;
    height: 30px;
  }
  .site-logo {
    font-size: 18px;
    line-height: 1.2;
  }
  .site-logo {
    flex-wrap: wrap;
    gap: 4px 6px;
  }
  .site-logo-sub {
    font-size: 11px;
  }
  .header-right {
    width: 100%;
    margin-left: 0;
    order: 3;
  }
  .header-right .btn-twitch {
    width: auto;
    min-width: 0;
    padding: 6px 11px;
    font-size: 11px;
  }
  .user-chip {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px;
  }
  .search-wrap {
    order: 2;
    width: 100%;
    max-width: none;
  }
  .search-wrap input {
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .mobile-controls { display: block; }
  .mobile-controls-head {
    align-items: stretch;
    flex-direction: column;
  }
  .main-header {
    margin-bottom: 0;
  }
  .main-header h2,
  .main-header .sort-wrap {
    display: none;
  }
  .main-header-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .sort-wrap {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }
  .sort-wrap-group {
    width: 100%;
    justify-content: space-between;
  }
  .sort-wrap select { min-width: 0; }
  #add-term-btn {
    width: 100%;
    justify-content: center;
  }
  .term-card {
    border-radius: 18px;
    margin-bottom: 10px;
  }
  .term-header {
    padding: 14px;
    gap: 12px;
    flex-direction: column;
  }
  .term-copy {
    width: 100%;
  }
  .term-title {
    font-size: 19px;
  }
  .term-summary {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  .term-meta {
    width: 100%;
    justify-content: space-between;
  }
  .toggle-btn {
    padding: 7px 12px;
    font-size: 12px;
  }
  .comments-area,
  .add-comment-area {
    padding-left: 14px;
    padding-right: 14px;
  }
  .comment {
    gap: 8px;
  }
  .comment-avatar img,
  .comment-avatar-placeholder {
    width: 24px;
    height: 24px;
  }
  .comment-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
  .comment-actions,
  .vote-wrap {
    margin-left: 0;
  }
  .comment-actions {
    width: 100%;
    justify-content: space-between;
  }
  .comment-input-wrap {
    flex-direction: column;
  }
  .term-edit-controls {
    width: 100%;
  }
  .term-edit-select,
  .term-edit-controls .btn {
    width: 100%;
  }
  .comment-input-wrap button,
  .modal-footer .btn {
    width: 100%;
  }
  .modal {
    padding: 1.15rem;
    margin: 0.75rem;
  }
  .modal-footer {
    flex-direction: column-reverse;
  }
}

/* 非表示議案（管理者にのみ見える）と提出ボタンの注記 */
.submit-note {
  color: var(--text3);
  font-size: 11px;
  line-height: 1.5;
  margin: 0;
}

.proposal-row.is-hidden-proposal {
  opacity: 0.55;
  border-style: dashed;
}

.proposal-row.is-hidden-proposal .rank-label {
  color: var(--text3);
}
