:root {
  --navy: #08004F;
  --navy-2: #1a1366;
  --ink: #14122b;
  --muted: #5d5a75;
  --paper: #f7f5f0;
  --card: #ffffff;
  --line: #e4e0d6;
  --gold: #b8955a;
  --gold-soft: #f1e8d8;
  --ok: #2f7a55;
  --err: #b3402f;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(8, 0, 79, .06), 0 8px 24px rgba(8, 0, 79, .06);
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--sans); color: var(--ink); background: var(--paper);
  -webkit-font-smoothing: antialiased; line-height: 1.5; min-height: 100vh;
}
img { display: block; max-width: 100%; }
button { font: inherit; }
a { color: var(--navy); }

/* header */
.top {
  background: var(--navy); color: #fff; padding: 18px 16px 56px;
  position: relative; overflow: hidden;
}
.top::after {
  content: ""; position: absolute; right: -80px; top: -80px; width: 260px; height: 260px;
  border-radius: 50%; border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 0 0 40px rgba(255,255,255,.03), 0 0 0 90px rgba(255,255,255,.02);
}
.top-inner { max-width: 960px; margin: 0 auto; position: relative; z-index: 1; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; opacity: .85; }
.brand-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.top h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(34px, 7vw, 54px); line-height: 1.02; margin: 22px 0 8px; letter-spacing: -.01em; }
.top h1 em { color: #e9d6b0; }
.top .sub { margin: 0; opacity: .8; font-size: 15px; max-width: 520px; }

main { max-width: 960px; margin: -36px auto 0; padding: 0 16px 48px; position: relative; z-index: 2; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.card + .card { margin-top: 16px; }
.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }

h2 { font-family: var(--serif); font-weight: 400; font-size: 28px; margin: 0 0 6px; line-height: 1.15; }
h3 { font-size: 15px; margin: 0 0 8px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.steps { list-style: none; padding: 0; margin: 18px 0; display: grid; gap: 12px; }
.steps li { display: flex; gap: 12px; align-items: flex-start; }
.steps b { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--gold-soft); color: var(--navy); display: grid; place-items: center; font-size: 13px; }

.consent { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #fcfbf8; margin: 18px 0; cursor: pointer; font-size: 14px; }
.consent input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--navy); flex: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 14px 22px; font-weight: 600; font-size: 15px;
  background: var(--navy); color: #fff; cursor: pointer; text-decoration: none;
  transition: transform .08s ease, background .2s ease, opacity .2s;
}
.btn:hover { background: var(--navy-2); }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .4; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--navy); border: 1px solid var(--line); }
.btn.ghost:hover { background: #f2f0ea; }
.btn.gold { background: var(--gold); }
.btn.danger { background: var(--err); }
.btn.block { width: 100%; }
.btn.sm { padding: 9px 14px; font-size: 13px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row.center { justify-content: center; }
.stack { display: grid; gap: 10px; }

/* camera */
.cam { position: relative; border-radius: var(--radius); overflow: hidden; background: #000; aspect-ratio: 3 / 4; max-height: 70vh; margin: 0 auto 14px; }
.cam video, .cam canvas { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.cam .oval { position: absolute; inset: 12% 18% 18%; border: 2px solid rgba(255,255,255,.85); border-radius: 50% / 45%; box-shadow: 0 0 0 999px rgba(8,0,79,.35); pointer-events: none; }
.cam .hint { position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; color: #fff; font-size: 14px; text-shadow: 0 1px 4px rgba(0,0,0,.5); }

/* status */
.status { display: flex; align-items: center; gap: 12px; padding: 18px 0; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--navy); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.alert { padding: 12px 14px; border-radius: 10px; font-size: 14px; margin: 12px 0; }
.alert.err { background: #fbecea; color: var(--err); }
.alert.ok { background: #e8f3ed; color: var(--ok); }
.alert.info { background: var(--gold-soft); color: #6b5226; }
.progress { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--navy); width: 0; transition: width .3s; }

/* gallery */
.gal-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.grid button { border: 0; padding: 0; background: var(--line); border-radius: 10px; overflow: hidden; aspect-ratio: 1; cursor: zoom-in; position: relative; }
.grid img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.grid button:hover img { transform: scale(1.03); }
@media (max-width: 480px) { .grid { grid-template-columns: repeat(2, 1fr); gap: 6px; } }

.lightbox { position: fixed; inset: 0; background: rgba(8, 0, 30, .94); display: none; flex-direction: column; z-index: 50; }
.lightbox.open { display: flex; }
.lightbox .lb-img { flex: 1; display: grid; place-items: center; padding: 16px; min-height: 0; }
.lightbox img { max-height: 100%; max-width: 100%; object-fit: contain; border-radius: 6px; }
.lightbox .lb-bar { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); }
.lightbox .lb-close { position: absolute; top: 12px; right: 12px; background: rgba(255,255,255,.12); color: #fff; border: 0; width: 42px; height: 42px; border-radius: 50%; font-size: 22px; cursor: pointer; }
.lightbox .lb-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,.12); color: #fff; border: 0; width: 44px; height: 44px; border-radius: 50%; font-size: 20px; cursor: pointer; }
.lightbox .lb-prev { left: 10px; } .lightbox .lb-next { right: 10px; }

footer { max-width: 960px; margin: 0 auto; padding: 0 16px 40px; color: var(--muted); font-size: 12.5px; text-align: center; }
footer .lockup { letter-spacing: .08em; text-transform: uppercase; font-size: 11px; margin-bottom: 6px; color: var(--navy); }

/* admin */
.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.field input, .field select { font: inherit; font-size: 15px; color: var(--ink); padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; width: 100%; }
.field input:focus, .field select:focus { outline: 2px solid var(--navy); outline-offset: 1px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0 4px; }
.stat { background: #fcfbf8; border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.stat b { display: block; font-family: var(--serif); font-size: 30px; font-weight: 400; line-height: 1; color: var(--navy); }
.stat span { font-size: 12px; color: var(--muted); }
@media (max-width: 600px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 34px 16px; text-align: center; cursor: pointer; transition: border-color .2s, background .2s; }
.drop.over { border-color: var(--navy); background: #f2f0fa; }
.log { max-height: 220px; overflow: auto; font-size: 12.5px; font-family: ui-monospace, Menlo, monospace; background: #fcfbf8; border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-top: 12px; }
.log div { padding: 2px 0; }
.log .e { color: var(--err); }
.tile { position: relative; }
.tile .badge { position: absolute; left: 6px; bottom: 6px; background: rgba(8,0,79,.85); color: #fff; font-size: 11px; padding: 2px 7px; border-radius: 99px; }
.tile .del { position: absolute; right: 6px; top: 6px; background: rgba(255,255,255,.92); border: 0; border-radius: 50%; width: 28px; height: 28px; cursor: pointer; color: var(--err); font-weight: 700; }
.qr { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.qr canvas, .qr img { width: 150px; height: 150px; border-radius: 8px; background: #fff; padding: 8px; border: 1px solid var(--line); }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 13px; word-break: break-all; }
.hidden { display: none !important; }
