*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #F4F4F4;
  --surface: #FFFFFF;
  --coral: #E83817;
  --coral-pale: #FCEEE9;
  --sage: #2A7A74;
  --sage-pale: #E0F0EE;
  --text: #212121;
  --muted: #757575;
  --border: #E0E0E0;
  --primary: var(--coral);
  --primary-pale: var(--coral-pale);
  --ann-before: #1E9C33;
  --ann-after: var(--coral);
  --radius-btn: 4px;
  --radius-card: 4px;
  --radius-ann: 4px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px 60px;
  background: linear-gradient(145deg, #D8D8D8 0%, #C8C8C8 100%);
  color: var(--text);
  font-family: "Noto Sans JP", "Hiragino Sans", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(375px, 100vw);
  height: min(812px, calc(100dvh - 80px));
  min-height: 0;
  max-height: 812px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg);
  border-radius: 28px;
}

.status {
  position: relative;
  z-index: 20;
  height: 48px;
  display: none;
  align-items: flex-end;
  justify-content: space-between;
  flex-shrink: 0;
  padding: 0 28px 9px;
  background: var(--bg);
}

.status-time {
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.status-r {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text);
}

.status-r svg {
  fill: currentColor;
  opacity: .7;
}

.screens {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: hidden;
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}

.screen.active {
  opacity: 1;
  pointer-events: auto;
}

.screen.float-enter {
  animation: floatEnter .55s cubic-bezier(.2, .8, .2, 1) both;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.logo {
  display: block;
  width: auto;
}

.logo-main {
  flex: 0 1 160px;
  width: auto;
  height: auto;
  max-width: min(160px, calc(100% - 52px));
  max-height: 28px;
  object-fit: contain;
}

.logo-small {
  height: 20px;
}

.top-header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  flex-shrink: 0;
  gap: 16px;
  padding: 12px 20px;
  background: var(--bg);
}

.ham {
  width: 36px;
  min-width: 36px;
  height: 36px;
  flex-shrink: 0;
  margin-left: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 6px;
  border: 0;
  background: none;
  opacity: 1;
}

.ham span {
  display: block;
  height: 1.5px;
  border-radius: 1px;
  background: var(--text);
}

.hero-wrap {
  flex-shrink: 0;
  padding: 0 20px;
}

.hero-card {
  width: 100%;
  position: relative;
  overflow: visible;
  border-radius: 0;
  background: transparent;
}

.hero-image {
  display: block;
  width: 100%;
  height: auto;
}

.hero-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.h-ann {
  position: absolute;
  max-width: 132px;
  padding: 7px 10px;
  border-radius: 10px;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.5;
  filter: drop-shadow(0 3px 10px rgba(44, 36, 32, .22));
}

.h-ann::after {
  content: "";
  position: absolute;
  left: 14px;
  bottom: -12px;
  width: 0;
  height: 0;
  border: 6px solid transparent;
}

.h-ann-coral {
  top: 52px;
  right: 14px;
  background: var(--coral);
}

.h-ann-coral::after {
  border-top-color: var(--coral);
}

.h-ann-sage {
  bottom: 44px;
  left: 14px;
  background: var(--sage);
}

.h-ann-sage::after {
  border-top-color: var(--sage);
}

.h-dot {
  position: absolute;
  width: 11px;
  height: 11px;
  border: 2.5px solid #fff;
  border-radius: 50%;
}

.h-dot-coral {
  top: 100px;
  right: 112px;
  background: var(--coral);
}

.h-dot-sage {
  bottom: 96px;
  left: 62px;
  background: var(--sage);
}

.copy {
  flex-shrink: 0;
  padding: 18px 20px 8px;
}

.copy h1 {
  margin-bottom: 10px;
  color: var(--text);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.45;
}

.copy h1 strong {
  color: var(--coral);
}

.copy p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.75;
}

.btns {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  gap: 10px;
  padding: 14px 20px calc(22px + var(--safe-bottom));
}

.btn {
  width: 100%;
  min-height: 0;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 15px 20px;
  border: 0;
  border-radius: var(--radius-btn);
  font-family: "Noto Sans JP", sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .02em;
  appearance: none;
  touch-action: manipulation;
  transition: background .15s ease, color .15s ease, border-color .15s ease, opacity .15s ease;
}

.btn > * {
  pointer-events: none;
}

.btn-primary,
.btn-fill {
  background: var(--coral);
  color: #fff;
}

.btn-primary:hover,
.btn-fill:hover {
  opacity: .91;
}

.btn-outline,
.btn-out {
  border: 1.5px solid var(--coral);
  background: transparent;
  color: var(--coral);
}

.btn-outline:hover,
.btn-out:hover {
  background: var(--coral-pale);
}

.btn-text {
  border: 0;
  background: transparent;
  color: var(--muted);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 1;
}

.loading-screen {
  justify-content: center;
}

.s2-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 40px;
  text-align: center;
}

.pulse {
  width: 88px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--coral-pale);
  animation: pR 2s ease-in-out infinite;
}

.pulse-inner {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--coral);
}

.loading-screen h2 {
  color: var(--text);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.5;
}

.loading-screen p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.status-badge {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.active-dot {
  border-color: transparent;
  background: var(--coral-pale);
  color: var(--coral);
  animation: tF 1.4s ease-in-out infinite alternate;
}

.progress-track {
  width: 220px;
  height: 4px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--border);
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--coral), #F06040);
  transition: width 500ms ease;
}

.loading-hint {
  margin-top: -4px;
  color: #8B9692;
  font-size: 12px;
  letter-spacing: .04em;
  line-height: 1.8;
}

.result-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  padding: 8px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.back {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 0;
  background: none;
  color: var(--text);
  font-size: 20px;
}

.tabs {
  display: flex;
  flex-shrink: 0;
  border-bottom: 1.5px solid var(--border);
  background: var(--bg);
}

.tab {
  flex: 1;
  position: relative;
  padding: 11px 8px;
  border: 0;
  background: none;
  color: var(--muted);
  font-family: "Noto Sans JP", sans-serif;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  transition: color .2s ease;
}

.tab.active {
  color: var(--coral);
  font-weight: 700;
}

.tab.active::after {
  content: "";
  position: absolute;
  left: 25%;
  right: 25%;
  bottom: -1.5px;
  height: 3px;
}

.tab-before.active {
  color: var(--ann-before);
}

.tab-before.active::after {
  background: var(--ann-before);
}

.tab-after.active {
  color: var(--coral);
}

.tab-after.active::after {
  background: var(--coral);
}

.photo-frame {
  width: 100%;
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: #000;
}

.photo-panel {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}

.photo-panel.active {
  opacity: 1;
  pointer-events: auto;
}

.photo-panel img {
  position: relative;
  width: 100%;
  height: auto;
  max-height: 100%;
  display: block;
  object-fit: contain;
  pointer-events: none;
}

.photo-panel canvas {
  position: absolute;
  z-index: 2;
  cursor: pointer;
  pointer-events: auto;
}

.result-scroll {
  display: none;
}

.sec-lbl {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.advice-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.advice-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.advice-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
  border-radius: 50%;
  background: #E8F7EB;
  color: var(--ann-before);
  font-size: 12px;
}

#advA .advice-icon {
  background: var(--coral-pale);
  color: var(--coral);
}

.advice-card h3 {
  margin-bottom: 2px;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.5;
}

.advice-card p {
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.6;
}

.result-actions {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  gap: 10px;
  padding: 12px 20px 28px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  pointer-events: auto;
}

.result-actions .btn {
  min-height: 48px;
}

.retake-link {
  min-height: 44px;
  padding: 10px;
  color: var(--muted);
  font-size: 13px;
}

.annotation-detail {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 4;
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  padding: 14px 42px 14px 14px;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 14px;
  background: rgba(255, 255, 255, .94);
  color: var(--text);
  backdrop-filter: blur(14px);
  transform-origin: center bottom;
  animation: detailPop .24s ease both;
}

.annotation-detail[hidden] {
  display: none;
}

.annotation-detail-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #E8F7EB;
  color: var(--ann-before);
  font-size: 13px;
  font-weight: 700;
}

.annotation-detail.after .annotation-detail-icon {
  background: var(--coral-pale);
  color: var(--coral);
}

.annotation-detail h3 {
  margin-bottom: 4px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.annotation-detail p {
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.7;
}

.annotation-detail-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
}

.camera-screen {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #181210;
}

.cam-view {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(165deg, #2C2018 0%, #181208 60%, #221A10 100%);
}

.cam-light {
  position: absolute;
  top: -40px;
  left: 50%;
  width: 300px;
  height: 300px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse, rgba(255, 230, 200, .07) 0%, transparent 70%);
  pointer-events: none;
}

#cameraVideo {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-back {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 100px;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-family: "Noto Sans JP", sans-serif;
  font-size: 12px;
  font-weight: 600;
  backdrop-filter: blur(10px);
}

.face-guide {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  width: 200px;
  height: 270px;
  transform: translate(-50%, -65%);
  border: 2px solid rgba(255, 255, 255, .55);
  border-radius: 50%;
}

.face-guide span {
  position: absolute;
  bottom: -26px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, .48);
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
}

.camera-badges {
  position: absolute;
  top: 72px;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: 8px;
}

.camera-badges span {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 100px;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
}

.qb-ok {
  background: rgba(123, 170, 142, .9);
}

.qb-chk {
  background: rgba(200, 120, 90, .85);
  animation: tF 1.2s ease-in-out infinite alternate;
}

.privacy-note {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 116px;
  z-index: 2;
  color: rgba(255, 255, 255, .3);
  font-size: 9.5px;
  text-align: center;
}

.cam-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 60px;
  background: rgba(20, 15, 10, .85);
  backdrop-filter: blur(20px);
}

.cam-side {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  font-size: 17px;
}

.shutter {
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 4px solid rgba(255, 255, 255, .35);
  border-radius: 50%;
  background: #fff;
  transition: transform .1s ease;
}

.shutter:active {
  transform: scale(.94);
}

.shutter-in {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #fff;
}

.drawer {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}

.drawer.open {
  opacity: 1;
  pointer-events: auto;
}

.menu-bd {
  position: absolute;
  inset: 0;
  background: rgba(44, 36, 32, .44);
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 288px;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 26px;
  overflow-y: auto;
  padding: 56px 24px 40px;
  border-radius: 0 4px 4px 0;
  background: var(--surface);
  transform: translateX(100%);
  transition: transform .28s ease;
}

.drawer.open .drawer-panel {
  transform: translateX(0);
}

.drawer-close {
  position: absolute;
  top: 20px;
  right: 24px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 22px;
}

.menu-logo-img {
  height: 26px;
}

.msec h2 {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.msec p,
.msec li {
  color: var(--text);
  font-size: 13px;
  line-height: 1.75;
}

.m-steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.m-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.step-n {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  border-radius: 50%;
  background: var(--coral);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.step-t {
  color: var(--text);
  font-size: 13px;
  line-height: 1.65;
}

.drawer-privacy {
  padding: 12px;
  border-radius: 12px;
  background: var(--sage-pale);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.7;
}

.drawer-privacy strong {
  color: var(--sage);
  font-weight: 700;
}

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

@keyframes tF {
  from {
    opacity: .6;
  }
  to {
    opacity: 1;
  }
}

@keyframes floatEnter {
  from {
    opacity: 0;
    transform: translateY(18px) scale(.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes detailPop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 430px) {
  body {
    display: block;
    width: 100vw;
    height: 100dvh;
    min-height: 100dvh;
    padding: 0;
    overflow: hidden;
    background: var(--bg);
  }

  .app-shell {
    width: 100vw;
    height: 100dvh;
    min-height: 0;
    max-height: none;
    border-radius: 0;
  }

  .top-header {
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    padding-left: max(16px, env(safe-area-inset-left, 0px));
  }

  .hero-wrap {
    padding-right: 16px;
    padding-left: 16px;
  }

  .hero-card {
    height: auto;
  }

  .copy {
    padding: 16px 20px 6px;
  }

  .btns {
    padding: 12px 20px calc(18px + var(--safe-bottom));
  }
}

@supports (height: 100svh) {
  @media (max-width: 430px) {
    body {
      height: 100svh;
      min-height: 100svh;
    }

    .app-shell {
      height: 100svh;
    }
  }
}

@media (max-width: 430px) and (max-height: 700px) {
  .top-header {
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .hero-card {
    height: auto;
  }

  .copy {
    padding-top: 12px;
  }

  .copy h1 {
    margin-bottom: 6px;
    font-size: 18px;
    line-height: 1.38;
  }

  .copy p {
    font-size: 12px;
    line-height: 1.58;
  }

  .btns {
    gap: 8px;
    padding-top: 10px;
    padding-bottom: calc(12px + var(--safe-bottom));
  }

  .btn {
    padding-top: 12px;
    padding-bottom: 12px;
  }
}
