:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f4f7fb;
  background: #07111f;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: radial-gradient(circle at top, #16243a 0, #07111f 42%, #040a12 100%); }
button { font: inherit; }
code { font-family: "SFMono-Regular", Consolas, monospace; }

.demo-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 52px 0 72px; }
.demo-copy { max-width: 760px; margin-bottom: 28px; }
.eyebrow { display: inline-block; margin-bottom: 12px; color: #9fb4d3; font-size: 12px; font-weight: 800; letter-spacing: .16em; }
h1 { margin: 0 0 14px; font-size: clamp(36px, 7vw, 72px); line-height: .95; letter-spacing: -.045em; }
p { color: #a9b8cc; line-height: 1.7; }
.demo-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, .8fr); gap: 20px; align-items: start; }
.demo-note { margin-top: 12px; color: #7f92aa; font-size: 13px; line-height: 1.6; }
.demo-note code { color: #d6e3f5; }

.ovp { width: 100%; background: #000; border: 1px solid rgba(255,255,255,.1); border-radius: 22px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.ovp__stage { position: relative; aspect-ratio: 16 / 9; background: #000; overflow: hidden; }
.ovp__video, .ovp__ad-container { position: absolute; inset: 0; width: 100%; height: 100%; }
.ovp__video { object-fit: contain; background: #000; }
.ovp__ad-container { z-index: 4; }
.ovp__controls { position: absolute; z-index: 8; left: 0; right: 0; bottom: 0; display: flex; gap: 8px; padding: 42px 14px 14px; background: linear-gradient(transparent, rgba(0,0,0,.82)); pointer-events: none; }
.ovp__controls button { pointer-events: auto; appearance: none; border: 1px solid rgba(255,255,255,.18); background: rgba(7,17,31,.78); color: #fff; border-radius: 999px; padding: 9px 13px; cursor: pointer; backdrop-filter: blur(12px); }
.ovp__fullscreen { margin-left: auto; }
.ovp__loader { position: absolute; inset: 0; z-index: 7; display: grid; place-items: center; pointer-events: none; }
.ovp__loader[hidden] { display: none; }
.ovp__loader span { width: 36px; height: 36px; border: 3px solid rgba(255,255,255,.2); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
.ovp__end-layer { position: absolute; inset: 0; z-index: 12; background: rgba(4,10,18,.94); display: grid; place-items: center; padding: 28px; }
.ovp__end-layer[hidden] { display: none; }
.ovp__display-placeholder { width: min(420px, 100%); min-height: 220px; border: 1px dashed rgba(255,255,255,.32); border-radius: 18px; display: grid; place-items: center; align-content: center; gap: 8px; text-align: center; color: #9fb4d3; padding: 24px; }
.ovp__display-placeholder span { font-size: 11px; font-weight: 800; letter-spacing: .2em; }
.ovp__display-placeholder strong { color: #fff; font-size: 24px; }
.ovp__display-placeholder small { max-width: 300px; line-height: 1.5; }

.event-panel { border: 1px solid rgba(255,255,255,.09); background: rgba(9,19,33,.72); border-radius: 18px; overflow: hidden; backdrop-filter: blur(18px); }
.event-panel__header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.event-panel__header button { appearance: none; border: 0; border-radius: 8px; color: #c7d6e8; background: rgba(255,255,255,.08); padding: 6px 9px; cursor: pointer; }
.event-log { max-height: 520px; overflow: auto; padding: 8px; }
.event-row { display: grid; grid-template-columns: 64px 1fr; gap: 5px 10px; padding: 9px; border-radius: 10px; font-size: 12px; }
.event-row + .event-row { border-top: 1px solid rgba(255,255,255,.05); }
.event-row__time { color: #60758f; }
.event-row strong { color: #dce8f6; }
.event-row code { grid-column: 2; color: #8fa3bc; white-space: pre-wrap; overflow-wrap: anywhere; }

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 860px) {
  .demo-shell { width: min(100% - 20px, 720px); padding-top: 28px; }
  .demo-grid { grid-template-columns: 1fr; }
  .event-log { max-height: 300px; }
}

/* v0.4 diagnostics */
.diagnostics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 0 0 20px; }
.diagnostic-card { min-width: 0; padding: 13px 14px; border: 1px solid rgba(255,255,255,.09); background: rgba(9,19,33,.74); border-radius: 14px; backdrop-filter: blur(16px); }
.diagnostic-card span { display: block; margin-bottom: 7px; color: #71869f; font-size: 10px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.diagnostic-card strong { display: block; overflow: hidden; color: #ecf4ff; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.diagnostic-card--status strong { font-size: 18px; }
.diagnostic-card--status strong[data-state="requesting"] { color: #f4d486; }
.diagnostic-card--status strong[data-state="fill"] { color: #8de3b2; }
.diagnostic-card--status strong[data-state="no-fill"] { color: #f1b879; }
.diagnostic-card--status strong[data-state="error"] { color: #ff9d9d; }
.diagnostic-card--wide { grid-column: span 2; }
.diagnostic-card--error { grid-column: span 3; }
.diagnostic-card--error strong { color: #d9e5f4; white-space: normal; overflow-wrap: anywhere; line-height: 1.45; }

@media (max-width: 980px) {
  .diagnostics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .diagnostic-card--error { grid-column: span 3; }
}

@media (max-width: 620px) {
  .diagnostics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .diagnostic-card--wide, .diagnostic-card--error { grid-column: span 2; }
}

/* v0.5 Analytics Core */
.analytics-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0 0 20px; }
.analytics-card { min-width: 0; padding: 13px 14px; border: 1px solid rgba(126, 179, 255, .12); background: linear-gradient(180deg, rgba(16, 31, 52, .86), rgba(8, 18, 31, .82)); border-radius: 14px; }
.analytics-card span { display: block; margin-bottom: 7px; color: #718eaf; font-size: 10px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.analytics-card strong { display: block; overflow: hidden; color: #e8f3ff; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.analytics-card--id { grid-column: span 2; }
.analytics-card--id strong { font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; }
.analytics-export { margin-top: 20px; border: 1px solid rgba(255,255,255,.09); background: rgba(7, 15, 27, .84); border-radius: 20px; overflow: hidden; }
.analytics-export__header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding: 20px; border-bottom: 1px solid rgba(255,255,255,.08); }
.analytics-export__header .eyebrow { margin-bottom: 7px; }
.analytics-export h2 { margin: 0 0 6px; font-size: 24px; }
.analytics-export p { margin: 0; font-size: 13px; }
.analytics-export__actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.analytics-export__actions button { appearance: none; border: 1px solid rgba(255,255,255,.16); background: #e9f2ff; color: #07111f; border-radius: 10px; padding: 10px 14px; font-weight: 800; cursor: pointer; }
.copy-status { min-width: 64px; color: #8de3b2; font-size: 12px; text-align: right; }
.analytics-json { max-height: 540px; margin: 0; padding: 18px 20px 24px; overflow: auto; color: #9fb7d5; background: #040a12; font-size: 12px; line-height: 1.6; white-space: pre; }

@media (max-width: 900px) {
  .analytics-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .analytics-export__header { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 560px) {
  .analytics-card--id { grid-column: span 2; }
  .analytics-export__actions { width: 100%; justify-content: space-between; }
  .analytics-json { font-size: 11px; }
}

#backend-sync-state[data-state="online"] { color: #7ef0ad; }
#backend-sync-state[data-state="syncing"] { color: #ffd37e; }
#backend-sync-state[data-state="offline"],
#backend-sync-state[data-state="error"] { color: #ff8e8e; }
#backend-sync-error { overflow-wrap: anywhere; }

/* v0.7 dashboard entry */
.release-actions { display: flex; margin: -8px 0 22px; }
.release-action { display: inline-flex; align-items: center; gap: 12px; padding: 11px 15px; border: 1px solid rgba(126,179,255,.2); border-radius: 12px; background: rgba(18,39,64,.72); color: #dcecff; font-size: 13px; font-weight: 800; text-decoration: none; }
.release-action span { color: #7ef0ad; font-size: 18px; }
.release-action:hover { background: rgba(25,51,82,.9); }
