:root {
  --bg: #ffeccc;
  --paper: #fff8ea;
  --line: #37281a;
  --orange: #b97538;
  --gold: #e4ab5b;
  --pink: #f4a7a0;
  --mint: #a8dcc9;
}

* { box-sizing: border-box; }

/* 見出し・会場・操作・フッターまでを1画面に収める。会場は残った高さに合わせて縮む。
   それでも収まらないほど低い画面(横向きのスマホなど)では、縮みすぎないよう下限を設けてスクロールさせる */
body {
  margin: 0;
  height: 100svh;
  min-height: 540px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg);
  background-image: radial-gradient(#f6d9ae 2px, transparent 2px);
  background-size: 26px 26px;
  color: var(--line);
  font-family: 'M PLUS Rounded 1c', sans-serif;
  font-weight: 500;
  line-height: 1.6;
}

/* ---------- 見出し ---------- */

.header { padding: 12px 16px 8px; text-align: center; }
.header__date {
  display: inline-block;
  margin: 0;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--line);
  color: var(--paper);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .12em;
}
.header__title {
  margin: 6px 0 0;
  font-size: clamp(22px, 3.4vw, 34px);
  font-weight: 800;
  line-height: 1.3;
}

/* ---------- 会場 ---------- */

.main {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px;
}

/* 会場の置き場。ここの幅と高さの小さいほうに合わせて正方形の会場を置く */
.stage-wrap {
  flex: 1;
  min-height: 0;
  width: 100%;
  container-type: size;
  display: grid;
  place-items: center;
}

.stage {
  position: relative;
  /* 影(右下 8px)の分だけ小さくする */
  width: calc(min(100cqw, 100cqh) - 10px);
  aspect-ratio: 1;
  border: 5px solid var(--line);
  border-radius: 28px;
  overflow: hidden;
  background: var(--bg);
  box-shadow: 8px 8px 0 var(--line);
}
.scene {
  display: block;
  width: 100%;
  height: 100%;
  font-family: 'M PLUS Rounded 1c', sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.scene [role="button"] { cursor: pointer; outline: none; }
.scene [role="button"]:focus-visible { outline: 4px solid var(--orange); outline-offset: 4px; }
.scene .cake { touch-action: none; -webkit-touch-callout: none; }

.celebrate {
  position: absolute;
  inset: 19% 0 auto;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}
.celebrate[hidden] { display: none; }
.celebrate__title {
  display: inline-flex;
  margin: 0;
  /* 余白も含めて会場の幅に比例させ、SP でも下の「10.25」の飾りにかからないようにする */
  font-size: clamp(20px, 9cqi, 72px);
  font-weight: 800;
  line-height: 1;
  color: #fff;
  -webkit-text-stroke: .14em var(--line);
  paint-order: stroke fill;
  text-shadow: 0 .08em 0 var(--line);
}
.celebrate__title span { display: inline-block; }
.celebrate__sub {
  display: inline-block;
  margin: 1cqi 0 0;
  padding: .1em 1em;
  border: 3px solid var(--line);
  border-radius: 999px;
  background: var(--gold);
  font-size: clamp(10px, 2.6cqi, 20px);
  font-weight: 800;
}
.stage { container-type: inline-size; }

.noscript { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; font-weight: 800; }

/* ---------- 操作 ---------- */

.controls { width: min(100%, 560px); padding: 16px 0 0; text-align: center; }

.meter { display: flex; align-items: center; gap: 10px; transition: opacity .3s; }
.meter__label { font-weight: 800; font-size: 14px; white-space: nowrap; }
.meter__bar {
  flex: 1;
  height: 18px;
  border: 3px solid var(--line);
  border-radius: 999px;
  background: #fff;
  overflow: hidden;
}
.meter__bar i {
  display: block;
  height: 100%;
  background: repeating-linear-gradient(-45deg, var(--gold) 0 10px, #f0bd70 10px 20px);
  transform: scaleX(0);
  transform-origin: left center;
}
.is-out .meter { opacity: .35; }

/* 点いているとき用・消えたあと用のボタンの組を同じマスに重ね、visibility で切り替える。
   段の高さは常に高いほうの組に合うので、ボタンが入れ替わっても(折り返しても)会場の大きさが変わらない */
.buttons { display: grid; margin-top: 12px; }
.buttons__set { grid-area: 1 / 1; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; }
.buttons__set--out, .is-out .buttons__set--lit { visibility: hidden; }
.is-out .buttons__set--out { visibility: visible; }
.btn {
  font: inherit;
  font-weight: 800;
  font-size: 15px;
  color: var(--line);
  background: #fff;
  border: 3px solid var(--line);
  border-radius: 999px;
  padding: 8px 18px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.6;
  box-shadow: 0 4px 0 var(--line);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  transition: transform .08s, box-shadow .08s, background-color .15s;
}
.btn--main { background: var(--gold); }
.btn__icon { width: 18px; height: 18px; flex: none; }
.btn--nudge { animation: nudge 1.6s ease-in-out infinite; }
@keyframes nudge {
  0%, 60%, 100% { transform: none; }
  70% { transform: translateY(-4px) scale(1.04); }
  80% { transform: none; }
  88% { transform: translateY(-2px); }
}
@media (prefers-reduced-motion: reduce) { .btn--nudge { animation: none; } }
.btn:hover { background: #ffe2b3; }
.btn--main:hover { background: #f0bd70; }
.btn:active, .btn[aria-pressed="true"] { transform: translateY(4px); box-shadow: 0 0 0 var(--line); }
.btn[aria-pressed="true"] { background: var(--pink); }
.btn:focus-visible, .sound:focus-visible, .footer a:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; }
.btn[hidden] { display: none; }

/* 文が変わって行数が増減しても会場の大きさが変わらないよう、2行分の高さを確保する */
.hint { margin: 10px 0 0; min-height: 2.8em; white-space: pre-line; font-weight: 800; font-size: 17px; line-height: 1.4; }
.note { margin: 4px 0 0; font-size: 12px; line-height: 1.5; opacity: .75; }

.sound {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 10;
  font: inherit;
  font-weight: 800;
  font-size: 13px;
  color: var(--line);
  background: #fff;
  border: 3px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  box-shadow: 0 3px 0 var(--line);
  cursor: pointer;
}
.sound[aria-pressed="true"] { background: var(--mint); }

.footer { padding: 8px 16px 12px; font-size: 13px; }
.footer a { color: var(--line); font-weight: 800; }

.u-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.u-sp { display: none; }

@media (max-width: 767px) {
  .u-sp { display: inline; }
  .stage { border-width: 4px; border-radius: 22px; box-shadow: 5px 5px 0 var(--line); }
  .controls { padding-top: 12px; }
  .buttons__set { gap: 8px; }
  .btn { font-size: 14px; padding: 7px 13px; }
  .sound { top: 8px; right: 8px; }
}
