/* =============================================
   夜の街観測研究所 — アカデミック・レポート型
   ============================================= */

:root {
  --bg: #fafaf8;
  --bg-card: #ffffff;
  --bg-sidebar: #f5f4f0;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --text-light: #9ca3af;
  --accent: #e84393;
  --accent-hover: #d1357f;
  --accent-2: #7c3aed;
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --radius: 8px;
  --sidebar-w: 240px;
  --header-h: 60px;
}

/* リセット */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: 'Noto Sans JP', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
a { cursor: pointer; color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
ul { list-style: none; }
button { cursor: pointer; font-family: inherit; }

/* =============================================
   ヘッダー
   ============================================= */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.site-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--text-light);
  font-weight: 500;
}

.site-title {
  font-family: 'Noto Serif JP', serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.04em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.survey-badge {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 100px;
}

/* =============================================
   ボタン
   ============================================= */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  transition: background 0.2s;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary.full { width: 100%; padding: 12px; font-size: 14px; }

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  transition: border-color 0.2s, color 0.2s;
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-outline.full { width: 100%; padding: 12px; font-size: 14px; }

.btn-plan {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  width: 100%;
  margin-top: 8px;
  transition: background 0.2s, color 0.2s;
}
.btn-plan:hover { background: var(--accent); color: #fff; }

/* =============================================
   レイアウト
   ============================================= */
.layout {
  display: flex;
  margin-top: var(--header-h);
  min-height: calc(100vh - var(--header-h));
}

/* =============================================
   サイドバー
   ============================================= */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  position: fixed;
  top: var(--header-h);
  bottom: 0;
  left: 0;
  overflow-y: auto;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.nav-section-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text-light);
  font-weight: 600;
  padding: 0 16px 8px;
  text-transform: uppercase;
}

.sidebar-nav ul {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: block;
  padding: 9px 16px;
  font-size: 13.5px;
  color: var(--text-muted);
  border-radius: 0;
  font-weight: 400;
  transition: color 0.15s, background 0.15s;
  border-left: 3px solid transparent;
}
.nav-item:hover { color: var(--text); background: rgba(0,0,0,0.04); text-decoration: none; }
.nav-item.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(232,67,147,0.06);
  font-weight: 600;
}

.survey-meta {
  padding: 0 16px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.meta-title {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text-light);
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.meta-list dt {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 6px;
}
.meta-list dd {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}

.sidebar-plan-cta {
  margin: 0 12px;
  padding: 14px;
  background: rgba(232,67,147,0.05);
  border: 1px dashed rgba(232,67,147,0.3);
  border-radius: var(--radius);
}
.plan-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
}
.plan-desc {
  font-size: 11px;
  color: var(--text-muted);
}

/* =============================================
   メインコンテンツ
   ============================================= */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 32px 32px 64px;
  max-width: 1100px;
}

/* ページ切り替え */
.page { display: none; }
.page.active { display: block; }

/* =============================================
   ページヘッダー
   ============================================= */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--text);
}

.page-title {
  font-family: 'Noto Serif JP', serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.03em;
  margin-bottom: 4px;
}

.page-desc {
  font-size: 13px;
  color: var(--text-muted);
}

.update-badge {
  font-size: 11px;
  color: var(--text-light);
  white-space: nowrap;
  margin-top: 4px;
}

/* =============================================
   KPIカード
   ============================================= */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.kpi-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.kpi-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.kpi-num {
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.kpi-unit {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 2px;
}

.kpi-change {
  font-size: 11px;
  font-weight: 500;
}
.kpi-change.up { color: #10b981; }
.kpi-change.down { color: #ef4444; }
.kpi-change.neutral { color: var(--text-light); }

/* =============================================
   グラフグリッド
   ============================================= */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 20px 16px;
  box-shadow: var(--shadow);
}

.chart-card.wide {
  grid-column: 1 / -1;
}

.chart-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.chart-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.chart-n {
  font-size: 11px;
  color: var(--text-light);
  white-space: nowrap;
  margin-left: 8px;
  margin-top: 2px;
}

.chart-wrap {
  position: relative;
  height: 220px;
}

.chart-wrap.tall {
  height: 260px;
}

.chart-note {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-light);
  line-height: 1.5;
}

/* =============================================
   投票
   ============================================= */
.vote-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.vote-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

.vote-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.vote-tag {
  font-size: 11px;
  background: var(--text);
  color: #fff;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 500;
}
.vote-tag.community {
  background: var(--accent-2);
}

.vote-count {
  font-size: 12px;
  color: var(--text-muted);
}

.vote-question {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  line-height: 1.4;
  font-family: 'Noto Serif JP', serif;
}

.vote-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vote-btn {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-align: left;
  transition: all 0.15s;
  font-family: inherit;
}
.vote-btn:hover {
  border-color: var(--accent);
  background: rgba(232,67,147,0.04);
  color: var(--accent);
}
.vote-btn.voted {
  background: rgba(232,67,147,0.08);
  border-color: var(--accent);
  color: var(--accent);
}

.vote-result {
  margin-top: 16px;
  height: 180px;
}

.vote-note {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 10px;
}

.cta-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: linear-gradient(135deg, rgba(232,67,147,0.03), rgba(124,58,237,0.03));
  border: 1.5px dashed var(--border);
}

.cta-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.cta-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.cta-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.6;
}

.cta-list {
  list-style: none;
  text-align: left;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cta-list li {
  font-size: 13px;
  color: var(--text-muted);
}

/* =============================================
   モーダル
   ============================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
}

.modal-box {
  background: #fff;
  border-radius: 12px;
  padding: 36px;
  width: 420px;
  max-width: 90vw;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.modal-box.wide {
  width: 780px;
  max-width: 95vw;
}

.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 50%;
  width: 30px; height: 30px;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.modal-close:hover { background: var(--bg); color: var(--text); }

.modal-title {
  font-family: 'Noto Serif JP', serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.modal-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-form label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-top: 8px;
}

.auth-form input {
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.15s;
  outline: none;
}
.auth-form input:focus { border-color: var(--accent); }
.auth-form button { margin-top: 12px; }

.auth-switch {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 16px;
}

.auth-panel { }
.auth-panel.hidden { display: none; }

/* プランモーダル */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 20px;
}

.plan-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
}

.plan-card.featured {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232,67,147,0.08);
}

.plan-badge {
  position: absolute;
  top: -11px; left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 100px;
}

.plan-name {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.plan-price {
  font-size: 30px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
}
.plan-price span {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
}

.plan-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 20px;
}
.plan-features li {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* =============================================
   トースト
   ============================================= */
.toast {
  position: fixed;
  bottom: 28px; right: 28px;
  background: var(--text);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  z-index: 2000;
  transition: opacity 0.3s;
}
.toast.hidden { opacity: 0; pointer-events: none; }

/* =============================================
   ユーティリティ
   ============================================= */
.hidden { display: none !important; }

/* =============================================
   レスポンシブ（簡易）
   ============================================= */
@media (max-width: 900px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .chart-grid, .vote-grid { grid-template-columns: 1fr; }
  .chart-card.wide { grid-column: 1; }
  .plan-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 20px 16px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .site-label { display: none; }
  .survey-badge { display: none; }
}
