:root {
  --bg: #f1f4f1;
  --card: #ffffff;
  --text: #12291b;
  --muted: #65736a;
  --line: #d8e1db;
  --accent: #0c5d2d;
  --accent-dark: #06451f;
  --accent-soft: #deece1;
  --danger: #8c3535;
  --danger-soft: #f5e1e1;
  --warn-soft: #f5f0dc;
  --shadow: 0 8px 28px rgba(18, 45, 26, .06);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  background:
    linear-gradient(rgba(12,93,45,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(12,93,45,.025) 1px, transparent 1px),
    var(--bg);
  background-size: 32px 32px;
  color: var(--text);
  line-height: 1.75;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { width: min(1120px, calc(100vw - 32px)); margin: 0 auto; }
.site-header {
  background: rgba(255,255,255,.94);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(12px);
}
.site-footer { background: #fff; border-top: 1px solid var(--line); margin-top: 28px; padding: 20px 0; color: var(--muted); }
.header-flex, .footer-flex { display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.header-flex { padding: 16px 0; }
.brand { font-size: 1.1rem; font-weight: 900; letter-spacing: -.02em; color: var(--text); }
.nav-links { display: flex; gap: 18px; }
main.wrap { padding: 28px 0 18px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 26px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.hero { overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: 1.7fr 1fr; gap: 30px; align-items: center; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 4.7rem); line-height: 1.04; letter-spacing: -.055em; margin: 6px 0 20px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .74rem; color: var(--accent); font-weight: 900; }
.lead, .caption, .small-note, .form-note, .location-line { color: var(--muted); }
.master-panel { text-align: center; }
.scan-frame {
  position: relative;
  background: #fbfcfb;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  padding: 12px;
}
.scan-frame img { display: block; width: 100%; border-radius: 12px; }
.scan-line {
  position: absolute; left: 6%; right: 6%; height: 2px; top: 14%;
  background: rgba(12,93,45,.55);
  box-shadow: 0 0 18px rgba(12,93,45,.65);
  animation: scan 3.8s ease-in-out infinite alternate;
}
@keyframes scan { from { top: 14%; } to { top: 84%; } }

.archive-counter {
  display: inline-flex; flex-direction: column; gap: 1px;
  background: var(--accent); color: white; border-radius: 14px;
  padding: 12px 18px; margin-top: 10px;
}
.archive-counter strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 2rem; letter-spacing: .13em; line-height: 1.1;
}
.archive-counter.compact strong { font-size: 1.5rem; }
.counter-label { font-size: .63rem; letter-spacing: .13em; opacity: .8; }
.mini-stats { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; color: var(--muted); font-size: .86rem; }

.section-heading, .archive-title-row, .record-header, .admin-top {
  display: flex; justify-content: space-between; gap: 20px; align-items: flex-start;
}
.section-heading h2, .archive-title-row h1 { margin-top: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
label span { display: block; font-weight: 800; margin-bottom: 7px; }
label small { color: var(--muted); font-weight: 500; }
input[type="text"], input[type="password"], input[type="file"], textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 11px;
  padding: 12px 14px; font: inherit; background: #fff; color: var(--text);
}
textarea { resize: vertical; }
input:focus, textarea:focus { outline: 2px solid rgba(12,93,45,.16); border-color: var(--accent); }

.upload-drop {
  display: grid; place-items: center; text-align: center; min-height: 180px;
  border: 1.5px dashed #a9baae; border-radius: 14px; padding: 20px;
  background: #fafcfa; cursor: pointer;
}
.upload-drop input { max-width: 420px; }
.upload-title { font-size: 1.1rem; }
.upload-help { color: var(--muted); font-size: .85rem; font-weight: 500; margin-bottom: 10px; }
.image-preview { max-width: 420px; max-height: 360px; width: auto; margin-top: 14px; border-radius: 12px; border: 1px solid var(--line); }
.hidden { display: none !important; }
.honeypot { position: absolute !important; left: -10000px !important; opacity: 0 !important; }
.submit-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }

.button {
  display: inline-block; background: var(--accent); color: white;
  border: none; border-radius: 10px; padding: 11px 17px;
  font: inherit; font-weight: 800; cursor: pointer;
}
.button:hover { background: var(--accent-dark); text-decoration: none; }
.button.secondary { background: white; color: var(--accent); border: 1px solid var(--accent); }
.button.secondary:hover { background: var(--accent-soft); }
.button.danger { background: var(--danger); }
.button.small { padding: 7px 11px; font-size: .9rem; }
.primary-large { padding: 14px 22px; font-size: 1.02rem; }

.report-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 17px; }
.report-card { background: #fff; border: 1px solid var(--line); border-radius: 15px; overflow: hidden; }
.report-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: #edf2ee; transition: transform .25s ease; }
.report-card:hover img { transform: scale(1.02); }
.report-card-body { padding: 15px; }
.report-card-body h2, .report-card-body h3 { margin: 3px 0; }
.report-card-body p { color: var(--muted); margin: 4px 0; font-size: .9rem; }

.record-code {
  color: var(--accent); font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 900; letter-spacing: .08em; font-size: .78rem;
}
.record-code.large { font-size: 1.05rem; margin-bottom: 7px; }
.result-badge { display: inline-block; padding: 9px 13px; border-radius: 999px; font-weight: 900; }
.result-badge.confirmed { background: var(--accent-soft); color: var(--accent); }
.result-badge.rejected { background: var(--danger-soft); color: var(--danger); }

.classification-strip, .report-facts, .admin-stats {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px;
  border: 1px solid var(--line); border-radius: 13px; overflow: hidden; margin: 20px 0;
  background: var(--line);
}
.classification-strip > div, .report-facts > div, .admin-stats > div {
  background: #fff; padding: 13px 15px;
}
.classification-strip span, .report-facts span, .admin-stats span {
  display: block; color: var(--muted); font-size: .72rem; letter-spacing: .05em; margin-bottom: 2px;
}
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.detail-image { width: 100%; border-radius: 12px; border: 1px solid var(--line); background: white; }
.notice { margin: 15px 0; border-radius: 11px; border: 1px solid var(--line); padding: 13px 15px; background: #f5f7f5; }
.notice.approved { background: var(--accent-soft); }
.notice.rejected { background: var(--danger-soft); color: var(--danger); }
.meta { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; color: var(--muted); }
.meta dt { font-weight: 800; color: var(--text); }
.meta dd { margin: 0; }

.report-document { padding: 32px; }
.document-topline { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: .7rem; letter-spacing: .12em; border-bottom: 1px solid var(--line); padding-bottom: 9px; }
.article-header { display: flex; justify-content: space-between; gap: 26px; align-items: flex-start; margin: 25px 0 20px; }
.article-header h1 { font-size: clamp(2rem, 5vw, 3.7rem); line-height: 1.05; margin: 6px 0; letter-spacing: -.04em; }
.article-thumb { width: min(350px, 40%); border-radius: 13px; border: 1px solid var(--line); }
.report-subtitle { color: var(--muted); }
.report-facts { grid-template-columns: repeat(3, 1fr); }
.article-body { max-width: 820px; margin: 28px auto; font-size: 1.02rem; }
.article-body h1, .article-body h2, .article-body h3 { margin-top: 1.7em; line-height: 1.35; }
.article-body blockquote { margin-left: 0; border-left: 4px solid var(--line); padding-left: 15px; color: var(--muted); }
.share-panel { border-top: 1px solid var(--line); margin-top: 36px; padding-top: 22px; display: flex; justify-content: space-between; gap: 20px; align-items: center; }
.share-buttons { display: flex; gap: 10px; flex-wrap: wrap; }

.scan-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(241,244,241,.96); backdrop-filter: blur(10px);
  display: grid; place-items: center; padding: 24px;
}
.scan-dialog { width: min(560px, 100%); text-align: center; }
.scan-orbit { width: 150px; height: 150px; margin: 0 auto 20px; border-radius: 50%; position: relative; display: grid; place-items: center; }
.scan-orbit img { width: 115px; height: 115px; border-radius: 50%; object-fit: cover; }
.scan-orbit span { position: absolute; inset: 0; border: 2px solid transparent; border-top-color: var(--accent); border-radius: 50%; animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress-track { height: 8px; background: #dfe6e1; border-radius: 99px; overflow: hidden; margin-top: 20px; }
.progress-fill { height: 100%; width: 8%; background: var(--accent); transition: width .55s ease; }
.scan-small { color: var(--muted); font-size: .82rem; }

.admin-stats { grid-template-columns: repeat(4, 1fr); }
.admin-stats strong { font-size: 1.5rem; }
.status-row { display: flex; gap: 8px; margin: 14px 0; }
.status-chip, .state { display: inline-block; border: 1px solid var(--line); padding: 4px 9px; border-radius: 999px; font-size: .85rem; }
.state.approved { background: var(--accent-soft); color: var(--accent); }
.state.pending { background: var(--warn-soft); color: #76621b; }
.state.rejected { background: var(--danger-soft); color: var(--danger); }
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; min-width: 980px; }
.admin-table th, .admin-table td { border-bottom: 1px solid var(--line); padding: 10px; text-align: left; vertical-align: middle; }
.mini-thumb { width: 70px; height: 70px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.moderation-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.report-editor { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; line-height: 1.55; }
.ogp-preview { width: min(100%, 800px); border: 1px solid var(--line); border-radius: 13px; }

@media (max-width: 860px) {
  .hero-grid, .two-col, .report-grid, .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .article-header { display: grid; grid-template-columns: 1fr; }
  .article-thumb { width: 100%; }
  .report-facts, .classification-strip, .admin-stats { grid-template-columns: 1fr 1fr; }
  .moderation-actions { grid-template-columns: 1fr; }
  .share-panel, .section-heading, .archive-title-row, .record-header, .admin-top { flex-direction: column; }
}
@media (max-width: 560px) {
  .wrap { width: min(100% - 20px, 1120px); }
  .card { padding: 18px; border-radius: 14px; }
  .nav-links { gap: 10px; font-size: .9rem; }
  .hero h1 { font-size: 2.55rem; }
  .report-facts, .classification-strip, .admin-stats { grid-template-columns: 1fr; }
  .footer-flex { align-items: flex-start; flex-direction: column; }
}


.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 14px; }

.camera-start-note {
  width: min(340px, 100%);
  background: #f7faf7;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
}
.camera-start-note p { margin-bottom: 0; color: var(--muted); }

.camera-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.9fr);
  gap: 20px;
  align-items: start;
}
.camera-stage-wrap { display: grid; gap: 12px; }
.camera-stage {
  position: relative;
  aspect-ratio: 3 / 4;
  background: #0b0f0d;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  touch-action: none;
}
.camera-stage video,
.camera-stage .camera-fallback {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.camera-fallback {
  display: grid;
  place-items: center;
  color: white;
  padding: 20px;
  text-align: center;
  background:
    radial-gradient(circle at center, rgba(255,255,255,.08), rgba(0,0,0,.6)),
    linear-gradient(135deg, #203326, #0b100d);
}
.overlay-face {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 46%;
  transform-origin: center center;
  will-change: transform, opacity;
  pointer-events: auto;
  user-select: none;
  touch-action: none;
  cursor: grab;
}
.overlay-face:active { cursor: grabbing; }
.camera-crosshair {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.camera-crosshair::before,
.camera-crosshair::after {
  content: "";
  position: absolute;
  background: rgba(255,255,255,.32);
}
.camera-crosshair::before { left: 50%; top: 0; bottom: 0; width: 1px; }
.camera-crosshair::after { top: 50%; left: 0; right: 0; height: 1px; }

.camera-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.control-panel {
  background: #fbfcfb;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
}
.control-panel h2 { margin-top: 0; }
.control-grid { display: grid; gap: 14px; }
.segmented {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: white;
}
.segment {
  border: none;
  background: transparent;
  padding: 10px 16px;
  font: inherit;
  font-weight: 800;
  color: var(--muted);
  cursor: pointer;
}
.segment.is-active { background: var(--accent); color: white; }
.camera-subnote {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 16px;
}
.camera-subnote p {
  margin: 0;
  color: var(--muted);
}
.capture-result {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 20px;
  align-items: start;
}

.analysis-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(238, 242, 233, 0.96);
  backdrop-filter: blur(8px);
}

.analysis-overlay.hidden { display: none; }

.analysis-dialog {
  width: min(560px, 100%);
  padding: clamp(28px, 7vw, 54px);
  border: 1px solid rgba(12, 76, 46, 0.22);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(0, 45, 28, 0.18);
  text-align: center;
}

.analysis-spinner {
  width: 64px;
  height: 64px;
  margin: 0 auto 24px;
  border: 7px solid rgba(13, 92, 56, 0.16);
  border-top-color: #0d5c38;
  border-radius: 50%;
  animation: analysis-spin 0.9s linear infinite;
}

.analysis-dialog h2 { margin-bottom: 14px; }
.analysis-dialog p { line-height: 1.8; }
.analysis-caution { margin-bottom: 0; color: var(--muted); font-size: 0.92rem; }
body.analysis-active { overflow: hidden; }

@keyframes analysis-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .analysis-spinner { animation-duration: 1.8s; }
}
.captured-preview {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
}
input[type="range"] { width: 100%; }

@media (max-width: 920px) {
  .camera-layout,
  .capture-result {
    grid-template-columns: 1fr;
  }
}
