:root {
  --paper: #faf9f6;
  --ink: #141414;
  --muted: #6b6760;
  --rule: #e6e2da;
  --card: #ffffff;
  --accent: #0a4c66;
  --accent-ink: #ffffff;
  --money: #1f7a4d;
  --star: #c98a00;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 20, 20, .06), 0 8px 24px -12px rgba(20, 20, 20, .18);
  --shadow-lift: 0 2px 4px rgba(20, 20, 20, .08), 0 24px 48px -16px rgba(20, 20, 20, .28);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01", "tnum";
}
@supports (font-variation-settings: normal) { :root { font-family: InterVariable, Inter, system-ui, sans-serif; } }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--paper); color: var(--ink); -webkit-text-size-adjust: 100%; }
body { margin: 0; line-height: 1.5; }
a { color: inherit; }
button { font: inherit; color: inherit; }
img, video { display: block; max-width: 100%; }

.top { max-width: 1320px; margin: 0 auto; padding: 36px 24px 0; }
.home { display: inline-block; font-size: 14px; color: var(--muted); text-decoration: none; margin-bottom: 18px; }
.home:hover { color: var(--ink); }
h1 { font-size: clamp(28px, 3.6vw, 40px); line-height: 1.08; letter-spacing: -0.02em; margin: 0; font-weight: 650; }

.layout { max-width: 1320px; margin: 0 auto; padding: 20px 24px 8px; }

.toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 6px 0 18px; }
.toolbar-label { font-size: 13px; color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 999px; background: var(--card); padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: 8px 14px; min-height: 44px; font-size: 14px; cursor: pointer; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.seg button:not([aria-pressed="true"]):hover { color: var(--ink); }

.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 1100px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; } }
@media (max-width: 640px) { .grid { grid-template-columns: minmax(0, 1fr); gap: 14px; } }

/* ---------- card ---------- */
/* A tile: the app's whole first screen (a 1280x800 shot, never cropped; the iPhone apps show their real App Store screenshots)
   with icon · name · one number underneath. The whole tile is the link; hover plays the recording, the play button opens the
   preview here, a 5 s hold opens the live app. */
.card { position: relative; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; transition: transform .28s cubic-bezier(.2,.7,.2,1), box-shadow .28s; outline: none; isolation: isolate; }
.card:focus-visible { box-shadow: 0 0 0 3px var(--accent), var(--shadow-lift); }
.card.is-open { box-shadow: var(--shadow-lift); }
@media (hover: hover) { .card:hover { transform: translateY(-4px) scale(1.015); box-shadow: var(--shadow-lift); z-index: 2; } }
.card .media { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: #ece9e2; }
.card .media img, .card .media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top left; }
.card .media video { opacity: 0; transition: opacity .3s; }
.card .media.playing video { opacity: 1; }
.card .cover { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.card .ring { position: absolute; right: 12px; bottom: 12px; width: 56px; height: 56px; display: none; z-index: 2; }
.card.counting .ring { display: block; }
.ring svg { width: 56px; height: 56px; transform: rotate(-90deg); }
.ring circle { fill: rgba(20,20,20,.72); stroke: var(--paper); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 150.8; stroke-dashoffset: 150.8; transition: stroke-dashoffset 1s linear; }
.ring .n { position: absolute; inset: 0; display: grid; place-items: center; color: var(--paper); font-weight: 650; font-size: 20px; }
.card .count-label { position: absolute; left: 12px; top: 12px; padding: 6px 10px; border-radius: 8px; background: rgba(20,20,20,.72); color: var(--paper); font-size: 13px; display: none; z-index: 2; }
.card.counting .count-label { display: block; }
.card .peek { position: absolute; right: 12px; top: 12px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(20,20,20,.62); color: var(--paper); display: grid; place-items: center; cursor: pointer; z-index: 3; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); opacity: 0; transition: opacity .2s; }
.card .peek svg { width: 20px; height: 20px; }
.card:hover .peek, .card:focus-within .peek { opacity: 1; }
@media (hover: none) { .card .peek { opacity: 1; } }
.card.counting .peek { opacity: 0; pointer-events: none; }
.card .bar { position: relative; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 10px 14px; min-height: 52px; border-top: 1px solid var(--rule); background: var(--card); color: var(--ink); pointer-events: none; }
.card .bar .icon { width: 28px; height: 28px; border-radius: 7px; flex: none; object-fit: cover; background: #ece9e2; }
.card .bar .icon.ghost { display: grid; place-items: center; font-size: 13px; font-weight: 650; color: var(--muted); }
.card .bar h2 { margin: 0; flex: 1; min-width: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .bar .stat { flex: none; font-size: 13px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.card .bar .stat.money { color: var(--money); font-weight: 600; }
.card .bar .stat.star { color: var(--star); }
.card .bar .stat.archived { color: var(--muted); opacity: .7; }
.card[data-archived] .media { filter: saturate(.6); opacity: .85; }

/* ---------- daily chart ---------- */
.chart { max-width: 1320px; margin: 10px auto 0; padding: 0 24px; }
.chart-card { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px 12px; }
.chart-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.chart-head h2 { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.chart-sub { font-size: 13px; color: var(--muted); }
.chart-sub b { color: var(--ink); font-weight: 600; }
.chart-empty p { margin: 4px 0 0; font-size: 14px; color: var(--muted); max-width: 70ch; }
.chart-body { position: relative; }
.chart-body svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.chart-body .grid { stroke: var(--rule); stroke-width: 1; }
.chart-body .tick { font-size: 11px; fill: var(--muted); font-family: inherit; }
.chart-body .layer { fill: currentColor; fill-opacity: .82; stroke: var(--card); stroke-width: 1; }
.chart-body .layer.hits { fill-opacity: .28; }
.chart-body .guide { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-tip { position: absolute; top: 8px; background: var(--ink); color: var(--paper); font-size: 12px; padding: 8px 10px; border-radius: 8px; pointer-events: none; display: grid; gap: 2px; white-space: nowrap; z-index: 3; }
.chart-tip span { display: inline-flex; align-items: center; gap: 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.legend b { color: var(--ink); font-weight: 600; }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: currentColor; }
.sw.hits { opacity: .35; }
.chart-note { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.c0 { color: #0a4c66; } .c1 { color: #1f7a4d; } .c2 { color: #c98a00; } .c3 { color: #7a3e9d; } .c4 { color: #b5452b; } .c5 { color: #3f6f8f; } .c6 { color: #8a8276; }
.spark { width: 60px; height: 18px; flex: none; color: var(--accent); }
.spark polyline { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.spark.hits { color: #a09b93; }
.spark.hits polyline { stroke-dasharray: 2 2; }

/* ---------- totals strip (bottom of the page) ---------- */
.totals-wrap { max-width: 1320px; margin: 36px auto 0; padding: 0 24px 24px; }
.totals { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 18px 24px; }
.total .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.total .v { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.1; margin-top: 2px; }
.total .v small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.total .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.side-note { font-size: 12px; color: var(--muted); margin: 12px 4px 0; }

.foot { max-width: 1320px; margin: 0 auto; padding: 0 24px 56px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--rule); }
.foot p { max-width: 72ch; }

/* ---------- overlay ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; background: #0f0f0f; display: grid; grid-template-rows: auto 1fr; animation: fade .25s; }
.overlay[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
.ov-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: #171717; color: #f2f2f2; border-bottom: 1px solid #2a2a2a; }
.ov-bar strong { font-size: 15px; }
.ov-icon { width: 28px; height: 28px; border-radius: 7px; }
.ov-hint { margin-left: auto; font-size: 13px; color: #a6a6a6; }
.ov-bar .btn { border-color: #3a3a3a; color: #f2f2f2; background: transparent; }
.ov-bar .btn.close { background: #f2f2f2; color: #111; border-color: #f2f2f2; font-weight: 650; padding: 8px 18px; }
.ov-frame { position: relative; padding: 18px; min-height: 0; }
.ov-frame iframe { width: 100%; height: 100%; border: 0; border-radius: 10px; background: #fff; }
.ov-fallback { position: absolute; inset: 18px; display: grid; grid-template-rows: 1fr auto auto; gap: 12px; place-items: center; color: #e8e8e8; text-align: center; padding: 0 16px 16px; }
.ov-fallback[hidden] { display: none; }
.ov-fallback video { max-height: 100%; max-width: 100%; border-radius: 10px; background: #000; }
.ov-fallback p { margin: 0; font-size: 14px; max-width: 48ch; color: #bdbdbd; }
.ov-edge-close { position: fixed; right: 18px; bottom: 18px; min-height: 48px; padding: 10px 18px; border-radius: 999px; border: 0; background: #f2f2f2; color: #111; font-weight: 650; box-shadow: 0 6px 24px rgba(0,0,0,.4); cursor: pointer; }
@media (max-width: 640px) { .ov-hint, #ov-open { display: none; } .ov-frame { padding: 8px; } .ov-fallback { inset: 8px; } }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; background: var(--ink); color: var(--paper); padding: 12px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow-lift); max-width: calc(100vw - 32px); }
.toast[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) { .card, .card .media video, .card .peek, .overlay { transition: none; animation: none; } .card:hover { transform: none; } }
