/* 英単語でGO! — playful learning game UI */
:root {
  --ink: #183b56;
  --ink-soft: #5d7485;
  --blue: #2f80ed;
  --blue-deep: #1769d1;
  --sky: #dff4ff;
  --green: #38b76a;
  --green-deep: #23944f;
  --orange: #ff8b4a;
  --yellow: #ffd45c;
  --paper: #fffefa;
  --line: #d8e8ef;
  --shadow: 0 18px 55px rgba(28, 75, 103, 0.15);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  color: var(--ink);
  font-family: "BIZ UDPGothic", "Hiragino Maru Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  background:
    radial-gradient(circle at 15% 12%, rgba(255,255,255,.95) 0 5%, transparent 5.2%),
    radial-gradient(circle at 84% 24%, rgba(255,255,255,.75) 0 4%, transparent 4.2%),
    linear-gradient(165deg, #c8efff 0%, #edfaff 50%, #fff7dc 100%);
  overflow: hidden;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

body::after {
  content: "";
  position: fixed;
  inset: auto 0 0;
  height: 14vh;
  min-height: 70px;
  background: linear-gradient(170deg, transparent 0 35%, rgba(115, 205, 119, .2) 36% 100%);
  pointer-events: none;
}

button { font: inherit; appearance: none; -webkit-appearance: none; }
h1, h2, h3, p { margin: 0; }
button, .tile, .slot { touch-action: manipulation; }

.screen {
  display: none;
  position: fixed;
  inset: 0;
  overflow-y: auto;
  z-index: 1;
}

.screen.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
}

.screen-heading {
  color: var(--ink);
  font-size: clamp(22px, 4vw, 30px);
  font-weight: 900;
  letter-spacing: .04em;
  text-align: center;
  line-height: 1.35;
}

.screen-kicker,
.eyebrow {
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .16em;
  text-align: center;
}

.screen-kicker { margin-bottom: var(--space-1); }

.section-label {
  margin: var(--space-5) 0 var(--space-3);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .04em;
}

.section-label::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 4px rgba(255, 139, 74, .15);
}

.btn {
  min-width: 44px;
  min-height: 46px;
  padding: 11px 22px;
  border: 0;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: .04em;
  line-height: 1.25;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}

.btn:focus-visible,
.tile:focus-visible,
.buddy-list button:focus-visible,
.level-list button:focus-visible {
  outline: 4px solid rgba(47, 128, 237, .25);
  outline-offset: 3px;
}

.btn:hover { filter: brightness(1.035); transform: translateY(-1px); }
.btn:active { transform: translateY(3px); }

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-5);
  color: white;
  background: linear-gradient(135deg, #48ca78, var(--green));
  box-shadow: 0 6px 0 var(--green-deep), 0 12px 25px rgba(35, 148, 79, .22);
}

.btn-primary:active { box-shadow: 0 2px 0 var(--green-deep); }
.btn-arrow { font-size: 20px; line-height: 1; }

.btn-secondary {
  color: var(--blue-deep);
  border: 2px solid #b9d9f6;
  background: #fff;
  box-shadow: 0 4px 0 #c9dfe9;
}

.btn-secondary:active { box-shadow: 0 1px 0 #c9dfe9; }

.btn-sound {
  min-height: 46px;
  padding: 10px 16px;
  color: #806019;
  border: 1px solid #f1d47c;
  border-radius: 999px;
  background: #fff9df;
  box-shadow: none;
  font-size: 12px;
}

.btn-sub {
  min-height: 46px;
  padding: 10px 14px;
  color: var(--blue-deep);
  border: 1px solid #cfe1eb;
  border-radius: 13px;
  background: #f4faff;
  font-size: 12px;
}

.btn-quit { color: #d74d55; background: #fff6f6; border-color: #f1cbce; }

/* title */
#screen-title.active { justify-content: center; padding: 24px 18px; }

.title-card {
  position: relative;
  width: min(100%, 620px);
  padding: var(--space-6) var(--space-5) var(--space-5);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 32px;
  background: rgba(255, 254, 250, .88);
  box-shadow: var(--shadow), 0 7px 0 rgba(110, 177, 202, .22);
  text-align: center;
  backdrop-filter: blur(10px);
}

.title-card::before {
  content: "";
  position: absolute;
  top: -75px;
  right: -55px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(255, 212, 92, .2);
}

.eyebrow {
  display: inline-block;
  position: relative;
  padding: 7px 12px;
  border-radius: 999px;
  background: #e9f5ff;
  letter-spacing: .05em;
}

.title-animal {
  position: relative;
  width: 126px;
  height: 126px;
  margin: var(--space-3) auto 0;
  filter: drop-shadow(0 10px 8px rgba(35, 68, 83, .13));
}

.title-animal::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 1px;
  height: 11px;
  border-radius: 50%;
  background: rgba(24, 59, 86, .11);
  z-index: -1;
}

.title-animal svg { width: 100%; height: 100%; display: block; }

.emoji-character {
  --sticker-bg: #ffe3cf;
  --sticker-accent: #ff8b4a;
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  isolation: isolate;
}

.emoji-character__halo {
  position: absolute;
  inset: 9%;
  z-index: -1;
  border: 5px solid #fff;
  border-radius: 42% 58% 52% 48% / 55% 45% 55% 45%;
  background: var(--sticker-bg);
  box-shadow: 0 7px 0 color-mix(in srgb, var(--sticker-accent) 24%, transparent),
    0 10px 24px rgba(24, 59, 86, .13);
  transform: rotate(-4deg);
}

.emoji-character__face {
  display: block;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", sans-serif;
  font-size: 68px;
  line-height: 1;
  filter: drop-shadow(0 3px 0 rgba(255,255,255,.9));
  transform-origin: 50% 80%;
}

.emoji-character__mark {
  position: absolute;
  top: 4%;
  right: 2%;
  display: grid;
  place-items: center;
  width: 28%;
  aspect-ratio: 1;
  color: #fff;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--sticker-accent);
  box-shadow: 0 4px 8px rgba(24,59,86,.15);
  font-family: Arial, sans-serif;
  font-size: 18px;
  font-weight: 900;
}

.emoji-character--pink { --sticker-bg: #ffe4eb; --sticker-accent: #f27799; }
.emoji-character--blue { --sticker-bg: #dff2ff; --sticker-accent: #4b96dc; }
.emoji-character--honey { --sticker-bg: #fff0c5; --sticker-accent: #d79732; }
.emoji-character--lilac { --sticker-bg: #f0e7ff; --sticker-accent: #9b72dd; }
.emoji-character--mint { --sticker-bg: #ddf7df; --sticker-accent: #45b965; }

.emoji-character.mood-happy .emoji-character__face { transform: rotate(-3deg) scale(1.04); }
.emoji-character.mood-cheer .emoji-character__face { animation: characterWiggle 1.8s ease-in-out infinite; }
.emoji-character.mood-sad .emoji-character__face { transform: rotate(5deg) scale(.95); filter: grayscale(.15) drop-shadow(0 3px 0 rgba(255,255,255,.9)); }

.logo {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-1);
  color: var(--ink);
  font-weight: 900;
  letter-spacing: -.03em;
}

.logo-small { font-size: clamp(23px, 6vw, 34px); }
.logo-go {
  color: var(--orange);
  font-family: Arial Rounded MT Bold, "BIZ UDPGothic", sans-serif;
  font-size: clamp(42px, 11vw, 64px);
  line-height: .92;
  text-shadow: 0 4px 0 #ffe0c5;
}

.subcopy { margin-top: var(--space-2); color: var(--ink-soft); font-size: 14px; font-weight: 700; line-height: 1.6; }

.streak-box {
  width: min(100%, 350px);
  min-height: 74px;
  margin: var(--space-4) auto;
  padding: var(--space-3) var(--space-4);
  border: 1px solid #eee7cf;
  border-radius: 18px;
  background: #fffdf2;
}

.streak-count { color: var(--ink); font-size: 14px; font-weight: 800; }
.streak-count strong { color: var(--orange); font-size: 25px; }
.streak-sub { margin-top: var(--space-1); color: var(--ink-soft); font-size: 10px; font-weight: 700; }
.streak-dots { display: flex; justify-content: center; gap: var(--space-2); margin-top: var(--space-2); }
.streak-dot { width: 11px; height: 11px; border-radius: 50%; background: #dce7eb; }
.streak-dot.filled { background: var(--green); box-shadow: 0 0 0 3px rgba(56, 183, 106, .14); }

.title-buttons { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); }
.title-buttons .btn-primary { width: min(100%, 300px); min-height: 56px; font-size: 18px; }
.settings-row { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); }
.keyboard-note { margin-top: var(--space-3); color: #8ba0ad; font-size: 10px; font-weight: 700; }

.sky-decoration { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.cloud { position: absolute; width: 90px; height: 28px; border-radius: 999px; background: rgba(255,255,255,.67); }
.cloud::before, .cloud::after { content: ""; position: absolute; bottom: 0; border-radius: 50%; background: inherit; }
.cloud::before { left: 15px; width: 40px; height: 40px; }
.cloud::after { right: 13px; width: 52px; height: 52px; }
.cloud-one { top: 15%; left: 4%; }
.cloud-two { top: 23%; right: 5%; transform: scale(.7); }
.spark { position: absolute; color: rgba(47,128,237,.18); font-family: Arial, sans-serif; font-size: 28px; font-weight: 900; transform: rotate(-12deg); }
.spark-one { left: 8%; top: 60%; }
.spark-two { right: 8%; top: 56%; transform: rotate(14deg); color: rgba(255,139,74,.2); }
.spark-three { right: 16%; top: 10%; font-size: 18px; }

/* level select */
#screen-level.active { justify-content: flex-start; padding: var(--space-5) var(--space-4) var(--space-6); }
.level-card {
  width: min(100%, 680px);
  padding: var(--space-6);
  border: 1px solid rgba(255,255,255,.92);
  border-radius: 28px;
  background: rgba(255,254,250,.9);
  box-shadow: var(--shadow);
}

.buddy-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); }
.buddy-list button {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  min-width: 0;
  min-height: 96px;
  padding: var(--space-3) var(--space-2);
  color: var(--ink);
  border: 2px solid #e0ebf0;
  border-radius: 17px;
  background: #fff;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.buddy-list button:hover { transform: translateY(-2px); border-color: #b9d8e7; }
.buddy-list button svg { display: block; width: 55px; height: 55px; }
.buddy-svg { display: block; width: 58px; height: 58px; }
.buddy-svg .emoji-character__face { font-size: 36px; }
.buddy-svg .emoji-character__mark { font-size: 10px; }
.buddy-svg .emoji-character__halo { border-width: 3px; box-shadow: 0 4px 0 color-mix(in srgb, var(--sticker-accent) 18%, transparent); }
.buddy-svg .emoji-character__mark { border-width: 2px; }
.buddy-list button.selected { border-color: var(--orange); background: #fff8f1; box-shadow: 0 0 0 3px rgba(255,139,74,.13); }
.buddy-list button.selected::after { content: "✓"; position: absolute; top: 6px; right: 7px; width: 19px; height: 19px; color: #fff; border-radius: 50%; background: var(--orange); font-size: 12px; line-height: 19px; }

.level-list { display: grid; gap: var(--space-3); }
.level-list button {
  position: relative;
  width: 100%;
  min-height: 68px;
  padding: var(--space-3) 90px var(--space-3) 60px;
  color: var(--ink);
  border: 1px solid #dce9ef;
  border-radius: 16px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.level-list button::before {
  content: attr(data-level);
  position: absolute;
  top: 50%;
  left: 14px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #fff;
  border-radius: 12px;
  background: var(--blue);
  font-size: 14px;
  font-weight: 900;
  transform: translateY(-50%);
}

.level-list button:hover { transform: translateX(3px); border-color: #9fc7de; box-shadow: 0 8px 20px rgba(36,78,104,.08); }
.level-list button:nth-child(2)::before { background: var(--green); }
.level-list button:nth-child(3)::before { background: var(--orange); }
.level-list button:nth-child(4)::before { background: #8e68d8; }
.level-list button:nth-child(5)::before { background: #e0555f; }
.level-list button:disabled { cursor: not-allowed; opacity: .5; }
.level-list button:disabled:hover { transform: none; box-shadow: none; }
/* .level-list button::before より詳細度を上げないと既定の青に負ける */
.level-list .level-btn-weak::before { background: var(--orange); }
.level-name { display: block; font-size: 15px; font-weight: 900; }
.level-desc { display: block; margin-top: var(--space-1); color: var(--ink-soft); font-size: 11px; font-weight: 600; }
.level-best { position: absolute; top: 50%; right: 14px; color: var(--blue); font-size: 10px; font-weight: 800; transform: translateY(-50%); }
#btn-back-title { display: block; margin: var(--space-5) auto 0; }

/* game */
#screen-game.active { justify-content: flex-start; overflow: hidden; padding: 0; }
.game-card {
  width: min(100%, 680px);
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4) calc(var(--space-3) + env(safe-area-inset-bottom));
  overflow: hidden;
}

.hud { display: grid; grid-template-columns: 1fr auto 1fr auto; align-items: center; gap: var(--space-2); flex: 0 0 auto; color: var(--ink); font-size: 12px; font-weight: 900; }
.hud-item { padding: var(--space-1) var(--space-2); border-radius: 999px; background: rgba(255,255,255,.72); }
.hud-hearts { color: #ef5964; font-size: 15px; letter-spacing: 2px; }
.hud-score { color: var(--blue-deep); }
.hud-combo { min-width: 1.5em; color: var(--orange); text-align: right; background: transparent; }

.timer-track { flex: 0 0 auto; width: 100%; height: 9px; padding: 2px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.8); box-shadow: inset 0 0 0 1px #d6e4e9; }
.timer-bar { width: 100%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #72db8f, var(--green)); transition: width .2s linear, background-color .2s; }
.timer-bar.danger { background: linear-gradient(90deg, #ffaf68, #ef5964); animation: timerPulse .5s ease-in-out infinite; }

/* 動物エリアは必要な高さだけ取る。ここを伸ばすと問題文とタイルが画面下へ押し込まれる */
.stage-area { flex: 0 0 auto; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: var(--space-2); }
.animal-stage { width: 96px; height: 96px; max-width: 18vh; max-height: 18vh; filter: drop-shadow(0 9px 7px rgba(38,75,93,.12)); }
.animal-stage svg { display: block; width: 100%; height: 100%; }
.speech-bubble { position: relative; max-width: 92%; min-height: 1.3em; padding: var(--space-2) var(--space-4); color: var(--ink-soft); border: 1px solid #e1ebef; border-radius: 12px; background: #fff; box-shadow: 0 4px 12px rgba(33,72,91,.08); font-size: 13px; font-weight: 800; line-height: 1.4; text-align: center; }
.speech-bubble::before { content: ""; position: absolute; top: -5px; left: 50%; width: 9px; height: 9px; border-top: 1px solid #e1ebef; border-left: 1px solid #e1ebef; background: #fff; transform: translateX(-50%) rotate(45deg); }

.question-block { flex: 0 0 auto; display: grid; gap: var(--space-1); text-align: center; }
.question-label { color: #7f95a4; font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.question-ja { min-height: 1.2em; color: var(--ink); font-size: clamp(26px, 7.5vw, 38px); font-weight: 900; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.btn-listen-again { margin-top: var(--space-2); }

.answer-slots { flex: 0 0 auto; display: flex; flex-wrap: wrap; justify-content: center; align-content: center; gap: var(--space-2); min-height: 50px; }
.slot { width: 40px; height: 48px; color: var(--ink); border: 2px solid #bdd8e6; border-bottom: 5px solid #8ebbd0; border-radius: 9px; background: rgba(255,255,255,.58); font-family: Arial Rounded MT Bold, Arial, sans-serif; font-size: 23px; font-weight: 900; line-height: 43px; text-align: center; text-transform: uppercase; }
.slot.filled { border-color: #7fc9a0; border-bottom-color: var(--green); background: #f3fff6; }
.slot.hinted { color: #dd6c2d; border-color: #f4b88d; border-bottom-color: var(--orange); background: #fff8ef; }
.slot.prefilled { color: var(--ink-soft); border-color: #d8e0e4; border-bottom-color: #b9c6cc; background: #f4f7f8; }
.answer-slots.correct { animation: slotPop .4s ease; }
.answer-slots.wrong { animation: slotShake .4s ease; }
.choice-area.correct { animation: slotPop .4s ease; }
.choice-area.wrong { animation: slotShake .4s ease; }

/* 余った高さはタイル側で吸収する。タイルは上寄せで並ぶので不自然な空白にならない */
.letter-tiles { flex: 1 1 auto; min-height: 0; display: flex; flex-wrap: wrap; justify-content: center; align-content: flex-start; gap: var(--space-2); padding: var(--space-1) 0 var(--space-2); overflow-y: auto; }
.tile { min-width: 56px; min-height: 56px; padding: 0 9px; color: #5a4509; border: 1px solid #f2c741; border-radius: 12px; background: linear-gradient(155deg, #ffe991, var(--yellow)); box-shadow: 0 5px 0 #dcae28, 0 8px 12px rgba(86,65,8,.12); font-family: Arial Rounded MT Bold, Arial, sans-serif; font-size: 22px; font-weight: 900; text-transform: uppercase; cursor: pointer; transition: transform .07s ease, box-shadow .07s ease; }
.tile:hover { transform: translateY(-2px); }
.tile:active { transform: translateY(4px); box-shadow: 0 1px 0 #dcae28; }
.tile.used { color: #a9b5bb; border-color: #d8e0e4; background: #e6ecef; box-shadow: none; opacity: .5; pointer-events: none; transform: translateY(3px); }
#answer-slots[hidden], #letter-tiles[hidden], #choice-area[hidden] { display: none; }
.choice-area { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; align-content: flex-start; gap: var(--space-3); padding: var(--space-1) 0 var(--space-2); overflow-y: auto; }
.choice-btn {
  min-height: 56px;
  padding: var(--space-2) var(--space-3);
  color: #5a4509;
  border: 1px solid #f2c741;
  border-radius: 14px;
  background: linear-gradient(155deg, #ffe991, var(--yellow));
  box-shadow: 0 5px 0 #dcae28, 0 8px 12px rgba(86,65,8,.12);
  font-family: "BIZ UDPGothic", "Hiragino Maru Gothic ProN", Arial, sans-serif;
  font-size: 16px;
  font-weight: 900;
  text-transform: none;
  cursor: pointer;
  transition: transform .07s ease, box-shadow .07s ease;
}
.choice-btn .choice-key { display: inline-block; min-width: 1.4em; margin-right: var(--space-1); color: #8a6a12; font-size: 12px; }
.choice-btn:hover { transform: translateY(-2px); }
.choice-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #dcae28; }
.choice-btn.used { color: #a9b5bb; border-color: #d8e0e4; background: #e6ecef; box-shadow: none; opacity: .5; pointer-events: none; }
.choice-btn.correct-reveal { color: #1e7a45; border-color: #7fc9a0; background: #f3fff6; box-shadow: 0 5px 0 #7fc9a0, 0 8px 12px rgba(35,148,79,.15); }
.choice-btn.wrong-reveal { color: #b8353d; border-color: #f1cbce; background: #fff2f2; box-shadow: 0 5px 0 #f1cbce, 0 8px 12px rgba(215,77,85,.12); }

.fill-display { display: flex; justify-content: center; gap: var(--space-1); margin-top: var(--space-2); font-family: Arial Rounded MT Bold, Arial, sans-serif; font-size: clamp(22px, 6vw, 30px); font-weight: 900; letter-spacing: .06em; color: var(--ink); }
.fill-display .fill-blank { display: inline-block; min-width: .9em; border-bottom: 4px solid var(--orange); text-align: center; }
.fill-display .fill-blank.filled { color: #dd6c2d; }

.game-buttons { flex: 0 0 auto; display: flex; justify-content: center; gap: var(--space-2); }

/* result */
#screen-result.active { justify-content: center; padding: var(--space-5) var(--space-4); }
.result-card { width: min(100%, 560px); padding: var(--space-6) var(--space-5); border: 1px solid rgba(255,255,255,.9); border-radius: 28px; background: rgba(255,254,250,.9); box-shadow: var(--shadow); text-align: center; }
.result-rank { margin: var(--space-2) 0 0; color: var(--blue); font-family: Arial Rounded MT Bold, Arial, sans-serif; font-size: 76px; font-weight: 900; line-height: 1; text-shadow: 0 6px 0 #d8eaff; }
.result-rank.rank-s { color: #ffb930; text-shadow: 0 6px 0 #fff0a8; animation: rankGlow 1.2s ease-in-out infinite; }
.result-animal { width: 125px; height: 125px; margin: var(--space-2) auto; filter: drop-shadow(0 8px 7px rgba(33,70,88,.13)); }
.result-animal svg { width: 100%; height: 100%; }
.result-score, .result-correct, .result-best, .result-streak { margin: var(--space-1) 0; color: var(--ink); font-size: 13px; font-weight: 800; line-height: 1.5; }
.result-score { color: var(--orange); font-size: 23px; }
.result-streak { display: inline-block; margin-top: var(--space-3); padding: var(--space-2) var(--space-4); border-radius: 999px; background: #fff6da; color: #856719; font-size: 11px; }

.result-mistakes-wrap { margin-top: var(--space-5); }
.result-perfect { color: var(--green-deep); font-size: 15px; font-weight: 900; }
.result-mistakes-title { margin-bottom: var(--space-2); color: var(--ink-soft); font-size: 12px; font-weight: 800; letter-spacing: .04em; text-align: center; }
.result-mistakes { display: grid; gap: var(--space-2); max-height: 230px; padding: var(--space-1); overflow-y: auto; }
.result-mistake-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: var(--space-2);
  row-gap: 2px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: 0 4px 10px rgba(33,72,91,.06);
  text-align: left;
}
.result-mistake-en { grid-column: 1; color: var(--ink); font-family: Arial Rounded MT Bold, Arial, sans-serif; font-size: 16px; font-weight: 900; text-transform: capitalize; }
.result-mistake-kana { grid-column: 2; color: var(--blue-deep); font-size: 11px; font-weight: 800; }
.result-mistake-ja { grid-column: 1 / -1; color: var(--ink-soft); font-size: 12px; font-weight: 700; }

.result-buttons { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); margin-top: var(--space-5); }
.result-buttons .btn-primary { min-width: 230px; }

.bounce { animation: bounceAnim .5s ease; }

@keyframes slotPop { 0% { transform: scale(1); } 45% { transform: scale(1.14); } 100% { transform: scale(1); } }
@keyframes slotShake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-8px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(6px); } }
@keyframes bounceAnim { 0% { transform: translateY(0); } 30% { transform: translateY(-12px); } 55% { transform: translateY(0); } 75% { transform: translateY(-5px); } 100% { transform: translateY(0); } }
@keyframes characterWiggle { 0%,100% { transform: rotate(-3deg) translateY(0); } 50% { transform: rotate(3deg) translateY(-5px); } }
@keyframes timerPulse { 0%,100% { opacity: 1; } 50% { opacity: .62; } }
@keyframes rankGlow { 0%,100% { filter: brightness(1); } 50% { filter: brightness(1.12); } }

@media (min-width: 520px) {
  .buddy-list { grid-template-columns: repeat(6, 1fr); }
  .title-card { padding: var(--space-6) 44px var(--space-5); }
  .game-card { padding-inline: 24px; }
}

@media (max-width: 430px) {
  .screen-heading { font-size: 20px; letter-spacing: .02em; }
}

@media (min-width: 768px) {
  #screen-level.active { justify-content: center; }
  #screen-game.active { justify-content: center; padding: var(--space-5); }
  .game-card { height: min(720px, calc(100dvh - 48px)); min-height: 560px; padding: var(--space-5) var(--space-6); border: 1px solid rgba(255,255,255,.9); border-radius: 28px; background: rgba(255,254,250,.84); box-shadow: var(--shadow); }
  .animal-stage { width: 140px; height: 140px; }
  .level-list { grid-template-columns: 1fr 1fr; }
}

@media (max-height: 640px) {
  .title-card { padding-block: var(--space-4); }
  .title-animal { width: 90px; height: 90px; margin-top: var(--space-1); }
  .streak-box { margin-block: var(--space-2); padding-block: var(--space-2); }
  .keyboard-note { display: none; }
  .animal-stage { width: 72px; height: 72px; }
  .question-ja { font-size: 24px; }
  /* 画面が低くてもタップ目標は 44px を下回らせない */
  .slot { width: 34px; height: 40px; line-height: 35px; font-size: 20px; }
  .tile { min-width: 46px; min-height: 46px; font-size: 19px; }
  .choice-btn { min-height: 46px; font-size: 14px; }
  .speech-bubble { font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
