/* ブランドの色（AppFactory/brand/README.md）。色・余白は変数だけで使い、直書きしない */
:root {
  --navy: #24345e;
  --coral: #e8684a;
  --coral-dark: #c24a30;
  --cream: #fff1ec;
  --line: #f0dfd7;
  --text: #24345e;
  --muted: #5b6684;
  --radius: 12px;
  --gap: 16px;
}
* {
  box-sizing: border-box;
}
/* hidden はいつも勝たせる。display を指定した区画でも隠れるように（忘年会くじ v0.2.0 の不具合） */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--text);
  font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
  line-height: 1.7;
}
.top,
main,
.foot {
  max-width: 640px;
  margin: 0 auto;
  padding: var(--gap);
}
h1 {
  font-size: 22px;
  margin: 8px 0 4px;
}
.beta {
  font-size: 12px;
  background: var(--coral-dark);
  color: #fff;
  border-radius: 6px;
  padding: 2px 8px;
  vertical-align: middle;
}
.lead {
  color: var(--muted);
  margin: 0;
}
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--gap);
}
label {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
}
input {
  width: 100%;
  font-size: 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
input:focus {
  outline: 3px solid var(--coral);
  outline-offset: 1px;
}
.result {
  min-height: 1.7em;
  font-size: 18px;
  font-weight: 700;
}
.donate {
  margin-top: var(--gap);
  padding: 12px var(--gap);
  border-radius: var(--radius);
  background: #fff;
  border: 1px dashed var(--coral);
}
.donate a,
.foot a {
  color: var(--coral-dark);
  font-weight: 700;
}
.foot {
  display: flex;
  gap: var(--gap);
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 14px;
}
button {
  font: inherit;
  cursor: pointer;
  border-radius: var(--radius);
  padding: 12px var(--gap);
  width: 100%;
  margin-top: 10px;
}
button.primary {
  background: var(--coral-dark);
  color: #fff;
  border: 0;
  font-weight: 700;
  font-size: 18px;
}
button.primary:active {
  background: var(--navy);
}
button.ghost {
  background: #fff;
  color: var(--navy);
  border: 1px solid var(--line);
}
button:focus-visible {
  outline: 3px solid var(--navy);
  outline-offset: 2px;
}
.row {
  display: flex;
  gap: 8px;
}
.sizes {
  border: 0;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.sizes legend {
  font-weight: 700;
  margin-bottom: 6px;
}
.pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 400;
  background: var(--cream);
  border-radius: 999px;
  padding: 6px 14px;
}
.pill input {
  width: auto;
}
.small {
  font-size: 14px;
  color: var(--muted);
  margin: 6px 0;
}
.howto {
  color: var(--muted);
  font-size: 14px;
  padding-left: 1.4em;
}
.status {
  min-height: 1.7em;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 8px;
}
.status.bingo {
  color: var(--coral-dark);
  font-size: 32px;
}
.grid {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(var(--n, 3), 1fr);
}
.cell {
  aspect-ratio: 1;
  margin: 0;
  padding: 0;
  font-size: clamp(18px, 7vw, 36px);
  font-weight: 700;
  background: #fff;
  color: var(--navy);
  border: 2px solid var(--line);
}
.grid.n5 .cell {
  font-size: clamp(14px, 5vw, 26px);
}
.cell[aria-pressed="true"] {
  background: var(--coral-dark);
  color: #fff;
  border-color: var(--navy);
}
.cell.free {
  font-size: 14px;
}
dialog {
  border: 0;
  border-radius: var(--radius);
  padding: var(--gap);
  width: min(560px, 94vw);
  max-height: 90vh;
  color: var(--text);
}
dialog::backdrop {
  background: rgb(36 52 94 / 55%);
}
dialog h2 {
  font-size: 18px;
  margin: 0;
}
.called {
  text-align: center;
  font-size: 20px;
  margin: 0;
}
.called span {
  font-size: 40px;
  font-weight: 700;
  color: var(--coral-dark);
}
.topic {
  font-size: 24px;
  font-weight: 700;
  margin: 4px 0 8px;
}
.pass-ok {
  display: inline-block;
  background: var(--cream);
  border-radius: 999px;
  padding: 2px 12px;
  font-size: 14px;
  margin: 0;
}
.note {
  font-size: 13px;
  color: var(--muted);
}
button.slim {
  width: auto;
  margin: 0;
  padding: 8px 14px;
}
button.link {
  background: none;
  border: 0;
  color: var(--muted);
  text-decoration: underline;
  font-size: 14px;
  margin-top: 24px;
}
.called-form {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.called-form label {
  margin: 0;
  font-weight: 700;
}
.called-form input {
  font-size: 20px;
  padding: 6px 10px;
}
.turn-hint {
  text-align: center;
  font-weight: 700;
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius);
  padding: 8px;
  margin: 0 0 8px;
}
.grid.choosing .cell:not([aria-pressed="true"]) {
  border-color: var(--navy);
  border-style: dashed;
}
.cell.reach {
  box-shadow: inset 0 0 0 4px var(--coral);
}
.cell.flash {
  animation: flash 0.9s ease-out 2;
}
@keyframes flash {
  50% {
    transform: scale(1.12);
  }
}
.bingo-dialog {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  margin: 0;
  background: var(--coral-dark);
  color: #fff;
  text-align: center;
  overflow: hidden;
}
.bingo-dialog[open] {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
.bingo-dialog .small {
  color: #fff;
}
.bingo-dialog button.primary {
  background: #fff;
  color: var(--coral-dark);
  max-width: 320px;
}
.bingo-big {
  font-size: clamp(56px, 18vw, 120px);
  font-weight: 800;
  margin: 0;
  animation: pop 0.6s ease-out;
}
@keyframes pop {
  0% {
    transform: scale(0.3);
  }
  70% {
    transform: scale(1.15);
  }
}
.confetti i {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 16px;
  background: #fff;
  animation: fall 2.4s linear infinite;
}
.confetti i:nth-child(3n) {
  background: var(--navy);
}
.confetti i:nth-child(3n + 1) {
  background: var(--cream);
}
.confetti i:nth-child(1) { left: 5%; animation-delay: 0s; }
.confetti i:nth-child(2) { left: 13%; animation-delay: 0.8s; }
.confetti i:nth-child(3) { left: 21%; animation-delay: 0.3s; }
.confetti i:nth-child(4) { left: 30%; animation-delay: 1.4s; }
.confetti i:nth-child(5) { left: 38%; animation-delay: 0.6s; }
.confetti i:nth-child(6) { left: 47%; animation-delay: 1.9s; }
.confetti i:nth-child(7) { left: 55%; animation-delay: 0.2s; }
.confetti i:nth-child(8) { left: 63%; animation-delay: 1.1s; }
.confetti i:nth-child(9) { left: 71%; animation-delay: 0.5s; }
.confetti i:nth-child(10) { left: 80%; animation-delay: 1.6s; }
.confetti i:nth-child(11) { left: 88%; animation-delay: 0.9s; }
.confetti i:nth-child(12) { left: 95%; animation-delay: 0.1s; }
@keyframes fall {
  to {
    transform: translateY(110vh) rotate(540deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .confetti {
    display: none;
  }
  .cell.flash,
  .bingo-big {
    animation: none;
  }
}

.ask-msg {
  font-size: 18px;
  margin: 4px 0 16px;
}
.ask-row {
  display: flex;
  gap: 8px;
}
.ask-row button {
  flex: 1;
}

/* 指で操作する端末では入力欄を 16px 以上に（iPhone が入力のたびに画面を拡大しないように） */
@media (pointer: coarse) {
  input,
  textarea,
  select {
    font-size: max(16px, 1em);
  }
}

/* 動きを減らす設定の端末では、光る・はねる・紙吹雪を止める（結果の文字はそのまま出る） */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
  }
  .confetti {
    display: none;
  }
}
