/* ========== のりものクイズ / モバイル縦持ち主軸 ========== */

.launcher-link {
  display: inline-block;
  margin-bottom: 12px;
  padding: 6px 14px;
  font-size: 0.8rem;
  color: rgba(61,43,31,0.55);
  background: rgba(0,0,0,0.06);
  border-radius: 999px;
  text-decoration: none;
  transition: background 0.15s;
}
.launcher-link:hover { background: rgba(0,0,0,0.12); }

:root {
  --bg: #fff7e0;
  --bg2: #ffe9a8;
  --ink: #3d2b1f;
  --accent: #ff7a3d;
  --accent2: #ffd93d;
  --ok: #35c46a;
  --ng: #ff5a5a;
  --card: #ffffff;
  --shadow: 0 6px 0 rgba(0,0,0,.14);
  --radius: 22px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior: none;
}

body {
  font-family: "Hiragino Maru Gothic ProN", "ヒラギノ丸ゴ ProN", "Hiragino Sans",
               "Yu Gothic", "Meiryo", system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(170deg, var(--bg) 0%, var(--bg2) 100%);
  background-attachment: fixed;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100%;
  position: relative;
}

.screen { display: none; }
.screen.active { display: block; }

/* ---------- 汎用ボタン ---------- */
.big-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 72px;
  border: none;
  border-radius: var(--radius);
  font-size: 26px;
  font-weight: 800;
  font-family: inherit;
  color: #fff;
  cursor: pointer;
  transition: transform .08s;
}
.big-btn .btn-emoji { font-size: 28px; }
.big-btn.primary { background: var(--accent); box-shadow: 0 6px 0 #d4551f; }
.big-btn.ghost {
  background: #fff; color: var(--ink);
  box-shadow: 0 5px 0 rgba(0,0,0,.13);
  font-size: 20px; min-height: 60px;
}
.big-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #d4551f; }
.big-btn.ghost:active { box-shadow: 0 1px 0 rgba(0,0,0,.13); }

.text-btn {
  background: none; border: none; font-family: inherit;
  font-size: 16px; color: #8a6a4a; text-decoration: underline;
  padding: 12px; cursor: pointer;
}

.icon-btn {
  width: 48px; height: 48px; flex: 0 0 48px;
  border: none; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 0 rgba(0,0,0,.12);
  font-size: 22px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.icon-btn:active { transform: translateY(2px); box-shadow: none; }

/* ---------- スタート画面 ---------- */
.start-inner {
  padding: calc(24px + var(--safe-t)) 20px calc(28px + var(--safe-b));
  text-align: center;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}
.start-emoji { font-size: 44px; letter-spacing: 4px; }
.start-emoji.small { font-size: 30px; opacity: .85; margin-bottom: 8px; }
.title {
  font-size: 52px; line-height: 1.1; margin: 6px 0 0;
  color: var(--accent);
  text-shadow: 3px 3px 0 #fff, 6px 6px 0 rgba(0,0,0,.08);
  letter-spacing: 2px;
}
.subtitle { font-size: 19px; margin: 10px 0 4px; color: #8a6a4a; font-weight: 700; }

.mode-row { margin-top: 20px; }
.mode-label { font-size: 15px; color: #8a6a4a; font-weight: 700; display: block; margin-bottom: 8px; }
.seg { display: flex; gap: 8px; }
.seg-btn {
  flex: 1; min-height: 54px; border: 3px solid transparent;
  border-radius: 16px; background: #fff; font-family: inherit;
  font-size: 17px; font-weight: 800; color: #a8896a; cursor: pointer;
  box-shadow: 0 3px 0 rgba(0,0,0,.1);
}
.seg-btn.active { border-color: var(--accent); color: var(--accent); background: #fff3ea; }
.seg-btn:active { transform: translateY(2px); }

.note { font-size: 13px; color: #a08a70; margin: 4px 0 0; }

/* ---------- クイズ画面 ---------- */
/* 3さい児が スクロールしなくても 3まい ぜんぶ 見えるように
   画面の たかさに ぴったり おさめる */
#screen-quiz.active {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  padding: calc(10px + var(--safe-t)) 14px calc(14px + var(--safe-b));
  gap: 8px;
}

.quiz-head { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }

.progress { flex: 1; display: flex; gap: 5px; justify-content: center; flex-wrap: wrap; }
.dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: rgba(0,0,0,.13);
}
.dot.done { background: var(--ok); }
.dot.done.miss { background: #ffb03a; }
.dot.now { background: var(--accent); transform: scale(1.35); }

.star-count {
  font-size: 18px; font-weight: 800; color: #c78a1a;
  background: #fff; border-radius: 999px; padding: 8px 12px;
  box-shadow: 0 3px 0 rgba(0,0,0,.1); white-space: nowrap;
}

.question-card {
  flex: 0 0 auto;
  background: #fff;
  border-radius: var(--radius);
  padding: 10px 16px 12px;
  box-shadow: var(--shadow);
  text-align: center;
}
.q-lead { margin: 0; font-size: 15px; color: #a08a70; font-weight: 700; }
.q-main { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 2px; }
.q-name {
  font-size: clamp(28px, 8vw, 40px);
  font-weight: 900;
  color: var(--accent);
  letter-spacing: 1px;
  line-height: 1.2;
}
.speak-btn {
  flex: 0 0 56px; width: 56px; height: 56px;
  border: none; border-radius: 50%;
  background: var(--accent2); box-shadow: 0 4px 0 #d9ad13;
  font-size: 26px; cursor: pointer;
}
.speak-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #d9ad13; }
.speak-btn.pulse { animation: pulse .9s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(1);} 50% { transform: scale(1.12);} }

.q-hint {
  margin: 6px 0 0; font-size: 14px; color: #8a6a4a; line-height: 1.4;
  min-height: 20px;
}

/* ---------- せんたくし（しゃしん） ---------- */
.choices {
  flex: 1 1 auto;
  min-height: 0;          /* flex子が はみ出さないように */
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.choice {
  position: relative;
  flex: 1 1 0;
  min-height: 0;          /* 画像の たかさで おしひろげない */
  border: 5px solid #fff;
  border-radius: var(--radius);
  overflow: hidden;
  background: #eee;
  box-shadow: var(--shadow);
  cursor: pointer;
  padding: 0;
  transition: transform .1s;
}
.choice img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.choice:active { transform: scale(.98); }
.choice .badge {
  position: absolute; top: 8px; left: 8px;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.92); color: var(--ink);
  font-size: 18px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,.2);
}
.choice.correct { border-color: var(--ok); animation: pop .4s; }
.choice.wrong { border-color: var(--ng); animation: shake .45s; }
.choice.dim { opacity: .35; }
.choice .overlay {
  position: absolute; inset: 0;
  display: none; align-items: center; justify-content: center;
  font-size: 84px;
}
.choice.correct .overlay { display: flex; color: var(--ok); text-shadow: 0 0 12px #fff; }
.choice.wrong .overlay { display: flex; color: var(--ng); text-shadow: 0 0 12px #fff; }

@keyframes pop { 0% { transform: scale(1);} 45% { transform: scale(1.05);} 100% { transform: scale(1);} }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(9px); }
  60% { transform: translateX(-7px); }
  80% { transform: translateX(5px); }
}

/* ---------- フィードバック ---------- */
.feedback {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(255, 247, 224, .93);
  display: none;
  align-items: center; justify-content: center;
  padding: 24px;
}
.feedback.show { display: flex; animation: fadein .18s; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.feedback-inner { text-align: center; max-width: 420px; width: 100%; }
.fb-mark { font-size: 78px; line-height: 1; animation: pop .45s; }
.fb-img {
  width: 100%; max-height: 42vh; object-fit: cover;
  border-radius: var(--radius); border: 6px solid #fff;
  box-shadow: var(--shadow); margin: 10px 0;
}
.fb-text {
  font-size: 34px; font-weight: 900; color: var(--accent);
  text-shadow: 2px 2px 0 #fff;
}

/* ---------- けっか ---------- */
.result-inner {
  padding: calc(30px + var(--safe-t)) 20px calc(30px + var(--safe-b));
  text-align: center;
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; justify-content: center; gap: 14px;
}
.result-emoji { font-size: 76px; }
.result-title { font-size: 34px; margin: 0; color: var(--accent); text-shadow: 2px 2px 0 #fff; }
.result-stars { font-size: 30px; line-height: 1.4; word-break: break-word; }
.result-score { font-size: 20px; font-weight: 800; color: #8a6a4a; margin: 0 0 6px; }

/* ---------- クレジット ---------- */
#screen-credits.active { display: block; padding-bottom: calc(30px + var(--safe-b)); }
.credits-head {
  display: flex; align-items: center; gap: 12px;
  padding: calc(14px + var(--safe-t)) 16px 10px;
  position: sticky; top: 0; background: var(--bg); z-index: 2;
}
.credits-head h2 { font-size: 20px; margin: 0; }
.credits-body { padding: 0 16px; }
.credits-lead { font-size: 14px; line-height: 1.7; color: #6b5540; }
.credits-list { list-style: none; padding: 0; margin: 0; }
.credits-list li {
  background: #fff; border-radius: 14px; padding: 12px 14px; margin-bottom: 10px;
  font-size: 13px; line-height: 1.6; box-shadow: 0 3px 0 rgba(0,0,0,.07);
  display: flex; gap: 12px; align-items: center;
}
.credits-list img { width: 64px; height: 48px; object-fit: cover; border-radius: 8px; flex: 0 0 64px; }
.credits-list .cname { font-weight: 800; display: block; font-size: 15px; }
.credits-list a { color: #c4622a; word-break: break-all; }

/* ---------- 紙吹雪 ---------- */
#confetti {
  position: fixed; inset: 0; pointer-events: none; z-index: 60;
  display: none;
}
#confetti.on { display: block; }

/* ---------- 横向き / 大きい画面 ---------- */
@media (min-width: 700px) and (orientation: landscape) {
  .choices { flex-direction: row; }
  .choice { min-height: 150px; }
}
