:root {
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", sans-serif;
  line-height: 1.4;
  color: #0f172a;
  background-color: #e2e8f0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }

.app-shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 1rem;
  text-align: center;
}

h1 {
  font-size: 2rem;
  margin-bottom: 0.25rem;
}

.offline-ok {
  color: #047857;
  font-weight: 700;
  min-height: 1.5rem;
}

.card {
  background: #ffffff;
  border-radius: 16px;
  padding: 1.2rem;
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.08);
}

.progress {
  font-size: 1.4rem;
  font-weight: 700;
}

.staff-container {
  display: flex;
  justify-content: center;
  margin: 0.5rem 0 1rem;
  width: 100%;
  overflow-x: hidden; /* スマホで横スクロールを抑制 */
}

/* ★ここが一番重要：スマホでも切れない2列/1列 */
.choices-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* ★ここが二番目に重要：ボタンを可変サイズに */
button {
  border: none;
  border-radius: 12px;
  cursor: pointer;
  width: 100%;
  font-weight: 700;

  font-size: clamp(1.05rem, 4.2vw, 1.5rem);
  padding: clamp(0.8rem, 3.2vw, 1rem) 0.8rem;
  min-height: 56px;
}

.primary-btn,
.choice-btn {
  background: #2563eb;
  color: white;
}

.ghost-btn {
  background: #fde68a;
  color: #92400e;
}

.feedback {
  min-height: 2rem;
  font-size: 1.3rem;
  font-weight: 700;
}

.result-score {
  font-size: 1.8rem;
  font-weight: 800;
}

/* ===== Perfect celebration (CSS-only, no libs) ===== */
.celebration-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 9999;
  overflow: hidden;
  background: radial-gradient(1200px 600px at 50% 20%, rgba(255,255,255,0.35), rgba(0,0,0,0.0)),
              linear-gradient(120deg, rgba(37,99,235,0.35), rgba(16,185,129,0.25), rgba(245,158,11,0.25));
  animation: bgShift 6s ease-in-out infinite alternate;
  backdrop-filter: blur(2px);
}

@keyframes bgShift {
  0% { filter: saturate(1.0) brightness(1.0); transform: scale(1); }
  100% { filter: saturate(1.3) brightness(1.05); transform: scale(1.02); }
}

.celebration-card {
  position: relative;
  width: min(720px, calc(100vw - 48px));
  border-radius: 20px;
  padding: 24px 20px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 24px 80px rgba(0,0,0,0.25);
  border: 2px solid rgba(255,255,255,0.65);
}

.sparkle {
  position: absolute;
  inset: -2px;
  border-radius: 22px;
  pointer-events: none;
  background: conic-gradient(from 180deg,
    rgba(37,99,235,0.0),
    rgba(37,99,235,0.55),
    rgba(245,158,11,0.55),
    rgba(16,185,129,0.55),
    rgba(37,99,235,0.0)
  );
  filter: blur(10px);
  opacity: 0.55;
  animation: spin 2.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.celebration-title {
  margin: 0;
  font-size: 1.9rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 0 rgba(255,255,255,0.7);
  animation: pop 700ms ease-out both;
}

.celebration-sub {
  margin: 10px 0 18px;
  font-size: 1.2rem;
  font-weight: 800;
  opacity: 0.9;
}

@keyframes pop {
  0% { transform: translateY(10px) scale(0.98); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

.celebration-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.pulse {
  animation: pulseBtn 1.1s ease-in-out infinite;
}

@keyframes pulseBtn {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

/* Confetti */
.confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  top: -12px;
  width: 10px;
  height: 18px;
  border-radius: 3px;
  opacity: 0.95;
  transform: translateY(-20px) rotate(0deg);
  animation: confettiFall linear infinite;
}

/* 60個をランダム風に散らす（固定だけど見た目は十分） */
.confetti-piece:nth-child(1n)  { left: 2%;  animation-duration: 3.4s; animation-delay: -0.2s; transform: rotate(12deg);  background: #2563eb; }
.confetti-piece:nth-child(2n)  { left: 8%;  animation-duration: 4.1s; animation-delay: -1.3s; transform: rotate(38deg);  background: #10b981; }
.confetti-piece:nth-child(3n)  { left: 14%; animation-duration: 3.7s; animation-delay: -2.1s; transform: rotate(64deg);  background: #f59e0b; }
.confetti-piece:nth-child(4n)  { left: 20%; animation-duration: 4.6s; animation-delay: -0.9s; transform: rotate(91deg);  background: #ef4444; }
.confetti-piece:nth-child(5n)  { left: 26%; animation-duration: 3.2s; animation-delay: -1.8s; transform: rotate(117deg); background: #a855f7; }
.confetti-piece:nth-child(6n)  { left: 32%; animation-duration: 4.3s; animation-delay: -0.4s; transform: rotate(143deg); background: #06b6d4; }
.confetti-piece:nth-child(7n)  { left: 38%; animation-duration: 3.9s; animation-delay: -2.6s; transform: rotate(169deg); background: #22c55e; }
.confetti-piece:nth-child(8n)  { left: 44%; animation-duration: 4.9s; animation-delay: -1.1s; transform: rotate(195deg); background: #eab308; }
.confetti-piece:nth-child(9n)  { left: 50%; animation-duration: 3.5s; animation-delay: -2.9s; transform: rotate(221deg); background: #3b82f6; }
.confetti-piece:nth-child(10n) { left: 56%; animation-duration: 4.2s; animation-delay: -0.7s; transform: rotate(247deg); background: #14b8a6; }
.confetti-piece:nth-child(11n) { left: 62%; animation-duration: 3.3s; animation-delay: -2.0s; transform: rotate(273deg); background: #fb7185; }
.confetti-piece:nth-child(12n) { left: 68%; animation-duration: 4.7s; animation-delay: -1.5s; transform: rotate(299deg); background: #8b5cf6; }
.confetti-piece:nth-child(13n) { left: 74%; animation-duration: 3.8s; animation-delay: -0.3s; transform: rotate(325deg); background: #f97316; }
.confetti-piece:nth-child(14n) { left: 80%; animation-duration: 4.4s; animation-delay: -2.4s; transform: rotate(351deg); background: #22c55e; }
.confetti-piece:nth-child(15n) { left: 86%; animation-duration: 3.6s; animation-delay: -1.0s; transform: rotate(17deg);  background: #0ea5e9; }
.confetti-piece:nth-child(16n) { left: 92%; animation-duration: 4.8s; animation-delay: -2.7s; transform: rotate(44deg);  background: #f59e0b; }

@keyframes confettiFall {
  0%   { transform: translateY(-20px) rotate(0deg); opacity: 0.95; }
  100% { transform: translateY(120vh) rotate(720deg); opacity: 0.95; }
}

/* ★超小型スマホは1列に落とす（これが最終安全弁） */
@media (max-width: 420px) {
  .choices-grid {
    grid-template-columns: 1fr;
  }
}

