:root {
  color-scheme: light;
  font-family: "Hiragino Sans", "Yu Gothic", system-ui, -apple-system, sans-serif;
  --ink: #30251f;
  --paper: #fffaf1;
  --orange: #ff704d;
  --orange-dark: #d94b2b;
  --yellow: #ffd75e;
  --green: #3b9870;
}

* { box-sizing: border-box; }

html, body { width: 100%; min-height: 100%; margin: 0; }

body {
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 9%, #ffd75e 0 6px, transparent 7px),
    radial-gradient(circle at 88% 16%, #78c8a7 0 8px, transparent 9px),
    radial-gradient(circle at 82% 88%, #ff9b82 0 7px, transparent 8px),
    var(--paper);
}

button { font: inherit; }
button:focus-visible { outline: 4px solid #2f78c4; outline-offset: 3px; }

.app-shell { min-height: 100dvh; }
.panel { width: min(92vw, 440px); margin: 0 auto; }

.welcome {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 14px;
  padding: calc(28px + env(safe-area-inset-top)) 18px calc(24px + env(safe-area-inset-bottom));
  text-align: center;
}

.eyebrow {
  margin: 0;
  color: var(--orange-dark);
  font-weight: 800;
  letter-spacing: .08em;
}

.welcome-character {
  width: min(68vw, 320px);
  height: auto;
  max-height: 40vh;
  object-fit: contain;
  border-radius: 18px;
  filter: drop-shadow(0 12px 12px rgb(84 53 35 / 18%));
}

h1 { width: 100%; margin: 0; font-size: clamp(1.85rem, 8vw, 3.05rem); line-height: 1.08; }
.title-line { display: block; white-space: nowrap; }
h2 { margin: 0; font-size: 1.7rem; }
.lead { margin: 0; font-size: 1.05rem; line-height: 1.8; }

.steps {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 8px 0;
}

.steps span {
  padding: 12px 5px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 6px 20px rgb(77 47 27 / 8%);
  font-size: .78rem;
  font-weight: 700;
}

.steps b { display: block; width: 28px; height: 28px; margin: 0 auto 6px; padding-top: 4px; border-radius: 50%; color: #fff; background: var(--green); }
.primary-button, .secondary-button { width: 100%; min-height: 56px; border: 0; border-radius: 999px; font-weight: 800; font-size: 1.05rem; }
.primary-button { color: #fff; background: linear-gradient(135deg, var(--orange), #ff4f72); box-shadow: 0 8px 0 #b63d35, 0 14px 24px rgb(198 65 44 / 25%); }
.primary-button:active { transform: translateY(5px); box-shadow: 0 3px 0 #b63d35; }
.primary-button:disabled { opacity: .55; box-shadow: none; }
.secondary-button { color: var(--ink); background: #fff2cc; border: 2px solid var(--ink); }
.reset-button {
  min-height: 44px;
  padding: 8px 18px;
  border: 1px solid #b9aca3;
  border-radius: 999px;
  color: #6e625a;
  background: rgb(255 255 255 / 72%);
  font-size: .85rem;
  font-weight: 700;
}
.reset-button:active { background: #f2e8df; }
.reset-button:disabled { opacity: .5; }
.reset-status { min-height: 1.2em; margin: -6px 0 0; color: var(--green); font-size: .78rem; font-weight: 700; }
.privacy-note { margin: 8px 0 0; font-size: .75rem; color: #6e625a; }

.ar-view, #ar-container { position: fixed; inset: 0; width: 100%; height: 100dvh; overflow: hidden; background: #151515; }
#ar-container video { z-index: 0 !important; }
#ar-container a-scene { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; background: transparent !important; }
#ar-container canvas { z-index: 2 !important; background: transparent !important; }
.top-bar { position: fixed; z-index: 10; top: 0; left: 0; width: 100%; display: flex; justify-content: space-between; align-items: center; padding: calc(12px + env(safe-area-inset-top)) 16px 12px; color: #fff; background: linear-gradient(rgb(0 0 0 / 65%), transparent); pointer-events: none; }
.event-name-small, .progress-label { margin: 0; text-shadow: 0 2px 4px #000; }
.event-name-small { font-size: .75rem; }
.progress-label { font-weight: 800; }
.icon-button { width: 44px; height: 44px; border: 1px solid rgb(255 255 255 / 70%); border-radius: 50%; color: #fff; background: rgb(0 0 0 / 45%); font-size: 1.8rem; line-height: 1; pointer-events: auto; }

.guide { position: fixed; z-index: 8; inset: 19% 16px auto; text-align: center; color: #fff; pointer-events: none; }
.scan-frame { width: min(76vw, 420px); aspect-ratio: 1.58; margin: 0 auto; border: 4px solid var(--yellow); border-radius: 20px; box-shadow: 0 0 0 9999px rgb(0 0 0 / 22%), inset 0 0 24px rgb(255 215 94 / 35%); }
.guide p { display: inline-block; margin: 18px 0 0; padding: 9px 16px; border-radius: 999px; background: rgb(0 0 0 / 68%); font-weight: 800; }

.stamp-card { position: fixed; z-index: 12; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); width: min(90vw, 420px); transform: translateX(-50%); text-align: center; }
.discovery-message { display: inline-block; margin: 0 0 10px; padding: 8px 14px; border-radius: 999px; background: var(--yellow); font-weight: 900; }
.stamp-button { animation: button-pop .45s ease-out both; }

.success-card, .error-card { position: fixed; z-index: 20; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 28px 22px; border-radius: 28px; background: var(--paper); box-shadow: 0 24px 70px rgb(0 0 0 / 38%); text-align: center; }
.success-card p { line-height: 1.7; }
.stamp-seal { display: grid; place-items: center; width: 108px; height: 108px; margin: -70px auto 18px; border: 7px double #fff; border-radius: 50%; color: #fff; background: var(--orange); box-shadow: 0 7px 0 var(--orange-dark); font-size: 1.4rem; font-weight: 900; transform: rotate(-8deg); }

[hidden] { display: none !important; }
@keyframes button-pop { from { transform: scale(.8); opacity: 0; } 70% { transform: scale(1.05); } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; } }
