:root {
  color-scheme: light;
  --blue: #0877bd;
  --blue-dark: #005b98;
  --green: #0dac6f;
  --yellow: #f5c826;
  --ink: #101318;
  --paper: #ffffff;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

body {
  min-height: 100svh;
  overscroll-behavior: none;
}

button {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.app {
  min-height: 100svh;
}

.intro {
  position: relative;
  display: grid;
  min-height: 100svh;
  overflow: hidden;
  background:
    radial-gradient(circle at 88% 10%, var(--yellow) 0 6px, transparent 7px) 0 0 / 22px 22px,
    linear-gradient(165deg, #fff 0 72%, #eaf6fc 72% 100%);
}

.intro::before,
.intro::after {
  position: absolute;
  content: "";
  border-radius: 999px;
  transform: rotate(-16deg);
}

.intro::before {
  width: 190px;
  height: 70px;
  top: -24px;
  right: -58px;
  background: var(--yellow);
}

.intro::after {
  width: 170px;
  height: 62px;
  left: -84px;
  bottom: 7%;
  background: var(--green);
}

.brand {
  align-self: start;
  justify-self: start;
  z-index: 1;
  margin-top: max(24px, env(safe-area-inset-top));
  padding: 10px 22px 10px 18px;
  background: var(--blue);
  color: white;
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.intro__body {
  z-index: 1;
  align-self: center;
  width: min(100%, 560px);
  margin: 0 auto;
  padding: 34px 28px max(36px, env(safe-area-inset-bottom));
}

.test-label {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--blue);
  font-weight: 900;
  letter-spacing: 0.18em;
}

h1 {
  margin: 0;
  font-size: clamp(3.3rem, 15vw, 5.7rem);
  line-height: 0.98;
  letter-spacing: -0.06em;
}

.intro__body > p {
  max-width: 33em;
  margin: 24px 0;
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.85;
}

.checks {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 28px 0;
  border-block: 2px solid var(--blue);
}

.checks div {
  display: grid;
  gap: 4px;
  padding: 14px 5px;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 800;
}

.checks div + div {
  border-left: 1px dotted var(--blue);
}

.checks span {
  color: var(--blue);
  font-size: 1.25rem;
  font-weight: 900;
}

.primary-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 60px;
  padding: 14px 20px;
  border: 0;
  border-radius: 16px;
  background: var(--blue);
  box-shadow: 0 8px 0 var(--blue-dark);
  color: white;
  font-size: 1.05rem;
  font-weight: 900;
  cursor: pointer;
  touch-action: manipulation;
}

.primary-button span {
  margin-left: auto;
  font-size: 2rem;
  line-height: 1;
}

.primary-button:active {
  transform: translateY(4px);
  box-shadow: 0 4px 0 var(--blue-dark);
}

.intro__body .privacy-note {
  margin: 18px 0 0;
  color: #4b5563;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.6;
  text-align: center;
}

.camera-view {
  position: fixed;
  inset: 0;
  min-height: 100svh;
  overflow: hidden;
  background: #101318;
}

#camera {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgb(0 0 0 / 0.52), transparent 24%, transparent 72%, rgb(0 0 0 / 0.6));
  pointer-events: none;
}

.camera-header {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(18px, env(safe-area-inset-top)) 18px 12px;
  color: white;
}

.camera-brand {
  font-weight: 900;
  letter-spacing: 0.08em;
}

.camera-brand span {
  margin-left: 8px;
  padding: 4px 8px;
  border: 1px solid rgb(255 255 255 / 0.7);
  border-radius: 999px;
  font-size: 0.68rem;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 0.6);
  border-radius: 50%;
  background: rgb(0 0 0 / 0.32);
  color: white;
  font-size: 1.8rem;
  line-height: 1;
  place-items: center;
  cursor: pointer;
}

.guide {
  position: absolute;
  top: 48%;
  left: 50%;
  width: min(78vw, 390px);
  aspect-ratio: 1.4;
  transform: translate(-50%, -50%);
}

.guide i {
  position: absolute;
  width: 42px;
  height: 42px;
  border-color: white;
  border-style: solid;
  filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.5));
}

.guide i:nth-child(1) { top: 0; left: 0; border-width: 4px 0 0 4px; }
.guide i:nth-child(2) { top: 0; right: 0; border-width: 4px 4px 0 0; }
.guide i:nth-child(3) { right: 0; bottom: 0; border-width: 0 4px 4px 0; }
.guide i:nth-child(4) { bottom: 0; left: 0; border-width: 0 0 4px 4px; }

.guide__content {
  position: absolute;
  inset: 20%; 10%;
  display: grid;
  align-content: center;
  padding: 18px;
  border-radius: 20px;
  background: rgb(255 255 255 / 0.92);
  box-shadow: 0 14px 40px rgb(0 0 0 / 0.25);
  color: var(--ink);
  text-align: center;
  backdrop-filter: blur(8px);
}

.success-mark {
  display: grid;
  width: 40px;
  height: 40px;
  margin: 0 auto 8px;
  border-radius: 50%;
  background: var(--green);
  color: white;
  font-size: 1.5rem;
  font-weight: 900;
  place-items: center;
}

.guide__content strong {
  font-size: clamp(1.05rem, 4.6vw, 1.35rem);
}

.guide__content small {
  margin-top: 6px;
  color: #4b5563;
  font-size: 0.72rem;
}

.camera-message {
  position: absolute;
  right: 20px;
  bottom: calc(138px + env(safe-area-inset-bottom));
  left: 20px;
  color: white;
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
  text-shadow: 0 1px 2px #000;
}

.demo-card {
  position: absolute;
  right: 18px;
  bottom: max(24px, env(safe-area-inset-bottom));
  left: 18px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  min-height: 92px;
  padding: 14px 16px;
  border: 4px solid var(--green);
  border-radius: 18px;
  background: white;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.demo-card__number {
  padding-right: 14px;
  color: var(--green);
  font-size: 1.5rem;
  font-weight: 900;
}

.demo-card__text {
  display: grid;
  gap: 2px;
  padding-left: 14px;
  border-left: 2px dotted var(--green);
}

.demo-card__text strong {
  font-size: 1.35rem;
}

.demo-card__text small {
  color: #4b5563;
  font-size: 0.75rem;
  font-weight: 700;
}

.demo-card__arrow {
  color: var(--green);
  font-size: 2.5rem;
  font-weight: 500;
}

.error-panel {
  display: grid;
  min-height: 100svh;
  align-content: center;
  width: min(100%, 560px);
  margin: 0 auto;
  padding: 32px 28px;
}

.error-icon {
  display: grid;
  width: 64px;
  height: 64px;
  margin-bottom: 18px;
  border-radius: 50%;
  background: #e94848;
  color: white;
  font-size: 2rem;
  font-weight: 900;
  place-items: center;
}

.error-panel h2 {
  margin: 0 0 12px;
  font-size: 1.65rem;
  line-height: 1.35;
}

.error-panel p,
.error-panel ol {
  margin: 0 0 22px;
  line-height: 1.75;
}

.error-panel ol {
  padding-left: 1.4em;
}

@media (min-width: 700px) {
  .intro__body {
    padding-inline: 40px;
  }

  .demo-card {
    right: max(18px, calc(50% - 280px));
    left: max(18px, calc(50% - 280px));
  }
}

@media (prefers-reduced-motion: no-preference) {
  .guide__content {
    animation: appear 420ms ease-out both;
  }

  @keyframes appear {
    from { opacity: 0; transform: translateY(12px) scale(0.96); }
    to { opacity: 1; transform: none; }
  }
}
