/* ヒット＆ブロー (hit_and_blow) — the prototype's pastel picture-book theme (paper, wood, Shiro), ported from the Hit & Blow
   prototype (css/style.css). Everything is in the hb- namespace and its colour tokens are --hb-*,
   scoped to this page's body, so the shared site header, footer and consent panel keep the site's own tokens.
   Shiro's picture is shown as-is; only its display size changes. No external assets. */
.hb-body {
  --hb-bg: #fbf1e1;
  --hb-paper: #fffaf1;
  --hb-ink: #5e4436;      /* warm brown, matches Shiro's outline */
  --hb-ink-soft: #7d6152;
  --hb-wood-1: #efd6b4;
  --hb-wood-2: #e6c69e;
  --hb-wood-line: #c9a27a;
  --hb-line: #ecd8c4;
  --hb-line-strong: #d9bfa6;
  --hb-pink: #ffb3c6;
  --hb-pink-deep: #b23c64;
  --hb-sky: #a9dcf5;
  --hb-sky-deep: #1f6d96;
  --hb-mint: #bfeedb;
  --hb-mint-deep: #3f9e7c;
  --hb-lemon: #ffe7a0;
  --hb-lav: #dccbf6;
  --hb-lav-deep: #8a6fc4;
  --hb-shadow: 0 4px 0 var(--hb-line-strong);
  --hb-radius: 22px;
  --hb-font: "Hiragino Maru Gothic ProN", "Hiragino Maru Gothic Pro", "Kosugi Maru",
          "M PLUS Rounded 1c", "Arial Rounded MT Bold", "Varela Round",
          system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
}

.hb-body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--hb-bg);
  /* soft paper grain */
  background-image:
    radial-gradient(rgba(201, 162, 122, .13) 1px, transparent 1.6px),
    radial-gradient(rgba(201, 162, 122, .08) 1px, transparent 1.6px),
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(201, 162, 122, .035) 3px 4px);
  background-size: 13px 13px, 29px 29px, auto;
  background-position: 0 0, 7px 11px, 0 0;
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom);
}
/* the site header, footer and the game sit above the decorative sky */
.hb-body > .site-header, .hb-body > .site-footer { position: relative; z-index: 2; }
.hb-app { font-family: var(--hb-font); color: var(--hb-ink); font-size: 16px; line-height: 1.55; }

:where(.hb-app) button { font: inherit; color: inherit; } /* zero-specificity, as the prototype's bare `button` rule */
.hb-body [hidden] { display: none !important; }

.hb-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;
}

:where(.hb-app) :focus-visible { outline: 3px solid var(--hb-lav-deep); outline-offset: 2px; }
.hb-screen:focus, .hb-screen:focus-visible { outline: none; }

/* ---------- decorative sky ---------- */
.hb-sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.hb-cloud {
  position: absolute; width: 90px; height: 30px; background: #fff; border-radius: 30px;
  opacity: .85; animation: hb-drift 38s linear infinite;
}
.hb-cloud::before, .hb-cloud::after {
  content: ""; position: absolute; background: #fff; border-radius: 50%;
}
.hb-cloud::before { width: 40px; height: 40px; top: -20px; left: 14px; }
.hb-cloud::after { width: 30px; height: 30px; top: -13px; left: 46px; }
.hb-cloud.c1 { top: 12%; left: -10%; }
.hb-cloud.c2 { top: 55%; left: -30%; transform: scale(.7); animation-duration: 52s; animation-delay: -20s; }
.hb-cloud.c3 { top: 82%; left: -20%; transform: scale(.9); animation-duration: 44s; animation-delay: -8s; }
@keyframes hb-drift { from { translate: 0 0; } to { translate: 130vw 0; } }
.hb-star {
  position: absolute; width: 14px; height: 14px; background: var(--hb-lemon);
  clip-path: polygon(50% 0, 61% 38%, 100% 50%, 61% 62%, 50% 100%, 39% 62%, 0 50%, 39% 38%);
  animation: hb-twinkle 3s ease-in-out infinite;
}
.hb-star.s1 { top: 8%; right: 12%; }
.hb-star.s2 { top: 40%; left: 5%; animation-delay: -1s; background: var(--hb-pink); }
.hb-star.s3 { bottom: 10%; right: 6%; animation-delay: -2s; background: var(--hb-sky); }
@keyframes hb-twinkle { 50% { transform: scale(.6) rotate(20deg); opacity: .6; } }

/* ---------- top bar ---------- */
.hb-topbar {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  max-width: 1040px; margin: 0 auto; padding: 12px 16px 4px;
  flex-wrap: wrap;
}
.hb-logo {
  margin: 0; font-size: clamp(1.25rem, 5vw, 1.75rem); letter-spacing: .02em; line-height: 1.3;
  display: flex; align-items: center; gap: 8px; flex: 1 1 auto; min-width: 0;
}
.hb-logo-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--hb-ink); flex: none; }
.hb-logo-dot.hit { background: var(--hb-pink); }
.hb-logo-dot.blow { background: var(--hb-sky); }
.hb-topbar-actions { display: flex; gap: 6px; }
.hb-chip {
  border: 2px solid var(--hb-ink); background: var(--hb-paper); border-radius: 999px;
  padding: 6px 12px; min-height: 44px; font-size: .9rem; font-weight: 700; cursor: pointer;
  box-shadow: 0 2px 0 var(--hb-ink);
}
.hb-chip:active { transform: translateY(2px); box-shadow: none; }

.hb-shelf {
  position: relative; z-index: 2;
  background-color: var(--hb-wood-1);
  background-image:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .18) 0 2px, transparent 2px 38px),
    repeating-linear-gradient(0deg, var(--hb-wood-1) 0 9px, var(--hb-wood-2) 9px 11px, var(--hb-wood-1) 11px 17px);
  border-bottom: 4px solid var(--hb-wood-line);
  box-shadow: 0 3px 0 rgba(94, 68, 54, .12);
  margin-bottom: 14px;
}
.hb-shelf .hb-topbar { padding-bottom: 10px; }

main.hb-main { position: relative; z-index: 1; width: auto; max-width: 1040px; margin: 0 auto; padding: 8px 16px 32px; }

/* ---------- cards & buttons ---------- */
.hb-card {
  background: var(--hb-paper); border: 2.5px solid var(--hb-ink); border-radius: var(--hb-radius);
  box-shadow: 0 5px 0 var(--hb-ink); padding: 18px 16px; margin-bottom: 18px;
}
.hb-card-title { margin: 0 0 12px; font-size: 1.15rem; text-align: center; }
.hb-card-title.small { font-size: 1rem; display: flex; align-items: center; justify-content: center; gap: 6px; }
.hb-help { margin: -4px 0 12px; text-align: center; color: var(--hb-ink-soft); font-size: .92rem; }

.hb-btn {
  border: 2.5px solid var(--hb-ink); border-radius: 16px; padding: 10px 18px; min-height: 52px;
  font-weight: 800; font-size: 1.02rem; cursor: pointer; background: var(--hb-paper);
  box-shadow: 0 4px 0 var(--hb-ink); transition: transform .06s, box-shadow .06s;
  touch-action: manipulation;
}
.hb-btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 0 0 var(--hb-ink); }
.hb-btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: 0 2px 0 var(--hb-ink); }
.hb-btn-primary { background: var(--hb-pink); }
.hb-btn-soft { background: var(--hb-sky); }
.hb-btn-ghost { background: var(--hb-paper); font-weight: 700; }
.hb-btn-big { display: block; width: 100%; margin-top: 18px; font-size: 1.2rem; min-height: 60px; }

/* ---------- home ---------- */
.hb-hero { text-align: center; margin: 4px 0 14px; }
.hb-subtitle { margin: 8px 0 0; font-weight: 700; font-size: 1.05rem; }


.hb-choices { display: grid; gap: 10px; }
.hb-choices.two { grid-template-columns: 1fr 1fr; }
.hb-choice {
  display: flex; align-items: center; gap: 12px; text-align: left;
  border: 2.5px solid var(--hb-line-strong); border-radius: 18px; background: #fff;
  padding: 12px; min-height: 64px; cursor: pointer; transition: background .15s, border-color .15s;
}
.hb-choice.compact { justify-content: center; text-align: center; }
.hb-choice[aria-checked="true"] { border-color: var(--hb-ink); background: var(--hb-lav); box-shadow: 0 3px 0 var(--hb-ink); }
.hb-choice-text { display: flex; flex-direction: column; min-width: 0; }
.hb-choice-name { font-weight: 800; font-size: 1.05rem; }
.hb-choice-desc { font-size: .88rem; color: var(--hb-ink-soft); }
.hb-choice[aria-checked="true"] .hb-choice-desc { color: var(--hb-ink); }
.hb-choice-icon {
  flex: none; width: 46px; height: 46px; border-radius: 50%; border: 2.5px solid var(--hb-ink);
  position: relative; background: var(--hb-lemon);
}
.hb-icon-solo::after { /* magnifier */
  content: ""; position: absolute; left: 9px; top: 8px; width: 16px; height: 16px;
  border: 3px solid var(--hb-ink); border-radius: 50%; background: #fff;
}
.hb-icon-solo::before {
  content: ""; position: absolute; left: 26px; top: 26px; width: 4px; height: 12px;
  background: var(--hb-ink); border-radius: 2px; transform: rotate(-45deg);
}
.hb-icon-versus { background: linear-gradient(90deg, var(--hb-pink) 50%, var(--hb-sky) 50%); }
.hb-icon-versus::after {
  content: "VS"; position: absolute; inset: 0; display: grid; place-items: center;
  font-weight: 900; font-size: .85rem;
}
#difficulty-wrap { margin-top: 16px; }

/* ---------- slots & keypad ---------- */
.hb-slots { display: flex; justify-content: center; gap: clamp(6px, 2.5vw, 12px); margin: 6px 0; }
.hb-slot {
  width: clamp(54px, 17vw, 68px); height: clamp(54px, 17vw, 68px); border-radius: 50%;
  border: 2.5px dashed var(--hb-line-strong); background: #fff;
  display: grid; place-items: center; font-size: clamp(1.6rem, 7vw, 2.1rem); font-weight: 900;
}
.hb-slot.filled { border-style: solid; border-color: var(--hb-ink); background: var(--hb-lemon); animation: hb-pop .18s ease-out; }
.hb-slot.next { border-color: var(--hb-lav-deep); }
.hb-slots.small .hb-slot { width: 44px; height: 44px; font-size: 1.35rem; border-style: solid; border-color: var(--hb-ink); background: var(--hb-mint); }
@keyframes hb-pop { 0% { transform: scale(.7); } 70% { transform: scale(1.1); } 100% { transform: scale(1); } }
.hb-shake { animation: hb-shake .32s; }
@keyframes hb-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.hb-message { min-height: 1.6em; margin: 6px 0; text-align: center; font-weight: 700; font-size: .95rem; }
.hb-message.error { color: var(--hb-pink-deep); }
.hb-message.last { color: var(--hb-ink); }

.hb-keypad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  max-width: 340px; margin: 4px auto 0;
}
.hb-key {
  min-height: 56px; border: 2.5px solid var(--hb-ink); border-radius: 16px; background: #fff;
  font-size: 1.5rem; font-weight: 900; cursor: pointer; box-shadow: 0 4px 0 var(--hb-ink);
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
  transition: transform .06s, box-shadow .06s, background .12s;
}
.hb-key:active:not(:disabled) { transform: translateY(4px); box-shadow: none; }
.hb-key:disabled { background: var(--hb-line); color: var(--hb-ink-soft); box-shadow: 0 1px 0 var(--hb-line-strong); border-color: var(--hb-line-strong); cursor: not-allowed; }
.hb-key.used { position: relative; }
.hb-key.used::after {
  content: ""; position: absolute; right: 6px; top: 6px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--hb-lav-deep);
}
.hb-key.fn { font-size: .95rem; font-weight: 800; background: var(--hb-sky); white-space: nowrap; padding: 0 4px; }
.hb-key.fn.clear { background: #fff; }
.hb-key.fn.submit { background: var(--hb-pink); font-size: 1.05rem; }

.hb-kbd-hint { text-align: center; font-size: .82rem; color: var(--hb-ink-soft); margin: 10px 0 0; }
@media (hover: none) and (pointer: coarse) { .hb-kbd-hint { display: none; } }

.hb-row-actions { display: flex; gap: 10px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.hb-row-actions .hb-btn { flex: 1 1 120px; max-width: 220px; }

/* ---------- game ---------- */
.hb-status-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.hb-turn-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px;
  border: 2px solid var(--hb-ink); background: var(--hb-mint); font-weight: 800; font-size: .95rem;
}
.hb-turn-badge.cpu { background: var(--hb-sky); }
.hb-turn-badge.cpu::after { content: ""; width: 18px; height: 6px; background:
  radial-gradient(circle, var(--hb-ink) 2px, transparent 2.5px) 0 0 / 6px 6px repeat-x;
  animation: hb-dots 1s steps(3) infinite; }
.hb-turn-badge.over { background: var(--hb-lemon); }
@keyframes hb-dots { from { width: 6px; } to { width: 24px; } }
.hb-round-label { font-weight: 700; color: var(--hb-ink-soft); font-size: .9rem; }

.hb-secrets { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 12px; }
.hb-secrets.two { grid-template-columns: 1fr 1fr; }
.hb-secret-box {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  border: 2px dashed var(--hb-line-strong); border-radius: 14px; padding: 6px 8px; background: #fff;
}
.hb-secret-box.mine { background: #fff7fa; }
.hb-secret-box.revealed { border-style: solid; border-color: var(--hb-ink); background: var(--hb-mint); }
.hb-secret-box.revealed .hb-secret-label { color: var(--hb-ink); }
.hb-secret-label { display: flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; color: var(--hb-ink-soft); }
.hb-secret-digits { font-size: 1.3rem; font-weight: 900; letter-spacing: .25em; padding-left: .25em; }

.hb-mini-buddy { display: inline-block; flex: none; position: relative; border: 2px solid var(--hb-ink); }
.hb-mini-buddy { width: 18px; height: 16px; border-radius: 50% 50% 45% 45%; background: var(--hb-lemon); }

/* history */
.hb-history-col { display: grid; gap: 0; }
.hb-history { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.hb-history-item {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
  border: 2px solid var(--hb-line); border-radius: 14px; padding: 8px 10px; background: #fff;
  animation: hb-slidein .25s ease-out;
}
.hb-history-item.win { border-color: var(--hb-ink); background: var(--hb-lemon); }
@keyframes hb-slidein { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.hb-h-no { font-size: .78rem; font-weight: 800; color: var(--hb-ink-soft); min-width: 2.2em; }
.hb-h-guess { font-size: 1.35rem; font-weight: 900; letter-spacing: .18em; }
.hb-h-result { display: flex; align-items: center; gap: 8px; }
.hb-pegs { display: grid; grid-template-columns: repeat(2, 12px); gap: 3px; }
.hb-peg { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--hb-line-strong); background: #fff; }
.hb-peg.hit { background: var(--hb-pink); border-color: var(--hb-ink); }
.hb-peg.blow { background: var(--hb-sky); border-color: var(--hb-ink); }
.hb-counts { display: flex; flex-direction: column; font-size: .78rem; font-weight: 800; line-height: 1.25; text-align: right; }
.hb-counts .hb-h { color: var(--hb-pink-deep); }
.hb-counts .hb-b { color: var(--hb-sky-deep); }
.hb-history-empty { margin: 0; text-align: center; color: var(--hb-ink-soft); font-size: .9rem; }
.hb-cpu-candidates { margin: -6px 0 10px; text-align: center; font-size: .82rem; color: var(--hb-ink-soft); font-weight: 700; }

/* ---------- dialogs ---------- */
.hb-overlay {
  position: fixed; inset: 0; z-index: 10; background: rgba(90, 70, 96, .35);
  display: grid; place-items: center; padding: 16px; animation: hb-fade .2s ease-out;
}
@keyframes hb-fade { from { opacity: 0; } }
.hb-dialog {
  position: relative; width: min(440px, 100%); max-height: calc(100dvh - 32px); overflow: auto;
  background: var(--hb-paper); border: 3px solid var(--hb-ink); border-radius: 26px;
  box-shadow: 0 6px 0 var(--hb-ink); padding: 22px 18px 18px; animation: hb-rise .25s ease-out;
}
@keyframes hb-rise { from { transform: translateY(16px) scale(.97); opacity: 0; } }
.hb-dialog:focus { outline: none; }
.hb-dialog-actions { display: grid; gap: 10px; margin-top: 18px; }
.hb-result { text-align: center; overflow: hidden; }
.hb-result-title { margin: 6px 0 4px; font-size: 1.8rem; }
.hb-result-sub { margin: 2px 0; font-weight: 700; }
.hb-result-sub:empty { display: none; }
.hb-answer { margin-top: 14px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.hb-answer-label { font-weight: 800; font-size: .9rem; color: var(--hb-ink-soft); }
.hb-confetti span {
  position: absolute; top: -12px; width: 10px; height: 14px; border-radius: 3px; opacity: 0;
}
.hb-result.celebrate .hb-confetti span { animation: hb-fall 1.6s ease-in forwards; }
.hb-confetti span:nth-child(1) { left: 10%; background: var(--hb-pink); animation-delay: .0s; }
.hb-confetti span:nth-child(2) { left: 26%; background: var(--hb-sky); animation-delay: .2s; }
.hb-confetti span:nth-child(3) { left: 44%; background: var(--hb-lemon); animation-delay: .1s; }
.hb-confetti span:nth-child(4) { left: 60%; background: var(--hb-mint); animation-delay: .3s; }
.hb-confetti span:nth-child(5) { left: 76%; background: var(--hb-lav); animation-delay: .15s; }
.hb-confetti span:nth-child(6) { left: 90%; background: var(--hb-pink); animation-delay: .25s; }
@keyframes hb-fall { 0% { opacity: 1; transform: translateY(0) rotate(0); } 100% { opacity: 0; transform: translateY(260px) rotate(320deg); } }

.hb-rules-list { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }
.hb-rules-example { background: var(--hb-lemon); border-radius: 12px; padding: 8px 10px; font-weight: 700; font-size: .92rem; margin: 14px 0 0; }
.hb-tag { display: inline-block; padding: 0 8px; border-radius: 999px; border: 2px solid var(--hb-ink); font-size: .85rem; }
.hb-tag-hit { background: var(--hb-pink); }
.hb-tag-blow { background: var(--hb-sky); }

/* ---------- picture-book paper cards ---------- */
.hb-card { position: relative; background-color: var(--hb-paper); }
.hb-card::before { /* masking tape */
  content: ""; position: absolute; top: -11px; left: 50%; width: 76px; height: 20px;
  transform: translateX(-50%) rotate(-3deg); border-radius: 3px;
  background: rgba(255, 179, 198, .6); box-shadow: 0 1px 0 rgba(94, 68, 54, .12);
  pointer-events: none;
}
.hb-history-card::before { background: rgba(169, 220, 245, .65); transform: translateX(-50%) rotate(2deg); }
.hb-history-card.cpu::before { background: rgba(255, 231, 160, .75); }

/* ---------- gentle page transitions ---------- */
.hb-screen { animation: hb-pageIn .38s ease-out; }
@keyframes hb-pageIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Shiro (official image shown as-is; only its display size changes) ---------- */
.hb-shiro {
  position: relative; flex: none; margin: 0; padding: 5px;
  background: #fff; border: 3px solid var(--hb-ink); border-radius: 22px;
  box-shadow: 0 4px 0 var(--hb-ink); transform-origin: 50% 100%;
}
.hb-shiro img { display: block; width: 100%; height: auto; }
.hb-shiro-lg { width: clamp(136px, 42vw, 184px); margin: 0 auto; }
.hb-shiro-md { width: clamp(76px, 23vw, 100px); border-radius: 18px; padding: 4px; }
.hb-shiro.img-missing { aspect-ratio: 1; display: grid; place-items: center; background: var(--hb-sky); }
.hb-shiro.img-missing img { display: none; }
.hb-shiro-fallback { font-weight: 900; font-size: 1.1rem; white-space: nowrap; }
.hb-mini-shiro { display: inline-block; flex: none; width: 22px; height: 22px; border: 1.5px solid var(--hb-ink); background: #fff; }

/* moods: CSS motion only, never filters on the character */
.hb-mood-idle { animation: hb-breathe 3.2s ease-in-out infinite; }
.hb-mood-happy { animation: hb-hop .8s ease-in-out 2, hb-breathe 3.2s ease-in-out 1.6s infinite; }
.hb-mood-think { animation: hb-ponder 2.4s ease-in-out infinite; }
.hb-mood-sad { animation: hb-sigh 3s ease-in-out infinite; }
.hb-mood-cheer { animation: hb-jump .7s ease-out 3, hb-breathe 3.2s ease-in-out 2.1s infinite; }
.hb-mood-surprised { animation: hb-startle .55s ease-out 1, hb-breathe 3.2s ease-in-out .55s infinite; }
@keyframes hb-breathe { 50% { transform: translateY(-3px) scale(1.015); } }
@keyframes hb-hop { 0%, 100% { transform: none; } 30% { transform: translateY(-10px) rotate(-2deg); } 60% { transform: rotate(1deg); } }
@keyframes hb-ponder { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes hb-sigh { 0%, 100% { transform: translateY(4px) rotate(-5deg) scale(.96); } 50% { transform: translateY(6px) rotate(-6deg) scale(.95); } }
@keyframes hb-jump { 0%, 100% { transform: none; } 40% { transform: translateY(-16px) rotate(4deg) scale(1.04); } }
@keyframes hb-startle { 20% { transform: translateY(-7px) scale(1.06); } 45% { transform: rotate(-4deg); } 70% { transform: rotate(3deg); } 100% { transform: none; } }
.hb-mood-cheer::before, .hb-mood-cheer::after, .hb-mood-happy::after {
  content: ""; position: absolute; width: 18px; height: 18px; background: var(--hb-lemon);
  clip-path: polygon(50% 0, 61% 38%, 100% 50%, 61% 62%, 50% 100%, 39% 62%, 0 50%, 39% 38%);
  animation: hb-twinkle 1.4s ease-in-out infinite;
}
.hb-mood-cheer::before { top: -12px; left: -12px; background: var(--hb-pink); }
.hb-mood-cheer::after, .hb-mood-happy::after { top: -14px; right: -12px; }
.hb-mood-sad::after { /* little sweat drop */
  content: ""; position: absolute; top: 6px; right: -10px; width: 10px; height: 14px;
  background: var(--hb-sky); border: 2px solid var(--hb-ink); border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
}
.hb-mood-think::after { /* thinking dots */
  content: ""; position: absolute; top: -12px; right: -6px; width: 26px; height: 8px;
  background: radial-gradient(circle, var(--hb-ink) 3px, transparent 3.5px) 0 0 / 9px 8px repeat-x;
  opacity: .7;
}

/* speech bubbles */
.hb-bubble {
  position: relative; margin: 0; background: #fff; color: var(--hb-ink);
  border: 2.5px solid var(--hb-ink); border-radius: 18px; padding: 10px 14px;
  font-weight: 800; font-size: 1rem; line-height: 1.45; box-shadow: 0 3px 0 var(--hb-ink);
  overflow-wrap: anywhere;
  word-break: auto-phrase; /* natural Japanese phrase breaks where supported */
}
.hb-bubble::before, .hb-bubble::after { content: ""; position: absolute; width: 0; height: 0; border-style: solid; }
.hb-bubble-down { display: inline-block; max-width: 100%; margin-bottom: 18px; }
.hb-bubble-down::before { left: 50%; bottom: -14px; transform: translateX(-50%); border-width: 13px 10px 0; border-color: var(--hb-ink) transparent transparent; }
.hb-bubble-down::after { left: 50%; bottom: -9px; transform: translateX(-50%); border-width: 9px 7px 0; border-color: #fff transparent transparent; }
.hb-bubble-left::before { left: -14px; top: 50%; transform: translateY(-50%); border-width: 9px 13px 9px 0; border-color: transparent var(--hb-ink) transparent transparent; }
.hb-bubble-left::after { left: -9px; top: 50%; transform: translateY(-50%); border-width: 6px 9px 6px 0; border-color: transparent #fff transparent transparent; }
.hb-bubble.pop { animation: hb-bubblePop .35s ease-out; }
@keyframes hb-bubblePop { 0% { transform: scale(.92); opacity: .4; } 70% { transform: scale(1.03); } 100% { transform: none; opacity: 1; } }

.hb-shiro-row { display: flex; align-items: center; gap: 18px; margin: 2px 0 14px; }
.hb-shiro-row .hb-bubble { flex: 1 1 auto; min-width: 0; }
.hb-result-shiro { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 6px 0 4px; text-align: left; }
.hb-result-shiro .hb-bubble { flex: 0 1 auto; min-width: 0; }
.hb-hero .hb-subtitle { margin-top: 14px; }

/* ---------- larger screens ---------- */
@media (min-width: 560px) {
  .hb-choices:not(.two) { grid-template-columns: 1fr 1fr; }
  #screen-home .hb-card, #screen-secret .hb-card { max-width: 560px; margin-left: auto; margin-right: auto; }
}
@media (min-width: 860px) {
  .hb-game-layout { display: grid; grid-template-columns: minmax(360px, 440px) 1fr; gap: 20px; align-items: start; }
  .hb-play-card { position: sticky; top: 12px; }
  .hb-history-col.versus { grid-template-columns: 1fr 1fr; gap: 16px; }
  .hb-history-col.versus .hb-history-card { margin-bottom: 0; }
}

/* very narrow (320px) tweaks */
@media (max-width: 360px) {
  .hb-card { padding: 14px 12px; }
  .hb-topbar { padding-left: 12px; padding-right: 12px; }
  main.hb-main { padding-left: 12px; padding-right: 12px; }
  .hb-chip { padding: 6px 10px; font-size: .85rem; }
  .hb-key { min-height: 52px; }
  .hb-key.fn { font-size: .85rem; }
  .hb-key.fn.submit { font-size: .9rem; }
  .hb-h-guess { font-size: 1.2rem; letter-spacing: .12em; }
}

@media (prefers-reduced-motion: reduce) {
  .hb-body *, .hb-body *::before, .hb-body *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition: none !important; }
  .hb-cloud { display: none; }
}
