:root {
  --teal: #00b894; --teal-dk: #0e8c9a; --blue: #3498db; --blue-dk: #2d6fb7; --red: #e74c3c;
  --bg: #f4f7f6; --card: #ffffff; --text: #17202a; --muted: #5f6b76; --line: #e3e8ec;
  --safe-t: env(safe-area-inset-top); --safe-b: env(safe-area-inset-bottom);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1416; --card: #1a2226; --text: #eef2f4; --muted: #9aa7b0; --line: #2a353b; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; }
body { overscroll-behavior-y: none; }
h1 { font-size: 28px; margin: 12px 0 6px; font-weight: 800; letter-spacing: -0.02em; }
h1.big { font-size: 32px; line-height: 1.12; margin-bottom: 20px; }
h2 { font-size: 17px; margin: 0; font-weight: 700; }
p { margin: 4px 0; line-height: 1.4; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center-text { text-align: center; }
.white { color: #fff; } .white-dim { color: rgba(255,255,255,.85); }

.view { display: none; min-height: 100%; padding-top: var(--safe-t); padding-bottom: var(--safe-b);
  animation: fadein .35s ease; }
.view.active { display: flex; flex-direction: column; }
.view.center { align-items: center; justify-content: center; text-align: center; padding-left: 28px; padding-right: 28px; }
.view.pad { padding-left: 28px; padding-right: 28px; padding-bottom: calc(28px + var(--safe-b)); }
.pad-x { padding: 0 16px; }
.spacer { flex: 1; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.gradient { background: linear-gradient(135deg, var(--teal), var(--teal-dk) 55%, var(--blue-dk)); }
.dark { background: #000; color: #fff; }

.btn { width: 100%; border: 0; border-radius: 18px; padding: 17px; font-size: 17px; font-weight: 650;
  background: linear-gradient(135deg, var(--teal), var(--teal-dk)); color: #fff; margin-top: 10px;
  box-shadow: 0 8px 22px rgba(0,184,148,.28); cursor: pointer; }
.btn:active { transform: scale(.98); }
.btn-white { background: #fff; color: var(--teal); box-shadow: none; max-width: 420px; margin-top: 28px; }
.btn-ghost { background: transparent; color: var(--muted); box-shadow: none; }
.link, .link-white { background: none; border: 0; font-size: 17px; color: var(--teal); padding: 8px 4px; }
.link-white { color: #fff; }
.icon-btn { background: var(--card); border: 0; border-radius: 14px; width: 42px; height: 42px; font-size: 20px; }

.hero-icon img { width: 96px; height: 96px; border-radius: 22px; box-shadow: 0 10px 30px rgba(0,0,0,.12); }
.steps { text-align: left; margin: 22px auto; padding-left: 22px; max-width: 320px; font-size: 17px; line-height: 2; }
.share-ico { display: inline-block; border: 2px solid var(--blue); color: var(--blue); border-radius: 6px;
  width: 22px; height: 22px; line-height: 16px; text-align: center; font-weight: 800; }

.pulse { padding: 26px; border-radius: 50%; background: rgba(255,255,255,.14); animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { padding: 34px; background: rgba(255,255,255,.2); } }
.lock-disc { width: 112px; height: 112px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 52px; }

.hero-rings { width: 168px; height: 168px; margin: 0 auto; border-radius: 50%;
  background: linear-gradient(135deg, rgba(0,184,148,.25), rgba(52,152,219,.18)); display: grid; place-items: center; }
.hero-core { width: 108px; height: 108px; border-radius: 50%; display: grid; place-items: center; font-size: 46px;
  background: linear-gradient(135deg, var(--teal), var(--blue-dk)); }
.feature { display: flex; gap: 14px; margin-bottom: 16px; }
.feature p { color: var(--muted); font-size: 15px; }
.f-ico { flex: none; width: 44px; height: 44px; border-radius: 14px; background: rgba(0,184,148,.12); display: grid; place-items: center; font-size: 20px; }

/* scanner */
#v-scan { position: fixed; inset: 0; }
#scan-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; left: 50%; top: 46%; width: 72vw; height: 72vw; max-width: 340px; max-height: 340px;
  transform: translate(-50%, -50%); border: 4px solid var(--teal); border-radius: 28px;
  box-shadow: 0 0 0 100vmax rgba(0,0,0,.55); }
.scan-top { position: absolute; top: calc(8px + var(--safe-t)); left: 0; right: 0; display: flex;
  justify-content: space-between; align-items: center; padding: 0 12px; font-weight: 700; }
.scan-hint { position: absolute; left: 24px; right: 24px; bottom: calc(48px + var(--safe-b)); text-align: center; color: #fff; font-size: 16px; }

/* home */
.appbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 8px; }
.appbar .title { font-size: 34px; margin: 6px 0; }
.status { border-radius: 28px; padding: 20px; color: #fff; transition: background .5s ease;
  background: linear-gradient(135deg, #5d6d7e, #34495e); box-shadow: 0 12px 28px rgba(0,0,0,.18); }
.status.locked { background: linear-gradient(135deg, var(--teal), var(--teal-dk)); box-shadow: 0 12px 28px rgba(0,184,148,.35); }
.status.unlocked { background: linear-gradient(135deg, var(--blue), var(--blue-dk)); box-shadow: 0 12px 28px rgba(52,152,219,.35); }
.status-top { display: flex; justify-content: space-between; align-items: center; font-weight: 600; color: rgba(255,255,255,.8); }
.chip { background: rgba(255,255,255,.2); color: #fff; border-radius: 20px; padding: 4px 10px; font-size: 12px; }
.status-main { display: flex; align-items: center; gap: 16px; margin-top: 18px; }
.st-icon { width: 58px; height: 58px; border-radius: 50%; background: rgba(255,255,255,.2); display: grid; place-items: center; font-size: 28px; }
.st-title { font-size: 28px; font-weight: 800; }
.st-sub { opacity: .92; }
.timeline { padding: 0 16px 32px; }
.day { margin: 22px 8px 8px; font-weight: 700; color: var(--muted); font-size: 14px; }
.card { background: var(--card); border-radius: 20px; }
.ev { display: flex; align-items: center; gap: 12px; padding: 12px; margin-bottom: 10px; width: 100%;
  border: 0; text-align: left; color: var(--text); font: inherit; }
.ev:active { transform: scale(.99); }
.ev-ico { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; }
.ev-body { flex: 1; min-width: 0; }
.ev-title { font-weight: 700; }
.ev-sub { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-time { color: var(--muted); font-size: 12px; }
.ev-thumb { width: 64px; height: 48px; border-radius: 12px; object-fit: cover; flex: none; background: var(--line); }
.empty { display: none; text-align: center; padding: 40px; }
.empty.show { display: block; }
.empty-ico { font-size: 54px; opacity: .5; }

/* detail */
.sheet { background: var(--bg); }
.gallery { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; border-radius: 24px; gap: 0; }
.gallery figure { flex: none; width: 100%; margin: 0; scroll-snap-align: center; position: relative; }
.gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.gallery figcaption { position: absolute; left: 12px; bottom: 12px; background: rgba(0,0,0,.55); color: #fff;
  padding: 6px 12px; border-radius: 20px; font-size: 14px; }
.dots { display: flex; justify-content: center; gap: 8px; margin: 10px 0 16px; }
.dots i { width: 8px; height: 8px; border-radius: 8px; background: var(--line); transition: width .25s; }
.dots i.on { width: 22px; background: var(--teal); }
.info { padding: 6px 0; margin-bottom: 12px; }
.info-row { display: flex; gap: 14px; padding: 12px 16px; align-items: center; }
.info-row .k { color: var(--muted); font-size: 13px; }
.info-row .v { font-size: 16px; font-weight: 500; }

/* settings */
.row-card { display: flex; gap: 14px; align-items: center; padding: 16px; margin-bottom: 16px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--teal); display: grid; place-items: center; font-size: 22px; }
.list { margin-bottom: 16px; overflow: hidden; }
.list-item { display: flex; gap: 12px; align-items: center; width: 100%; background: none; border: 0;
  border-bottom: 1px solid var(--line); padding: 16px; font-size: 16px; color: var(--text); text-align: left; }
.list-item:last-child { border-bottom: 0; }
.list-item.danger { color: var(--red); font-weight: 600; }

.toast { position: fixed; left: 16px; right: 16px; bottom: calc(24px + var(--safe-b)); background: #1f2933; color: #fff;
  padding: 14px 16px; border-radius: 14px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.3); z-index: 9; }
