:root {
  --bg: #0e1320;
  --bg-soft: #161d31;
  --card: #ffffff;
  --ink: #16203a;
  --muted: #5b677f;
  --line: #e2e7f1;
  --blue: #2f5bff;
  --blue-dark: #1e42c9;
  --red: #e23b4e;
  --green: #1f9d63;
  --amber: #b7791f;
  --amber-bg: #fdf6e3;
  --green-bg: #e8f7ef;
  --red-bg: #fdecee;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--blue-dark); }

.shell {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 1rem 1rem;
}

/* ---------------------------------------------------------------- header */
header.site {
  background:
    radial-gradient(900px 300px at 50% -80%, rgba(47, 91, 255, .45), transparent 70%),
    linear-gradient(180deg, #0b1020, #131a33);
  color: #eef2ff;
  padding: 2rem 1rem .3rem;
  border-bottom: 3px solid transparent;
}
header.site .flag {
  width: 4.4rem; height: .35rem; border-radius: 999px; margin: 0 0 1rem;
  background: linear-gradient(90deg, var(--blue) 0 33%, #f5f7ff 33% 66%, var(--green) 66% 100%);
}
header.site h1 { margin: 0 0 .35rem; font-size: clamp(1.5rem, 4vw, 2.1rem); letter-spacing: -.02em; }
header.site p { margin: 0; color: #aab6d6; max-width: 46rem; }
header.site .crumbs { font-size: .85rem; margin-bottom: 1.2rem; color: #8f9cc0; }
header.site .crumbs a { color: #c3cdf0; }

/* ----------------------------------------------------------------- cards */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.3rem 1.35rem 1.5rem;
  margin-top: 1.4rem;
}
#scanCard { margin-top: .35rem; }
.card > h2 {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  display: flex; align-items: center; gap: .6rem;
}
.card > h2 .n {
  display: inline-grid; place-items: center;
  width: 1.7rem; height: 1.7rem; border-radius: 999px;
  background: var(--blue); color: #fff; font-size: .95rem; flex: 0 0 auto;
}

/* -------------------------------------------------------------- controls */
.btn {
  appearance: none; border: 1px solid var(--line);
  background: #f6f8fd; color: var(--ink);
  border-radius: 10px; padding: .6rem 1rem;
  font: inherit; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: .45rem;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: #eef2fb; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.small { padding: .4rem .7rem; font-size: .9rem; }

.controls { display: flex; flex-wrap: wrap; gap: .6rem; }

/* --------------------------------------------------------------- camera */
#cameraWrap { margin-top: 1rem; }
.video-box {
  position: relative; width: 100%; max-width: 520px; margin: 0 auto;
  border-radius: 12px; overflow: hidden; background: #000;
  aspect-ratio: 4 / 3;
}
.video-box video { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-box .reticle {
  position: absolute; inset: 12%;
  border: 3px solid rgba(255,255,255,.85);
  border-radius: 14px;
  box-shadow: 0 0 0 100vmax rgba(0,0,0,.25);
  pointer-events: none;
}
.status { text-align: center; color: var(--muted); font-size: .92rem; margin-top: .6rem; min-height: 1.4em; }

/* --------------------------------------------------------------- notice */
.notice {
  border-radius: 12px; padding: .85rem 1rem; margin: 0 0 1rem;
  border: 1px solid var(--line); background: #f7f9fd; font-size: .93rem;
}
.notice.warn { background: var(--amber-bg); border-color: #f0dfae; color: #6b4b12; }
.notice.error { background: var(--red-bg); border-color: #f5c6cc; color: #8f1f2e; }
.notice.ok { background: var(--green-bg); border-color: #bfe6d3; color: #14603f; }
.notice strong { display: block; margin-bottom: .15rem; }

/* --------------------------------------------------------------- paste */
details.paste { margin-top: 1rem; }
details.paste summary { cursor: pointer; font-weight: 600; color: var(--blue-dark); }
details.paste textarea {
  width: 100%; min-height: 8rem; margin-top: .7rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .85rem; padding: .7rem; border-radius: 10px;
  border: 1px solid var(--line); resize: vertical;
}

/* ---------------------------------------------------------------- drop */
.drop {
  margin-top: 1rem; border: 2px dashed var(--line); border-radius: 12px;
  padding: 1.1rem; text-align: center; color: var(--muted); font-size: .93rem;
  transition: border-color .15s, background .15s;
}
.drop.hover { border-color: var(--blue); background: #f2f6ff; color: var(--blue-dark); }
kbd {
  font-family: inherit; font-size: .85em; font-weight: 600;
  background: #eef2fb; border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 6px; padding: .05em .4em;
}
.drop .en { display: block; margin-top: .35rem; color: #9aa6bd; font-size: .85em; }
.preview { margin-top: .9rem; }
.preview img {
  max-width: 200px; max-height: 200px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; image-rendering: pixelated;
}
.preview .caption { font-size: .8rem; color: var(--muted); margin-top: .3rem; }

/* --------------------------------------------------------------- table */
table.data { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.data th, table.data td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { color: var(--muted); font-weight: 600; width: 45%; }
table.data td { font-variant-numeric: tabular-nums; word-break: break-word; }
table.data tr:last-child th, table.data tr:last-child td { border-bottom: none; }
table.data .en { display: block; font-weight: 400; color: #93a0ba; font-size: .82rem; }
td.empty { color: #a9b3c8; }
.amount { font-weight: 700; }

.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.badge.ok { background: var(--green-bg); color: var(--green); }
.badge.bad { background: var(--red-bg); color: var(--red); }

.subheading { margin: 1.4rem 0 .6rem; font-size: 1rem; }
.hint { color: var(--muted); font-size: .88rem; }

pre.payload {
  background: #0f1626; color: #d7e0ff; padding: .8rem .9rem; border-radius: 10px;
  overflow: auto; font-size: .8rem; line-height: 1.45; white-space: pre;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  max-height: 16rem;
}

/* ------------------------------------------------------------------ qr */
.qr-layout { display: flex; flex-wrap: wrap; gap: 1.3rem; align-items: flex-start; }
.qr-figure { flex: 0 0 auto; text-align: center; }
.qr-figure img { width: 260px; height: 260px; image-rendering: pixelated; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.qr-figure .caption { font-size: .85rem; color: var(--muted); margin-top: .5rem; }
.qr-meta { flex: 1 1 300px; min-width: 240px; }

.options { display: flex; flex-wrap: wrap; gap: 1rem; margin: 1rem 0 .2rem; font-size: .92rem; }
.options label { display: inline-flex; align-items: center; gap: .45rem; cursor: pointer; }

.actions { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: .8rem; }
ul.plain { margin: .4rem 0 0; padding-left: 1.1rem; }
ul.plain li { margin: .25rem 0; }

.table-scroll { overflow-x: auto; }

footer.site { color: #8f9cc0; text-align: center; font-size: .85rem; padding: 2rem 1rem 3rem; }
footer.site a { color: #c3cdf0; }

@media (max-width: 560px) {
  table.data th { width: 50%; }
  .qr-figure img { width: 220px; height: 220px; }
}
