/* tsubu coffee & bake — 長居のおとも（バターを当てる 30 秒）
   遊べる状態（.game.is-live）は play.js が付ける。付かないとき（JS なし・動きを減らす設定）は絵と一言だけ。 */

.game { margin-top: clamp(24px, 3vw, 44px); }
.game__stage {
  position: relative;
  height: 480px;
  overflow: hidden;
  border: 2px solid var(--ink);
  background: #e9e1d2;
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}
.game__canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: none; }
.game.is-live .game__canvas { display: block; }
.game.is-play .game__stage { cursor: crosshair; }

/* 遊べないときの絵 */
.game__still { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: clamp(20px, 6vw, 96px); }
.game__still img { width: clamp(120px, 17vw, 210px); height: auto; filter: drop-shadow(0 12px 12px rgba(58, 38, 16, .26)); }
.game__still img:first-child { transform: rotate(-11deg) translateY(-18px); }
.game__still img:last-child { transform: rotate(7deg) translateY(14px); }
.game.is-live .game__still { display: none; }
.game__off { margin-top: 14px; font-size: 14px; line-height: 1.8; color: var(--ink-2); }
.game.is-live .game__off { display: none; }
.game__hud, .game__sub, .game__say, .game__start, .game__keys { display: none; }

/* 残り時間と枚数 */
.game.is-live .game__hud {
  position: absolute;
  left: 18px;
  right: 18px;
  top: 14px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-family: var(--f-ja);
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s linear;
}
.game.is-play .game__hud, .game.is-over .game__hud { opacity: 1; }
.game__hud b { display: inline-block; min-width: 1.3em; font-family: var(--f-mono); font-weight: 500; font-size: 40px; letter-spacing: -.03em; text-align: right; }
.game__hud span:last-child b { color: var(--red); }

/* はずれ・逃した・最高記録（枚数のすぐ下） */
.game.is-live .game__sub {
  position: absolute;
  right: 18px;
  top: 62px;
  display: flex;
  gap: 12px;
  font-weight: 700;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--ink-2);
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s linear;
}
.game.is-play .game__sub, .game.is-over .game__sub { opacity: 1; }
.game__sub b { font-family: var(--f-mono); font-weight: 500; font-size: 15px; color: var(--ink); }

/* 店からのひとこと（札と同じ見た目） */
.game.is-live .game__say {
  position: absolute;
  left: 50%;
  top: 20px;
  display: block;
  padding: 6px 13px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
  font-size: 13px;
  line-height: 1.4;
  letter-spacing: .04em;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -6px);
  transition: opacity .2s linear, transform .3s var(--ease);
}
.game.is-live .game__say.is-on { opacity: 1; transform: translate(-50%, 0); }

/* はじめる */
.game.is-live .game__start { position: absolute; left: 50%; top: 46%; display: block; width: max-content; max-width: calc(100% - 32px); text-align: center; transform: translate(-50%, -50%); }
.game.is-play .game__start, .game.is-over .game__start { display: none; }
.game__go {
  min-height: 60px;
  padding: 0 30px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--f-ja);
  font-weight: 900;
  font-size: 18px;
  line-height: 1.3;
  letter-spacing: .02em;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(28, 26, 23, .26);
  transition: background-color .2s, transform .3s var(--ease);
}
.game__go:hover { background: var(--red); }
.game__go:active { transform: scale(.96); }
.game__go:focus-visible, .game__again:focus-visible, .game__keys button:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
.game__how { margin-top: 12px; padding: 4px 12px; border-radius: 999px; background: rgba(233, 225, 210, .86); font-size: 13px; line-height: 1.6; }
.game__best { width: max-content; margin: 8px auto 0; padding: 3px 12px; border: 1.5px solid var(--ink); border-radius: 999px; background: rgba(233, 225, 210, .86); font-weight: 700; font-size: 13px; line-height: 1.6; }
.game__best[hidden] { display: none; }
.game__best b { font-family: var(--f-mono); font-weight: 500; font-size: 16px; color: var(--red); }

/* 結果のレシート */
.game__result { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; background: rgba(233, 225, 210, .72); }
.game__result[hidden] { display: none; }
.game__rc {
  width: 264px;
  padding: 20px 18px 28px;
  background: #fdfcf8;
  color: #23211e;
  font-family: var(--f-mono);
  font-size: 12.5px;
  line-height: 1.7;
  box-shadow: 0 12px 24px rgba(58, 38, 16, .18);
  transform: rotate(-1.5deg);
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / 11px 100%;
  mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / 11px 100%;
  animation: game-rc .7s steps(9, end) both;
}
@keyframes game-rc { 0% { -webkit-clip-path: inset(0 0 100% 0); clip-path: inset(0 0 100% 0); } 100% { -webkit-clip-path: inset(0); clip-path: inset(0); } }
.game__rc-logo { font-family: var(--f-display); font-variation-settings: "wdth" 88; font-weight: 800; font-size: 30px; line-height: 1; letter-spacing: -.02em; text-align: center; }
.game__rc-title { margin-top: 8px; padding-bottom: 8px; border-bottom: 1px dashed rgba(35, 33, 30, .55); font-family: var(--f-ja); font-weight: 700; font-size: 12px; text-align: center; }
.game__rc dl { padding: 8px 0; border-bottom: 1px dashed rgba(35, 33, 30, .55); }
.game__rc dl div { display: flex; justify-content: space-between; gap: 8px; white-space: nowrap; }
.game__rc dt { font-family: var(--f-ja); font-weight: 500; }
.game__rc dl div:first-child { font-size: 15px; }
.game__rc dl div:first-child dt { font-weight: 700; }
.game__rc dt i { margin-left: 6px; padding: 0 5px; background: var(--red); color: #fff; font-style: normal; font-weight: 700; font-size: 10.5px; }
.game__rc dt i[hidden] { display: none; }
.game__rc-total { display: flex; align-items: baseline; justify-content: space-between; padding-top: 8px; font-family: var(--f-ja); font-weight: 700; font-size: 14px; }
.game__rc-total b { font-family: var(--f-mono); font-weight: 500; font-size: 26px; line-height: 1.1; }
.game__rc-msg { margin-top: 8px; font-family: var(--f-ja); font-size: 11.5px; line-height: 1.7; text-align: center; }
.game__again {
  min-height: 48px;
  padding: 0 28px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--f-ja);
  font-weight: 900;
  font-size: 16px;
  cursor: pointer;
}
.game__again:hover { background: var(--red); }

/* キーボード用のボタン（押せるのは遊んでいるあいだ） */
.game.is-live .game__keys { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.game__keys button {
  min-width: 48px;
  height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: none;
  color: var(--ink);
  font-family: var(--f-ja);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  touch-action: manipulation;
}
.game__keys .game__fire { min-width: 88px; background: var(--ink); color: var(--paper); }
.game__keys button[disabled] { opacity: .32; cursor: default; }
.game__keys p { margin-left: 8px; font-size: 13px; line-height: 1.6; color: var(--ink-2); }

@media (max-width: 768px) {
  .game__stage { height: 420px; }
  .game.is-live .game__hud { left: 12px; right: 12px; top: 10px; font-size: 13px; }
  .game__hud b { font-size: 32px; }
  .game.is-live .game__sub { right: 12px; top: 48px; gap: 9px; font-size: 11.5px; }
  .game__sub b { font-size: 13.5px; }
  .game.is-live .game__say { top: 76px; font-size: 12px; }
  .game__best { font-size: 12px; }
  .game__go { min-height: 56px; padding: 0 22px; font-size: 16px; }
  .game__how { font-size: 12px; }
  .game__rc { width: 240px; padding: 14px 16px 24px; }
  .game__result { gap: 12px; }
  .game__keys p { flex-basis: 100%; margin: 2px 0 0; font-size: 12.5px; }
  .game__off { font-size: 13.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .game__rc { animation: none; }
}
