:root {
  /* Bootstrap 風のクリーンな白ベース配色 */
  --bg: #f8f9fa;
  --surface: #ffffff;
  --card: #ffffff;
  --border: #dee2e6;
  --border-soft: #e9ecef;
  /* 文字色は freeasy-survey.com に合わせる（本文=ブルーグレー / 見出し=ネイビー） */
  --text: #323640;
  --heading: #364061;
  --text-soft: #4b5563;
  --muted: #7c8698;
  /* form.run 配色：緑を主役、シアンをアクセントに */
  --primary: #1ec86d;
  --primary-hover: #18b462;
  --primary-ink: #0f9e58;
  --primary-soft: #e3f6ec;
  --accent: #0db6cb;
  --danger: #dc3545;
  --danger-hover: #bb2d3b;
  --success: #1ec86d;
  --bar: #86dcaf;
  --bar-top: #1ec86d;
  --radius: 0.5rem;
  --radius-sm: 0.375rem;
  --shadow-sm: 0 0.0625rem 0.125rem rgba(33, 37, 41, 0.075);
  --shadow: 0 0.25rem 0.75rem rgba(33, 37, 41, 0.1);
  --shadow-lg: 0 0.5rem 1.5rem rgba(33, 37, 41, 0.15);
  --ring: 0 0 0 0.25rem rgba(30, 200, 109, 0.25);
  /* lp.php(world.yorisou.cards)と同じ書体構成 */
  --app-serif: "Noto Serif JP", "Hiragino Mincho ProN", serif;
  --app-en: "Cormorant Garamond", "Georgia", serif;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--app-font, "Noto Sans JP", "Hiragino Kaku Gothic ProN",
    system-ui, -apple-system, "Segoe UI", Roboto, Meiryo, Arial, sans-serif);
  line-height: 1.6;
  background-color: var(--bg);
}

a {
  color: var(--primary-ink);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* ---------- レイアウト ---------- */
.container {
  max-width: 820px;
  margin: 0 auto;
  padding: 32px 20px 96px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 820px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  font-family: var(--app-en);
  font-weight: 600;
  font-size: 26px;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.brand:hover {
  color: var(--text);
  text-decoration: none;
}
.brand .logo {
  font-size: 20px;
}

/* 右上のアクション（新規作成 / LOGIN / LOGOUT） */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--app-font, "Noto Sans JP", system-ui, sans-serif);
}
.topbar-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-soft);
  white-space: nowrap;
}
.topbar-link:hover {
  color: var(--primary-ink);
  text-decoration: none;
}
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
}
.user-chip .user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  object-fit: cover;
  flex: none;
  display: block;
}
.user-chip .user-avatar-ph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
}
.user-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- カード ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.card.hover-lift:hover {
  box-shadow: var(--shadow);
  border-color: #ced4da;
}

/* ---------- タイポグラフィ ---------- */
h1 {
  font-family: var(--app-serif);
  font-size: 28px;
  line-height: 1.4;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--heading);
  margin: 0 0 8px;
}
h2 {
  font-family: var(--app-serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--heading);
  margin: 0 0 14px;
}
.muted { color: var(--muted); }
.small { font-size: 13px; }
.page-head { margin-bottom: 22px; }

/* ---------- フォーム ---------- */
/* ラベル・入力欄・余白は form.run のフォームに合わせる（16px 基準） */
label {
  display: block;
  font-weight: 400;
  margin-bottom: 8px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
}

input[type="text"],
input[type="password"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d9d9d9;
  border-radius: var(--radius-sm);
  font-size: 16px;
  line-height: 1.5;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea {
  resize: vertical;
  min-height: 88px;
}
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #7fd3a7;
  box-shadow: var(--ring);
}
input::placeholder,
textarea::placeholder {
  color: #adb5bd;
}
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236c757d' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  cursor: pointer;
}
input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--primary);
  width: 17px;
  height: 17px;
  cursor: pointer;
}

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--primary);
  font-size: 14.5px;
  font-weight: 500;
  font-family: inherit;
  line-height: 1.4;
  cursor: pointer;
  color: #fff;
  background: var(--primary);
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}
.btn:hover {
  color: #fff;
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  text-decoration: none;
}
.btn:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}
.btn:active { background: var(--primary-hover); }
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn-secondary {
  background: #fff;
  color: var(--text-soft);
  border-color: #ced4da;
}
.btn-secondary:hover {
  color: var(--text);
  background: #f8f9fa;
  border-color: #adb5bd;
}
.btn-danger {
  background: #fff;
  color: var(--danger);
  border-color: var(--danger);
}
.btn-danger:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

/* ---------- ユーティリティ ---------- */
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.field { margin-bottom: 16px; }

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  color: #fff;
  background: var(--primary);
}
.required-mark { color: var(--danger); margin-left: 5px; }

.option-row { display: flex; gap: 9px; align-items: center; margin-bottom: 9px; }

/* ---------- 選択肢（回答フォーム） ---------- */
.choice {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 15px;
  border: 1px solid #ced4da;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  cursor: pointer;
  font-weight: 400;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.choice:hover {
  border-color: #7fd3a7;
  background: #f4fdf8;
}
.choice:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.choice input { flex: none; }

/* 評価スケール */
.rating {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.rating-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  height: 52px;
  border: 1px solid #ced4da;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 17px;
  color: var(--text-soft);
  cursor: pointer;
  background: #fff;
  transition: all 0.15s ease;
}
.rating-item input {
  position: absolute;
  opacity: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}
.rating-item:hover {
  border-color: #7fd3a7;
  background: #f4fdf8;
}
.rating-item:has(input:checked) {
  border-color: var(--primary);
  color: #fff;
  background: var(--primary);
}

/* ---------- 集計バー ---------- */
.bar-row { margin-bottom: 15px; }
.bar-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
  gap: 12px;
}
.bar-label .val { color: var(--muted); font-weight: 500; font-size: 13px; white-space: nowrap; }
.bar-track {
  background: #e9ecef;
  border-radius: var(--radius-sm);
  height: 24px;
  overflow: hidden;
  position: relative;
}
.bar-fill {
  height: 100%;
  border-radius: 4px;
  min-width: 4px;
  background: var(--fill, var(--bar));
  width: 0;
  animation: barGrow 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}
@keyframes barGrow {
  from { width: 0; }
  to { width: var(--w, 0%); }
}

/* 評価ゲージ（円形） */
.gauge-wrap {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.gauge { position: relative; width: 132px; height: 132px; flex: none; }
.gauge svg { transform: rotate(-90deg); }
.gauge .gauge-arc {
  stroke-dasharray: var(--c);
  stroke-dashoffset: var(--c);
  animation: gaugeFill 1s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}
@keyframes gaugeFill {
  to { stroke-dashoffset: var(--off); }
}
.gauge-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.gauge-center .num {
  font-family: var(--app-en);
  font-size: 34px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #3498db;
  line-height: 1;
}
.gauge-center .den { font-size: 12px; color: var(--muted); margin-top: 2px; }
.gauge-meta { flex: 1; min-width: 160px; }

/* 自由記述 */
.answer-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.answer-list li {
  padding: 12px 16px;
  background: #f8f9fa;
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-soft);
}

/* ---------- アラート ---------- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 9px;
}
.alert-error { background: #f8d7da; color: #842029; border: 1px solid #f5c2c7; }
.alert-success { background: #d1e7dd; color: #0f5132; border: 1px solid #badbcc; }

/* ---------- 空状態 ---------- */
.empty { text-align: center; padding: 52px 22px; color: var(--muted); }
.empty .emoji { font-size: 46px; display: block; margin-bottom: 10px; }

/* ---------- 統計 ---------- */
.stat-big {
  font-family: var(--app-en);
  font-size: 44px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--accent);
  line-height: 1.1;
}

.hero-stat { text-align: center; padding: 30px 22px; }
.hero-stat .stat-big { font-size: 60px; }

/* リスト項目のメタ情報 */
.meta-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-soft);
  background: #f1f3f5;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 3px 11px;
}

/* ---------- フッター ---------- */
.site-footer {
  max-width: 820px;
  margin: 0 auto;
  padding: 8px 20px 40px;
  text-align: center;
}
.site-footer a {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}
.site-footer a:hover { color: var(--primary-ink); }

/* ---------- 管理: フォント選択 ---------- */
.font-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.font-preset {
  position: relative;
  display: block;
  margin: 0;
  cursor: pointer;
}
.font-preset input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}
.font-preset-body {
  border: 1px solid #ced4da;
  border-radius: var(--radius);
  padding: 16px 17px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  height: 100%;
}
.font-preset:hover .font-preset-body {
  border-color: #7fd3a7;
}
.font-preset:has(input:checked) .font-preset-body {
  border-color: var(--primary);
  box-shadow: var(--ring);
  background: var(--primary-soft);
}
.font-preset-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.font-preset-name { font-weight: 600; font-size: 14px; color: var(--text); }
.font-check {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #fff;
  background: var(--primary);
  opacity: 0;
  transform: scale(0.6);
  transition: all 0.15s ease;
}
.font-preset:has(input:checked) .font-check { opacity: 1; transform: scale(1); }
.font-preview {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  margin-bottom: 8px;
}
.font-preset-note { margin: 0; }

/* ---------- 回答モーダル ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(33, 37, 41, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 20px;
}
.modal-overlay[hidden] { display: none; }
.modal-nav {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-soft);
  font-size: 17px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.modal-nav:hover:not(:disabled) { color: var(--primary-ink); border-color: #7fd3a7; }
.modal-nav:disabled { opacity: 0.35; cursor: default; }
.modal {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeUp 0.2s ease both;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.modal-body { padding: 26px 28px; overflow-y: auto; }
.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
}
.modal-close:hover { background: #f1f3f5; color: var(--text); }
.resp-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
  padding-right: 26px;
}
.resp-count { font-weight: 700; font-size: 15px; color: var(--heading); }
.resp-time { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.resp-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
}
.resp-user[hidden] { display: none; }
.resp-avatar { width: 44px; height: 44px; border-radius: 999px; object-fit: cover; flex: none; }
.resp-avatar-ph { display: flex; align-items: center; justify-content: center; background: var(--primary); color: #fff; font-size: 18px; }
.resp-user-name { font-weight: 700; color: var(--heading); }
.resp-user-email { font-size: 13px; color: var(--text-soft); word-break: break-all; }
.resp-qa { padding: 12px 0; border-bottom: 1px solid var(--border-soft); }
.resp-qa:last-child { border-bottom: none; }
.resp-q { font-weight: 600; font-size: 14px; color: var(--text-soft); margin-bottom: 5px; }
.resp-a { font-size: 15.5px; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.resp-empty { color: var(--muted); }
@media (max-width: 560px) {
  .modal-overlay { gap: 6px; padding: 12px; }
  .modal-nav { width: 36px; height: 36px; font-size: 15px; }
  .modal-body { padding: 22px 20px; }
}

/* ---------- Font Awesome 補完 ----------
   同梱 woff2 は全グリフを含むが、fa-subset.css は一部アイコンの
   content 定義を持たないため、ここで補う（.fa-solid がフォントを提供）。 */
.fa-arrow-up::before { content: "\f062"; }
.fa-arrow-down::before { content: "\f063"; }
.fa-eye-slash::before { content: "\f070"; }

/* 非公開チップ */
.chip-warn {
  color: #8a6d1f;
  background: #fff6e0;
  border-color: #f3e2b3;
}

/* 管理者リスト */
.admin-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
.admin-row .admin-edit {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 1;
  flex-wrap: wrap;
}
.admin-row .admin-edit input[type="email"] { flex: 2; min-width: 180px; }
.admin-row .admin-edit input[type="text"] { flex: 1; min-width: 120px; }
.admin-row .btn { flex: none; }

/* 空状態の大アイコンは控えめなトーンに */
.empty .emoji i { color: #ced4da; }

/* ---------- レスポンシブ ---------- */
@media (max-width: 560px) {
  h1 { font-size: 24px; }
  .card { padding: 19px; }
  .container { padding: 24px 15px 80px; }
  .topbar-actions { gap: 10px; }
  .user-name { display: none; }
}
