/* ============================================================
   かけざん くくマスター  --  style.css
   小2が つかう。もじは おおきく、ボタンは 56px いじょう。
   ============================================================ */

:root {
  --ink: #6b4a3a;
  --ink-soft: #9c7b68;
  --card: rgba(255, 255, 255, 0.88);
  --pink: #ff8fb1;
  --orange: #ffb057;
  --green: #6ed0a0;
  --blue: #6cc4f0;
  --purple: #b79bec;
  --yellow: #ffd86b;
  --shadow: 0 6px 0 rgba(0, 0, 0, 0.12);
  --shadow-sm: 0 2px 0 rgba(0, 0, 0, 0.12);
  --r: 24px;
}

* { box-sizing: border-box; }

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

body {
  font-family: "Hiragino Maru Gothic ProN", "ヒラギノ丸ゴ ProN", "Hiragino Sans",
    "Yu Gothic", "Meiryo", system-ui, -apple-system, sans-serif;
  /* にほんごは ことばの とちゅうで おらない */
  word-break: keep-all;
  overflow-wrap: break-word;
  line-height: 1.5;
  background: linear-gradient(170deg, #fff8ee 0%, #ffeef5 45%, #e8f6fd 100%);
  background-attachment: fixed;
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
  /* ★たてに ひっぱっても かたまらないように pan-y は のこす */
  touch-action: pan-y;
  font-size: 17px;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  padding: 14px 14px calc(28px + env(safe-area-inset-bottom));
  min-height: 100%;
}

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 56px;
  padding: 12px 18px;
  border: none;
  border-radius: var(--r);
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  box-shadow: var(--shadow);
  transition: transform .08s ease, box-shadow .08s ease, filter .12s ease;
}
.btn:active { transform: translateY(4px); box-shadow: var(--shadow-sm); }
.btn:disabled { opacity: .45; }
.btn.big { min-height: 84px; font-size: 1.5rem; width: 100%; }
.btn.pink   { background: var(--pink);   color: #fff; }
.btn.orange { background: var(--orange); color: #fff; }
.btn.green  { background: var(--green);  color: #fff; }
.btn.blue   { background: var(--blue);   color: #fff; }
.btn.purple { background: var(--purple); color: #fff; }
.btn.ghost  { background: rgba(255,255,255,.85); }
.btn.on { outline: 4px solid var(--yellow); outline-offset: -4px; }

/* ---------- カード ---------- */
.card {
  background: var(--card);
  border-radius: 28px;
  padding: 16px;
  box-shadow: 0 8px 22px rgba(160, 120, 100, .12);
}

/* ---------- ヘッダ ---------- */
header.bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
header.bar h2 {
  margin: 0;
  font-size: 1.35rem;
  flex: 1;
  text-align: center;
}
.btn.icon {
  min-height: 56px;
  min-width: 56px;
  padding: 0 14px;
  font-size: 1.3rem;
}

/* ---------- ホーム ---------- */
.title {
  text-align: center;
  margin: 10px 0 18px;
}
.title .logo {
  font-size: 2.15rem;
  font-weight: 900;
  letter-spacing: .02em;
  color: #ff7aa2;
  text-shadow: 2px 3px 0 #fff, 4px 6px 0 rgba(255,138,170,.25);
}
.title .sub { font-size: 1rem; color: var(--ink-soft); margin-top: 6px; }

.menu { display: grid; gap: 14px; }
.menu .btn { justify-content: flex-start; padding-left: 22px; }
.menu .em { font-size: 2rem; }
.menu .lines { text-align: left; line-height: 1.25; }
.menu .lines small { display: block; font-size: .82rem; font-weight: 700; opacity: .85; }

/* ---------- だんえらび ---------- */
.dan-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.dan-btn {
  flex-direction: column;
  min-height: 92px;
  gap: 2px;
  font-size: 1.5rem;
  background: #fff;
}
.dan-btn .stars { font-size: .95rem; letter-spacing: 1px; line-height: 1; }
.dan-btn .em2 { font-size: 1.2rem; }
.wide { grid-column: span 3; }

/* ---------- きくモード ---------- */
.eq {
  text-align: center;
  font-size: clamp(2.4rem, 13vw, 3.6rem);
  font-weight: 900;
  letter-spacing: .02em;
  margin: 4px 0 2px;
  font-variant-numeric: tabular-nums;
}
.eq .ans { color: #ef6b95; }
.eq .ans.pop { animation: popin .45s cubic-bezier(.3,1.6,.5,1); display: inline-block; }
@keyframes popin { 0% { transform: scale(.3); opacity: 0 } 100% { transform: scale(1); opacity: 1 } }

.yomi {
  text-align: center;
  font-size: 1.35rem;
  font-weight: 800;
  color: #e2749a;
  min-height: 2rem;
  margin-bottom: 8px;
}

.pic {
  display: grid;
  gap: 4px;
  justify-content: center;
  margin: 6px auto 10px;
  min-height: 90px;
  align-content: center;
}
.pic .row { display: flex; gap: 4px; justify-content: center; }
.pic .it {
  font-size: clamp(14px, 5.2vw, 26px);
  line-height: 1.05;
  animation: fadein .3s ease both;
}
@keyframes fadein { from { opacity: 0; transform: scale(.6) } to { opacity: 1; transform: scale(1) } }
.pic-note { text-align: center; font-size: .92rem; color: var(--ink-soft); margin-top: -4px; }

.ctrl-row { display: flex; gap: 10px; margin-top: 12px; }
.ctrl-row .btn { flex: 1; }

.opt {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}
.opt .lab { font-size: .95rem; font-weight: 800; color: var(--ink-soft); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips .btn { flex: 1; min-width: 64px; min-height: 56px; font-size: 1rem; padding: 8px 6px; }

.progress {
  height: 10px;
  border-radius: 99px;
  background: rgba(255,255,255,.7);
  overflow: hidden;
  margin-top: 12px;
}
.progress > i { display: block; height: 100%; background: var(--green); width: 0; transition: width .2s; }

/* ---------- クイズ ---------- */
.q-head { display: flex; align-items: center; justify-content: space-between; font-weight: 800; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.choices .btn { min-height: 84px; font-size: 2rem; font-weight: 900; }
.choices .btn.ok { background: var(--green); color: #fff; }
.choices .btn.no { background: #ffb3c4; color: #fff; }
.verdict {
  text-align: center;
  font-size: 1.6rem;
  font-weight: 900;
  min-height: 2.2rem;
  margin-top: 10px;
}
.verdict.ok { color: #35a877; }
.verdict.ng { color: #e2749a; }

.result-big { text-align: center; font-size: 3rem; font-weight: 900; }
.result-stars { text-align: center; font-size: 2.4rem; letter-spacing: 4px; }

/* ---------- ひょう ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.kuku {
  border-collapse: separate;
  border-spacing: 3px;
  margin: 0 auto;
  font-variant-numeric: tabular-nums;
}
table.kuku th, table.kuku td {
  width: 34px; height: 34px;
  text-align: center;
  font-size: .95rem;
  font-weight: 800;
  border-radius: 9px;
  padding: 0;
}
table.kuku th { color: var(--ink-soft); background: transparent; }
table.kuku td {
  background: #eee6e0;
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
  border: none;
}
table.kuku td.m1 { background: #ffe9a8; }
table.kuku td.m2 { background: #a8e8c6; }
table.kuku td.sel { outline: 3px solid #ff7aa2; }

/* ---------- せってい ---------- */
.set-row { display: grid; gap: 8px; margin-bottom: 18px; }

/* ---------- こんふぇってぃ ---------- */
#confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 50; }
#confetti i {
  position: absolute;
  font-size: 22px;
  animation: fall 1.35s linear forwards;
}
@keyframes fall {
  0% { transform: translateY(-10vh) rotate(0); opacity: 1 }
  100% { transform: translateY(105vh) rotate(540deg); opacity: 0 }
}

/* ---------- スタート（おとの ロック かいじょ） ---------- */
#gate {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 24px;
  background: linear-gradient(170deg, #fff8ee 0%, #ffeef5 45%, #e8f6fd 100%);
}
#gate .btn { min-width: 220px; min-height: 92px; font-size: 1.8rem; }

.tiny { font-size: .85rem; color: var(--ink-soft); text-align: center; margin-top: 14px; }

@media (min-width: 420px) {
  table.kuku th, table.kuku td { width: 40px; height: 40px; font-size: 1.05rem; }
}
