/* ズバリいくら？ — スマホ縦画面を優先 */
:root {
  --bg: #fff6e5;
  --ink: #2a1f14;
  --muted: #7a6a58;
  --line: #eee2cf;
  --card: #fff;
  --red: #e8402f;
  --red-d: #c22d1e;
  --yellow: #ffc531;
  --g: #2fa86a;
  --y: #d9a600;
  --o: #ef7d1a;
  --r: #e0424a;
  --radius: 18px;
  --shadow: 0 6px 24px rgba(80, 50, 10, .10);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
button { touch-action: manipulation; }
a { color: var(--red-d); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 広告表記の帯 */
.pr-bar {
  margin: 0;
  padding: 4px 10px calc(4px);
  padding-top: max(4px, env(safe-area-inset-top));
  background: var(--ink);
  color: #fff;
  font-size: 11.5px;
  text-align: center;
  letter-spacing: .02em;
}

/* ヘッダー */
.top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 6px 12px 6px;
}
.logo { margin: 0; font-size: 24px; font-weight: 900; letter-spacing: .01em; line-height: 1.2; }
.logo-z {
  display: inline-block;
  padding: 0 8px 1px;
  margin-right: 2px;
  background: var(--red);
  color: #fff;
  border-radius: 8px 3px 8px 3px;
  transform: rotate(-3deg);
}
.icon-btn {
  width: 38px; height: 38px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: #fff;
  font-size: 17px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--ink);
}
.icon-btn:active { transform: translateY(2px); box-shadow: none; }
.top-left { justify-self: start; }
.top-right { justify-self: end; display: flex; gap: 6px; }
@media (max-width: 420px) {
  .top { gap: 6px; }
  .top .logo { font-size: 21px; }
  .top .icon-btn { width: 34px; height: 34px; font-size: 15px; }
  .top-right { gap: 4px; }
}

/* 属性（年代・性別）の入力 */
.profile-card h2 { margin: 4px 0 6px; font-size: 21px; text-align: center; line-height: 1.4; }
.profile-card .lead { margin: 0 0 14px; text-align: center; font-size: 14px; }
.profile-form { margin: 0; }
.seg-field { margin: 0 0 14px; padding: 0; border: 0; min-width: 0; }
.seg-field legend { margin-bottom: 6px; padding: 0; font-size: 14px; font-weight: 800; }
.seg-opts { display: grid; gap: 8px; }
.seg-opts.cols-3 { grid-template-columns: repeat(3, 1fr); }
.seg-opts.cols-4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 440px) { .seg-opts.cols-4 { grid-template-columns: repeat(4, 1fr); } }
.seg-opt { position: relative; display: block; cursor: pointer; }
.seg-opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.seg-opt span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 6px 4px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: #fff;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 3px 0 var(--ink);
}
.seg-opt input:checked + span { background: var(--red); color: #fff; }
.seg-opt input:focus-visible + span { outline: 3px solid var(--yellow); outline-offset: 2px; }
.btn:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; transform: none; }
.dlg .profile-form .btn.wide { margin-top: 4px; }

main {
  flex: 1;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 0 12px 16px;
}

/* カード */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px 18px;
  margin-bottom: 14px;
}
.card.center { text-align: center; padding: 28px 18px; }
.card h2 { margin: 6px 0 8px; font-size: 20px; }
.big-emoji { font-size: 56px; line-height: 1.2; }
.sample-banner {
  margin: 0 0 8px;
  padding: 4px 10px;
  border: 2px dashed var(--o);
  border-radius: 10px;
  background: #fff1df;
  color: #8a4b00;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

/* ボタン */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 46px;
  padding: 10px 18px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--ink);
}
.btn:active { transform: translateY(3px); box-shadow: none; }
.btn.primary { background: var(--red); color: #fff; }
.btn.wide { display: flex; width: 100%; margin-top: 12px; }
.btn.big { min-height: 54px; font-size: 18px; }
.btn:focus-visible, .nudge:focus-visible, .icon-btn:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

/* 問題 */
/* 見出しは1行に収める（ジャンル名が長いときは「…」で切る） */
.q-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.q-no { flex: none; font-size: 20px; font-weight: 900; white-space: nowrap; }
.q-no small { font-size: 13px; color: var(--muted); font-weight: 700; }
.dots { flex: none; display: inline-flex; gap: 4px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.dot.done { background: var(--ink); }
.dot.now { background: var(--red); transform: scale(1.25); }
.chip {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-left: auto;
  padding: 2px 10px;
  border-radius: 999px;
  background: #fff1c9;
  color: #7a5200;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.q-day { flex: none; font-weight: 700; white-space: nowrap; }
.q-img {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 8px auto 0;
  width: 100%;
  max-width: 340px;
  aspect-ratio: 1 / 1;
  max-height: min(32vh, 300px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.q-img img { width: 100%; height: 100%; object-fit: contain; }
.emoji-visual { font-size: min(24vw, 20vh, 140px); line-height: 1; }
.img-fallback { color: var(--muted); font-size: 13px; padding: 12px; }
.q-name { margin: 10px 0 0; font-size: 16px; line-height: 1.45; font-weight: 800; }
.q-meta { margin: 0; }

/* 予想の入力 */
.panel { margin-top: 8px; padding-top: 8px; border-top: 2px dashed var(--line); }
.guess-label { display: block; text-align: center; font-weight: 800; font-size: 14px; color: var(--muted); }
.guess-field {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  margin: 2px auto 2px;
  padding: 2px 14px;
  max-width: 300px;
  border-bottom: 3px solid var(--ink);
}
.yen-mark, .yen-unit { font-size: 20px; font-weight: 900; }
.guess-input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  text-align: center;
  padding: 0;
  font-size: 34px;
  line-height: 1.25;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
  outline: none;
}
.guess-input:focus { background: #fff8e1; border-radius: 8px; }
.slider-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.nudge {
  flex: none;
  width: 44px; height: 44px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: #fff;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.nudge:active { background: #fff1c9; }
.range {
  --fill: 50%;
  flex: 1;
  min-width: 0;
  height: 40px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  touch-action: pan-y;
}
.range::-webkit-slider-runnable-track {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--red) 0 var(--fill), var(--line) var(--fill) 100%);
}
.range::-moz-range-track { height: 12px; border-radius: 6px; background: var(--line); }
.range::-moz-range-progress { height: 12px; border-radius: 6px; background: var(--red); }
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 34px; height: 34px;
  margin-top: -11px;
  border: 4px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 2px 4px rgba(0, 0, 0, .25);
}
.range::-moz-range-thumb {
  width: 26px; height: 26px;
  border: 4px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
}
.range:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; border-radius: 8px; }
.scale { position: relative; height: 18px; margin: 0 69px 0 69px; font-size: 11px; color: var(--muted); }
.scale span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }

/* 答え合わせ */
.panel.reveal { text-align: center; }
.judge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 auto 8px;
  padding: 8px 14px;
  border-radius: 14px;
  color: #fff;
  font-weight: 900;
  animation: pop .45s cubic-bezier(.2, 1.6, .4, 1);
}
.judge-g { background: var(--g); }
.judge-y { background: var(--yellow); color: var(--ink); }
.judge-o { background: var(--o); }
.judge-r { background: var(--r); }
.judge-emoji { font-size: 26px; }
.judge-label { font-size: 22px; }
.judge-pts { margin-left: auto; font-size: 24px; }
.judge-pts small { font-size: 13px; }
@keyframes pop { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.answer-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 0 12px;
  margin: 4px auto 0;
  max-width: 320px;
  text-align: left;
}
.answer-grid dt { font-size: 13px; font-weight: 800; color: var(--muted); }
.answer-grid dd { margin: 0; text-align: right; font-weight: 900; font-variant-numeric: tabular-nums; }
.answer-grid .answer { font-size: 34px; color: var(--red-d); }
.answer-grid .mine { font-size: 19px; }
.diff { margin: 2px 0 10px; font-weight: 700; }
.rank-note { margin: -4px 0 10px; font-size: 13px; font-weight: 700; color: #8a5a00; }
/* 特価（セール中）の商品 */
.chip.sale { background: #ffe1dc; color: #b3261e; }
.sale-note { margin: -4px 0 10px; font-size: 14px; font-weight: 800; color: var(--red-d); }
.sale-badge { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 4px; background: #ffe1dc; color: #b3261e; font-size: 11px; font-weight: 800; white-space: nowrap; }
.shop-link { width: 100%; background: #fff8e1; }
.pr {
  display: inline-block;
  padding: 0 6px;
  border: 1.5px solid currentColor;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.5;
  letter-spacing: .04em;
  color: var(--muted);
}
.note { margin: 8px 0 0; text-align: left; }

/* 結果 */
.result { text-align: center; }
.r-title { margin: 4px 0 0; font-weight: 800; color: var(--muted); }
.r-seg {
  display: inline-block;
  margin: 4px 0 0;
  padding: 1px 12px;
  border-radius: 999px;
  background: #fff1c9;
  color: #7a5200;
  font-size: 13px;
  font-weight: 800;
}
.r-score { font-size: 72px; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--red-d); }
.r-score small { font-size: 24px; margin-left: 2px; color: var(--ink); }
.r-emojis { font-size: 34px; letter-spacing: .08em; line-height: 1.3; }
.r-comment { margin: 4px 0 12px; font-size: 17px; font-weight: 800; }
.share-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.x-btn { background: #111; color: #fff; }
.r-streak { margin: 14px 0 0; font-weight: 700; font-size: 14px; }
.next-box {
  margin-top: 12px;
  padding: 10px;
  border-radius: 12px;
  background: #fff1c9;
  font-weight: 700;
}
.next-box time { font-size: 20px; font-weight: 900; font-variant-numeric: tabular-nums; margin-left: 4px; }
.r-list-card h3 { margin: 2px 0 8px; font-size: 16px; }
.r-list { list-style: none; margin: 0; padding: 0; }
.r-item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.r-item:first-child { border-top: 0; }
.r-thumb {
  width: 64px; height: 64px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.r-thumb img { width: 100%; height: 100%; object-fit: contain; }
.r-thumb .emoji-visual { font-size: 38px; }
.r-thumb .img-fallback { font-size: 9px; padding: 2px; }
.r-name { margin: 0; font-size: 13px; font-weight: 700; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.r-nums { margin: 2px 0; font-size: 13px; font-variant-numeric: tabular-nums; }
.r-link { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 800; }
.r-judge { text-align: center; }
.r-emoji { display: block; font-size: 24px; line-height: 1.2; }
.r-pts { font-size: 12px; }
.r-pts b { font-size: 18px; }

/* フッター */
.foot {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.7;
}
.foot p { margin: 0 0 6px; }
.foot strong { color: var(--ink); }
.credit a { color: var(--muted); }
/* Yahoo! JAPAN のクレジットは、色を変えたり極端に小さくしたりしてはいけない（規定）。
   サイト全体のリンクの色を当てず、ブラウザの標準の色に戻し、文字もフッターのほかより大きめにする */
.yj-credit { font-size: 13px; }
.yj-credit a { color: revert; }

/* ダイアログ */
.dlg {
  width: min(92vw, 440px);
  max-height: 86vh;
  padding: 18px 18px 20px;
  border: 0;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
  color: var(--ink);
}
.dlg::backdrop { background: rgba(42, 31, 20, .5); }
.dlg h2 { margin: 0 0 10px; font-size: 20px; }
.dlg h3 { margin: 16px 0 6px; font-size: 14px; }
.dlg-close-form { position: absolute; top: 8px; right: 8px; margin: 0; }
.dlg-close { width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--bg); font-size: 20px; font-weight: 900; cursor: pointer; }
.help-list { padding-left: 1.3em; margin: 0 0 10px; }
.help-list li { margin-bottom: 6px; }
.judge-table { width: 100%; border-collapse: collapse; margin: 6px 0 10px; font-size: 14px; }
.judge-table td { padding: 4px 6px; border-bottom: 1px solid var(--line); }
.judge-table td:first-child { width: 2em; font-size: 18px; }
.stat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; text-align: center; }
.stat-grid b { display: block; font-size: 26px; font-weight: 900; font-variant-numeric: tabular-nums; }
.stat-grid span { font-size: 11px; color: var(--muted); }
.bars { display: grid; gap: 4px; }
.bar-row { display: grid; grid-template-columns: 52px 1fr 28px; gap: 8px; align-items: center; font-size: 12px; }
.bar { height: 16px; border-radius: 4px; background: var(--bg); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--red); border-radius: 4px; }
.bar-n { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.jc-row { display: flex; gap: 14px; justify-content: center; font-size: 15px; }
.jc { display: inline-flex; gap: 4px; align-items: center; }

/* トースト */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.r-sample-note { margin: 12px 0 0; }

/* 背の低い画面（小さいスマホ・ブラウザのバーが大きいとき） */
@media (max-height: 700px) {
  .q-img { max-height: 26vh; }
  .q-name { font-size: 15px; }
  .btn.big { min-height: 50px; }
}
/* 小さい画面 */
@media (max-width: 360px) {
  .logo { font-size: 21px; }
  .guess-input { font-size: 32px; }
  .r-score { font-size: 60px; }
  .stat-grid b { font-size: 21px; }
}
/* 横に広い画面（PC） */
@media (min-width: 720px) {
  body { background: radial-gradient(circle at 20% 10%, #ffe9b8 0, transparent 40%), radial-gradient(circle at 85% 80%, #ffd9cf 0, transparent 40%), var(--bg); }
  .card { padding: 18px 22px 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
