:root {
  --ink: #172a3d;
  --muted: #718096;
  --line: #e5ebf2;
  --bg: #f7f9fc;
  --surface: #ffffff;
  --navy: #16324b;
  --coral: #ff745a;
  --mint: #7ddbc0;
  --soft-blue: #edf3f8;
  --shadow: 0 18px 50px rgba(33, 58, 84, 0.09);
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--bg);
  font-family: "DM Sans", "Noto Sans SC", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { cursor: pointer; }

.app-shell { width: min(100%, 720px); margin: 0 auto; padding: 20px 20px 34px; }

.topbar { display: flex; align-items: center; justify-content: space-between; }
.brand-lockup { display: flex; align-items: center; gap: 10px; }
.brand-mark { position: relative; width: 32px; height: 32px; display: flex; align-items: flex-end; gap: 3px; padding: 6px; border-radius: 10px; background: var(--navy); }
.brand-mark span { display: block; width: 4px; border-radius: 6px; background: var(--mint); }
.brand-mark span:nth-child(1) { height: 8px; opacity: .72; }
.brand-mark span:nth-child(2) { height: 14px; }
.brand-mark span:nth-child(3) { height: 20px; background: var(--coral); }
.brand-name, .brand-caption { margin: 0; }
.brand-name { font-size: 15px; font-weight: 800; letter-spacing: .01em; }
.brand-caption { margin-top: 1px; color: var(--muted); font-size: 10px; letter-spacing: .05em; }
.icon-button { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); background: rgba(255,255,255,.75); transition: .2s ease; }
.icon-button:hover { transform: translateY(-1px); border-color: #cbd7e4; background: #fff; }
.icon-button svg { width: 19px; }

.hero-copy { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin: 42px 2px 24px; }
.eyebrow { display: inline-flex; align-items: center; gap: 7px; color: #547085; font-size: 11px; font-weight: 700; letter-spacing: .06em; }
.live-dot, .status-dot { width: 7px; height: 7px; border-radius: 99px; background: #37bb8a; box-shadow: 0 0 0 4px rgba(55,187,138,.13); }
h1 { margin: 13px 0 9px; font-size: clamp(31px, 8vw, 45px); line-height: 1.12; letter-spacing: -.045em; }
h1 em { color: var(--coral); font-style: normal; }
.hero-copy p { max-width: 340px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.hero-stat { min-width: 96px; padding-bottom: 5px; text-align: right; }
.hero-stat strong { display: block; color: var(--navy); font-size: 28px; line-height: 1; letter-spacing: -.04em; }
.hero-stat strong span { font-size: 15px; }
.hero-stat small { display: block; margin-top: 8px; color: var(--muted); font-size: 10px; }

.section-tabs { display: flex; gap: 5px; margin-bottom: 13px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.7); }
.tab { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 700; transition: .2s ease; }
.tab svg { width: 15px; height: 15px; }
.tab.is-active { color: var(--navy); background: #fff; box-shadow: 0 3px 10px rgba(34, 58, 80, .08); }

.panel { padding: 17px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.tab-panel { display: none; }
.tab-panel.is-visible { display: block; animation: reveal .26s ease; }
@keyframes reveal { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.section-kicker { display: block; margin-bottom: 4px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
h2 { margin: 0; font-size: 20px; letter-spacing: -.03em; }
.status-pill, .unlimited-pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 999px; color: #298265; background: #ebfaf5; font-size: 10px; font-weight: 700; white-space: nowrap; }
.unlimited-pill { color: #8a5b39; background: #fff4e9; }
.unlimited-pill svg { width: 14px; height: 14px; }

.photo-frame { position: relative; overflow: hidden; width: 100%; aspect-ratio: 1 / 1.13; border-radius: 16px; background: #dfe4e6; isolation: isolate; }
.photo-frame > img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; filter: saturate(.93) contrast(1.03); }
.photo-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(9,30,48,.38), transparent 23%, transparent 70%, rgba(9,30,48,.47)); pointer-events: none; }
.photo-topline, .photo-bottomline { position: absolute; z-index: 5; left: 12px; right: 12px; display: flex; align-items: center; justify-content: space-between; color: #fff; }
.photo-topline { top: 12px; }
.photo-bottomline { bottom: 12px; font-size: 10px; opacity: .86; }
.photo-bottomline span:first-child { display: inline-flex; align-items: center; gap: 5px; }
.photo-bottomline svg { width: 13px; height: 13px; }
.tiny-chip { display: inline-flex; align-items: center; gap: 5px; padding: 6px 8px; border: 1px solid rgba(255,255,255,.25); border-radius: 7px; background: rgba(15, 38, 55, .38); backdrop-filter: blur(7px); font-size: 10px; font-weight: 700; }
.tiny-chip svg { width: 13px; height: 13px; color: var(--mint); }
.photo-action { display: grid; place-items: center; width: 29px; height: 29px; border: 1px solid rgba(255,255,255,.25); border-radius: 8px; color: #fff; background: rgba(15,38,55,.38); backdrop-filter: blur(7px); }
.photo-action svg { width: 15px; height: 15px; }
.scan-line { position: absolute; z-index: 4; top: 26%; left: 0; right: 0; height: 1px; background: rgba(125,219,192,.75); box-shadow: 0 0 15px 3px rgba(125,219,192,.42); opacity: .65; animation: scan 4.6s ease-in-out infinite; }
@keyframes scan { 0%, 100% { transform: translateY(-14px); opacity: 0; } 15% { opacity: .75; } 50% { transform: translateY(210px); opacity: .8; } 85% { opacity: .15; } }
.marker-layer { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; pointer-events: none; }
.marker { position: absolute; width: 9px; height: 9px; border: 2px solid #ff5c45; border-radius: 99px; background: #ffe5df; box-shadow: 0 0 0 2px rgba(255, 92, 69, .18); transform: translate(-50%, -50%); animation: marker-in .45s both; }
@keyframes marker-in { from { opacity: 0; transform: translate(-50%, -50%) scale(.4); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
.logo-watermark { position: absolute; z-index: 8; right: 13px; bottom: 36px; display: flex; align-items: center; gap: 6px; padding: 6px 8px; border: 1px solid rgba(255,255,255,.4); border-radius: 8px; color: #fff; background: rgba(16, 37, 54, .55); backdrop-filter: blur(8px); font-size: 9px; font-weight: 700; letter-spacing: .08em; }
.logo-watermark img { display: none; width: 22px; height: 22px; object-fit: contain; border-radius: 4px; background: #fff; }
.logo-watermark.has-image img { display: block; }
.hidden { display: none !important; }

.result-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 19px 2px 13px; }
.result-number { display: flex; align-items: baseline; gap: 7px; }
.result-number strong { color: var(--navy); font-size: 47px; line-height: 1; letter-spacing: -.065em; }
.result-number span { color: var(--muted); font-size: 13px; font-weight: 700; }
.result-meta { display: grid; gap: 7px; min-width: 135px; }
.result-meta div { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 10px; }
.result-meta strong { color: var(--ink); font-size: 11px; }
.accuracy-track { overflow: hidden; height: 5px; border-radius: 10px; background: #eef1f4; }
.accuracy-track span { display: block; width: 98.6%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--mint), #43bc9a); }
.action-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 10px; margin-top: 16px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; border-radius: 12px; font-size: 13px; font-weight: 700; transition: .2s ease; }
.button svg { width: 17px; height: 17px; }
.button-primary { border: 1px solid var(--navy); color: #fff; background: var(--navy); box-shadow: 0 9px 20px rgba(22,50,75,.17); }
.button-primary:hover { background: #224965; transform: translateY(-1px); }
.button-secondary { border: 1px solid #dbe4eb; color: var(--navy); background: #f9fbfd; }
.button-secondary:hover { border-color: #bacbd7; background: #fff; transform: translateY(-1px); }

.logo-upload { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px dashed #cad8e3; border-radius: 14px; background: #fbfcfe; }
.logo-preview-box { display: grid; place-items: center; flex: 0 0 auto; width: 48px; height: 48px; overflow: hidden; border-radius: 11px; color: #83a0b2; background: #eaf1f5; }
.logo-preview-box svg { width: 20px; }
.logo-preview-box img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.logo-upload-copy { display: grid; gap: 4px; min-width: 0; flex: 1; }
.logo-upload-copy strong { overflow: hidden; color: var(--ink); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.logo-upload-copy span { color: var(--muted); font-size: 10px; }
.mini-button { padding: 8px 10px; border: 1px solid #d2dfe8; border-radius: 8px; color: var(--navy); background: #fff; font-size: 10px; font-weight: 700; white-space: nowrap; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 17px 2px; border-bottom: 1px solid var(--line); }
.setting-copy { display: grid; gap: 4px; }
.setting-copy strong { font-size: 13px; }
.setting-copy span { color: var(--muted); font-size: 10px; }
.switch { position: relative; display: inline-flex; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; }
.switch span { position: relative; display: block; width: 42px; height: 25px; border-radius: 99px; background: #dce5eb; transition: .2s ease; }
.switch span::after { content: ""; position: absolute; top: 4px; left: 4px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(20,40,60,.16); transition: .2s ease; }
.switch input:checked + span { background: var(--navy); }
.switch input:checked + span::after { transform: translateX(17px); }
.logo-note { display: flex; align-items: center; gap: 8px; margin-top: 16px; padding: 10px; border-radius: 10px; color: #527186; background: #f1f7f8; font-size: 10px; line-height: 1.5; }
.logo-note svg { flex: 0 0 auto; width: 15px; color: #36a582; }

.text-button { padding: 4px 0; border: 0; color: var(--coral); background: none; font-size: 11px; font-weight: 700; }
.history-list { display: grid; gap: 8px; }
.history-item { display: flex; align-items: center; gap: 10px; padding: 9px; border: 1px solid var(--line); border-radius: 12px; }
.history-thumb { display: grid; place-items: center; overflow: hidden; width: 42px; height: 42px; border-radius: 9px; background: #e9eef0; }
.history-thumb img { width: 100%; height: 100%; object-fit: cover; }
.accent-thumb { color: var(--coral); background: #fff0ec; }
.accent-thumb svg { width: 19px; }
.history-copy { display: grid; gap: 4px; min-width: 0; flex: 1; }
.history-copy strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.history-copy span { color: var(--muted); font-size: 10px; }
.history-item b { color: var(--navy); font-size: 11px; white-space: nowrap; }
.empty-history { display: grid; place-items: center; gap: 8px; padding: 36px 0; color: var(--muted); font-size: 11px; }
.empty-history svg { width: 24px; height: 24px; color: #a5b8c6; }

.footer-note { display: flex; justify-content: center; align-items: center; gap: 9px; margin-top: 18px; color: #9aaab6; font-size: 10px; }
.footer-divider { width: 3px; height: 3px; border-radius: 99px; background: #b9c5cd; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 22px; max-width: calc(100vw - 32px); padding: 11px 15px; border-radius: 999px; color: #fff; background: rgba(22,50,75,.93); box-shadow: 0 10px 25px rgba(20,40,60,.2); font-size: 12px; opacity: 0; pointer-events: none; transform: translate(-50%, 10px); transition: .25s ease; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 640px) {
  .app-shell { padding: 34px 28px 46px; }
  .hero-copy { margin-top: 60px; }
  .photo-frame { aspect-ratio: 1.35 / 1; }
  .photo-frame > img { object-position: center 53%; }
}

@media (max-width: 400px) {
  .app-shell { padding-inline: 14px; }
  .hero-copy { margin-top: 30px; }
  h1 { font-size: 31px; }
  .hero-stat { min-width: 80px; }
  .hero-stat strong { font-size: 24px; }
  .panel { padding: 13px; }
  .result-number strong { font-size: 41px; }
  .result-meta { min-width: 120px; }
}

/* Live counting workflow */
.top-label { color: var(--muted); font-size: 11px; font-weight: 700; }
.hero-copy { margin-top: 24px; margin-bottom: 17px; }
.hero-copy h1 { margin: 8px 0 7px; font-size: 30px; letter-spacing: 0; }
.hero-copy p { font-size: 12px; }
.section-tabs { margin-top: 15px; }
.photo-frame { aspect-ratio: 1.1 / 1; max-height: 390px; background: #e9eef1; }
.photo-frame > img { object-fit: contain; object-position: center; filter: none; }
.photo-frame-empty { background: #f1f5f7; border: 1px dashed #bed0d9; }
.photo-placeholder { display: grid; place-content: center; justify-items: center; gap: 10px; width: 100%; height: 100%; border: 0; color: var(--navy); background: transparent; text-align: center; }
.photo-placeholder svg { width: 28px; height: 28px; color: #63869b; }
.photo-placeholder strong { font-size: 15px; }
.photo-placeholder span { color: var(--muted); font-size: 11px; }
.photo-shade { background: linear-gradient(180deg, rgba(9,30,48,.42), transparent 22%, transparent 76%, rgba(9,30,48,.42)); }
.photo-bottomline span { overflow: hidden; max-width: 100%; text-overflow: ellipsis; white-space: nowrap; }
.logo-watermark img, .logo-watermark.has-image img { display: block; width: 44px; height: 44px; padding: 4px; }
.logo-watermark { right: 12px; bottom: 28px; }
.result-row { align-items: flex-end; padding-bottom: 6px; }
.result-source { color: var(--muted); font-size: 11px; text-align: right; }
.result-note { margin: 0 0 14px; color: #677e8e; font-size: 11px; line-height: 1.55; }
.turnstile-area { display: flex; justify-content: center; margin: 9px 0 4px; min-height: 65px; }
.status-pill[data-kind="warning"] { color: #976120; background: #fff6e8; }
.status-pill[data-kind="success"] { color: #298265; background: #e9f8f1; }
.button:disabled { cursor: not-allowed; opacity: .48; box-shadow: none; transform: none; }
@media (min-width: 640px) { .photo-frame { aspect-ratio: 1.5 / 1; } }
@media (max-width: 400px) { .hero-copy h1 { font-size: 28px; } .result-source { max-width: 145px; } }
