@charset "UTF-8";

/* ===========================================================================
   ポケモン相性クイズ - スタイル
   設計方針: 可読性・操作性 → フィードバック → 装飾 の順。基準は375x667の縦画面。
   =========================================================================== */

:root {
  --bg-0: #070a1c;
  --bg-1: #0f1533;
  --bg-2: #171e46;
  --card: rgba(23, 30, 70, 0.82);
  --card-solid: #1b2350;
  --line: rgba(255, 255, 255, 0.14);
  --line-strong: rgba(255, 255, 255, 0.28);
  --text: #f2f5ff;
  --text-dim: #a8b2dd;
  --accent: #ffd93d;
  --accent-2: #ff5d8f;
  --accent-3: #4fe3c1;
  --ok: #3ddc84;
  --ng: #ff5468;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  --tap: 200ms;
  --font: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", YuGothic,
    "Noto Sans JP", Meiryo, system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-0);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* --------------------------------------------------------------------------
   背景演出
   -------------------------------------------------------------------------- */

.bg-fx {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% 0%, var(--bg-2) 0%, var(--bg-1) 45%, var(--bg-0) 100%);
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.45;
  animation: drift 18s ease-in-out infinite alternate;
}
.orb-1 { width: 44vmax; height: 44vmax; left: -14vmax; top: -10vmax; background: #4f5dff; }
.orb-2 { width: 38vmax; height: 38vmax; right: -12vmax; top: 18vh; background: #ff4f9d; animation-delay: -6s; }
.orb-3 { width: 40vmax; height: 40vmax; left: 20vw; bottom: -18vmax; background: #17c9a8; animation-delay: -11s; }

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(4vw, -3vh, 0) scale(1.15); }
}

.grid-lines {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(80% 60% at 50% 30%, #000 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(80% 60% at 50% 30%, #000 30%, transparent 100%);
}

/* --------------------------------------------------------------------------
   レイアウト
   -------------------------------------------------------------------------- */

#app {
  position: relative;
  z-index: 1;
  flex: 1;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 14px 0;
}

.screen { display: none; }
.screen.is-active { display: block; animation: screen-in 260ms ease-out; }

@keyframes screen-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.site-footer {
  position: relative;
  z-index: 1;
  padding: 18px 16px calc(14px + env(safe-area-inset-bottom));
  text-align: center;
}
.site-footer nav {
  margin-bottom: 8px;
}
.site-footer a {
  color: rgba(242, 245, 255, 0.78);
  font-size: 11px;
  font-weight: 800;
  text-underline-offset: 3px;
}
.site-footer a:hover {
  color: var(--accent);
}
.site-footer a:focus-visible {
  outline: 3px solid var(--accent-3);
  outline-offset: 3px;
  border-radius: 2px;
}
.site-footer p {
  max-width: 760px;
  margin: 0;
  margin-inline: auto;
  font-size: 10px;
  line-height: 1.6;
  color: rgba(168, 178, 221, 0.55);
}

/* --------------------------------------------------------------------------
   ボタン共通
   -------------------------------------------------------------------------- */

.btn {
  position: relative;
  overflow: hidden;
  min-height: 48px;
  padding: 12px 20px;
  border: 0;
  border-radius: 999px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: transform var(--tap) ease, box-shadow var(--tap) ease, opacity var(--tap) ease;
}
.btn:active { transform: scale(0.96); }
.btn:focus-visible { outline: 3px solid var(--accent-3); outline-offset: 3px; }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn:disabled:active { transform: none; }

.btn-primary {
  color: #201400;
  background: linear-gradient(135deg, #ffe680 0%, var(--accent) 45%, #ff9f45 100%);
  box-shadow: 0 8px 0 #b8791a, 0 14px 26px rgba(255, 176, 61, 0.32);
}
.btn-primary:active { box-shadow: 0 3px 0 #b8791a, 0 8px 16px rgba(255, 176, 61, 0.28); transform: translateY(4px) scale(0.99); }
.btn-primary:disabled { box-shadow: 0 8px 0 rgba(184, 121, 26, 0.4); }

.btn-ghost {
  border: 2px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.btn-huge { width: 100%; min-height: 62px; font-size: 22px; }
.btn-wide { flex: 1; }

.btn-shine {
  position: absolute;
  top: 0;
  left: -60%;
  width: 40%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.7), transparent);
  transform: skewX(-20deg);
  animation: shine 3.4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes shine {
  0%, 62% { left: -60%; }
  86%, 100% { left: 130%; }
}

.sound-toggle {
  position: fixed;
  z-index: 30;
  top: max(10px, env(safe-area-inset-top));
  right: 10px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(10, 14, 38, 0.7);
  backdrop-filter: blur(8px);
  font-size: 18px;
  cursor: pointer;
}
.sound-toggle .sound-off { display: none; }
.sound-toggle[aria-pressed="false"] .sound-on { display: none; }
.sound-toggle[aria-pressed="false"] .sound-off { display: inline; }

/* --------------------------------------------------------------------------
   タイトル画面
   -------------------------------------------------------------------------- */

.title-card {
  margin-top: 3vh;
  padding: 30px 20px 26px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--card);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  text-align: center;
}

.title-kicker {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.4em;
  color: var(--accent-3);
}

.title-logo {
  margin: 0 0 14px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0.02em;
}
.title-subject {
  display: block;
  margin-bottom: 7px;
  color: var(--accent-3);
  font-size: 12px;
  letter-spacing: 0.24em;
  text-shadow: none;
}
.title-line-1 {
  display: block;
  font-size: clamp(34px, 12vw, 54px);
  background: linear-gradient(180deg, #fff 20%, var(--accent) 55%, #ff8a3d 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.45));
}
.title-line-2 {
  display: block;
  margin-top: 4px;
  font-size: clamp(46px, 17vw, 76px);
  background: linear-gradient(180deg, #fff 15%, #7fd9ff 50%, #4f5dff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.5));
}

.title-lead {
  margin: 0 0 22px;
  font-size: 14px;
  line-height: 1.75;
  color: var(--text-dim);
}

.seo-intro {
  margin: 18px 0 24px;
  padding: 24px 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    linear-gradient(145deg, rgba(79, 227, 193, 0.08), transparent 34%),
    rgba(12, 17, 43, 0.82);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
}
.seo-intro-kicker {
  margin: 0 0 6px;
  color: var(--accent-3);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.22em;
}
.seo-intro h2 {
  margin: 0 0 12px;
  font-size: clamp(20px, 5vw, 26px);
  line-height: 1.45;
}
.seo-intro > p {
  margin: 0;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.9;
}
.seo-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin: 18px 0;
}
.seo-mode-grid article {
  position: relative;
  padding: 14px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
}
.seo-mode-grid article > span {
  position: absolute;
  top: -8px;
  right: 5px;
  color: rgba(255, 217, 61, 0.11);
  font-size: 42px;
  font-weight: 900;
  line-height: 1;
}
.seo-mode-grid h3 {
  position: relative;
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 12px;
}
.seo-mode-grid p {
  position: relative;
  margin: 0;
  color: var(--text-dim);
  font-size: 10px;
  line-height: 1.7;
}
.seo-intro .seo-intro-note {
  padding: 10px 12px;
  border-left: 3px solid var(--accent-3);
  background: rgba(79, 227, 193, 0.06);
  color: var(--text);
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   このサイトについて
   -------------------------------------------------------------------------- */

.about-page {
  user-select: text;
}
.info-main {
  position: relative;
  z-index: 1;
  flex: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) 14px 20px;
}
.info-back {
  display: inline-flex;
  min-height: 44px;
  padding: 0 5px;
  align-items: center;
  gap: 7px;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}
.info-back:hover {
  color: var(--accent);
}
.info-back:focus-visible {
  outline: 3px solid var(--accent-3);
  outline-offset: 2px;
  border-radius: 4px;
}
.info-card {
  margin-top: 8px;
  padding: clamp(22px, 6vw, 42px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--card);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}
.info-hero {
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
}
.info-kicker {
  margin: 0 0 8px;
  color: var(--accent-3);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.28em;
}
.info-hero h1 {
  margin: 0 0 13px;
  font-size: clamp(30px, 8vw, 48px);
  line-height: 1.25;
  background: linear-gradient(180deg, #fff 18%, var(--accent) 65%, #ff9f45 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.info-hero p {
  margin: 0;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.85;
}
.info-card > section {
  padding: 25px 0;
  border-bottom: 1px solid var(--line);
}
.info-card section h2 {
  display: flex;
  margin: 0 0 12px;
  align-items: baseline;
  gap: 10px;
  color: var(--text);
  font-size: 18px;
}
.info-card section h2 span {
  color: var(--accent-3);
  font-size: 10px;
  letter-spacing: 0.12em;
}
.info-card section p {
  margin: 0;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.95;
}
.info-card section p + p {
  margin-top: 12px;
}
.info-notice {
  margin: 25px 0;
  padding: 17px;
  border: 1px solid rgba(255, 217, 61, 0.28);
  border-radius: var(--radius-sm);
  background: rgba(255, 217, 61, 0.07);
}
.info-notice strong {
  display: block;
  margin-bottom: 5px;
  color: var(--accent);
  font-size: 12px;
}
.info-notice p {
  margin: 0;
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1.8;
}
.info-cta {
  display: grid;
  width: 100%;
  place-items: center;
  text-decoration: none;
}
.title-lead strong { color: var(--accent); }

.mode-select { margin-bottom: 22px; }
.mode-heading {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.22em;
  color: var(--text-dim);
}
.mode-buttons { display: grid; gap: 8px; }

.mode-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 10px 14px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform var(--tap) ease, border-color var(--tap) ease, background var(--tap) ease;
}
.mode-btn:active { transform: scale(0.98); }
.mode-btn[aria-pressed="true"] {
  border-color: var(--accent);
  background: rgba(255, 217, 61, 0.14);
  box-shadow: 0 0 0 4px rgba(255, 217, 61, 0.12);
}
.mode-btn .mode-stars {
  flex: 0 0 auto;
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--accent);
}
.mode-btn .mode-name { display: block; font-size: 16px; font-weight: 800; }
.mode-btn .mode-desc { display: block; margin-top: 2px; font-size: 11px; color: var(--text-dim); }
.mode-badge {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 3px 7px;
  border: 1px solid rgba(255, 217, 61, 0.45);
  border-radius: 999px;
  color: var(--accent);
  font-size: 9px;
  font-weight: 900;
  white-space: nowrap;
}

.title-hint {
  margin: 16px 0 0;
  min-height: 18px;
  font-size: 12px;
  color: var(--text-dim);
}
.title-hint b { color: var(--accent); font-size: 14px; }

/* --------------------------------------------------------------------------
   HUD
   -------------------------------------------------------------------------- */

.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(10, 14, 38, 0.66);
  backdrop-filter: blur(10px);
}
.quit-btn {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 5px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}
.quit-btn:active { transform: scale(0.95); }
.quit-btn:focus-visible { outline: 2px solid var(--accent-3); outline-offset: 2px; }
.hud-left, .hud-right { display: flex; flex-direction: column; line-height: 1.1; }
.hud-right { align-items: flex-end; }
.hud-label { font-size: 9px; letter-spacing: 0.18em; color: var(--text-dim); }
.hud-value { font-size: 17px; font-weight: 900; font-variant-numeric: tabular-nums; }
.hud-value small { font-size: 11px; color: var(--text-dim); font-weight: 700; }
.hud-value.is-bump { animation: bump 380ms cubic-bezier(0.34, 1.56, 0.64, 1); color: var(--accent); }

@keyframes bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.42); }
  100% { transform: scale(1); }
}

.progress-dots { display: flex; gap: 5px; flex-wrap: wrap; justify-content: center; max-width: 45%; }
.progress-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transition: background 200ms ease, transform 200ms ease;
}
.progress-dots i.is-ok { background: var(--ok); }
.progress-dots i.is-ng { background: var(--ng); }
.progress-dots i.is-now { background: var(--accent); transform: scale(1.5); }
.progress-dots.is-marathon {
  flex: 1;
  min-width: 70px;
  max-width: 38%;
}
.progress-track {
  display: block;
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}
.progress-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-3), var(--accent));
  box-shadow: 0 0 10px rgba(79, 227, 193, 0.5);
  transition: width 260ms ease;
}

.combo-badge {
  position: relative;
  height: 0;
  text-align: center;
  font-size: 18px;
  font-weight: 900;
  color: var(--accent-2);
  opacity: 0;
  pointer-events: none;
}
.combo-badge.is-show {
  animation: combo-pop 900ms ease-out;
  text-shadow: 0 0 18px rgba(255, 93, 143, 0.8);
}
@keyframes combo-pop {
  0% { opacity: 0; transform: translateY(6px) scale(0.6); }
  25% { opacity: 1; transform: translateY(-4px) scale(1.25); }
  70% { opacity: 1; transform: translateY(-6px) scale(1); }
  100% { opacity: 0; transform: translateY(-16px) scale(0.95); }
}

/* --------------------------------------------------------------------------
   問題カード
   -------------------------------------------------------------------------- */

.question-card {
  position: relative;
  margin: 12px 0;
  padding: 16px 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  text-align: center;
}

.question-mode-tag {
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--accent-3);
  color: #04231d;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.14em;
  white-space: nowrap;
}

.question-lead {
  margin: 8px 0 10px;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

.target { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }

.target-chip {
  padding: 9px 18px;
  border-radius: 12px;
  font-size: clamp(22px, 7.4vw, 32px);
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #fff;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.5);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.3), 0 8px 20px rgba(0, 0, 0, 0.35);
  animation: chip-in 340ms cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}
.target-chip:nth-child(3) { animation-delay: 110ms; }
.target-plus { font-size: 22px; font-weight: 900; color: var(--text-dim); }

@keyframes chip-in {
  from { opacity: 0; transform: translateY(-14px) rotate(-6deg) scale(0.7); }
  to   { opacity: 1; transform: none; }
}

.target-example {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--text-dim);
}
/* 単タイプの問題では例が無い。空の行で縦を食わないよう畳む */
.target-example:empty { display: none; }
.target-example b {
  display: inline-block;
  padding: 3px 10px;
  border: 1px dashed var(--line-strong);
  border-radius: 999px;
  color: var(--text);
  font-size: 12px;
}

.question-ask {
  margin: 12px 0 0;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.4;
  color: var(--accent);
}
.ask-hint {
  display: block;
  margin-top: 3px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-dim);
}

/* --------------------------------------------------------------------------
   タイプ選択グリッド
   -------------------------------------------------------------------------- */

/* 18タイプは「スクロールせず一覧できる」ことを優先する。
   縦画面では4列5段（最終段は2枚）、広い画面では6列3段。 */
.type-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
@media (min-width: 620px) { .type-grid { grid-template-columns: repeat(6, 1fr); } }

.type-btn {
  position: relative;
  overflow: hidden;
  min-height: 56px;
  padding: 8px 4px;
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-sm);
  background: var(--btn-color, #444);
  color: #fff;
  font-family: inherit;
  font-size: clamp(11px, 3.3vw, 16px);
  font-weight: 800;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  cursor: pointer;
  transition: transform 120ms ease, border-color 160ms ease, filter 160ms ease, opacity 200ms ease;
}
.type-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 55%, rgba(0, 0, 0, 0.28));
  pointer-events: none;
}
.type-btn:active { transform: scale(0.93); }
.type-btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

/* 未選択は少し沈ませ、選択中を目立たせる */
.type-btn { filter: saturate(0.72) brightness(0.72); }
.type-btn.is-selected {
  filter: saturate(1.15) brightness(1.08);
  border-color: #fff;
  transform: translateY(-3px);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35), 0 10px 22px rgba(0, 0, 0, 0.45);
}
.type-btn.is-selected::before {
  content: "✓";
  position: absolute;
  top: 2px;
  right: 5px;
  z-index: 2;
  font-size: 13px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.8);
}

/* むずかしい: 増減が一目で分かる赤/青の二極表示 */
.type-grid[data-answer-kind="direction"] .type-btn.is-increase {
  border-color: #ff7a69;
  box-shadow: 0 0 0 3px rgba(255, 84, 104, 0.35), 0 10px 22px rgba(0, 0, 0, 0.45);
}
.type-grid[data-answer-kind="direction"] .type-btn.is-decrease {
  border-color: #74b9ff;
  box-shadow: 0 0 0 3px rgba(63, 127, 216, 0.4), 0 10px 22px rgba(0, 0, 0, 0.45);
}
.type-grid[data-answer-kind="direction"] .type-btn.is-increase::before {
  content: "↑";
  color: #ffe3df;
}
.type-grid[data-answer-kind="direction"] .type-btn.is-decrease::before {
  content: "↓";
  color: #dceeff;
}
.type-grid[data-answer-kind="direction"] .type-btn .answer-direction,
.type-grid[data-answer-kind="multiplier"] .type-btn .chosen {
  opacity: 1;
}
.type-btn .answer-direction.increase { background: #d83e50; }
.type-btn .answer-direction.decrease { background: #276ab5; }

/* 超むずかしい: 回答済みタイルには選んだ倍率を常時表示 */
.type-grid[data-answer-kind="multiplier"] .type-btn.has-multiplier {
  padding-bottom: 20px;
  border-color: rgba(255, 255, 255, 0.8);
}
.type-grid[data-answer-kind="multiplier"] .type-btn.has-multiplier::before {
  content: "●";
  color: var(--accent);
  font-size: 10px;
}

/* 答え合わせ表示 */
.type-btn .mult {
  position: absolute;
  z-index: 2;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  opacity: 0;
  transition: opacity 200ms ease;
}
.type-btn .mark {
  position: absolute;
  z-index: 3;
  top: 0;
  left: 4px;
  font-size: 13px;
  line-height: 1.25;
  font-weight: 900;
  opacity: 0;
  transition: opacity 200ms ease;
}

.is-revealed .type-btn { cursor: default; transform: none; }
.is-revealed .type-btn .mult,
.is-revealed .type-btn .mark { opacity: 1; }
/* 上に○✕・中央にタイプ名・下に倍率、の3段に重ならず収まる余白 */
.is-revealed .type-btn { padding-top: 16px; padding-bottom: 20px; }

/* reveal 時: 正解タイプを光らせ、それ以外を沈める */
.is-revealed .type-btn.is-answer {
  filter: saturate(1.2) brightness(1.12);
  border-color: var(--ok);
  box-shadow: 0 0 0 3px rgba(61, 220, 132, 0.45), 0 8px 18px rgba(0, 0, 0, 0.4);
  animation: answer-pop 320ms cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}
.is-revealed .type-btn:not(.is-answer) { filter: saturate(0.25) brightness(0.5); opacity: 0.75; }
.is-revealed .type-btn.is-extra {
  border-color: var(--ng);
  box-shadow: 0 0 0 3px rgba(255, 84, 104, 0.45);
  filter: saturate(0.6) brightness(0.72);
  opacity: 1;
}

@keyframes answer-pop {
  from { transform: scale(0.86); }
  to   { transform: scale(1); }
}

.mult.weak    { background: #ff4b5c; color: #fff; }
.mult.neutral { background: rgba(0, 0, 0, 0.5); color: #dfe4ff; }
.mult.resist  { background: #3f7fd8; color: #fff; }
.mult.immune  { background: #2a2f45; color: #b7bede; }

.mark.hit  { color: #7cffb0; text-shadow: 0 0 6px rgba(0, 0, 0, 0.9); }
.mark.miss { color: #ff8c98; text-shadow: 0 0 6px rgba(0, 0, 0, 0.9); }

/* --------------------------------------------------------------------------
   倍率選択メニュー
   -------------------------------------------------------------------------- */

.has-open-menu { overflow: hidden; }
.multiplier-menu[hidden] { display: none; }
.multiplier-menu {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  align-items: end;
  padding: 16px;
  background: rgba(3, 5, 16, 0.76);
  backdrop-filter: blur(8px);
  animation: menu-fade 160ms ease-out;
}
.multiplier-panel {
  width: min(100%, 520px);
  margin: 0 auto;
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(79, 93, 255, 0.28), transparent 55%),
    #111735;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.68);
  animation: menu-rise 220ms cubic-bezier(0.22, 1, 0.36, 1);
}
.multiplier-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.multiplier-kicker {
  margin: 0 0 3px;
  color: var(--accent-3);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.28em;
}
.multiplier-panel h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}
.multiplier-close {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  font-size: 24px;
  cursor: pointer;
}
.multiplier-help {
  margin: 8px 0 14px;
  color: var(--text-dim);
  font-size: 11px;
}
.multiplier-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.multiplier-options button {
  min-height: 68px;
  padding: 8px 4px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  transition: transform 120ms ease, border-color 140ms ease, background 140ms ease;
}
.multiplier-options button:active { transform: scale(0.96); }
.multiplier-options button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.multiplier-options button.is-current {
  border-color: var(--accent);
  background: rgba(255, 217, 61, 0.13);
}
.multiplier-options b {
  display: block;
  font-size: 24px;
  font-variant-numeric: tabular-nums;
}
.multiplier-options span {
  display: block;
  margin-top: 2px;
  color: var(--text-dim);
  font-size: 9px;
  font-weight: 700;
}
.multiplier-options button:nth-child(1),
.multiplier-options button:nth-child(2) { border-color: rgba(255, 84, 104, 0.5); }
.multiplier-options button:nth-child(4),
.multiplier-options button:nth-child(5) { border-color: rgba(63, 127, 216, 0.65); }
.multiplier-options button:nth-child(6) { border-color: rgba(143, 155, 208, 0.55); }

@keyframes menu-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes menu-rise {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   下部アクションバー（親指の届く位置に固定）
   -------------------------------------------------------------------------- */

.action-bar {
  position: sticky;
  bottom: 0;
  z-index: 12;
  margin: 0 -14px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(7, 10, 28, 0) 0%, rgba(7, 10, 28, 0.88) 42%, #070a1c 100%);
}
.action-inner { max-width: 680px; margin: 0 auto; }
.selection-info {
  margin: 0 0 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  min-height: 17px;
}
.selection-info b { color: var(--accent); }
.action-buttons { display: flex; gap: 8px; }

/* --------------------------------------------------------------------------
   判定スタンプ
   -------------------------------------------------------------------------- */

.verdict {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
}
.verdict.is-show { animation: verdict-show 1100ms ease-out forwards; }
.verdict-inner { text-align: center; }
.verdict-text {
  margin: 0;
  font-size: clamp(50px, 17vw, 92px);
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1;
}
.verdict-sub {
  margin: 8px 0 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
}
.verdict.ok .verdict-text {
  color: #fff;
  text-shadow: 0 0 18px rgba(61, 220, 132, 0.95), 0 0 46px rgba(61, 220, 132, 0.6), 0 5px 0 #147a42;
}
.verdict.ng .verdict-text {
  color: #fff;
  text-shadow: 0 0 18px rgba(255, 84, 104, 0.95), 0 0 46px rgba(255, 84, 104, 0.55), 0 5px 0 #8f1725;
}

@keyframes verdict-show {
  0%   { opacity: 0; transform: scale(0.35) rotate(-10deg); }
  18%  { opacity: 1; transform: scale(1.16) rotate(2deg); }
  30%  { transform: scale(1) rotate(0deg); }
  78%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.06); }
}

/* --------------------------------------------------------------------------
   リザルト
   -------------------------------------------------------------------------- */

.result-card {
  margin: 14px 0;
  padding: 24px 18px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--card);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  text-align: center;
}
.result-kicker {
  margin: 0 0 14px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.34em;
  color: var(--accent-3);
}

.rank-stamp {
  width: 118px;
  height: 118px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border: 5px solid var(--accent);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.25), transparent 60%);
  box-shadow: 0 0 0 8px rgba(255, 217, 61, 0.12), 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: stamp 520ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.rank-stamp span {
  font-size: 64px;
  font-weight: 900;
  line-height: 1;
  color: var(--accent);
  text-shadow: 0 3px 12px rgba(0, 0, 0, 0.5);
}
.rank-stamp[data-rank="S"] { border-color: #ffd93d; }
.rank-stamp[data-rank="S"] span { color: #ffd93d; }
.rank-stamp[data-rank="A"] { border-color: #ff9f45; box-shadow: 0 0 0 8px rgba(255, 159, 69, 0.12), 0 10px 30px rgba(0, 0, 0, 0.5); }
.rank-stamp[data-rank="A"] span { color: #ff9f45; }
.rank-stamp[data-rank="B"] { border-color: #4fe3c1; box-shadow: 0 0 0 8px rgba(79, 227, 193, 0.12), 0 10px 30px rgba(0, 0, 0, 0.5); }
.rank-stamp[data-rank="B"] span { color: #4fe3c1; }
.rank-stamp[data-rank="C"], .rank-stamp[data-rank="D"] { border-color: #8f9bd0; box-shadow: 0 0 0 8px rgba(143, 155, 208, 0.1), 0 10px 30px rgba(0, 0, 0, 0.5); }
.rank-stamp[data-rank="C"] span, .rank-stamp[data-rank="D"] span { color: #b9c2ea; }

@keyframes stamp {
  0% { opacity: 0; transform: scale(2.2) rotate(-16deg); }
  60% { opacity: 1; transform: scale(0.92) rotate(3deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}

.rank-title {
  margin: 14px 0 18px;
  font-size: 19px;
  font-weight: 900;
  color: var(--text);
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.stat {
  padding: 10px 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
}
.stat-label { display: block; font-size: 10px; letter-spacing: 0.1em; color: var(--text-dim); }
.stat-value { display: block; margin-top: 3px; font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 12px; color: var(--text-dim); }

.result-comment {
  margin: 0 0 20px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-dim);
}

.affiliate-section {
  position: relative;
  margin: 0 0 24px;
  padding: 17px;
  border: 1px solid rgba(255, 217, 61, 0.3);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 217, 61, 0.1), transparent 38%),
    rgba(7, 10, 28, 0.52);
  text-align: left;
  overflow: hidden;
}
.affiliate-section::after {
  content: "";
  position: absolute;
  width: 110px;
  height: 110px;
  top: -58px;
  right: -42px;
  border: 22px solid rgba(255, 217, 61, 0.06);
  border-radius: 50%;
  pointer-events: none;
}
.affiliate-heading-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}
.affiliate-pr {
  flex: 0 0 auto;
  padding: 4px 7px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 5px;
  background: #bf0000;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
}
.affiliate-kicker {
  margin: 0 0 2px;
  color: var(--accent);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.16em;
}
.affiliate-heading-row h2 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.35;
}
.affiliate-disclosure {
  margin: 10px 0 13px;
  color: var(--text-dim);
  font-size: 9px;
  line-height: 1.6;
}
.affiliate-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.affiliate-card {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  min-height: 118px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(27, 35, 80, 0.9);
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
  transition: transform var(--tap) ease, border-color var(--tap) ease, box-shadow var(--tap) ease;
}
.affiliate-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 217, 61, 0.65);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3);
}
.affiliate-card:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
.affiliate-image {
  display: grid;
  place-items: center;
  padding: 7px;
  background: #fff;
}
.affiliate-image img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
}
.affiliate-copy {
  display: flex;
  min-width: 0;
  padding: 11px 10px;
  flex-direction: column;
  align-items: flex-start;
}
.affiliate-title {
  font-size: 11px;
  font-weight: 900;
  line-height: 1.55;
}
.affiliate-note {
  margin-top: 4px;
  color: var(--text-dim);
  font-size: 9px;
  line-height: 1.45;
}
.affiliate-cta {
  display: flex;
  width: 100%;
  margin-top: auto;
  padding-top: 8px;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  color: #ff9b9b;
  font-size: 9px;
  font-weight: 900;
}

.review { text-align: left; margin-bottom: 20px; }
.review-heading {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--text-dim);
}
.review-hint { font-weight: 600; letter-spacing: 0; font-size: 10px; opacity: 0.8; }
.review-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }

.review-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
}
.review-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 46px;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.review-summary .rv-no { font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums; min-width: 22px; }
.review-summary .rv-mark { font-size: 16px; font-weight: 900; }
.review-item.ok .rv-mark { color: var(--ok); }
.review-item.ng .rv-mark { color: var(--ng); }
.review-summary .rv-name { flex: 1; font-weight: 800; }
.review-summary .rv-ex { font-size: 10px; color: var(--text-dim); }
.review-summary .rv-caret { color: var(--text-dim); font-size: 11px; transition: transform 200ms ease; }
.review-item.is-open .rv-caret { transform: rotate(180deg); }

.review-detail { display: none; padding: 0 12px 12px; }
.review-item.is-open .review-detail { display: block; }
.review-row { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 7px; }
.review-row .rv-label { font-size: 10px; color: var(--text-dim); min-width: 62px; }
.mini-chip {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
}
.mini-chip .mini-mult { font-size: 9px; opacity: 0.9; margin-left: 3px; }
.review-none { font-size: 11px; color: var(--text-dim); }

.result-actions { display: grid; gap: 8px; }

/* --------------------------------------------------------------------------
   紙吹雪
   -------------------------------------------------------------------------- */

.confetti {
  position: fixed;
  inset: 0;
  z-index: 25;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: none;
}
.confetti.is-active { display: block; }

/* --------------------------------------------------------------------------
   アクセシビリティ: モーション低減
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
  .verdict.is-show { opacity: 1; animation: none !important; }
  .verdict.is-show.is-hidden { opacity: 0; }
  .orb { animation: none !important; }
}

/* 大きい画面では余白を広げる */
@media (min-width: 700px) {
  #app { padding-left: 20px; padding-right: 20px; }
  .action-bar { margin: 0 -20px; padding-left: 20px; padding-right: 20px; }
}

/* --------------------------------------------------------------------------
   小さい画面の詰め込み
   HUDの右端は固定配置のサウンドボタンと重なるので、その分だけ内側に寄せる。
   -------------------------------------------------------------------------- */

@media (max-width: 760px) {
  .hud { padding-right: 50px; gap: 7px; }
  .progress-dots { gap: 3px; }
  .progress-dots i { width: 7px; height: 7px; }
  .affiliate-grid { grid-template-columns: 1fr; }
  .affiliate-card { grid-template-columns: 104px minmax(0, 1fr); }
  .seo-mode-grid { grid-template-columns: 1fr; }
  .seo-mode-grid article { padding: 13px 52px 13px 13px; }
}

/* 375x667 でも「問題カード＋18タイル＋確定ボタン」が一画面に収まるよう詰める */
@media (max-height: 720px), (max-width: 400px) {
  .title-card { margin-top: 2.5vh; padding: 24px 18px 20px; }
  .title-logo { margin-bottom: 10px; }
  .title-lead { margin-bottom: 18px; }
  .mode-select { margin-bottom: 18px; }
  .mode-buttons { gap: 6px; }
  .mode-btn { min-height: 50px; padding: 7px 10px; }
  .mode-btn .mode-name { font-size: 14px; }
  .mode-btn .mode-desc { font-size: 10px; }
  .mode-btn .mode-stars { font-size: 10px; }
  .btn-huge { min-height: 56px; font-size: 20px; }
  .question-card { margin: 10px 0; padding: 13px 14px 15px; }
  .question-lead { margin: 6px 0 8px; }
  .target-chip { padding: 7px 15px; font-size: clamp(20px, 6.8vw, 28px); }
  .question-ask { margin-top: 10px; font-size: 14px; }
  .type-btn { min-height: 50px; }
  .type-grid { gap: 7px; margin-bottom: 10px; }
  .action-bar { padding-top: 6px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .selection-info { margin-bottom: 6px; }
  .btn { min-height: 46px; }
  .is-revealed .type-btn { padding-top: 14px; padding-bottom: 18px; }
  .multiplier-menu { padding: 8px; }
  .multiplier-panel { padding: 14px; border-radius: 20px; }
  .multiplier-options button { min-height: 60px; }
  .affiliate-section { padding: 14px; }
  .affiliate-card { grid-template-columns: 88px minmax(0, 1fr); min-height: 110px; }
}
