:root {
  --bg: #0D1014;
  --bg-deep: #0A0D11;
  --panel: #161A21;
  --line: #2A303A;
  --line2: #3A4250;
  --text: #EEF1F5;
  --sub: #C9D0DA;
  --mute: #A3ACB9;
  --lamp: #FF4B3E;
  --on-lamp: #1A0503;
  --ok: #4C9DFF;
  --ok-bg: #13243A;
  --ng: #FF9F45;
  --ng-bg: #2E1F12;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans JP", system-ui, -apple-system, "Hiragino Sans", "Yu Gothic UI", sans-serif;
  line-height: 1.6;
}
a { color: #FF8A80; }
a:hover { color: #FFB3AC; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ヘッダー */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg-deep); }
.site-header .wrap {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 4px 16px; min-height: 60px; padding-top: 8px; padding-bottom: 8px;
}
.logo { color: var(--text); text-decoration: none; font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.logo:hover { color: var(--text); }
.logo small { font-size: 11px; font-weight: 500; padding: 2px 6px; border: 1px solid var(--line2); border-radius: 4px; color: var(--mute); }
.site-nav { display: flex; gap: 4px; }
.site-nav a {
  color: var(--sub); text-decoration: none; padding: 8px 12px; border-radius: 8px;
  font-size: 14px; min-height: 44px; display: inline-flex; align-items: center;
}
.site-nav a:hover { color: var(--text); }
.site-nav a[aria-current="page"] { color: var(--text); background: var(--panel); }

/* 共通 */
h1 { font-size: 28px; line-height: 1.35; margin: 28px 0 6px; }
.lead { margin: 0 0 16px; color: var(--sub); }
.notice {
  margin: 0 0 20px; padding: 12px 16px; background: #1B1F27; border: 1px solid var(--line2);
  border-radius: 8px; font-size: 13px; color: var(--sub);
}
.btn-ghost {
  min-height: 44px; padding: 6px 16px; border-radius: 8px; border: 1px solid var(--line2);
  background: transparent; color: var(--text); font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
.btn-ghost:hover { color: var(--text); border-color: var(--mute); }
.btn-primary {
  min-height: 52px; padding: 8px 16px; border-radius: 10px; background: var(--lamp); color: var(--on-lamp);
  font-size: 15px; font-weight: 700; text-decoration: none; display: flex; align-items: center; justify-content: center;
}
.btn-primary:hover { color: var(--on-lamp); filter: brightness(1.08); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { padding: 2px 8px; border-radius: 4px; background: var(--line); font-size: 11px; color: var(--text); }
.mute { color: var(--mute); }
.small { font-size: 12px; }

/* SVG */
.carbody { fill: none; stroke: #55606F; stroke-width: 1.5; stroke-linejoin: round; }
.lamp { fill: none; stroke: var(--lamp); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.lamp-fill { fill: var(--lamp); }

/* 検索画面 */
.layout { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; padding-bottom: 48px; }
.filters {
  flex: 1 1 260px; min-width: 0; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 18px;
}
.filters fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.filters legend { font-size: 14px; font-weight: 700; padding: 0; margin-bottom: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; padding: 6px 12px; display: inline-flex; align-items: center; gap: 8px;
  border-radius: 8px; border: 1px solid var(--line2); background: var(--bg); color: var(--text);
  font-size: 14px; font-weight: 500;
}
.chip svg { width: 36px; height: 18px; flex: none; }
.chip svg path { fill: none; stroke: var(--lamp); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chip[aria-pressed="true"] { background: var(--lamp); border-color: var(--lamp); color: var(--on-lamp); }
.chip[aria-pressed="true"] svg path { stroke: var(--on-lamp); }

.results { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.results-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.results-head p { margin: 0; }
.results-head strong { font-size: 24px; }
.empty {
  margin: 0; padding: 32px 16px; text-align: center; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; color: var(--sub);
}
.grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; height: 100%; display: flex; flex-direction: column; }
.card .pic { background: #06080B; padding: 8px 12px; }
.card .pic svg { display: block; width: 100%; height: auto; }
.card .info { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 2px; }
.card .maker, .card .gen { font-size: 12px; color: var(--mute); }
.card h2 { margin: 0; font-size: 16px; line-height: 1.4; }
.card .tags { margin-top: 6px; }

/* クイズ画面 */
.quiz { max-width: 560px; margin: 0 auto; padding: 0 20px 48px; display: flex; flex-direction: column; gap: 16px; }
.quiz h1 { margin-bottom: 0; }
.quiz-meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--sub); }
.quiz-meta strong { color: var(--text); }
.night { margin: 0; background: #05070A; border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.night svg { display: block; width: 100%; height: auto; }
.night figcaption { font-size: 11px; color: var(--mute); text-align: right; }
.quiz h2 { margin: 0; font-size: 18px; line-height: 1.4; }
.choices { display: flex; flex-direction: column; gap: 8px; }
.choice {
  min-height: 52px; padding: 8px 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  text-align: left; border-radius: 10px; border: 2px solid var(--line2); background: var(--panel);
  color: var(--text); font-size: 15px; font-weight: 500;
}
.choice:not(:disabled):hover { border-color: var(--mute); }
.choice.is-answer { border-color: var(--ok); background: var(--ok-bg); }
.choice.is-picked { border-color: var(--ng); background: var(--ng-bg); }
.badge { flex: none; padding: 2px 8px; border-radius: 4px; color: var(--bg); font-size: 12px; font-weight: 700; }
.is-answer .badge { background: var(--ok); }
.is-picked .badge { background: var(--ng); }
.result { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.verdict { margin: 0; font-size: 18px; font-weight: 700; outline: none; }
.verdict.ok { color: #7DB8FF; }
.verdict.ng { color: #FFB36B; }
.result p { margin: 0; }
.explain { font-size: 14px; color: var(--sub); }
.actions { display: flex; flex-direction: column; gap: 8px; }
.share { border: 1px dashed var(--line2); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.share-text { font-size: 13px; }
.share-actions { display: flex; flex-wrap: wrap; gap: 8px; }

footer { border-top: 1px solid var(--line); color: var(--mute); font-size: 12px; padding: 20px 0 32px; }
footer p { margin: 0; }

@media (max-width: 520px) {
  h1 { font-size: 22px; margin-top: 20px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .card .info { padding: 10px; }
  .card h2 { font-size: 14px; }
}
