/* 来年の漢字。枠は game-ui.css の共通UI。ここにあるのはゲームの中身だけ */
a.g-icon-btn, a.g-btn { text-decoration: none; }
.kj-a { display: flex; align-items: center; justify-content: center; }

/* 遊ぶ画面: スマホ縦の1画面に収める */
.kj-play { display: flex; flex-direction: column; height: 100vh; height: 100dvh; padding-bottom: .5rem; overflow: hidden; }
.kj-play .g-stats { margin-bottom: .625rem; }
.kj-play .g-stat b { font-size: 1.0625rem; font-variant-numeric: tabular-nums; }
.kj-play .g-stat b.pop { animation: kj-pop 360ms var(--spring-fast); }
@keyframes kj-pop { from { transform: scale(1.3); } }
.kj-dots { margin-bottom: .625rem; }
.kj-prompt { margin: 0 0 .625rem; text-align: center; font-size: 1.0625rem; font-weight: 800; color: var(--on-surface); }

/* 二択 */
.kj-stage { position: relative; flex: 1 1 auto; min-height: 250px; display: flex; flex-direction: column; gap: .5rem; margin-bottom: .5rem; }
.kj-opt {
  --tone: var(--primary-container); --on-tone: var(--on-primary-container);
  flex: 1 1 0; min-height: 0; width: 100%; border: 0; padding: 1rem; cursor: pointer; font-family: inherit;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem;
  border-radius: var(--r-xl); background: var(--tone); color: var(--on-tone);
  transition: border-radius 300ms var(--emph), transform 300ms var(--spring-fast), opacity 200ms;
}
.kj-opt.t1 { --tone: var(--tertiary-container); --on-tone: var(--on-tertiary-container); }
.kj-opt:active { border-radius: var(--r-l); transform: scale(.97); }
.kj-opt .icon { font-size: 40px; }
.kj-opt b { font-size: clamp(1.25rem, 6.4vw, 1.625rem); font-weight: 900; line-height: 1.35; text-wrap: balance; }
.kj-or {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 1;
  width: 44px; height: 44px; border-radius: var(--r-full); display: flex; align-items: center; justify-content: center;
  background: var(--surface); color: var(--on-surface-variant); font-size: .875rem; font-weight: 800; pointer-events: none;
}
.kj-stage.is-picking .kj-opt { pointer-events: none; }
.kj-opt.win { transform: scale(1.03); border-radius: var(--r-l); }
.kj-opt.lose { opacity: .25; transform: scale(.94); }
.kj-stage.is-new .kj-opt { animation: kj-in 300ms var(--spring) both; }
.kj-stage.is-new .kj-opt.t1 { animation-delay: 60ms; }
@keyframes kj-in { from { opacity: 0; transform: translateY(10px) scale(.96); } }

.kj-foot { display: flex; align-items: center; justify-content: space-between; }
.kj-sound { width: 40px; height: 40px; }

/* 半紙と筆の字 */
.kj-paper {
  position: relative; width: min(64vw, 260px); aspect-ratio: 1 / 1.12; margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-container-lowest); color: var(--on-surface); border-radius: var(--r-xl);
  box-shadow: inset 0 0 0 1px var(--outline-variant);
}
.kj-char { font-family: 'Yuji Syuku', 'Noto Serif JP', serif; font-size: min(46vw, 188px); line-height: 1; margin: -6% 0 0 -4%; }
.kj-seal {
  position: absolute; right: 12px; bottom: 12px; width: 40px; height: 40px; border-radius: var(--r-s);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--primary); color: var(--on-primary); font-size: .75rem; font-weight: 900; line-height: 1.05;
}
.kj-seal i { font-style: normal; }
.kj-hero-top { margin: 0 0 .75rem; text-align: center; font-size: .9375rem; font-weight: 800; color: var(--on-surface-variant); }
.kj-yomi { margin: .75rem 0 0; text-align: center; font-size: 1.125rem; font-weight: 800; letter-spacing: .12em; color: var(--primary); }

/* 結果 */
.kj-hero { padding: .5rem 0 1.25rem; }
.kj-card { text-align: center; }
.kj-words { text-wrap: balance; margin: 0 0 1rem; font-size: 1.125rem; font-weight: 800; line-height: 1.6; color: var(--on-surface); }
.kj-w { display: inline-block; }
.kj-label { margin: 0 0 .5rem; font-size: .75rem; font-weight: 700; color: var(--on-surface-variant); }
.kj-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: .375rem; margin-bottom: 1.25rem; }
.kj-chip {
  padding: .375rem .75rem; border-radius: var(--r-s); font-size: .8125rem; font-weight: 700; line-height: 1.4;
  background: var(--secondary-container); color: var(--on-secondary-container);
}
.kj-sub { margin: .5rem 0 0; }
.kj-sub .icon { font-size: 20px; }
/* 広告はボタンから離す（誤タップさせない） */
.kj-ad { margin: 3rem auto 1rem; text-align: center; }
.kj-ad small { display: block; margin-bottom: .25rem; font-size: 11px; color: var(--on-surface-variant); }
.kj-ad iframe { display: block; margin: 0 auto; border: 0; max-width: 100%; }

/* 書く瞬間: 字がめくれて、上から墨で書かれ、判子が押される */
.kj-reveal {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 1rem; background: var(--surface); cursor: pointer; animation: kj-fade-in 240ms ease both;
}
.kj-reveal.out { animation: kj-fade-out 280ms ease forwards; }
.kj-paper.big { width: min(78vw, 340px); }
.kj-paper.big .kj-char { font-size: min(58vw, 250px); }
.kj-paper.big .kj-seal { width: 54px; height: 54px; right: 16px; bottom: 16px; font-size: 1rem; border-radius: var(--r-m); }
.kj-reveal .kj-char.roll { opacity: .18; }
.kj-reveal .kj-char.ink { animation: kj-ink 900ms cubic-bezier(.45, 0, .2, 1) both; }
.kj-reveal .kj-seal { opacity: 0; }
.kj-reveal .kj-seal.stamp { animation: kj-stamp 380ms var(--spring-fast) both; }
.kj-reveal .kj-yomi { opacity: 0; }
.kj-reveal .kj-yomi.on { opacity: 1; transition: opacity 300ms; }
@keyframes kj-ink {
  from { clip-path: inset(0 0 100% 0); filter: blur(3px); }
  70% { filter: blur(0); }
  to { clip-path: inset(0 0 0 0); filter: none; }
}
@keyframes kj-stamp { from { opacity: 0; transform: scale(2.4) rotate(-12deg); } to { opacity: 1; transform: none; } }
@keyframes kj-fade-in { from { opacity: 0; } }
@keyframes kj-fade-out { to { opacity: 0; } }

/* 背の低い画面では詰める */
@media (max-height: 640px) {
  .kj-play .g-header { min-height: 3.25rem; padding: .25rem 0; }
  .kj-play .g-stats { margin-bottom: .375rem; }
  .kj-dots { margin-bottom: .375rem; }
  .kj-prompt { margin-bottom: .375rem; font-size: 1rem; }
  .kj-opt .icon { font-size: 32px; }
  .kj-opt { gap: .25rem; padding: .75rem; }
}

@media (prefers-reduced-motion: reduce) {
  .kj-stage.is-new .kj-opt, .kj-reveal .kj-char.ink, .kj-reveal .kj-seal.stamp { animation: none; }
  .kj-reveal .kj-seal.stamp { opacity: 1; }
}
