:root {
  color-scheme: dark;
  --bg: #0c0d0e;
  --panel: #151719;
  --panel-soft: #1a1c1f;
  --line: #2a2d30;
  --text: #f5f2ed;
  --muted: #97999d;
  --orange: #ff6b22;
  --orange-bright: #ff8748;
  --green: #66d19e;
  --red: #ff806c;
  --radius: 24px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 78% 8%, rgba(255, 107, 34, 0.12), transparent 31rem),
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px),
    var(--bg);
  background-size: auto, 52px 52px, 52px 52px, auto;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 38px 0 24px; }

.hero { max-width: 820px; padding: 20px 0 56px; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.brand strong { color: var(--orange); }

.brand-mark {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  color: #111;
  background: var(--orange);
  font-weight: 900;
  transform: rotate(-4deg);
  box-shadow: 0 6px 20px rgba(255,107,34,.22);
}

.brand-mark.mini { width: 24px; height: 24px; border-radius: 7px; font-size: .75rem; }

.eyebrow, .overline {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .71rem;
  font-weight: 750;
}

.eyebrow { display: flex; align-items: center; gap: 8px; margin-top: 72px; }
.signal-dot { width: 6px; height: 6px; border-radius: 99px; background: var(--orange); box-shadow: 0 0 0 5px rgba(255,107,34,.12); }

.hero h1 {
  max-width: 760px;
  margin: 18px 0 16px;
  font-size: clamp(2.8rem, 7vw, 6.2rem);
  font-weight: 850;
  letter-spacing: -.065em;
  line-height: .92;
}

.hero-copy { max-width: 650px; margin: 0; color: #b5b6b8; font-size: clamp(1rem, 2vw, 1.2rem); line-height: 1.65; }

.workspace-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 18px; }

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(255,255,255,.025), transparent 45%), var(--panel);
  box-shadow: 0 24px 80px rgba(0,0,0,.25);
}

.form-panel, .result-panel { padding: clamp(24px, 4vw, 38px); }

.panel-heading { display: flex; align-items: center; gap: 15px; margin-bottom: 34px; }
.panel-heading h2 { margin: 3px 0 0; font-size: 1.18rem; letter-spacing: -.025em; }
.panel-heading .overline { margin: 0; }

.step-number { display: grid; width: 42px; height: 42px; place-items: center; flex: 0 0 auto; border: 1px solid #3a3d40; border-radius: 50%; color: var(--orange-bright); font-size: .72rem; font-weight: 800; }

label { display: block; margin: 20px 0 9px; color: #d7d5d1; font-size: .83rem; font-weight: 700; }

input {
  width: 100%;
  min-height: 51px;
  padding: 0 15px;
  border: 1px solid #323538;
  border-radius: 12px;
  outline: 0;
  color: var(--text);
  background: #101214;
  transition: border-color .2s, box-shadow .2s;
}

input:focus { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(255,107,34,.1); }
input::placeholder { color: #65686c; }

.input-wrap { position: relative; }
.input-wrap input { padding-right: 68px; }
.text-button { position: absolute; right: 8px; top: 50%; padding: 7px 9px; transform: translateY(-50%); border: 0; color: var(--orange-bright); background: transparent; cursor: pointer; font-size: .78rem; font-weight: 750; }

.field-help { margin: 9px 0 0; color: #74777b; font-size: .75rem; line-height: 1.5; }
code { padding: 2px 5px; border-radius: 5px; color: #aaa; background: #0e1011; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.primary-button, .secondary-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 51px;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
  transition: transform .2s, filter .2s, opacity .2s;
}

.primary-button { width: 100%; margin-top: 27px; padding: 0 18px; color: #160a04; background: var(--orange); }
.primary-button span:last-child { margin-left: auto; font-size: 1.15rem; }
.primary-button:hover, .secondary-button:hover { filter: brightness(1.09); transform: translateY(-1px); }
.primary-button:disabled { cursor: wait; opacity: .6; transform: none; }
.secondary-button { flex: 0 0 auto; padding: 0 18px; color: var(--text); background: #303337; }
.button-link { text-decoration: none; }

.form-status, .result-message { min-height: 20px; margin: 13px 0 0; color: var(--green); font-size: .79rem; line-height: 1.5; }
.form-status.error, .result-message.error { color: var(--red); }

.result-panel.is-empty { display: grid; place-items: center; min-height: 440px; border-style: dashed; }
.empty-result { text-align: center; color: #74777b; }
.empty-result p { margin: -11px 0 0; font-size: .84rem; }
.ghost-count { display: block; color: rgba(255,255,255,.045); font-size: clamp(7rem, 18vw, 13rem); font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.result-content { width: 100%; }
.result-heading { margin-bottom: 26px; }
.result-heading .status-pill { margin-left: auto; }

.status-pill { display: inline-flex; align-items: center; justify-content: center; padding: 7px 10px; border: 1px solid rgba(102,209,158,.2); border-radius: 99px; color: var(--green); background: rgba(102,209,158,.08); font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.status-pill.degraded { border-color: rgba(255,128,108,.2); color: var(--red); background: rgba(255,128,108,.08); }

.profile-row { display: flex; align-items: center; gap: 15px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: #111315; }
.avatar-frame, .counter-avatar-frame { display: grid; place-items: center; overflow: hidden; flex: 0 0 auto; background: linear-gradient(135deg, #373a3e, #1d2023); }
.avatar-frame { width: 58px; height: 58px; border-radius: 16px; }
.avatar-frame img, .counter-avatar-frame img { width: 100%; height: 100%; object-fit: cover; }
.profile-identity { min-width: 0; }
.profile-identity h3 { overflow: hidden; margin: 0 0 4px; text-overflow: ellipsis; white-space: nowrap; font-size: 1.07rem; }
.profile-identity p { margin: 0; color: var(--muted); font-size: .85rem; }

.follower-block { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; padding: 32px 4px 27px; }
.follower-value { overflow: hidden; font-size: clamp(2.8rem, 7vw, 5.4rem); font-weight: 850; letter-spacing: -.055em; line-height: .9; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.follower-label { color: var(--orange); font-size: .68rem; font-weight: 850; text-transform: uppercase; letter-spacing: .18em; }

.meta-row { display: flex; justify-content: space-between; gap: 15px; padding: 13px 0 17px; border-top: 1px solid var(--line); color: var(--muted); font-size: .74rem; }
.meta-row time { color: #cac8c4; text-align: right; }
.tracking-panel { margin: 8px 0 24px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: #111315; }
.tracking-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.tracking-heading .overline { margin: 0 0 5px; }
.tracking-heading h3 { margin: 0; font-size: .98rem; letter-spacing: -.02em; }
.tracking-heading h3 span { color: var(--green); }
.tracking-heading h3 span.is-off { color: var(--muted); }
.tracking-switch { position: relative; display: block; width: 48px; height: 27px; flex: 0 0 auto; margin: 0; }
.tracking-switch input { position: absolute; width: 1px; height: 1px; min-height: 0; opacity: 0; }
.tracking-switch span { position: absolute; inset: 0; border: 1px solid #3b3e41; border-radius: 99px; background: #24272a; cursor: pointer; transition:background .2s,border-color .2s; }
.tracking-switch span::after { content:""; position:absolute; top:3px; left:3px; width:19px; height:19px; border-radius:50%; background:#8a8d91; transition:transform .2s,background .2s; }
.tracking-switch input:checked + span { border-color:rgba(102,209,158,.5); background:rgba(102,209,158,.18); }
.tracking-switch input:checked + span::after { background:var(--green); transform:translateX(21px); }
.tracking-switch input:focus-visible + span { outline:2px solid var(--orange); outline-offset:3px; }
.tracking-switch input:disabled + span { cursor:wait; opacity:.55; }
.tracking-details { display:grid; gap:9px; margin:17px 0 0; padding-top:14px; border-top:1px solid var(--line); }
.tracking-details div { display:flex; justify-content:space-between; gap:14px; font-size:.72rem; }
.tracking-details dt { color:var(--muted); }
.tracking-details dd { margin:0; color:#d6d4d0; text-align:right; }
.tracking-message { min-height:17px; margin:11px 0 0; color:var(--green); font-size:.72rem; }
.tracking-message.error { color:var(--red); }
.copy-row { display: flex; gap: 8px; }
.copy-row input { min-width: 0; color: #a9aaac; font-size: .78rem; }

footer { display: flex; justify-content: space-between; gap: 20px; padding: 28px 4px 0; color: #66696d; font-size: .72rem; }

/* Browser-source counter */
html:has(.counter-body) { background: transparent; }
.counter-body { display: grid; min-height: 100vh; place-items: center; padding: 32px; background: transparent; }
.counter-stage { width: min(780px, 100%); }
.counter-card { position: relative; overflow: hidden; padding: clamp(24px, 5vw, 48px); border: 1px solid rgba(255,255,255,.11); border-radius: 32px; background: radial-gradient(circle at 90% 0, rgba(255,107,34,.14), transparent 45%), rgba(14,15,16,.96); box-shadow: 0 28px 90px rgba(0,0,0,.45); }
.counter-card::after { position: absolute; right: -45px; bottom: -60px; width: 190px; height: 190px; border: 1px solid rgba(255,107,34,.13); border-radius: 50%; content: ""; }
.counter-card.is-degraded { border-color: rgba(255,128,108,.22); }
.counter-topline { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 42px; }
.counter-brand { display: flex; align-items: center; gap: 9px; font-size: .78rem; font-weight: 780; letter-spacing: .02em; }
.counter-profile { display: flex; align-items: center; gap: 19px; }
.counter-avatar-frame { width: 76px; height: 76px; border: 2px solid #2c2f31; border-radius: 22px; box-shadow: 0 0 0 5px rgba(255,255,255,.025); }
.counter-profile h1 { margin: 0 0 6px; font-size: clamp(1.25rem, 3vw, 1.75rem); letter-spacing: -.035em; }
.counter-profile p { margin: 0; color: var(--muted); }
.counter-number-wrap { padding: clamp(50px, 9vw, 82px) 0; text-align: center; }
.counter-number { overflow: hidden; color: var(--text); font-size: clamp(2.25rem, 9.5vw, 8rem); font-weight: 900; letter-spacing: -.065em; line-height: .85; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.counter-number.number-changed { animation: count-change .62s cubic-bezier(.2,.8,.2,1); }
@keyframes count-change { 0% { opacity: .35; transform: translateY(12px) scale(.985); color: var(--orange); } 100% { opacity: 1; transform: none; color: var(--text); } }
.counter-label { display: flex; align-items: center; justify-content: center; gap: 13px; margin-top: 24px; color: var(--orange-bright); font-size: .75rem; font-weight: 850; text-transform: uppercase; letter-spacing: .3em; }
.counter-label span { display: block; width: 28px; height: 1px; background: rgba(255,107,34,.5); }
.counter-footer { display: flex; justify-content: space-between; gap: 16px; padding-top: 19px; border-top: 1px solid rgba(255,255,255,.08); color: #717478; font-size: .71rem; text-transform: uppercase; letter-spacing: .08em; }
.counter-footer time { color: #aaa; text-align: right; text-transform: none; letter-spacing: 0; }
.counter-error { min-height: 17px; margin: 13px 0 -8px; color: var(--red); font-size: .72rem; text-align: right; }

@media (max-width: 780px) {
  .shell { width: min(100% - 24px, 620px); padding-top: 18px; }
  .hero { padding-bottom: 34px; }
  .eyebrow { margin-top: 48px; }
  .workspace-grid { grid-template-columns: 1fr; }
  .result-panel.is-empty { min-height: 300px; }
  footer { flex-direction: column; }
  .counter-body { padding: 14px; }
  .counter-card { border-radius: 22px; }
  .counter-topline { margin-bottom: 30px; }
  .counter-avatar-frame { width: 61px; height: 61px; border-radius: 18px; }
  .counter-number-wrap { padding: 48px 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Modular overlay theme picker */
.theme-picker { margin: 9px 0 26px; padding-top: 24px; border-top: 1px solid var(--line); }
.theme-picker-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 15px; }
.theme-picker-heading .overline { margin: 0 0 4px; }
.theme-picker-heading h3 { margin: 0; font-size: 1rem; letter-spacing: -.02em; }
.theme-count { color: var(--muted); font-size: .7rem; }
.theme-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.theme-card { min-width: 0; overflow: hidden; border: 1px solid #303338; border-radius: 15px; background: #101214; transition: border-color .2s, transform .2s; }
.theme-card:hover { transform: translateY(-1px); border-color: #45494e; }
.theme-card.is-active { border-color: var(--orange); box-shadow: 0 0 0 2px rgba(255,107,34,.1); }
.theme-preview { display: block; width: 100%; height: auto; aspect-ratio: 16/9; object-fit: cover; color: transparent; background: #08090a; }
.theme-details { padding: 12px; }
.theme-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.theme-title-row h4 { overflow: hidden; margin: 0; font-size: .82rem; text-overflow: ellipsis; white-space: nowrap; }
.active-badge { padding: 3px 6px; border-radius: 99px; color: #111; background: var(--orange); font-size: .56rem; font-weight: 900; text-transform: uppercase; }
.theme-details p { min-height: 45px; margin: 8px 0 12px; color: #777b80; font-size: .68rem; line-height: 1.45; }
.theme-actions { display: flex; align-items: center; gap: 7px; }
.theme-preview-link, .theme-apply-button { display: inline-grid; min-height: 34px; place-items: center; border-radius: 8px; font-size: .66rem; font-weight: 800; text-decoration: none; }
.theme-preview-link { flex: 0 0 auto; padding: 0 9px; border: 1px solid #30343a; color: #b5b7ba; }
.theme-apply-button { flex: 1; padding: 0 8px; border: 0; color: #140904; background: var(--orange); cursor: pointer; }
.theme-apply-button:disabled { color: #777; background: #25282c; cursor: default; }
.theme-status { min-height: 18px; margin: 10px 0 0; color: var(--muted); font-size: .72rem; }
.theme-status.error { color: var(--red); }
.theme-status.success { color: var(--green); }
.theme-empty { grid-column: 1/-1; min-height: 0 !important; margin: 0 !important; padding: 18px; border: 1px dashed #303338; border-radius: 12px; text-align: center; }

/* Stable browser-source canvas shared by every isolated theme. */
.counter-document, .counter-document body { width: 100%; height: 100%; min-height: 0; overflow: hidden; background: transparent; }
.counter-body { display: block; padding: 0; }
.counter-stage { display: grid; width: 100%; height: 100%; place-items: center; }
.theme-root { width: 100%; height: 100%; display: grid; place-items: center; overflow: hidden; container: overlay / size; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.theme-root .overlay-shell { position: relative; box-sizing: border-box; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; isolation: isolate; }
.theme-root .overlay-avatar-frame { display: grid; overflow: hidden; place-items: center; }
.theme-root .overlay-avatar, .theme-root .overlay-avatar-fallback { grid-area: 1/1; width: 100%; height: 100%; }
.theme-root .overlay-avatar { display: block; object-fit: cover; }
.theme-root .overlay-avatar[hidden], .theme-root .overlay-avatar-fallback[hidden] { display: none; }
.theme-root .overlay-avatar-fallback { display: grid; place-items: center; }
.theme-root .overlay-number { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.theme-root .overlay-error { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.theme-root .overlay-change-badge {
  position: fixed;
  z-index: 100;
  top: 50%;
  left: 50%;
  min-width: 58px;
  padding: 9px 14px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 999px;
  color: #fff;
  background: rgba(14,16,18,.9);
  box-shadow: 0 10px 28px rgba(0,0,0,.35);
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  transform: translate(-50%,-30%);
  pointer-events: none;
}
.theme-root .overlay-change-badge.is-follow { color: #91efbc; border-color: rgba(102,209,158,.42); }
.theme-root .overlay-change-badge.is-unfollow { color: #ff9a89; border-color: rgba(255,128,108,.38); }
.theme-root .overlay-change-badge.is-visible { animation:overlay-change-badge 1.8s ease both; }
.theme-root .overlay-number.is-fallback-follow { animation:overlay-fallback-follow .55s cubic-bezier(.22,1,.36,1); }
.theme-root .overlay-number.is-fallback-unfollow { animation:overlay-fallback-unfollow .5s ease; }

@keyframes overlay-change-badge {
  0% { opacity:0; transform:translate(-50%,0) scale(.86); }
  18%,72% { opacity:1; transform:translate(-50%,-50%) scale(1); }
  100% { opacity:0; transform:translate(-50%,-80%) scale(.96); }
}
@keyframes overlay-fallback-follow { 0%,100% { transform:scale(1); } 42% { transform:scale(1.055); } }
@keyframes overlay-fallback-unfollow { 0%,100% { opacity:1; } 45% { opacity:.72; } }

@media (prefers-reduced-motion: reduce) {
  .theme-root .overlay-change-badge.is-visible,
  .theme-root .overlay-number.is-fallback-follow,
  .theme-root .overlay-number.is-fallback-unfollow { animation-duration:.01ms; }
}

@media (max-width: 560px) {
  .theme-grid { grid-template-columns: 1fr; }
  .theme-details p { min-height: 0; }
}
