:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-raised: #ffffff;
  --text: #172033;
  --muted: #697386;
  --subtle: #94a0b2;
  --border: #e4e8f0;
  --border-strong: #d6dce7;
  --accent: #5b5bd6;
  --accent-strong: #4848bd;
  --accent-soft: #eeeeff;
  --success: #159570;
  --shadow-sm: 0 1px 2px rgba(21, 31, 50, .04);
  --shadow-md: 0 12px 36px rgba(35, 46, 68, .07);
  --radius: 18px;
  --radius-sm: 11px;
  --shell: 1180px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d111b;
  --surface: #151b28;
  --surface-soft: #111724;
  --surface-raised: #1a2130;
  --text: #f0f3f8;
  --muted: #a5afbf;
  --subtle: #7d8899;
  --border: #283142;
  --border-strong: #364055;
  --accent: #8b8cf3;
  --accent-strong: #a7a8ff;
  --accent-soft: #24264b;
  --success: #47c59e;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .18);
  --shadow-md: 0 18px 46px rgba(0, 0, 0, .2);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    color-scheme: dark;
    --bg: #0d111b;
    --surface: #151b28;
    --surface-soft: #111724;
    --surface-raised: #1a2130;
    --text: #f0f3f8;
    --muted: #a5afbf;
    --subtle: #7d8899;
    --border: #283142;
    --border-strong: #364055;
    --accent: #8b8cf3;
    --accent-strong: #a7a8ff;
    --accent-soft: #24264b;
    --success: #47c59e;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .18);
    --shadow-md: 0 18px 46px rgba(0, 0, 0, .2);
  }
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.55; }
a { color: inherit; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
svg { display: block; }
[hidden] { display: none !important; }

.shell { width: min(calc(100% - 40px), var(--shell)); margin-inline: auto; }
.main-content { min-height: calc(100vh - 154px); padding-block: 46px 70px; }
.skip-link { position: fixed; z-index: 100; top: 8px; left: 8px; padding: 10px 14px; border-radius: 8px; background: var(--text); color: var(--surface); transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.site-header { position: sticky; z-index: 20; top: 0; background: color-mix(in srgb, var(--bg) 88%, transparent); border-bottom: 1px solid color-mix(in srgb, var(--border) 80%, transparent); backdrop-filter: blur(16px); }
.header-inner { min-height: 72px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; width: fit-content; color: var(--text); font-weight: 760; letter-spacing: -.02em; text-decoration: none; }
.brand-mark { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 10px; color: white; background: linear-gradient(145deg, #7172e6, #4c4dca); box-shadow: 0 6px 16px rgba(79, 70, 229, .24); }
.brand-mark svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.main-nav { display: flex; align-items: center; gap: 4px; padding: 4px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-sm); }
.main-nav a { padding: 7px 13px; border-radius: 8px; color: var(--muted); font-size: 14px; font-weight: 590; text-decoration: none; transition: .15s ease; }
.main-nav a:hover { color: var(--text); background: var(--surface-soft); }
.main-nav a[aria-current="page"] { color: var(--accent-strong); background: var(--accent-soft); }
.icon-button { display: grid; justify-self: end; width: 38px; height: 38px; place-items: center; border: 1px solid var(--border); border-radius: 10px; color: var(--muted); background: var(--surface); cursor: pointer; }
.icon-button:hover { color: var(--text); border-color: var(--border-strong); }
.icon-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.moon-icon { display: none; }
html[data-theme="dark"] .sun-icon { display: none; }
html[data-theme="dark"] .moon-icon { display: block; }
@media (prefers-color-scheme: dark) { html[data-theme="auto"] .sun-icon { display: none; } html[data-theme="auto"] .moon-icon { display: block; } }

.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 28px; margin-bottom: 30px; }
.page-heading h1 { max-width: 820px; margin: 5px 0 7px; font-size: clamp(30px, 5vw, 42px); line-height: 1.08; letter-spacing: -.045em; overflow-wrap: anywhere; }
.page-heading p { max-width: 680px; margin: 0; color: var(--muted); font-size: 16px; }
.path-heading { margin-top: 14px; }
.heading-prefix { color: var(--subtle); font-weight: 520; }
.eyebrow { color: var(--accent-strong); font-size: 12px; font-weight: 760; letter-spacing: .11em; text-transform: uppercase; }
.muted { color: var(--muted); }
.breadcrumbs { display: flex; align-items: center; gap: 8px; color: var(--subtle); font-size: 13px; }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent); }

.button-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 9px; padding: 9px 15px; border: 1px solid transparent; border-radius: 10px; font-size: 14px; font-weight: 680; line-height: 1.3; text-decoration: none; transition: .15s ease; }
.button-primary { color: white; background: var(--accent); box-shadow: 0 7px 18px color-mix(in srgb, var(--accent) 24%, transparent); }
.button-primary:hover { background: var(--accent-strong); transform: translateY(-1px); }
.button-secondary { color: var(--text); border-color: var(--border); background: var(--surface); box-shadow: var(--shadow-sm); }
.button-secondary:hover { border-color: var(--border-strong); background: var(--surface-soft); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.metric-card { position: relative; min-height: 164px; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; padding: 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.metric-card::after { position: absolute; width: 110px; height: 110px; top: -55px; right: -48px; border-radius: 50%; background: var(--accent-soft); content: ""; opacity: .6; }
.metric-card strong { margin-top: 8px; font-size: 32px; font-weight: 760; line-height: 1; letter-spacing: -.035em; }
.metric-label { color: var(--muted); font-size: 13px; font-weight: 650; }
.metric-note { margin-top: 9px; color: var(--subtle); font-size: 12px; }
.metric-icon { position: absolute; z-index: 1; top: 18px; right: 18px; display: grid; width: 36px; height: 36px; place-items: center; border-radius: 10px; color: var(--accent); background: var(--accent-soft); }
.metric-icon svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.metric-accent { color: white; border-color: transparent; background: linear-gradient(145deg, #6061dd, #4849ba); box-shadow: 0 14px 30px rgba(72, 73, 186, .2); }
.metric-accent::after { width: 160px; height: 160px; top: -88px; right: -68px; background: rgba(255,255,255,.14); }
.metric-accent .metric-label, .metric-accent .metric-note { color: rgba(255,255,255,.74); }
.metric-accent .metric-icon { color: white; background: rgba(255,255,255,.14); }

.metric-strip { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.metric-strip div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 18px 22px; border-right: 1px solid var(--border); }
.metric-strip div:last-child { border-right: 0; }
.metric-strip span { color: var(--muted); font-size: 13px; }
.metric-strip strong { font-size: 22px; letter-spacing: -.03em; }

.panel { overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.panel + .panel { margin-top: 22px; }
.panel-header { display: flex; min-height: 82px; align-items: center; justify-content: space-between; gap: 24px; padding: 19px 22px; border-bottom: 1px solid var(--border); }
.panel-header h2 { margin: 0; font-size: 17px; letter-spacing: -.015em; }
.panel-header p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.panel-header-toolbar { flex-wrap: wrap; }
.search-box { width: min(100%, 260px); display: flex; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-soft); transition: .15s ease; }
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-box svg { flex: 0 0 auto; width: 17px; fill: none; stroke: var(--subtle); stroke-width: 1.8; stroke-linecap: round; }
.search-box input { min-width: 0; flex: 1; padding: 9px 0; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 13px; }
.search-box input::placeholder { color: var(--subtle); }
.search-box kbd { padding: 0 5px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; color: var(--subtle); background: var(--surface); font-size: 11px; }

.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 11px 18px; color: var(--subtle); background: var(--surface-soft); font-size: 11px; font-weight: 720; letter-spacing: .07em; text-align: left; text-transform: uppercase; }
.data-table td { padding: 16px 18px; border-top: 1px solid var(--border); }
.data-table tbody tr:first-child td { border-top: 0; }
.data-table tbody tr { transition: background .12s ease; }
.data-table tbody tr:hover { background: var(--surface-soft); }
.path-link { display: inline-block; max-width: 520px; color: var(--text); font-weight: 640; overflow-wrap: anywhere; text-decoration: none; }
.path-link:hover { color: var(--accent-strong); }
.number-cell { width: 1%; white-space: nowrap; text-align: right !important; }
.number-cell strong { font-variant-numeric: tabular-nums; }
.share-cell { min-width: 240px; }
.share-cell progress { width: 150px; height: 6px; overflow: hidden; border: 0; border-radius: 999px; vertical-align: middle; background: var(--border); }
.share-cell progress::-webkit-progress-bar { border-radius: 999px; background: var(--border); }
.share-cell progress::-webkit-progress-value { border-radius: 999px; background: var(--accent); }
.share-cell progress::-moz-progress-bar { border-radius: 999px; background: var(--accent); }
.share-cell span { margin-left: 10px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.open-cell { width: 50px; text-align: right; }
.open-cell a { display: grid; width: 30px; height: 30px; place-items: center; border: 1px solid var(--border); border-radius: 8px; color: var(--muted); text-decoration: none; }
.open-cell a:hover { color: var(--accent); border-color: var(--accent); }

.chart-summary { text-align: right; }
.chart-summary strong, .chart-summary span { display: block; }
.chart-summary strong { font-size: 24px; line-height: 1; }
.chart-summary span { margin-top: 5px; color: var(--muted); font-size: 11px; }
.chart-wrap { padding: 24px 24px 15px; }
.line-chart { width: 100%; height: 270px; overflow: visible; }
.chart-grid line { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 5; vector-effect: non-scaling-stroke; }
.chart-area { fill: url(#area-gradient); opacity: .15; }
#area-gradient stop:first-child { stop-color: var(--accent); stop-opacity: .7; }
#area-gradient stop:last-child { stop-color: var(--accent); stop-opacity: 0; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.chart-point { fill: var(--surface); stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart-axis { display: flex; justify-content: space-between; padding-inline: 16px; color: var(--subtle); font-size: 11px; }
.daily-details { padding: 0 24px 20px; }
.daily-details summary, .metadata-details summary { width: fit-content; color: var(--muted); cursor: pointer; font-size: 12px; }
.daily-details summary:hover, .metadata-details summary:hover { color: var(--accent); }
.daily-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1px; overflow: hidden; margin-top: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--border); }
.daily-grid div { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; background: var(--surface-soft); font-size: 11px; }
.daily-grid time { color: var(--muted); }

.visit-list { background: var(--surface-soft); }
.visit-card { padding: 19px 22px; border-bottom: 1px solid var(--border); background: var(--surface); transition: .12s ease; }
.visit-card:last-child { border-bottom: 0; }
.visit-card:hover { background: color-mix(in srgb, var(--surface-soft) 60%, var(--surface)); }
.visit-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.visit-time { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.status-dot { display: inline-block; flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 13%, transparent); }
.path-pill { max-width: 55%; overflow: hidden; padding: 4px 9px; border-radius: 7px; color: var(--accent-strong); background: var(--accent-soft); font-size: 12px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
.path-pill:hover { text-decoration: underline; }
.visit-details { display: grid; grid-template-columns: 150px minmax(220px, 1.5fr) minmax(180px, 1fr) 150px; gap: 22px; }
.visit-field { min-width: 0; }
.visit-field > span:not(.field-label), .visit-field > div { display: block; overflow: hidden; color: var(--text); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.field-label { display: block; margin-bottom: 4px; color: var(--subtle); font-size: 10px; font-weight: 720; letter-spacing: .06em; text-transform: uppercase; }
.visit-ip div { display: flex; align-items: center; gap: 5px; }
.visit-ip code { padding: 2px 6px; border-radius: 5px; color: var(--text); background: var(--surface-soft); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.mini-copy { padding: 2px 5px; border: 0; color: var(--subtle); background: transparent; cursor: pointer; }
.mini-copy:hover { color: var(--accent); }
.metadata-details { margin-top: 14px; }
.metadata-details pre { max-height: 300px; overflow: auto; margin: 10px 0 0; padding: 14px; border: 1px solid var(--border); border-radius: 9px; color: var(--muted); background: var(--surface-soft); font: 11px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-word; }

.pagination { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 16px 22px; border-top: 1px solid var(--border); }
.pagination-button { display: inline-flex; width: fit-content; min-height: 34px; align-items: center; gap: 7px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; color: var(--text); background: var(--surface); font-size: 12px; font-weight: 620; text-decoration: none; }
.pagination-button:last-child { justify-self: end; }
.pagination-button:hover { border-color: var(--accent); color: var(--accent); }
.pagination-button.is-disabled { color: var(--subtle); background: var(--surface-soft); cursor: not-allowed; }
.pagination-status { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.empty-state { padding: 62px 24px; text-align: center; }
.empty-state.compact { padding: 34px 24px; color: var(--muted); font-size: 13px; }
.empty-icon { display: grid; width: 48px; height: 48px; margin: 0 auto 14px; place-items: center; border-radius: 14px; color: var(--accent); background: var(--accent-soft); font-size: 20px; }
.empty-state h3 { margin: 0 0 6px; font-size: 16px; }
.empty-state p { max-width: 450px; margin: auto; color: var(--muted); font-size: 13px; }

.landing-hero { min-height: 530px; display: grid; grid-template-columns: 1.05fr .95fr; align-items: center; gap: 70px; padding: 30px 20px 80px; }
.landing-hero h1 { margin: 12px 0 18px; font-size: clamp(40px, 6vw, 68px); line-height: .99; letter-spacing: -.058em; }
.landing-hero .lead { max-width: 590px; color: var(--muted); font-size: 18px; }
.landing-visual { position: relative; min-height: 360px; }
.landing-visual::before { position: absolute; inset: 20px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 26%, transparent), transparent 68%); content: ""; filter: blur(15px); }
.visual-card { position: absolute; border: 1px solid var(--border); border-radius: 22px; background: color-mix(in srgb, var(--surface) 92%, transparent); box-shadow: var(--shadow-md); backdrop-filter: blur(12px); }
.visual-card-main { inset: 30px 10px 50px 20px; padding: 28px; transform: rotate(1.5deg); }
.visual-card-main strong { display: block; margin-top: 8px; font-size: 48px; letter-spacing: -.05em; }
.visual-label { color: var(--muted); font-size: 13px; }
.trend-up { color: var(--success); font-size: 13px; font-weight: 650; }
.visual-card-main svg { width: 100%; margin-top: 25px; fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; }
.visual-card-small { right: -5px; bottom: 24px; display: flex; align-items: center; gap: 10px; padding: 13px 16px; color: var(--muted); font-size: 12px; transform: rotate(-2deg); }
.setup-panel { display: grid; grid-template-columns: 1fr 1.2fr; align-items: center; gap: 40px; padding: 30px; }
.setup-panel h2 { margin: 5px 0; font-size: 24px; letter-spacing: -.03em; }
.setup-panel p { margin: 0; }
.code-block { display: flex; min-width: 0; align-items: center; gap: 14px; padding: 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-soft); }
.code-block code { min-width: 0; flex: 1; overflow-x: auto; color: var(--muted); font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap; }
.copy-button { padding: 7px 10px; border: 1px solid var(--border); border-radius: 7px; color: var(--text); background: var(--surface); cursor: pointer; font-size: 11px; }
.copy-button:hover { border-color: var(--accent); color: var(--accent); }

.site-footer { display: flex; align-items: center; justify-content: center; gap: 9px; min-height: 82px; border-top: 1px solid var(--border); color: var(--subtle); font-size: 11px; }
.footer-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--subtle); }

:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 38%, transparent); outline-offset: 2px; }

@media (max-width: 900px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-strip { grid-template-columns: repeat(2, 1fr); }
  .metric-strip div:nth-child(2) { border-right: 0; }
  .metric-strip div:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .visit-details { grid-template-columns: 140px 1fr; }
  .daily-grid { grid-template-columns: repeat(3, 1fr); }
  .landing-hero { grid-template-columns: 1fr; gap: 0; }
  .landing-visual { min-height: 320px; }
  .setup-panel { grid-template-columns: 1fr; gap: 22px; }
}

@media (max-width: 680px) {
  .shell { width: min(calc(100% - 24px), var(--shell)); }
  .main-content { padding-block: 28px 50px; }
  .header-inner { min-height: 108px; grid-template-columns: 1fr auto; gap: 8px 10px; padding-block: 9px; }
  .brand { font-size: 14px; }
  .brand-mark { width: 31px; height: 31px; }
  .main-nav { position: static; grid-column: 1 / -1; grid-row: 2; width: 100%; justify-content: space-around; padding: 5px; box-shadow: var(--shadow-sm); }
  .main-nav a { flex: 1; padding-inline: 7px; text-align: center; }
  .icon-button { grid-column: 2; grid-row: 1; }
  .page-heading { align-items: stretch; flex-direction: column; margin-bottom: 22px; }
  .page-heading .button { width: 100%; }
  .page-heading h1 { font-size: 32px; }
  .metric-grid { gap: 10px; }
  .metric-card { min-height: 142px; padding: 17px; }
  .metric-card strong { font-size: 27px; }
  .metric-icon { top: 14px; right: 14px; }
  .metric-strip div { padding: 14px 16px; }
  .metric-strip div:nth-child(even) { border-right: 0; }
  .panel { border-radius: 14px; }
  .panel-header { min-height: 0; align-items: stretch; padding: 17px; }
  .panel-header-toolbar { flex-direction: column; }
  .search-box { width: 100%; }
  .data-table th, .data-table td { padding-inline: 14px; }
  .share-cell { min-width: 180px; }
  .share-cell progress { width: 100px; }
  .line-chart { height: 210px; }
  .chart-wrap { padding-inline: 12px; }
  .chart-summary { display: none; }
  .daily-details { padding-inline: 17px; }
  .daily-grid { grid-template-columns: repeat(2, 1fr); }
  .visit-card { padding: 17px; }
  .visit-header { align-items: flex-start; flex-direction: column; gap: 9px; }
  .path-pill { max-width: 100%; }
  .visit-details { grid-template-columns: 1fr; gap: 13px; }
  .pagination { padding: 14px 17px; }
  .pagination-button { padding-inline: 8px; }
  .desktop-only { display: none; }
  .landing-hero { min-height: auto; padding: 30px 3px 55px; }
  .landing-hero h1 { font-size: 41px; }
  .landing-visual { min-height: 280px; }
  .visual-card-main { inset: 20px 0 42px; }
  .visual-card-small { right: -2px; }
  .setup-panel { padding: 22px; }
  .code-block { align-items: stretch; flex-direction: column; }
  .site-footer { padding-bottom: 0; }
}

@media (max-width: 420px) {
  .metric-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 130px; }
  .brand span:last-child { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

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