/* 配色・タイトル画面は Englishoose（/games/englishoose/）に合わせる */
:root {
  --bg: #fdf8f0;
  --card: #ffffff;
  --ink: #3a2f2a;
  --muted: #94867c;
  --line: #ece0d2;
  --accent: #f5842c;
  --ok: #1f9d55;
  --ng: #e0364b;
  --shadow: 0 2px 0 rgba(58,47,42,.10), 0 6px 18px rgba(58,47,42,.06);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); overflow: hidden; }
body {
  color: var(--ink);
  font-family: "Hiragino Maru Gothic ProN", "ヒラギノ丸ゴ ProN", -apple-system, BlinkMacSystemFont,
               "Hiragino Sans", "Noto Sans JP", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
#app { position: fixed; inset: 0; height: 100dvh; }
#video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #2a2320; }

/* ---------- プレイ中 ---------- */
.hud-time { font-size: 22px; font-variant-numeric: tabular-nums; }
#hud {
  position: absolute; left: 0; right: 0; top: 0;
  padding: calc(env(safe-area-inset-top) + 10px) 14px 14px;
  background: linear-gradient(rgba(0, 0, 0, 0.45), transparent);
}
.hud-top { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; font-size: 15px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.6); }
.quest {
  display: flex; align-items: center; gap: 12px; margin-top: 8px;
  background: var(--card); border: 3px solid var(--line); border-radius: 18px; padding: 10px 12px 10px 18px;
  box-shadow: var(--shadow);
}
.quest-main { flex: 1; min-width: 0; }
.quest small { display: block; font-size: 13px; color: var(--muted); font-weight: 700; }
.quest-word {
  display: block; font-size: clamp(30px, 10vw, 44px); font-weight: 800; line-height: 1.15;
  font-family: "Arial Rounded MT Bold", "Hiragino Maru Gothic ProN", sans-serif; letter-spacing: .01em;
  overflow-wrap: anywhere;
}
.quest-hint { display: block; font-size: 14px; color: var(--accent); font-weight: 700; margin-top: 2px; }
.btn-say {
  flex: none; width: 52px; height: 52px; border-radius: 50%; font-size: 24px;
  background: #fff5eb; border: 2px solid var(--accent);
}
.btn-say:active { transform: translateY(1px); }
.timer { height: 8px; margin-top: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.4); overflow: hidden; }
.timer-bar { height: 100%; width: 100%; background: var(--accent); border-radius: 4px; transition: width 0.12s linear; }
.timer-bar.hurry { background: var(--ng); }

#bottom {
  position: absolute; left: 0; right: 0; bottom: 0; color: #fff;
  padding: 24px 14px calc(env(safe-area-inset-bottom) + 14px);
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.65));
  display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: end;
}
.heat { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; }
.heat-label { font-size: 13px; font-weight: 700; white-space: nowrap; min-width: 6.5em; } /* 言葉が変わってもバーの位置が動かないよう幅を固定 */
.heat-track { flex: 1; height: 14px; border-radius: 7px; background: rgba(255, 255, 255, 0.3); overflow: hidden; }
.heat-bar {
  height: 100%; width: 0; border-radius: 7px;
  background: linear-gradient(90deg, #60a5fa, #facc15, #f5842c, #e0364b); background-size: 300px 100%;
  transition: width 0.15s;
}
.eye { min-width: 0; }
.eye-label { display: block; font-size: 12px; opacity: 0.85; }
.eye-guess { display: block; font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bottom-buttons { display: flex; gap: 8px; }
.btn-sub {
  font-size: 15px; font-weight: 700; color: #fff; background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.6); border-radius: 999px; padding: 8px 16px;
}
.btn-sub:disabled { opacity: 0.4; }
.btn-sub.dark { color: var(--ink); background: var(--card); border-color: var(--line); }

/* ---------- 画面（タイトル・出題・結果） ---------- */
.screen {
  position: absolute; inset: 0; overflow-y: auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: calc(env(safe-area-inset-top) + 20px) 20px calc(env(safe-area-inset-bottom) + 20px);
  background: var(--bg);
}
.screen.clear { background: rgba(253, 248, 240, 0.9); }

.home-head { position: relative; width: 100%; max-width: 420px; padding: 0.6rem 0 1.1rem; }
.mascot {
  display: block; width: clamp(96px, 26vw, 132px); margin: 0 auto 0.5rem;
  border-radius: 26%; border: 2px solid var(--line); background: #fff;
}
.mascot.flip { transform: scaleX(-1); }
.home-head h1 { margin: 0; font-size: clamp(1.4rem, 6.5vw, 2rem); letter-spacing: .02em; }
.home-head p { margin: .35rem 0 0; color: var(--muted); font-size: clamp(.85rem, 3.6vw, 1rem); line-height: 1.6; }
.sound-toggle {
  position: absolute; top: 0; right: 0; width: 2.75rem; height: 2.75rem; font-size: 1.25rem; line-height: 1;
  background: var(--card); border: 2px solid var(--line); border-radius: 50%;
}
.mode-row { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; justify-content: center; }
.mode-btn {
  font-size: 15px; font-weight: 700; background: var(--card); color: var(--muted);
  border: 2px solid var(--line); border-radius: 999px; padding: 8px 18px;
}
.mode-btn.selected { background: #fff5eb; border-color: var(--accent); color: var(--accent); }
.speak-row { display: flex; align-items: center; justify-content: center; gap: .5rem; flex-wrap: wrap; margin: 0 0 1.1rem; }
.speak-toggle {
  background: var(--card); border: 2px solid var(--line); border-radius: 999px;
  padding: .35rem .85rem; font-size: .82rem; font-weight: 700; color: var(--muted);
}
.voice-select {
  font: inherit; font-size: .8rem; max-width: 11rem; padding: .32rem .5rem;
  border: 2px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink);
}
.btn-main {
  min-height: 3.4rem; min-width: 14rem; border-radius: 16px; border: 3px solid var(--accent);
  background: var(--accent); color: #fff; font-size: 1.2rem; font-weight: 700; box-shadow: var(--shadow);
}
.btn-main:active { transform: translateY(2px); }
.btn-main.go { margin-top: 28px; animation: pop 0.4s ease-out; }
.hint { margin: 10px 0 0; font-size: 13px; color: var(--muted); line-height: 1.6; }
.hint.small { font-size: 12px; margin-top: 14px; }
.parent-note {
  max-width: 420px; margin: 16px 0 0; padding: 10px 14px; text-align: left;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  font-size: 11px; line-height: 1.7; color: var(--muted); background: var(--card);
  border: 1px solid var(--line); border-radius: 10px;
}
h2 { font-size: 22px; margin: 0; }

.intro-round { margin: 0; font-weight: 700; color: var(--muted); }
.intro-find { margin: 18px 0 0; font-size: 20px; color: var(--muted); font-weight: 700; }
.intro-word {
  margin: 4px 0 0; font-size: clamp(44px, 15vw, 72px); font-weight: 800; line-height: 1.1;
  font-family: "Arial Rounded MT Bold", "Hiragino Maru Gothic ProN", sans-serif;
  animation: pop 0.4s ease-out; overflow-wrap: anywhere;
}
@keyframes pop { from { transform: scale(0.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.flash-photo {
  width: 200px; height: 200px; border-radius: 22px; overflow: hidden; display: grid; place-items: center;
  font-size: 80px; font-weight: 800; color: var(--muted); background: var(--card); border: 3px solid var(--line);
  animation: pop 0.35s ease-out;
}
.found .flash-photo { border: 5px solid var(--ok); box-shadow: 0 0 36px rgba(31, 157, 85, 0.35); }
.flash-photo img { width: 100%; height: 100%; object-fit: cover; }
.flash-text { font-size: 34px; font-weight: 800; margin: 14px 0 0; color: var(--ng); }
.found .flash-text { color: var(--ok); }
.flash-word { margin: 4px 0 0; font-size: 30px; font-weight: 800; font-family: "Arial Rounded MT Bold", "Hiragino Maru Gothic ProN", sans-serif; }
.flash-word small { display: block; font-size: 15px; color: var(--muted); font-family: "Hiragino Maru Gothic ProN", sans-serif; }
.flash-points { margin: 6px 0 0; font-size: 16px; font-weight: 700; color: var(--accent); }

.result-score { font-size: 20px; margin: 6px 0 0; }
.result-found { margin: 2px 0 0; font-size: 18px; font-weight: 700; }
.result-score span { font-size: 56px; font-weight: 800; color: var(--accent); }
.result-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 100px)); gap: 12px; margin: 18px 0 0; justify-content: center; }
.result-cell {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 0;
  background: none; border: 0; text-align: center;
}
.result-pic {
  width: 96px; height: 96px; border-radius: 16px; overflow: hidden; display: grid; place-items: center;
  font-size: 40px; font-weight: 800; color: var(--muted); background: var(--card); border: 3px solid var(--line);
}
.result-cell.found .result-pic { border-color: var(--ok); }
.result-pic img { width: 100%; height: 100%; object-fit: cover; }
.result-word { font-size: 15px; font-weight: 800; }
.result-cell small { font-size: 11px; color: var(--muted); }
.name-box {
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  margin: 0 0 .9rem; font-size: .9rem; color: var(--muted);
}
.name-box input {
  font: inherit; width: 9rem; padding: .4rem .7rem; border: 2px solid var(--line);
  border-radius: 12px; background: var(--card); color: var(--ink); -webkit-user-select: text; user-select: text;
}
.name-box input:focus { outline: none; border-color: var(--accent); }
.rank-box {
  width: 100%; max-width: 360px; margin: 18px 0 0; padding: 12px 14px; text-align: left;
  background: var(--card); border: 2px solid var(--line); border-radius: 16px;
}
.rank-title { font-size: .85rem; color: var(--muted); font-weight: 700; margin: 0 0 .3rem; }
.rank-list { list-style: none; margin: 0; padding: 0; counter-reset: rank; font-size: .92rem; }
.rank-list li {
  display: flex; align-items: baseline; gap: .5rem; padding: .32rem .1rem;
  border-bottom: 1px solid var(--line); counter-increment: rank;
}
.rank-list li:last-child { border-bottom: 0; }
.rank-list li::before {
  content: counter(rank); flex: none; width: 1.4rem; text-align: right;
  color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums;
}
.rank-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-score { flex: none; font-weight: 700; white-space: nowrap; }
.rank-list li.mine, .rank-list li.mine .rank-score { color: var(--accent); }
.result-buttons { display: flex; flex-direction: column; gap: 12px; align-items: center; margin-top: 18px; }
