:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, "Hiragino Sans", sans-serif;
  line-height: 1.55;
  background: #f1f4f3;
  color: #16312a;
  --accent: #095e48;
  --border: #cddbd5;
  --muted: #48655a;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
.shell { width: min(100% - 2rem, 52rem); margin: 0 auto; padding: 1.75rem 0 max(2rem, env(safe-area-inset-bottom)); }
.shell.admin { width: min(100% - 2rem, 70rem); }
.page-header { border-top: 4px solid var(--accent); padding-top: 1rem; margin-bottom: 1.2rem; }
h1, h2, h3, p, figure { margin: 0; }
h1 { font-size: clamp(1.7rem, 5vw, 2.25rem); letter-spacing: -.035em; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1.23rem; }
.page-header p, .panel > p { color: var(--muted); margin-top: .35rem; }
.panel, .notice { padding: 1rem; border: 1px solid var(--border); background: white; border-radius: 12px; margin-bottom: .8rem; }
.notice { background: #e5f1ec; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.panel .actions, .panel form, .result-grid { margin-top: .8rem; }
.controls { margin: 0 0 .8rem; }
button, .button, input, select { font: inherit; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; padding: .58rem .85rem;
  min-height: 44px; border: 1px solid transparent; border-radius: 8px; background: var(--accent);
  color: white; font-weight: 650; text-align: center; cursor: pointer;
}
.secondary { background: #f8fbfa; border-color: var(--border); color: var(--accent); }
.danger { color: #9b3026; }
button:hover:not(:disabled), .button:hover { filter: brightness(.94); }
button:disabled { opacity: .6; cursor: default; }
:focus-visible { outline: 3px solid #c4731b; outline-offset: 3px; }
label:has(+ input:focus-visible) { outline: 3px solid #c4731b; outline-offset: 3px; }
label:has(+ input:disabled) { opacity: .6; pointer-events: none; }
input[type="search"], select {
  padding: .45rem .7rem; min-height: 44px; min-width: 0; color: inherit;
  border: 1px solid #99aea5; border-radius: 8px; background: white;
}
.search-field input { flex: 1; }
form [role="status"]:not(:empty) { margin-top: .65rem; color: var(--muted); }
.camera { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: #13251f; margin-top: .8rem; border-radius: 10px; }
.camera video { display: block; width: 100%; height: 100%; object-fit: cover; }
.guide { position: absolute; inset: 19% 6%; outline: 2px solid #b9ffdf; box-shadow: 0 0 0 100vmax #001c1470; pointer-events: none; }
.result-grid { display: grid; gap: .8rem; }
figure img { width: 100%; max-height: 18rem; object-fit: contain; border: 1px solid var(--border); border-radius: 8px; }
figcaption, .muted, .rank { font-size: .875rem; color: var(--muted); }
.candidate-list { display: grid; gap: .65rem; min-width: 0; }
.candidate { border: 1px solid var(--border); border-radius: 8px; padding: .85rem; background: #fbfdfc; overflow-wrap: anywhere; }
.candidate dl { margin: .55rem 0; }
.candidate dl > div { display: grid; grid-template-columns: 2.55rem 1fr; gap: .5rem; }
dt { color: var(--muted); }
dd { margin: 0; }
.evidence { display: flex; flex-wrap: wrap; gap: .35rem; margin: .6rem 0; }
.evidence span { background: #e4f1eb; color: #174d3a; border-radius: 5px; padding: .12rem .45rem; font-size: .8rem; }
.candidate button { width: 100%; }
.admin-grid { display: grid; gap: .8rem; }
.drop {
  display: block; text-align: center; padding: 1.1rem .6rem; background: #f3f8f5;
  border: 1px dashed #7c9f90; border-radius: 8px; cursor: pointer;
}
.drop.dragging { background: #d2eadf; }
#file-name { margin: .45rem 0; overflow-wrap: anywhere; }
.form-settings { display: flex; flex-wrap: wrap; gap: .4rem .8rem; align-items: center; margin: .85rem 0; }
.checkbox { display: flex; align-items: center; min-height: 44px; }
.qr { display: block; width: min(100%, 21rem); margin: .8rem auto; border: 1px solid var(--border); }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; }
.section-heading .actions { margin: 0; }
.metrics { margin: .85rem 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .6rem; }
.metrics > div { border-top: 1px solid var(--border); padding: .55rem 0; }
.metrics dd { font-weight: 700; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (min-width: 44rem) {
  .admin-grid { grid-template-columns: 1fr 1fr; }
  .result-grid:has(figure:not([hidden])) { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
}
