:root {
  --line-green: #06c755;
  --line-green-dark: #05a648;
  --bg: #fff8e7;
  --ink: #2b2b33;
  --muted: #6b6b76;
  --accent: #ffcf33;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  color: var(--ink);
  background: var(--bg);
  overflow: hidden;
}
#app { position: relative; height: 100vh; height: 100dvh; width: 100%; }

.screen {
  position: absolute; inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 22px calc(24px + env(safe-area-inset-bottom));
  gap: 14px;
  animation: fade .35s ease;
}
.screen.active { display: flex; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---- ボタン ---- */
.btn {
  border: none; border-radius: 14px;
  font-size: 18px; font-weight: 700;
  padding: 15px 22px; width: 100%; max-width: 340px;
  cursor: pointer; transition: transform .08s ease, filter .15s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--line-green); color: #fff; box-shadow: 0 6px 0 var(--line-green-dark); }
.btn-primary:active { box-shadow: 0 2px 0 var(--line-green-dark); }
.btn-secondary { background: #fff; color: var(--ink); border: 2px solid #ddd; }
.btn-staff { background: #7a8290; color: #fff; font-size: 16px; }

/* ---- ローディング ---- */
.loader {
  width: 54px; height: 54px; border-radius: 50%;
  border: 6px solid #ffe08a; border-top-color: var(--line-green);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: var(--muted); }

/* ---- 画面①ウェルカム ---- */
.badge {
  background: #e4404a; color: #fff; font-weight: 800;
  padding: 8px 20px; border-radius: 999px; font-size: 15px;
  transform: rotate(-2deg); box-shadow: 0 3px 0 #b62b34;
}
.welcome-title { font-size: 27px; margin: 6px 0 0; line-height: 1.35; }
.welcome-sub { font-size: 17px; color: var(--muted); margin: 0; line-height: 1.6; }
.hint {
  background: #fff; border: 2px dashed var(--accent); border-radius: 12px;
  padding: 10px 16px; font-weight: 700; color: #b8860b; margin: 4px 0;
}

/* ---- 画面②ルーレット ---- */
.wheel-wrap { position: relative; width: min(82vw, 340px); aspect-ratio: 1; }
.wheel-pointer {
  position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
  color: var(--accent); font-size: 40px; z-index: 5;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.35)); line-height: 1;
}
.wheel-spin {
  width: 100%; height: 100%; border-radius: 50%;
  border: 10px solid #2b2b33;
  box-shadow: 0 10px 26px rgba(0,0,0,.22), inset 0 0 0 4px #ffd84d;
  overflow: hidden; background: #fff;
  transition: transform 4.6s cubic-bezier(.15, .82, .22, 1);
}
.wheel-spin svg { width: 100%; height: 100%; display: block; }
.wheel-center {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 34%; height: 34%; border-radius: 50%;
  background: var(--accent); color: #2b2b33; border: 5px solid #fff;
  font-size: 22px; font-weight: 900; cursor: pointer; z-index: 6;
  box-shadow: 0 5px 14px rgba(0,0,0,.28);
}
.wheel-center:disabled { opacity: .6; cursor: default; }
.wheel-center:active:not(:disabled) { transform: translate(-50%, -50%) scale(.94); }
.wheel-note { font-weight: 800; font-size: 18px; color: #b8860b; margin: 4px 0 0; }

/* ---- 画面③結果 ---- */
#confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
#screen-result > *:not(#confetti) { position: relative; z-index: 2; }
.result-congrats { font-size: 25px; margin: 0; }
.result-emoji { font-size: 60px; line-height: 1; }
.result-prize { font-size: 30px; font-weight: 900; }
.result-prize-name { font-size: 22px; font-weight: 800; margin-top: -4px; }
.result-guide { font-size: 16px; color: var(--muted); font-weight: 700; margin: 8px 0 2px; }
.redeem-box { width: 100%; max-width: 340px; display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 6px; }
.redeem-box[hidden] { display: none; }
.redeem-caution { font-size: 12px; color: #a0a0a8; margin: 0; }
.redeemed-stamp {
  color: #06c755; border: 3px solid #06c755; border-radius: 12px;
  padding: 10px 18px; font-weight: 900; font-size: 20px; transform: rotate(-4deg);
}

/* ---- 画面④参加済み ---- */
#screen-done { background: linear-gradient(180deg, #d7ebf7, #eaf4fb); }
.done-thanks { color: var(--muted); font-size: 15px; margin: 0; }
.done-title { font-size: 30px; margin: 6px 0; line-height: 1.35; }
.done-sub { color: #4a5560; font-size: 16px; line-height: 1.7; margin: 0; }
.done-prize { margin-top: 14px; background: rgba(255,255,255,.7); border-radius: 12px; padding: 10px 16px; font-weight: 700; }
.done-foot { margin-top: 22px; color: #8aa0b0; font-weight: 700; }

/* ---- エラー ---- */
.err-emoji { font-size: 52px; }
.err-title { font-size: 22px; margin: 0; }
.err-msg, .err-help { color: var(--muted); margin: 0; font-size: 15px; }

/* ---- PINモーダル ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 24px;
}
.modal-overlay[hidden] { display: none; }
.modal { background: #fff; border-radius: 16px; padding: 24px; width: 100%; max-width: 320px; text-align: center; }
.modal h2 { margin: 0 0 6px; font-size: 20px; }
.modal p { margin: 0 0 14px; color: var(--muted); font-size: 14px; }
.pin-input {
  width: 100%; font-size: 28px; text-align: center; letter-spacing: 10px;
  padding: 12px; border: 2px solid #ddd; border-radius: 12px; margin-bottom: 8px;
}
.pin-error { color: #e4404a !important; font-weight: 700; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { font-size: 16px; padding: 12px; }
