/* 海の環境クイズ（quiz.bluehub.jp）
   BlueHub共通デザインシステム（_docs/09_デザイン.md）準拠。トップ(bluehub.jp)の部品を流用。
   ※ロジック(js/quiz.js)・API・DOMのIDは不変。Bootstrapは撤去し本CSSで全て賄う。 */

:root {
  --bh-ink: #102b3f;
  --bh-muted: #5d7180;
  --bh-blue: #0b72b9;
  --bh-cyan: #18aeca;
  --bh-sea: #78d9b3;
  --bh-coral: #ff8c66;
  --bh-paper: #f5fbfd;
  --bh-line: rgba(16, 43, 63, .12);
  --bh-radius: 16px;
  --slant: 22px;
}

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

body {
  background-color: #eef7f7;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.06 0 0 0 0 0.28 0 0 0 0 0.36 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
  color: var(--bh-ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Noto Sans JP", "Hiragino Kaku Gothic Pro", Meiryo, sans-serif;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
.container { max-width: 960px; margin: 0 auto; padding: 0 20px; }

/* ===== ヘッダー ===== */
.site-header {
  background: rgba(255, 255, 255, .88);
  border-bottom: 1px solid var(--bh-line);
}
.header-util {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 8px 0 0; font-size: .78rem; color: var(--bh-muted); font-weight: 700;
}
.header-util .util-note { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-brand { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 0 4px; text-align: center; }
.brand-logo { width: min(240px, 56vw); height: auto; }
.brand-tagline { margin: 0; font-size: .84rem; font-weight: 800; color: #0f6c93; letter-spacing: .1em; }
.global-nav {
  display: flex; align-items: center; gap: 2px; min-width: 0;
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding: 6px 0 10px;
}
.global-nav::-webkit-scrollbar { display: none; }
.global-nav > a:first-child { margin-left: auto; }
.global-nav > a:last-child { margin-right: auto; }
.global-nav a { flex: 0 0 auto; padding: 8px 14px; border-radius: 999px; font-size: .9rem; font-weight: 800; color: #0b5687; transition: background .15s; }
.global-nav a:hover { background: rgba(24, 174, 202, .12); }
.global-nav a.is-current { background: rgba(11, 114, 185, .12); }

/* ===== 言語スイッチャー（多言語対応） ===== */
.header-lang { display: flex; justify-content: center; padding: 0 0 10px; }
.lang-switch { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 1px solid rgba(0, 0, 0, .15); border-radius: 999px; background: #fff; font-size: .78rem; white-space: nowrap; }
.lang-switch a { color: #5d7180; font-weight: 600; text-decoration: none; }
.lang-switch a + a { border-left: 1px solid rgba(0, 0, 0, .12); padding-left: 6px; }
.lang-switch a.is-active { color: #0b72b9; font-weight: 800; }

/* ===== ボタン共通 ===== */
.btn-primary-bh {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 50px; padding: 0 26px; border: none; border-radius: 999px;
  background: #073e66; color: #fff; font-size: .95rem; font-weight: 800; font-family: inherit;
  box-shadow: 0 14px 30px rgba(7, 62, 102, .24); cursor: pointer;
  transition: transform .15s, background .15s; text-align: center;
}
.btn-primary-bh:hover { background: #0b5687; transform: translateY(-2px); }
.btn-ghost-bh {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px; border: 1px solid var(--bh-line); border-radius: 999px;
  background: rgba(255, 255, 255, .8); color: #0b5687; font-size: .9rem; font-weight: 800; cursor: pointer;
}

/* ===== 画面共通の見出し ===== */
main { padding: 26px 0 8px; }
.corner-head { text-align: center; margin-bottom: 22px; }
.corner-en { display: block; font-size: .78rem; font-weight: 900; letter-spacing: .22em; color: var(--bh-cyan); }
.corner-head h1, .corner-head h2 {
  margin: 4px 0 6px; font-size: clamp(1.4rem, 3.4vw, 2rem); font-weight: 900; letter-spacing: .02em;
  text-shadow: 2px 0 0 #fff, -2px 0 0 #fff, 0 2px 0 #fff, 0 -2px 0 #fff, 2px 2px 0 #fff, -2px -2px 0 #fff, 2px -2px 0 #fff, -2px 2px 0 #fff, 0 6px 14px rgba(16, 43, 63, .14);
}
.corner-wave { display: block; margin: 2px auto 8px; }
.corner-lead { max-width: 640px; margin: 0 auto; color: var(--bh-muted); font-size: .95rem; font-weight: 600; }

/* ===== スタート画面（カテゴリ選択） ===== */
.start-hero { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 18px; }
.start-hero img { width: 96px; height: auto; }

#category-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.cat-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  width: 100%; min-height: 108px; padding: 18px 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.97), rgba(245,251,253,.92));
  border: 1px solid var(--bh-line); border-radius: var(--bh-radius);
  box-shadow: 0 6px 20px rgba(16, 43, 63, .07); color: inherit; cursor: pointer; font-family: inherit;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.cat-card:hover { transform: translateY(-4px); border-color: rgba(24, 174, 202, .36); box-shadow: 0 14px 30px rgba(16, 43, 63, .13); }
.cat-card .cat-emoji { font-size: 1.7rem; line-height: 1; filter: drop-shadow(0 2px 3px rgba(16, 43, 63, .12)); }
.cat-card:hover .cat-emoji { transform: scale(1.12); transition: transform .18s; }
.cat-card .cat-name { font-size: 1rem; font-weight: 900; line-height: 1.4; }
.cat-card .cat-count { font-size: .78rem; font-weight: 800; color: var(--bh-muted); }
.cat-empty { grid-column: 1 / -1; text-align: center; color: var(--bh-muted); font-weight: 700; padding: 24px; }

/* ===== 出題画面 ===== */
.quiz-box {
  max-width: 720px; margin: 0 auto; padding: 24px 24px 22px;
  background: #fff; border: 1px solid var(--bh-line); border-radius: var(--bh-radius);
  box-shadow: 0 10px 30px rgba(16, 43, 63, .1);
}
.quiz-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.quiz-cat { padding: 4px 13px; border-radius: 999px; background: rgba(24, 174, 202, .14); color: #0e7e93; font-size: .78rem; font-weight: 900; }
.quiz-progress-num { color: var(--bh-muted); font-size: .82rem; font-weight: 800; }
.quiz-bar { height: 8px; border-radius: 999px; background: rgba(16, 43, 63, .1); overflow: hidden; margin-bottom: 18px; }
.quiz-bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--bh-cyan), var(--bh-sea)); transition: width .3s; }
.quiz-q { margin: 0 0 16px; font-size: 1.05rem; font-weight: 800; line-height: 1.7; display: flex; gap: 10px; }
.quiz-q::before { content: "Q."; color: var(--bh-coral); font-weight: 900; font-size: 1.2rem; }

.quiz-choices { display: grid; gap: 10px; }
.quiz-choice {
  width: 100%; text-align: left; min-height: 52px; padding: 13px 16px;
  border: 1.5px solid var(--bh-line); border-radius: 12px; background: var(--bh-paper);
  font-size: .95rem; font-weight: 700; color: var(--bh-ink); cursor: pointer; line-height: 1.6;
  font-family: inherit; transition: border-color .15s, background .15s;
}
.quiz-choice:hover:not(:disabled) { border-color: var(--bh-cyan); background: #fff; }
.quiz-choice:disabled { cursor: default; }
.quiz-choice.is-correct { border-color: #1d9e6f; background: rgba(120, 217, 179, .22); }
.quiz-choice.is-wrong { border-color: #d95b3c; background: rgba(255, 140, 102, .16); }

/* 解説 */
.quiz-explain-wrap { margin-top: 16px; }
.quiz-verdict { margin: 0 0 12px; font-size: 1.05rem; font-weight: 900; }
.quiz-verdict.ok { color: #1d9e6f; }
.quiz-verdict.ng { color: #d95b3c; }

/* カメ博士の吹き出し */
.kame-balloon { display: flex; gap: 12px; align-items: flex-start; }
.kame-face { flex: 0 0 auto; width: 56px; height: 56px; border-radius: 50%; overflow: hidden; background: var(--bh-paper); border: 1px solid var(--bh-line); }
.kame-face img { width: 100%; height: 100%; object-fit: cover; }
.kame-says { position: relative; flex: 1; min-width: 0; background: rgba(24, 174, 202, .08); border: 1px solid rgba(24, 174, 202, .2); border-radius: 14px; padding: 12px 16px; }
.kame-says::before { content: ""; position: absolute; left: -8px; top: 18px; width: 14px; height: 14px; background: rgba(24, 174, 202, .08); border-left: 1px solid rgba(24, 174, 202, .2); border-bottom: 1px solid rgba(24, 174, 202, .2); transform: rotate(45deg); }
.kame-name { font-size: .82rem; font-weight: 900; color: #0e7e93; margin-bottom: 4px; }
.kame-says p { margin: 0; font-size: .9rem; color: #315165; font-weight: 600; line-height: 1.75; }
.kame-evidence { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 8px 13px; border-radius: 999px; background: #fff; border: 1px solid var(--bh-line); color: #0b5687; font-size: .8rem; font-weight: 800; word-break: break-word; }
.quiz-next-wrap { text-align: center; margin-top: 18px; }

/* ===== 結果画面 ===== */
.result-box { text-align: center; max-width: 640px; margin: 0 auto; }
.result-score { font-size: clamp(2.4rem, 8vw, 3.4rem); font-weight: 900; color: var(--bh-blue); margin: 6px 0; }
.result-message { font-size: 1.05rem; font-weight: 700; color: var(--bh-ink); margin: 0 0 20px; }
.result-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-bottom: 26px; }
.result-events { text-align: left; margin: 22px auto 0; }
.result-events-head { text-align: center; }

/* ===== フッター ===== */
.site-footer { padding: 34px 0 90px; background: #092f4d; color: rgba(255, 255, 255, .74); font-size: .88rem; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; }
.site-footer p { margin: 0; }
.footer-logo { width: 120px; padding: 8px 12px; border-radius: 8px; background: #fff; }

/* ===== 右端 SHARE + TOP ===== */
.side-rail { position: fixed; right: 12px; bottom: 18px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.rail-label { writing-mode: vertical-rl; margin: 0 auto 2px; font-size: .66rem; font-weight: 900; letter-spacing: .2em; color: var(--bh-muted); }
.rail-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--bh-line); background: #fff; box-shadow: 0 8px 20px rgba(16, 43, 63, .18); display: grid; place-items: center; font-size: .68rem; font-weight: 900; cursor: pointer; text-align: center; line-height: 1.1; }
.rail-btn:hover { transform: translateY(-2px); }
.rail-x { color: #000; } .rail-line { color: #06c755; } .rail-fb { color: #1877f2; } .rail-top { color: #0b5687; background: #eaf6fb; }

/* ===== レスポンシブ ===== */
@media (max-width: 780px) {
  #category-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quiz-box { padding: 20px 18px; }
  :root { --slant: 16px; }
}
@media (max-width: 480px) {
  .result-actions .btn-primary-bh, .result-actions .btn-ghost-bh { width: 100%; }
}
