:root {
  --bg: #0a3d62;
  --fg: #ffffff;
  --accent: #f6b93b;
  --muted: rgba(255,255,255,0.7);
  --btn: #ffffff;
  --btn-fg: #0a3d62;
  --error: #e55039;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN",
               "Yu Gothic", Meiryo, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

#app {
  position: fixed;
  inset: 0;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
          env(safe-area-inset-bottom) env(safe-area-inset-left);
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  text-align: center;
}
.screen[data-active] { display: flex; }

h1 { font-size: 1.8rem; margin: 0 0 1rem; }
h2 { font-size: 1.5rem; margin: 0 0 1rem; }
.lead { font-size: 1.4rem; margin: 0.25rem 0; }
.lead strong { color: var(--accent); font-size: 1.8rem; }
.hint { color: var(--muted); margin: 0.5rem 0 1.5rem; }
.error { color: var(--error); margin-top: 1rem; min-height: 1.2em; }

.buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 380px;
}

.btn {
  font-size: 1.1rem;
  font-weight: 600;
  padding: 1rem 1.25rem;
  border: 2px solid var(--btn);
  border-radius: 12px;
  background: var(--btn);
  color: var(--btn-fg);
  cursor: pointer;
}
.btn-ghost {
  background: transparent;
  color: var(--btn);
}
.btn:active { transform: scale(0.98); }

.spinner {
  width: 56px;
  height: 56px;
  border: 6px solid rgba(255,255,255,0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 1rem 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.camera-wrap {
  position: relative;
  width: min(85vw, 320px);
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
  margin-bottom: 1rem;
}
#camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.camera-frame {
  position: absolute;
  inset: 12%;
  border: 3px solid var(--accent);
  border-radius: 12px;
  pointer-events: none;
}

.env {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom) + 6px);
  left: 0;
  right: 0;
  font-size: 0.7rem;
  color: var(--muted);
  margin: 0;
}
