:root {
  --photo-green: #0f6f55;
  --photo-green-dark: #084f3d;
  --photo-green-soft: #e7f5ef;
  --photo-amber: #c97412;
  --photo-amber-soft: #fff4df;
  --photo-red: #b93838;
  --photo-red-soft: #fff0f0;
  --photo-ink: #15362e;
  --photo-muted: #61736d;
  --photo-line: #dce8e3;
  --photo-surface: #ffffff;
  --photo-shadow: 0 14px 36px rgba(18, 73, 58, 0.12);
}

.photo-checkin-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 100% 0, rgba(80, 182, 142, 0.18), transparent 32rem),
    linear-gradient(180deg, #f3fbf7 0, #edf6f2 45%, #f8faf9 100%);
  color: var(--photo-ink);
}

.photo-checkin-shell {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 18px 16px calc(104px + env(safe-area-inset-bottom));
}

.photo-checkin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.photo-checkin-back {
  color: var(--photo-green-dark);
  font-weight: 800;
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 6px;
}

.photo-checkin-security {
  border: 1px solid rgba(15, 111, 85, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  padding: 7px 10px;
  color: var(--photo-green);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.photo-checkin-shell .member-card {
  border: 1px solid rgba(15, 111, 85, 0.1);
  box-shadow: var(--photo-shadow);
  border-radius: 22px;
  margin-bottom: 14px;
}

.photo-checkin-intro {
  position: relative;
  overflow: hidden;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.98), rgba(235,249,242,.95));
}

.photo-checkin-intro::after {
  content: "";
  position: absolute;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  right: -75px;
  top: -80px;
  background: rgba(15, 111, 85, 0.1);
  pointer-events: none;
}

.photo-checkin-intro h1 {
  margin: 4px 0 8px;
  font-size: clamp(28px, 7vw, 40px);
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.photo-checkin-mission-name {
  margin: 0 0 14px;
  font-size: 18px;
  font-weight: 800;
  color: var(--photo-green-dark);
}

.photo-checkin-rule-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.photo-checkin-rule-badges span,
.photo-checkin-state-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--photo-green-soft);
  color: var(--photo-green-dark);
  font-size: 13px;
  font-weight: 800;
}

.photo-checkin-purpose {
  margin: 0;
  color: var(--photo-muted);
  font-size: 14px;
  line-height: 1.65;
}


.photo-checkin-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 14px 0;
  padding: 0;
  list-style: none;
}

.photo-checkin-steps li {
  min-width: 0;
  text-align: center;
  color: #789087;
  font-size: 11px;
  font-weight: 700;
}

.photo-checkin-steps li span {
  width: 34px;
  height: 34px;
  margin: 0 auto 6px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #dce8e3;
  color: #587169;
  font-weight: 900;
  position: relative;
  z-index: 1;
}

.photo-checkin-steps li strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-checkin-steps li.is-active,
.photo-checkin-steps li.is-complete {
  color: var(--photo-green-dark);
}

.photo-checkin-steps li.is-active span {
  background: var(--photo-green);
  color: white;
  box-shadow: 0 0 0 5px rgba(15,111,85,.12);
}

.photo-checkin-steps li.is-complete span {
  background: #bfe7d5;
  color: var(--photo-green-dark);
}

.photo-checkin-status-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: var(--photo-surface);
}

.photo-checkin-status-card.is-error {
  border-color: rgba(185, 56, 56, .25);
  background: var(--photo-red-soft);
}

.photo-checkin-status-card.is-warning {
  border-color: rgba(201, 116, 18, .25);
  background: var(--photo-amber-soft);
}

.photo-checkin-status-card.is-success {
  border-color: rgba(15,111,85,.28);
  background: var(--photo-green-soft);
}

.photo-checkin-status-icon {
  width: 46px;
  height: 46px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: var(--photo-green-soft);
  color: var(--photo-green);
  font-size: 24px;
  font-weight: 900;
}

.photo-checkin-status-card.is-error .photo-checkin-status-icon {
  color: var(--photo-red);
  background: #ffe0e0;
}

.photo-checkin-status-card.is-warning .photo-checkin-status-icon {
  color: var(--photo-amber);
  background: #ffe8bb;
}

.photo-checkin-status-card h2,
.photo-checkin-section-head h2,
.photo-checkin-result-card h2 {
  margin: 0 0 4px;
  font-size: 20px;
  line-height: 1.25;
}

.photo-checkin-status-card p,
.photo-checkin-progress-card p,
.photo-checkin-result-card p {
  margin: 0;
  color: var(--photo-muted);
  line-height: 1.55;
}

.photo-checkin-location-card,
.photo-checkin-camera-card,
.photo-checkin-progress-card,
.photo-checkin-result-card {
  padding: 20px;
  background: var(--photo-surface);
}

.photo-checkin-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.photo-checkin-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}

.photo-checkin-metrics > div {
  min-width: 0;
  padding: 12px;
  border-radius: 14px;
  background: #f5f9f7;
  border: 1px solid var(--photo-line);
}

.photo-checkin-metrics dt {
  color: var(--photo-muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
}

.photo-checkin-metrics dd {
  margin: 0;
  color: var(--photo-ink);
  font-size: 16px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.photo-checkin-primary {
  background: linear-gradient(135deg, var(--photo-green), var(--photo-green-dark));
  color: white;
  border: none;
  box-shadow: 0 10px 24px rgba(15,111,85,.22);
}

.photo-checkin-primary:hover,
.photo-checkin-primary:focus-visible {
  filter: brightness(1.05);
}

.photo-checkin-primary:disabled,
.photo-checkin-shutter:disabled {
  opacity: .5;
  cursor: not-allowed;
  box-shadow: none;
}

.photo-checkin-location-card > .member-btn {
  width: 100%;
  min-height: 50px;
  font-size: 17px;
}

.photo-checkin-help {
  margin: 12px 0 0;
  color: var(--photo-muted);
  font-size: 13px;
  line-height: 1.55;
}

.photo-checkin-viewport {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 3 / 4;
  max-height: 68vh;
  border-radius: 20px;
  background: #10251f;
  border: 1px solid rgba(15,111,85,.18);
}

.photo-checkin-viewport video,
.photo-checkin-viewport img,
.photo-checkin-viewport canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-checkin-camera-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  color: rgba(255,255,255,.82);
  text-align: center;
  padding: 24px;
}

.photo-checkin-camera-placeholder span {
  font-size: 48px;
}

.photo-checkin-camera-placeholder small {
  color: rgba(255,255,255,.62);
}

.photo-checkin-frame-guide {
  position: absolute;
  inset: 8%;
  border: 2px solid rgba(255,255,255,.58);
  border-radius: 20px;
  pointer-events: none;
}

.photo-checkin-frame-guide::before,
.photo-checkin-frame-guide::after {
  content: "";
  position: absolute;
  background: rgba(255,255,255,.18);
}

.photo-checkin-frame-guide::before {
  left: 33.33%;
  right: 33.33%;
  top: 0;
  bottom: 0;
  border-left: 1px solid rgba(255,255,255,.2);
  border-right: 1px solid rgba(255,255,255,.2);
  background: transparent;
}

.photo-checkin-frame-guide::after {
  top: 33.33%;
  bottom: 33.33%;
  left: 0;
  right: 0;
  border-top: 1px solid rgba(255,255,255,.2);
  border-bottom: 1px solid rgba(255,255,255,.2);
  background: transparent;
}

.photo-checkin-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.photo-checkin-actions .member-btn {
  min-height: 48px;
  min-width: min(180px, 46%);
  justify-content: center;
}

.photo-checkin-shutter {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 5px solid white;
  background: rgba(255,255,255,.2);
  padding: 5px;
  box-shadow: 0 0 0 2px rgba(15,111,85,.3), 0 10px 24px rgba(0,0,0,.18);
}

.photo-checkin-shutter span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: white;
}

.photo-checkin-fallback {
  margin-top: 16px;
  padding: 14px;
  border-radius: 14px;
  background: var(--photo-amber-soft);
  border: 1px solid #f1d8a6;
}

.photo-checkin-fallback p {
  margin: 0 0 12px;
  color: #76500e;
  line-height: 1.55;
}

.photo-checkin-file-label {
  display: inline-flex;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.photo-checkin-file-label input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.photo-checkin-progress {
  height: 12px;
  border-radius: 999px;
  background: #dce8e3;
  overflow: hidden;
  margin: 6px 0 14px;
}

.photo-checkin-progress span {
  display: block;
  width: 12%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--photo-green), #55b990);
  transition: width .35s ease;
  animation: photo-checkin-pulse 1.6s ease-in-out infinite;
}

@keyframes photo-checkin-pulse {
  0%, 100% { filter: brightness(.95); }
  50% { filter: brightness(1.18); }
}

.photo-checkin-result-card {
  text-align: center;
}

.photo-checkin-result-icon {
  width: 76px;
  height: 76px;
  margin: 0 auto 14px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(135deg, #27a879, var(--photo-green-dark));
  font-size: 40px;
  font-weight: 900;
  box-shadow: 0 12px 30px rgba(15,111,85,.25);
}

.photo-checkin-result-card.is-error .photo-checkin-result-icon {
  background: linear-gradient(135deg, #d45c5c, #9d2929);
}

.photo-checkin-result-metrics {
  text-align: left;
  margin-top: 18px;
}

.photo-checkin-state-badge.is-error {
  color: #8d2626;
  background: #ffe0e0;
}

.photo-checkin-state-badge.is-warning {
  color: #76500e;
  background: #ffe8bb;
}

.photo-checkin-state-badge.is-success {
  color: var(--photo-green-dark);
  background: #ccebdc;
}

.photo-checkin-page [hidden] {
  display: none !important;
}

.photo-checkin-page button,
.photo-checkin-page a,
.photo-checkin-page input,
.photo-checkin-page label {
  -webkit-tap-highlight-color: transparent;
}

.photo-checkin-page button:focus-visible,
.photo-checkin-page a:focus-visible,
.photo-checkin-page input:focus-visible,
.photo-checkin-page label:focus-within {
  outline: 3px solid rgba(15,111,85,.32);
  outline-offset: 3px;
}

.photo-checkin-page.is-camera-active .member-bottom-nav {
  opacity: .72;
}

@media (max-width: 520px) {
  .photo-checkin-shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  .photo-checkin-intro,
  .photo-checkin-location-card,
  .photo-checkin-camera-card,
  .photo-checkin-progress-card,
  .photo-checkin-result-card {
    padding: 17px;
    border-radius: 19px;
  }

  .photo-checkin-topbar {
    align-items: flex-start;
  }

  .photo-checkin-security {
    max-width: 48%;
    white-space: normal;
    text-align: center;
  }

  .photo-checkin-metrics {
    grid-template-columns: 1fr 1fr;
  }

  .photo-checkin-actions {
    align-items: stretch;
  }

  .photo-checkin-actions .member-btn {
    min-width: 0;
    flex: 1 1 140px;
  }

  .photo-checkin-viewport {
    max-height: 62vh;
  }
}

@media (max-width: 360px) {
  .photo-checkin-steps li strong {
    font-size: 10px;
  }

  .photo-checkin-metrics {
    grid-template-columns: 1fr;
  }
}

@media (orientation: landscape) and (max-height: 560px) {
  .photo-checkin-viewport {
    aspect-ratio: 16 / 9;
    max-height: 52vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .photo-checkin-progress span {
    animation: none;
  }

  .photo-checkin-progress span,
  .photo-checkin-steps li span {
    transition: none;
  }
}
