/* Palette follows the watercolor kitten: white paper, mint scarf, peach cheeks. */
:root {
  --paper: #fefefe;
  --mint-wash: #e3f4ea;
  --peach-wash: #fdeee4;
  --ink: #45403c;
  --soft: #8a827a;
  --accent: #5cb89c;
  --accent-dark: #3f9a7f;
  --en: #2f7fd1;
  --card: #ffffff;
  --line: #e4ece6;
  --listen: #f0788a;
  --font: "Hiragino Maru Gothic ProN", "Hiragino Sans", "BIZ UDPGothic", "Yu Gothic", system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  /* washes stay in the corners so the painting's white paper meets plain white */
  background:
    radial-gradient(60vmax 40vmax at -10% 110%, var(--mint-wash), transparent 70%),
    radial-gradient(50vmax 35vmax at 110% -10%, var(--peach-wash), transparent 70%),
    var(--paper);
  color: var(--ink);
  font-family: var(--font);
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
[hidden] { display: none !important; }

.screen {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}
#play { justify-content: space-between; }

/* soft edge so the picture never shows a rectangle */
.start-buddy, .cat img {
  -webkit-mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 82%, transparent 100%);
  mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 82%, transparent 100%);
}

/* start / bye */
.start-buddy { height: min(60vh, 560px); aspect-ratio: 928/1232; }
.big-btn {
  margin-top: 24px; font: inherit; font-size: 40px; font-weight: 800; letter-spacing: .1em;
  padding: 20px 64px; border: 0; border-radius: 999px; color: #fff; background: var(--accent);
  box-shadow: 0 8px 0 var(--accent-dark); cursor: pointer;
}
.big-btn:active { transform: translateY(6px); box-shadow: 0 2px 0 var(--accent-dark); }
.bye-text { font-size: 34px; text-align: center; line-height: 1.6; font-weight: 700; }
.parent-link { margin-top: 24px; font-size: 16px; color: var(--soft); }

/* header */
.top { width: 100%; display: flex; justify-content: space-between; align-items: center; }
.timer { font-size: 20px; color: var(--soft); background: #ffffffcc; padding: 6px 16px; border-radius: 999px; border: 1px solid var(--line); }
.parent-btn { font-size: 22px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: #c8c2bb; cursor: pointer; }

/* stage */
.stage { flex: 1; width: 100%; max-width: 900px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 0; }
.bubble {
  position: relative; z-index: 1; max-width: 760px; min-height: 2.6em; background: var(--card); border-radius: 28px;
  padding: 18px 26px; font-size: clamp(24px, 3.6vw, 38px); line-height: 1.55; font-weight: 700;
  border: 2px solid var(--line); box-shadow: 0 6px 20px #5cb89c1f; text-align: center;
  flex-shrink: 0; word-break: keep-all; overflow-wrap: anywhere; line-break: strict;
}
.bubble:empty { visibility: hidden; }
.bubble::after {
  content: ""; position: absolute; left: 50%; bottom: -16px; transform: translateX(-50%);
  border: 12px solid transparent; border-top: 14px solid var(--card); border-bottom: 0;
}
.en { color: var(--en); font-weight: 800; }
.bubble .en { cursor: pointer; border-bottom: 3px dotted #2f7fd155; }

.buddy { position: relative; height: clamp(170px, 46vh, 460px); max-height: 100%; aspect-ratio: 928/1232; flex-shrink: 1; min-height: 0; border: 0; background: none; padding: 0; cursor: pointer; }
.heard { min-height: 1.5em; font-size: 22px; color: var(--soft); text-align: center; }

/* the kitten: painting + overlay for blinking and talking */
/* the painting has wide white margins, so let it spill past the button box */
.cat { position: absolute; inset: -16%; display: block; transform-origin: 50% 85%; }
.cat img { display: block; width: 100%; height: 100%; pointer-events: none; }
.cat-face { position: absolute; inset: 0; width: 100%; height: 100%; }
.cat-face .lids, .cat-face .mouth { display: none; }
.buddy.blink .cat-face .lids { display: inline; }
.buddy[data-state="talking"] .cat-face .mouth { display: inline; transform-box: fill-box; transform-origin: 50% 20%; animation: talk .2s ease-in-out infinite alternate; }

/* 亜東 2026-10-18: the kitten itself stays still (no sway, no scaling); only eyes and mouth move */

.thinking-dots { position: absolute; top: 8%; right: 0; display: none; gap: 8px; background: #fff; padding: 10px 14px; border-radius: 999px; border: 2px solid var(--line); }
.buddy[data-state="thinking"] .thinking-dots { display: flex; }
.thinking-dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); animation: dot 1s infinite; }
.thinking-dots i:nth-child(2) { animation-delay: .15s; }
.thinking-dots i:nth-child(3) { animation-delay: .3s; }

@keyframes talk { from { transform: scaleY(.3); } to { transform: scaleY(1.1); } }
@keyframes dot { 50% { transform: translateY(-6px); opacity: .5; } }

/* word cards */
.words { width: 100%; max-width: 900px; display: flex; justify-content: safe center; gap: 10px; overflow-x: auto; padding: 6px 4px 10px; scrollbar-width: none; }
.words:empty { display: none; }
.word {
  flex: none; font: inherit; border: 2px solid var(--line); border-radius: 18px; background: var(--card); padding: 8px 18px;
  box-shadow: 0 3px 0 var(--line); cursor: pointer; text-align: center; animation: pop .35s ease-out;
}
.word b { display: block; font-size: 26px; color: var(--en); }
.word small { font-size: 16px; color: var(--soft); }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }

/* talk button */
.controls { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.talk-btn {
  width: 128px; height: 128px; border-radius: 50%; border: 0; background: var(--accent); color: #fff;
  box-shadow: 0 8px 0 var(--accent-dark); cursor: pointer; touch-action: none; transition: transform .1s;
}
.talk-btn svg { width: 60px; height: 60px; fill: currentColor; }
.talk-btn.listening { background: var(--listen); box-shadow: 0 0 0 14px #f0788a44, 0 0 0 28px #f0788a22; transform: scale(1.08); }
.talk-btn:disabled { background: #cfe3da; box-shadow: 0 8px 0 #b5d1c4; }
.hint { margin: 4px 0 0; font-size: 22px; color: var(--soft); font-weight: 700; }

.type-form { display: flex; gap: 8px; margin-top: 6px; }
.type-form input { font: inherit; font-size: 22px; padding: 10px 16px; border-radius: 999px; border: 3px solid var(--line); width: min(60vw, 420px); }
.send-btn { font: inherit; font-size: 20px; font-weight: 700; padding: 10px 20px; border: 0; border-radius: 999px; background: var(--accent); color: #fff; }

@media (max-height: 700px) {
  .talk-btn { width: 100px; height: 100px; }
  .buddy { height: clamp(140px, 38vh, 300px); }
}
