/* ぽとん どうぶつ — 見た目。外部フォントは使わない */
:root {
  --bg: #fff1dc;
  --stage: #fffaf0;
  --ink: #2b2433;
  --sub: #6b6177;
  --card: #ffffff;
  --card-sh: #d9c49e;
  --well: #e3f1ff;
  --well-line: rgba(43, 36, 51, .1);
  --aim: rgba(255, 212, 59, .32);
  --gold: #ffc53d;
  --go: #3ccf6b;
  --go-sh: #1f9d4a;
  --go-ink: #0f3320;
  --focus: #2f7cf6;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1f1c2c;
    --stage: #29253a;
    --ink: #f3eefc;
    --sub: #bfb6d4;
    --card: #3a3550;
    --card-sh: #0f0d17;
    --well: #1d2a40;
    --well-line: rgba(255, 255, 255, .1);
    --aim: rgba(255, 212, 59, .18);
    --focus: #ffc53d;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Maru Gothic Pro", "BIZ UDPGothic", "Yu Gothic UI", Meiryo, system-ui, sans-serif;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  overscroll-behavior: none;
  overflow: hidden;
}
#app {
  position: fixed; inset: 0;
  display: grid; grid-template-rows: auto minmax(0, 1fr); grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  /* 画面の下 15% には押すものを置かない(手首が当たる) */
  padding: calc(env(safe-area-inset-top) + 8px) calc(env(safe-area-inset-right) + 10px) 15vh calc(env(safe-area-inset-left) + 10px);
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; margin: 0; cursor: pointer; touch-action: manipulation; }
button:focus-visible { outline: 4px solid var(--focus); outline-offset: 3px; }
svg { display: block; width: 100%; height: 100%; overflow: visible; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.logo { display: flex; align-items: center; gap: 8px; margin: 0; min-width: 0; font-size: clamp(17px, 4.6vw, 24px); font-weight: 900; white-space: nowrap; }
.logo img { width: 40px; height: 40px; flex-shrink: 0; }
@media (max-width: 380px) { .logo span { display: none; } }
.tbtns { display: flex; gap: 8px; flex-shrink: 0; }
.tb { width: 52px; height: 56px; border-radius: 16px; background: var(--card); box-shadow: 0 4px 0 var(--card-sh); display: grid; place-items: center; }
.tb svg { width: 32px; height: 32px; }
.tb:active { transform: translateY(3px); }
.spk { fill: var(--ink); }
.wave, .slash { fill: none; stroke: var(--ink); stroke-width: 3.5; stroke-linecap: round; }
.snd.off .wave, .snd:not(.off) .slash { display: none; }

/* ---- ステージ ---- */
.stage { position: relative; min-height: 0; border: 3px solid var(--ink); border-radius: 22px; overflow: hidden; background: var(--stage); }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.say {
  position: absolute; left: 0; right: 0; top: 30%; width: fit-content; max-width: 90%; margin: 0 auto; padding: 8px 18px; border-radius: 20px;
  background: #fff; color: #2b2433; border: 3px solid #2b2433; font-size: clamp(22px, 7vw, 34px); font-weight: 900; z-index: 3; pointer-events: none; white-space: nowrap;
}

/* ---- えらぶ ---- */
.pick {
  position: absolute; inset: 0; z-index: 2; background: var(--stage);
  display: grid; align-content: center; justify-items: center; gap: clamp(10px, 3vh, 24px); padding: 10px 12px;
}
.howto { display: grid; justify-items: center; gap: 6px; text-align: center; }
#how { width: 180px; height: 60px; }
.howto p { margin: 0; font-size: clamp(15px, 4.2vw, 20px); font-weight: 900; color: var(--sub); }
.modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; width: min(100%, 440px); }
.mode {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 150px; padding: 10px 6px; border-radius: 22px; background: var(--card); box-shadow: 0 5px 0 var(--card-sh); border: 3px solid var(--ink);
}
.mode svg { width: 64px; height: 64px; }
.mode b { font-size: clamp(22px, 6.4vw, 28px); font-weight: 900; }
.mode span { font-size: clamp(13px, 3.6vw, 16px); font-weight: 900; color: var(--sub); }
.mode.easy { background: #e9fbe9; color: #2b2433; }
.mode.hard { background: #ffe9e3; color: #2b2433; }
.mode.easy span, .mode.hard span { color: #5c5268; }
.mode:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--card-sh); }

/* ---- けっか ---- */
.result { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; padding: 10px; background: rgba(20, 16, 40, .18); }
.card {
  display: grid; justify-items: center; gap: 10px; width: min(100%, 360px); padding: 16px 16px 18px; border-radius: 26px;
  background: var(--card); border: 3px solid var(--ink); box-shadow: 0 6px 0 var(--card-sh);
}
.medal { width: 82px; height: 100px; }
.txt { text-align: center; }
.rtitle { margin: 0; font-size: 40px; font-weight: 900; line-height: 1.1; }
.rmsg { margin: 4px 0 0; font-size: clamp(16px, 4.4vw, 20px); font-weight: 900; color: var(--sub); }
.rsub { margin: 4px 0 0; font-size: 16px; font-weight: 900; color: var(--sub); }
.rsub:empty { display: none; }
.btns { display: grid; gap: 10px; width: 100%; }
.big { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 58px; border-radius: 18px; font-size: 22px; font-weight: 900; background: var(--go); color: var(--go-ink); box-shadow: 0 5px 0 var(--go-sh); }
.big.back { background: var(--stage); color: var(--ink); box-shadow: 0 5px 0 var(--card-sh); border: 3px solid var(--ink); }
.big svg { width: 28px; height: 28px; flex-shrink: 0; }
.big:active { transform: translateY(3px); }

/* スマホを横にしたとき(ひくい 画面) */
@media (orientation: landscape) and (max-height: 600px) {
  .logo img { width: 32px; height: 32px; }
  .tb { width: 48px; height: 48px; }
  .tb svg { width: 28px; height: 28px; }
  .pick { grid-template-columns: auto minmax(0, 440px); justify-content: center; column-gap: 18px; }
  #how { width: 120px; height: 40px; }
  .howto p { font-size: 14px; max-width: 150px; }
  .mode { min-height: 110px; }
  .mode svg { width: 44px; height: 44px; }
  .card { width: min(100%, 520px); grid-template-columns: auto 1fr auto; gap: 12px; padding: 10px 14px; border-radius: 22px; }
  .medal { width: 54px; height: 66px; }
  .txt { text-align: left; }
  .rtitle { font-size: 30px; }
  .rmsg { font-size: 15px; margin-top: 2px; }
  .btns { width: 190px; gap: 8px; }
  .big { min-height: 50px; font-size: 18px; border-radius: 14px; }
  .say { top: 22%; font-size: 24px; padding: 4px 14px; }
}

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