:root {
  --bg: #FFF7F9; --pink: #FF7EB6; --pink-soft: #FF9ECB; --lav: #B892FF; --lav-soft: #E6D9FF;
  --mint: #7EE8C7; --lemon: #FFE66D; --gold: #FFC84A; --grey: #F1E4EA;
  --ink: #4A3B45; --ink-soft: #8A7580; --white: #fff;
  --radius: 22px; --shadow: 0 6px 18px rgba(255, 126, 182, 0.18);
  --font: "Hiragino Maru Gothic ProN", "Rounded Mplus 1c", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font); color: var(--ink);
  background: var(--bg) radial-gradient(circle, rgba(255, 126, 182, .10) 2.5px, transparent 3px) 0 0 / 28px 28px;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.screen { max-width: 480px; margin: 0 auto; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); min-height: 100dvh; display: flex; flex-direction: column; gap: 14px; }
h1 { font-size: 28px; margin: 6px 0 0; text-align: center; color: var(--pink); letter-spacing: .04em; }
h2 { font-size: 20px; margin: 0; }
.sub { text-align: center; margin: 0; color: var(--ink-soft); font-size: 15px; }
.center { text-align: center; }
.small { font-size: 13px; color: var(--ink-soft); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.btn { font: inherit; font-size: 18px; border: 0; border-radius: 999px; padding: 14px 22px; background: var(--white); color: var(--ink); box-shadow: var(--shadow); cursor: pointer; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--pink); color: #fff; font-size: 22px; padding: 18px 24px; width: 100%; }
.btn-lav { background: var(--lav); color: #fff; }
.btn-ghost { background: transparent; box-shadow: none; color: var(--ink-soft); padding: 8px 12px; }
.row { display: flex; gap: 10px; }
.row > .btn { flex: 1; }
.streak { display: inline-flex; align-items: center; gap: 6px; background: var(--lemon); border-radius: 999px; padding: 6px 12px; font-size: 15px; }
.icon-btn { font-size: 22px; background: var(--white); border: 0; border-radius: 50%; width: 44px; height: 44px; box-shadow: var(--shadow); cursor: pointer; }
.notice { background: var(--lemon); border-radius: 12px; padding: 8px 12px; font-size: 13px; }

/* 九九マップ */
.kmap { display: grid; grid-template-columns: 1.4fr repeat(9, 1fr); gap: 3px; }
.kmap-corner, .kmap-head { font-size: 12px; color: var(--ink-soft); display: flex; align-items: center; justify-content: center; }
.kmap-rowhead { flex-direction: column; line-height: 1; gap: 1px; }
.kmap-emoji { font-size: 11px; }
.kmap-cell { font: inherit; font-size: 12px; aspect-ratio: 1; border: 0; border-radius: 8px; padding: 0; color: var(--ink); background: var(--white); position: relative; cursor: pointer; }
.tier-0 { background: #fff; color: #CDB9C3; }
.tier-1 { background: var(--grey); }
.tier-2 { background: var(--lav-soft); }
.tier-3 { background: var(--pink-soft); color: #fff; }
.tier-4 { background: var(--gold); color: #7A5A00; }
.kmap-cell.tier-4::after { content: '✨'; position: absolute; top: -4px; right: -3px; font-size: 9px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 12px; color: var(--ink-soft); justify-content: center; margin-top: 10px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 4px; vertical-align: -2px; }

/* 練習 */
.expr { font-size: 64px; text-align: center; margin: 10px 0 0; font-weight: 600; letter-spacing: .05em; }
.answer-box { position: relative; margin: 0 auto; min-width: 150px; min-height: 76px; display: flex; align-items: center; justify-content: center; font-size: 52px; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 4px 24px; }
.answer-box.ok { background: var(--mint); font-size: 32px; animation: pop .35s ease; }
.answer-box.ng { background: var(--lav-soft); font-size: 28px; }
.answer-box .caret { width: 3px; height: 48px; background: var(--pink); margin-left: 4px; animation: blink 1s steps(2) infinite; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: auto; }
.key { font: inherit; font-size: 30px; height: 64px; border: 0; border-radius: 20px; background: var(--white); box-shadow: var(--shadow); color: var(--ink); cursor: pointer; }
.key:active { transform: scale(.95); background: var(--lav-soft); }
.key-del { font-size: 24px; color: var(--ink-soft); }
.key-enter { background: var(--pink); color: #fff; font-size: 20px; }
.dots { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--grey); }
.dots i.on { background: var(--pink); }
.progress-text { text-align: center; color: var(--ink-soft); font-size: 15px; }

/* 解説カード */
.big { font-size: 40px; text-align: center; margin: 0; }
.reading { text-align: center; font-size: 24px; color: var(--lav); margin: 6px 0; }
.reading b { color: var(--pink); font-weight: 600; }
.hint { background: var(--lav-soft); border-radius: 14px; padding: 10px 12px; text-align: center; font-size: 17px; margin-top: 10px; }
.arr-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 8px; }
.arr { display: grid; gap: 4px; max-width: 260px; }
.arr i { width: 100%; aspect-ratio: 1; min-width: 14px; border-radius: 50%; background: var(--pink-soft); display: block; }
.arr-cap { font-size: 14px; color: var(--ink-soft); }

/* 成果・ずかん */
.result-num { font-size: 44px; text-align: center; margin: 0; color: var(--pink); }
.result-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; font-size: 17px; }
.unlock { text-align: center; font-size: 56px; animation: boing .6s ease; }
.zukan { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pedestal { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 6px; text-align: center; }
.ped-top { font-size: 44px; width: 72px; height: 72px; margin: 0 auto; border-radius: 50%; background: var(--grey); display: flex; align-items: center; justify-content: center; color: #CDB9C3; }
.pedestal.on .ped-top { background: var(--lav-soft); color: inherit; }
.ped-name { font-size: 12px; margin-top: 6px; color: var(--ink-soft); line-height: 1.3; }
.pedestal.on .ped-name { color: var(--ink); font-size: 14px; }

/* おとな用 */
.weak { width: 100%; border-collapse: collapse; font-size: 13px; }
.weak th, .weak td { padding: 6px 4px; text-align: center; border-bottom: 1px solid var(--grey); }
.chip { display: inline-block; border-radius: 999px; padding: 2px 8px; font-size: 11px; }
.setting { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--grey); gap: 8px; }
.setting select { font: inherit; font-size: 16px; border-radius: 10px; border: 1px solid var(--lav-soft); padding: 6px 10px; background: #fff; }
.danger { color: #C2185B; }

/* 吹き出し（マスの詳細） */
.pop-back { position: fixed; inset: 0; background: rgba(74, 59, 69, .25); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.pop { background: var(--white); border-radius: 26px 26px 0 0; width: 100%; max-width: 480px; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); display: grid; gap: 10px; animation: up .25s ease; }

/* 演出 */
.sp { position: absolute; top: -10px; font-size: 22px; animation: sparkle .7s ease-out forwards; pointer-events: none; }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 20; }
.confetti i { position: absolute; top: -12px; width: 10px; height: 14px; border-radius: 3px; animation: fall 2.6s ease-in forwards; }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes boing { 0% { transform: scale(.6); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes blink { to { visibility: hidden; } }
@keyframes sparkle { 0% { transform: translateY(0) scale(.6); opacity: 1; } 100% { transform: translateY(-46px) scale(1.2); opacity: 0; } }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); opacity: .8; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
