/* DEM-172 (Fatia 1) — tela pública de Circuitos. Tokens do portal (GRID RIVAL); protagonista: a pista. */
#circuit-list-view {
    --cvl-accent: var(--color-accent, #f39600);
    --cvl-surface: var(--color-surface, #1a1b22);
    --cvl-bg: var(--color-background, #121318);
    --cvl-line: rgba(132, 132, 154, .3);
    --cvl-fg: var(--color-text-primary, #f4f6fb);
    --cvl-muted: var(--color-text-secondary, rgba(244, 246, 251, .68));
    --cvl-live: rgba(231, 76, 60, .92);
    --cvl-ok: #2ed573;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
}
#circuit-list-view > * { min-width: 0; }
#circuit-list-view [hidden] { display: none !important; }
#circuit-list-view :focus-visible { outline: 2px solid var(--cvl-accent); outline-offset: 2px; }

.cvl-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: .7rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; line-height: 1.4; }
.cvl-live { background: var(--cvl-live); color: #fff; }
.cvl-acc { background: var(--cvl-accent); color: #141414; }
.cvl-ghost { background: rgba(0, 0, 0, .45); color: var(--cvl-fg); border: 1px solid var(--cvl-line); backdrop-filter: blur(4px); }
.cvl-ok { background: rgba(46, 213, 115, .14); color: var(--cvl-ok); border: 1px solid rgba(46, 213, 115, .35); }
.cvl-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: cvl-pulse 1.6s ease-in-out infinite; }
@keyframes cvl-pulse { 50% { opacity: .35; } }
.cvl-flag { width: 20px; height: 15px; border-radius: 2px; object-fit: cover; flex: none; box-shadow: 0 0 0 1px rgba(255, 255, 255, .14); }

/* ---------- Palco ---------- */
.cvl-hero { position: relative; overflow: hidden; border-radius: 24px; border: 1px solid var(--cvl-line); background: radial-gradient(90% 120% at 0% 100%, rgba(var(--color-accent-rgb, 243, 150, 0), .22), transparent 60%), linear-gradient(160deg, #15161d, #0b0c11); display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); min-height: 380px; }
.cvl-hero.cvl-hero-solo { grid-template-columns: 1fr; min-height: 0; }
.cvl-hero-copy { padding: 34px 32px 30px; display: flex; flex-direction: column; justify-content: center; gap: 14px; position: relative; z-index: 1; }
.cvl-kicker { font-size: .7rem; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; color: var(--cvl-accent); margin: 0; }
.cvl-hero h1 { margin: 0; font-size: clamp(2rem, 3.6vw, 3.1rem); line-height: 1.02; font-style: italic; font-weight: 900; text-transform: uppercase; color: var(--cvl-fg); text-wrap: balance; }
.cvl-hero h1 em { color: var(--cvl-accent); font-style: italic; }
.cvl-lead { margin: 0; color: var(--cvl-muted); max-width: 46ch; font-size: 1rem; }
.cvl-counters { display: flex; gap: 26px; flex-wrap: wrap; margin-top: 4px; }
.cvl-counters div { display: grid; }
.cvl-counters b { font-size: 2.2rem; line-height: 1; font-style: italic; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--cvl-fg); }
.cvl-counters span { font-size: .68rem; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; color: var(--cvl-muted); opacity: .8; }
.cvl-counters .cvl-hot b { color: var(--cvl-accent); }

.cvl-stage { position: relative; min-height: 380px; display: flex; flex-direction: column; justify-content: flex-end; isolation: isolate; color: var(--cvl-fg); }
.cvl-stage-art { position: absolute; inset: 0; z-index: -1; overflow: hidden; display: grid; place-items: center; background: #0b0c11; }
.cvl-stage-art img { position: absolute; left: -2%; top: -7%; width: 128%; height: auto; -webkit-mask-image: linear-gradient(180deg, #000 52%, transparent 67%); mask-image: linear-gradient(180deg, #000 52%, transparent 67%); animation: cvl-drift 18s ease-in-out infinite alternate; }
.cvl-stage-art .cvl-stage-flag { width: 120px; height: 90px; border-radius: 8px; opacity: .5; }
.cvl-stage-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, #0d0e13 0%, rgba(13, 14, 19, .2) 28%, transparent 60%), linear-gradient(0deg, rgba(10, 11, 15, .96) 8%, rgba(10, 11, 15, .35) 46%, transparent 70%); }
@keyframes cvl-drift { from { transform: scale(1) translate(0, 0); } to { transform: scale(1.06) translate(-1.5%, 1%); } }
.cvl-stage-body { padding: 22px 26px 24px; display: grid; gap: 10px; text-shadow: 0 1px 10px rgba(0, 0, 0, .95), 0 0 2px rgba(0, 0, 0, .9); }
.cvl-stage-body .cvl-btn, .cvl-stage-body .cvl-pill { text-shadow: none; }
.cvl-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cvl-stage-name { margin: 0; font-size: clamp(1.5rem, 2.6vw, 2.2rem); line-height: 1.05; font-style: italic; font-weight: 900; text-transform: uppercase; color: var(--cvl-fg); }
.cvl-stage-meta { margin: 0; color: var(--cvl-muted); font-size: .92rem; display: flex; gap: 6px 12px; flex-wrap: wrap; align-items: center; }
.cvl-stage-meta b { color: var(--cvl-fg); }
.cvl-cd { display: flex; gap: 10px; }
.cvl-cd div { background: rgba(0, 0, 0, .45); border: 1px solid var(--cvl-line); border-radius: 10px; padding: 6px 10px; min-width: 58px; text-align: center; }
.cvl-cd b { display: block; font-size: 1.5rem; line-height: 1; font-style: italic; font-weight: 900; font-variant-numeric: tabular-nums; }
.cvl-cd span { font-size: .6rem; font-weight: 900; letter-spacing: .14em; color: var(--cvl-muted); text-transform: uppercase; }
.cvl-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.cvl-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: 12px; font-weight: 900; font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; text-decoration: none; border: 1px solid transparent; cursor: pointer; font-family: inherit; }
.cvl-primary { background: var(--cvl-accent); color: #141414; box-shadow: 0 8px 26px rgba(var(--color-accent-rgb, 243, 150, 0), .32); }
.cvl-secondary { background: rgba(255, 255, 255, .06); border-color: var(--cvl-line); color: var(--cvl-fg); }
.cvl-btn:hover { filter: brightness(1.08); color: inherit; }
.cvl-primary:hover { color: #141414; }

.cvl-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.cvl-head h2 { margin: 0; font-size: 1.15rem; font-weight: 900; font-style: italic; text-transform: uppercase; letter-spacing: .02em; display: flex; gap: 10px; align-items: center; color: var(--cvl-fg); }
.cvl-head h2 i { width: 10px; height: 22px; background: var(--cvl-accent); transform: skewX(-18deg); display: inline-block; }
.cvl-head span { color: var(--cvl-muted); font-size: .82rem; }
.cvl-queue { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.cvl-q { display: grid; grid-template-columns: 84px 1fr; gap: 12px; align-items: center; padding: 10px; border-radius: 14px; background: var(--cvl-surface); border: 1px solid var(--cvl-line); text-decoration: none; color: var(--cvl-fg); transition: border-color .2s, transform .2s; }
.cvl-q:hover { border-color: var(--cvl-accent); transform: translateY(-2px); color: var(--cvl-fg); }
.cvl-q-thumb { width: 84px; height: 56px; border-radius: 9px; overflow: hidden; background: linear-gradient(135deg, #2a2b36, #0d0e13); position: relative; display: grid; place-items: center; }
.cvl-q-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cvl-q-thumb.is-art img { position: absolute; top: -4%; left: -9%; width: 118%; height: auto; -webkit-mask-image: linear-gradient(180deg, #000 52%, transparent 67%); mask-image: linear-gradient(180deg, #000 52%, transparent 67%); }
.cvl-q-thumb .cvl-q-flag { width: 30px; height: 22px; border-radius: 3px; }
.cvl-q small { display: block; font-size: .68rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; color: var(--cvl-accent); }
.cvl-q b { display: block; font-size: .95rem; line-height: 1.2; }
.cvl-q span { font-size: .78rem; color: var(--cvl-muted); }

/* ---------- Ferramentas ---------- */
.cvl-tools { display: grid; gap: 12px; }
.cvl-tools-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.cvl-search { flex: 1 1 320px; display: flex; align-items: center; gap: 10px; background: var(--cvl-surface); border: 1px solid var(--cvl-line); border-radius: 12px; padding: 0 14px; height: 46px; color: var(--cvl-muted); }
.cvl-search input { flex: 1; min-width: 0; background: none; border: 0; outline: none; font: inherit; font-size: .95rem; color: var(--cvl-fg); }
.cvl-search:focus-within { border-color: var(--cvl-accent); }
.cvl-seg { display: inline-flex; background: var(--cvl-surface); border: 1px solid var(--cvl-line); border-radius: 12px; padding: 4px; height: 46px; }
.cvl-seg button { border: 0; background: none; padding: 0 14px; border-radius: 9px; font: inherit; font-size: .78rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--cvl-muted); cursor: pointer; }
.cvl-seg button[aria-pressed="true"] { background: var(--cvl-accent); color: #141414; }
.cvl-toggle, .cvl-league { display: inline-flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px; border-radius: 12px; background: var(--cvl-surface); border: 1px solid var(--cvl-line); cursor: pointer; font: inherit; font-size: .82rem; font-weight: 700; color: var(--cvl-fg); }
.cvl-toggle .cvl-sw { width: 34px; height: 20px; border-radius: 99px; background: #3a3c48; position: relative; transition: background .2s; flex: none; }
.cvl-toggle .cvl-sw::after { content: ""; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .2s; }
.cvl-toggle[aria-pressed="true"] .cvl-sw { background: var(--cvl-accent); }
.cvl-toggle[aria-pressed="true"] .cvl-sw::after { transform: translateX(14px); }
.cvl-league { background: transparent; color: var(--cvl-muted); font-weight: 600; }
.cvl-league b { color: var(--cvl-fg); max-width: 18ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cvl-league u { text-decoration: none; color: var(--cvl-accent); font-weight: 900; letter-spacing: .08em; text-transform: uppercase; font-size: .7rem; }
.cvl-league .org-filter-status-logo { width: 22px; height: 22px; border-radius: 50%; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; }
.cvl-league .org-filter-status-logo img { width: 100%; height: 100%; object-fit: cover; display: none; }
.cvl-league .org-filter-status-logo i { color: var(--cvl-accent); font-size: .8rem; }
.cvl-flags { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; scroll-snap-type: x proximity; }
.cvl-flagchip { flex: none; scroll-snap-align: start; display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px 7px 8px; border-radius: 999px; background: var(--cvl-surface); border: 1px solid var(--cvl-line); cursor: pointer; font: inherit; font-size: .8rem; font-weight: 700; color: var(--cvl-fg); white-space: nowrap; transition: border-color .2s, background .2s; }
.cvl-flagchip .cvl-flag { width: 22px; height: 16px; border-radius: 3px; }
.cvl-flagchip em { font-style: italic; font-weight: 900; color: var(--cvl-accent); }
.cvl-flagchip.cvl-all { padding-left: 12px; }
.cvl-flagchip[aria-pressed="true"] { background: rgba(var(--color-accent-rgb, 243, 150, 0), .16); border-color: var(--cvl-accent); }

/* ---------- Grade ---------- */
.cvl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 16px; }
.cvl-card { position: relative; display: flex; flex-direction: column; border-radius: 18px; overflow: hidden; background: var(--cvl-surface); border: 1px solid var(--cvl-line); text-decoration: none; color: var(--cvl-fg); transition: transform .25s, border-color .25s, box-shadow .25s; opacity: 0; transform: translateY(10px); animation: cvl-in .5s ease forwards; }
.cvl-card:hover { transform: translateY(-4px); border-color: var(--cvl-accent); box-shadow: 0 18px 40px rgba(0, 0, 0, .45); color: var(--cvl-fg); }
@keyframes cvl-in { to { opacity: 1; transform: none; } }
.cvl-media { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #0b0c11; }
.cvl-media img { position: absolute; transition: opacity .45s ease, transform .6s ease; }
.cvl-media .cvl-art { width: 126%; left: -13%; top: 0; height: auto; -webkit-mask-image: linear-gradient(180deg, #000 52%, transparent 67%); mask-image: linear-gradient(180deg, #000 52%, transparent 67%); }
.cvl-media .cvl-photo { inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cvl-media .cvl-swap { opacity: 0; }
.cvl-card:hover .cvl-art + .cvl-swap { opacity: 1; transform: scale(1.04); }
.cvl-card:has(.cvl-swap):hover .cvl-art { opacity: 0; }
.cvl-fallback { position: absolute; inset: 0; display: grid; place-items: center; background: radial-gradient(80% 90% at 30% 20%, rgba(var(--color-accent-rgb, 243, 150, 0), .28), transparent 60%), linear-gradient(135deg, #1d1e27, #0d0e13); }
.cvl-fallback .cvl-fallback-flag { width: 64px; height: 46px; border-radius: 6px; box-shadow: 0 6px 20px rgba(0, 0, 0, .5); }
.cvl-fallback b { position: absolute; right: 14px; bottom: 6px; font-size: 3.4rem; font-style: italic; font-weight: 900; color: rgba(255, 255, 255, .06); line-height: 1; }
.cvl-tl { position: absolute; top: 10px; left: 10px; }
.cvl-tr { position: absolute; top: 10px; right: 10px; }
.cvl-hint { position: absolute; right: 10px; bottom: 8px; font-size: .62rem; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; color: var(--cvl-muted); opacity: 0; transition: opacity .3s; }
.cvl-card:hover .cvl-hint { opacity: 1; }
.cvl-main { display: flex; flex-direction: column; flex: 1; color: inherit; text-decoration: none; }
.cvl-main:hover { color: inherit; }
.cvl-main:focus-visible, .cvl-laps:focus-visible { outline: 2px solid var(--cvl-accent); outline-offset: -2px; }
.cvl-body { padding: 14px 16px 16px; display: grid; gap: 6px; align-content: start; flex: 1; }
/* DEM-171: atalho «Melhores voltas» no rodapé do card (só em pista com volta registrada). */
.cvl-laps { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 16px; border-top: 1px solid var(--cvl-line); color: var(--cvl-accent); font-weight: 800; font-size: .82rem; letter-spacing: .04em; text-decoration: none; transition: background-color .2s ease; }
.cvl-laps:hover { background: rgba(var(--color-accent-rgb, 243, 150, 0), .1); color: var(--cvl-accent); }
.cvl-laps .cvl-laps-go { margin-left: auto; font-size: .75rem; transition: transform .2s ease; }
.cvl-laps:hover .cvl-laps-go { transform: translateX(3px); }
.cvl-body h3 { margin: 0; font-size: 1.08rem; line-height: 1.15; font-weight: 900; font-style: italic; text-transform: uppercase; color: var(--cvl-fg); }
.cvl-sub { margin: -3px 0 0; font-size: .8rem; color: var(--cvl-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cvl-loc { display: flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--cvl-muted); }
.cvl-km { margin-left: auto; font-style: italic; font-weight: 900; color: var(--cvl-fg); white-space: nowrap; }
.cvl-km small { font-size: .62rem; letter-spacing: .1em; color: var(--cvl-muted); font-style: normal; margin-left: 2px; text-transform: uppercase; }
.cvl-foot { margin-top: 6px; padding-top: 10px; border-top: 1px dashed var(--cvl-line); display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .76rem; color: var(--cvl-muted); }
.cvl-foot b { color: var(--cvl-fg); font-weight: 700; }
.cvl-ins { color: var(--cvl-ok); font-weight: 900; font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }

.cvl-empty { padding: 34px; text-align: center; border: 1px dashed var(--cvl-line); border-radius: 18px; color: var(--cvl-muted); display: grid; gap: 10px; justify-items: center; }
.cvl-empty b { color: var(--cvl-fg); font-size: 1.05rem; }
.cvl-band { border-radius: 20px; padding: 24px 26px; display: flex; gap: 18px; align-items: center; justify-content: space-between; flex-wrap: wrap; border: 1px solid rgba(var(--color-accent-rgb, 243, 150, 0), .35); background: linear-gradient(110deg, rgba(var(--color-accent-rgb, 243, 150, 0), .16), rgba(var(--color-accent-rgb, 243, 150, 0), .02) 60%), var(--cvl-surface); }
.cvl-band h2 { margin: 0 0 4px; font-size: 1.2rem; font-weight: 900; font-style: italic; text-transform: uppercase; color: var(--cvl-fg); }
.cvl-band p { margin: 0; color: var(--cvl-muted); }

/* Skeleton no formato do card novo. */
#circuit-list-view .skeleton-grid { grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 16px; }
#circuit-list-view .skeleton-card { border-radius: 18px; }

@media (max-width: 900px) {
    .cvl-hero { grid-template-columns: 1fr; }
    .cvl-hero-copy { padding: 26px 20px 8px; }
    .cvl-stage { min-height: 320px; }
    .cvl-stage-art img { width: 150%; left: -12%; top: -4%; }
    .cvl-queue { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 82%; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; }
    .cvl-q { scroll-snap-align: start; }
    .cvl-counters { gap: 18px; }
    .cvl-counters b { font-size: 1.8rem; }
}
@media (max-width: 560px) {
    .cvl-seg { width: 100%; }
    .cvl-seg button { flex: 1; padding: 0 6px; font-size: .7rem; }
    .cvl-toggle, .cvl-league { flex: 1 1 40%; height: 42px; font-size: .74rem; padding: 0 10px; }
    .cvl-grid { grid-template-columns: 1fr; }
    .cvl-stage-body { padding: 18px; }
    .cvl-cd div { min-width: 50px; }
}
@media (prefers-reduced-motion: reduce) {
    #circuit-list-view *, #circuit-list-view *::before, #circuit-list-view *::after { animation: none !important; transition: none !important; }
    .cvl-card { opacity: 1; transform: none; }
}
