/* Chromium 53: flex + margens; sem grid, gap, inset, clamp ou aspect-ratio.
   Vidro (Liquid Glass): camadas translúcidas + brilho de borda; blur real só onde backdrop-filter existe. */
:root {
  --bg: #05070b; --fg: #f5f6f8; --muted: #a3a9b6; --line: rgba(255,255,255,.16); --focus: #fff;
  --glass: rgba(255,255,255,.07); --glass-strong: rgba(255,255,255,.16); --glass-line: rgba(255,255,255,.2); --glass-hi: rgba(255,255,255,.34);
  --shadow: rgba(0,0,0,.45); --panel: rgba(18,22,30,.94); --surface: rgba(255,255,255,.08);
  --button: #f5f6f8; --button-fg: #0b0d12; --ambient: .5;
}
:root[data-theme="light"] {
  --bg: #e8ecf2; --fg: #0f1520; --muted: #4f5b6d; --line: rgba(0,0,0,.12); --focus: #0f1520;
  --glass: rgba(255,255,255,.42); --glass-strong: rgba(255,255,255,.72); --glass-line: rgba(255,255,255,.85); --glass-hi: rgba(255,255,255,.95);
  --shadow: rgba(30,45,70,.18); --panel: rgba(246,248,251,.96); --surface: rgba(255,255,255,.6);
  --button: #0f1520; --button-fg: #fff; --ambient: .35;
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { background: var(--bg); color: var(--fg); font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Arial, Helvetica, sans-serif; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; -webkit-appearance: none; appearance: none; }
button:focus, [role="button"]:focus { outline: none; }
[hidden] { display: none !important; }

.glass { background: linear-gradient(160deg, var(--glass-strong), var(--glass)); border: 1px solid var(--glass-line); box-shadow: inset 0 1px 0 var(--glass-hi), 0 10px 30px var(--shadow); }
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .glass { -webkit-backdrop-filter: blur(22px) saturate(170%); backdrop-filter: blur(22px) saturate(170%); }
}

/* Luz ambiente: o destaque atual tinge o fundo da tela inteira. */
.ambient { position: fixed; top: 0; right: 0; bottom: 0; left: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.ambient-layer { position: absolute; top: -15%; left: -15%; width: 130%; height: 130%; opacity: var(--ambient); -webkit-transform: translateZ(0); transform: translateZ(0); }
/* Canvas de 32×18 esticado: o próprio aumento desfoca, sem filter (caro no Chromium 53). Camada própria: desenhada uma vez por destaque. */
.ambient-layer canvas { display: block; width: 100%; height: 100%; }
.tv { position: relative; z-index: 1; height: 100%; overflow: hidden; }
/* Camada própria: descer às fileiras só desloca a camada, sem repintar a tela inteira. */
.stage { position: relative; -webkit-transform: translateZ(0); transform: translateZ(0); }
.first { display: flex; flex-direction: column; height: 100vh; padding: 3vh 3vw 2vh; }

.topbar { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; margin-bottom: 2.5vh; }
.tabs { display: flex; padding: 4px; border-radius: 30px; }
.tab { padding: 9px 20px; background: transparent; border-radius: 24px; font-size: 16px; font-weight: 600; }
.tab[aria-selected="true"] { background: var(--button); color: var(--button-fg); }
.tab + .tab { margin-left: 6px; }
.status { display: flex; align-items: center; color: var(--muted); }
.status > * + * { margin-left: 14px; }
.demo-chip { font-size: 12px; }
.icon-btn { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; color: var(--fg); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn { position: relative; }
.connect-dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 4px; background: #ffb4a6; box-shadow: 0 0 0 2px var(--bg); }
.icon-btn.connected .connect-dot { background: #70daca; }
.icon-sun { display: none; }
:root[data-theme="light"] .icon-sun { display: block; }
:root[data-theme="light"] .icon-moon { display: none; }
.library-btn { border-radius: 22px; min-height: 44px; padding: 9px 18px; font-size: 14px; font-weight: 600; color: var(--fg); }
.update-dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 4px; background: #70daca; box-shadow: 0 0 0 2px var(--bg); }
.clock { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--fg); }
.clock .date { font-size: 14px; font-weight: 400; margin-right: 12px; color: var(--muted); }
.tab, .icon-btn, .library-btn { transition: transform .18s ease, background-color .18s ease, color .18s ease; }
.tab.focused, .icon-btn.focused, .library-btn.focused { -webkit-transform: scale(1.08); transform: scale(1.08); background: var(--button); color: var(--button-fg); box-shadow: 0 10px 26px var(--shadow); }

.hero { position: relative; flex: 1 1 auto; min-height: 0; border-radius: 28px; background: #0d1219; color: #fff; margin-bottom: 2.5vh; box-shadow: 0 20px 40px rgba(0,0,0,.45); }
.kind-toolbar { flex: 0 0 auto; display: flex; align-items: center; margin: -4px 0 16px; }
.kind-label { font-size: 15px; font-weight: 600; color: var(--muted); margin-right: 18px; }
.kind-options { display: flex; padding: 4px; border-radius: 24px; }
.kind-option { min-width: 94px; padding: 8px 20px; border-radius: 20px; font-size: 16px; font-weight: 600; background: transparent; color: var(--fg); }
.kind-option + .kind-option { margin-left: 4px; }
.kind-option[aria-pressed="true"] { background: var(--button); color: var(--button-fg); }
.kind-option.focused { box-shadow: 0 0 0 3px var(--focus); }
.type-badge { display: inline-block; padding: 5px 11px; margin-right: 8px; border-radius: 6px; border: 1px solid rgba(255,255,255,.55); background: rgba(4,6,10,.65); color: #fff; font-size: 15px; font-weight: 700; letter-spacing: .5px; }
.type-badge:empty { display: none; }
.hero::after { content: ''; position: absolute; top: 0; right: 0; bottom: 0; left: 0; border-radius: 28px; box-shadow: inset 0 1px 0 rgba(255,255,255,.28), inset 0 0 0 1px rgba(255,255,255,.08); pointer-events: none; }
/* Sem overflow: hidden no .hero: recorte arredondado sobre camadas compostas virava máscara, cara no Chromium 53. Cada camada tem o próprio raio. */
.backdrop, .scrim { position: absolute; top: 0; right: 0; bottom: 0; left: 0; border-radius: 28px; }
.backdrop { background: linear-gradient(120deg, #68472c, #10151e); background-size: cover; background-position: center; opacity: 0; transition: opacity .6s ease; will-change: opacity; }
/* Sem zoom lento (drift): a imagem do destaque ficava animando quase o tempo todo e disputava a GPU com a navegação. */
.backdrop.show { opacity: 1; }
.scrim { background: linear-gradient(90deg, rgba(4,6,10,.9), rgba(4,6,10,.55) 45%, rgba(4,6,10,.05)), linear-gradient(0deg, rgba(4,6,10,.75), transparent 70%); }
.hero-content { position: absolute; left: 4%; bottom: 8%; width: 62%; max-width: 860px; }
.hero-content.enter { -webkit-animation: rise .45s ease both; animation: rise .45s ease both; }
@-webkit-keyframes rise { from { opacity: 0; -webkit-transform: translateY(16px); } to { opacity: 1; -webkit-transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.hero-content > * + * { margin-top: 12px; }
.service-badge { display: inline-block; font-size: 13px; font-weight: 600; color: #fff; padding: 6px 13px; border-radius: 16px; background: linear-gradient(160deg, rgba(255,255,255,.22), rgba(255,255,255,.08)); border-color: rgba(255,255,255,.28); box-shadow: inset 0 1px 0 rgba(255,255,255,.4); }
.service-badge:empty { display: none; }
.hero-title { margin: 12px 0 0; font-size: 50px; font-weight: 700; line-height: 1.06; letter-spacing: -1.2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-shadow: 0 2px 20px rgba(0,0,0,.35); }
.hero-meta { color: #d3d8e1; font-size: 15px; }
.cert { border: 1px solid rgba(255,255,255,.4); border-radius: 4px; padding: 1px 5px; margin-left: 6px; }
.ratings { display: flex; flex-wrap: wrap; }
.rating { display: inline-flex; align-items: center; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.14); border-radius: 9px; padding: 6px 10px; font-size: 14px; margin-right: 8px; }
.rating .src { font-size: 10px; font-weight: bold; margin-right: 6px; }
.imdb .src { color: #f5c518; } .rt .src { color: #ff806b; } .meta .src { color: #8bdd7c; } .tmdb .src { color: #6fd6c4; }
.tv-detail-ratings { margin: 10px 0 4px; }
.synopsis { color: #d7dce5; margin-bottom: 0; font-size: 16px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hero-actions { display: flex; align-items: center; padding-top: 6px; }
.cta { display: inline-flex; align-items: center; min-height: 48px; padding: 12px 26px; border-radius: 26px; font-size: 17px; font-weight: 700; background: #fff; color: #0b0d12; transition: transform .2s ease, background-color .2s ease, color .2s ease; will-change: transform; }
.cta + .cta { margin-left: 14px; }
.cta.secondary { color: #fff; background: linear-gradient(160deg, rgba(255,255,255,.24), rgba(255,255,255,.08)); border-color: rgba(255,255,255,.3); box-shadow: inset 0 1px 0 rgba(255,255,255,.45), 0 8px 22px rgba(0,0,0,.3); }
.play { width: 0; height: 0; border-style: solid; border-width: 7px 0 7px 12px; border-color: transparent transparent transparent currentColor; margin-right: 10px; }
.cta.focused { -webkit-transform: scale(1.09); transform: scale(1.09); box-shadow: 0 16px 34px rgba(0,0,0,.55), 0 0 0 3px rgba(255,255,255,.9); }
.cta.secondary.focused { background: #fff; color: #0b0d12; }
.pager { display: flex; align-items: center; position: absolute; right: 3.5%; bottom: 8%; padding: 8px 10px; border-radius: 14px; background: linear-gradient(160deg, rgba(255,255,255,.16), rgba(255,255,255,.05)); border-color: rgba(255,255,255,.2); box-shadow: inset 0 1px 0 rgba(255,255,255,.3); }
.dot { position: relative; width: 8px; height: 8px; border-radius: 4px; background: rgba(255,255,255,.38); margin: 0 3px; overflow: hidden; }
.dot.on { width: 34px; background: rgba(255,255,255,.3); }
/* Barra cresce por transform (compositor), não por width: animar width refazia layout e pintura a cada quadro, o tempo todo. */
.progress { position: absolute; top: 0; left: 0; bottom: 0; width: 100%; background: #fff; -webkit-transform-origin: 0 50%; transform-origin: 0 50%; -webkit-transform: scaleX(0); transform: scaleX(0); -webkit-animation: fill 8s linear forwards; animation: fill 8s linear forwards; }
@-webkit-keyframes fill { from { -webkit-transform: scaleX(0); } to { -webkit-transform: scaleX(1); } }
@keyframes fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* will-change nos itens que crescem com o foco: camada fixa, sem criar e desfazer uma a cada tecla. */
.apps-wrap { flex: 0 0 auto; }
.apps-label { margin: 0 0 2px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 1.4px; }
.apps { display: flex; padding: 14px 10px 14px; margin: 0 -10px; overflow-x: auto; overflow-y: hidden; }
.apps::-webkit-scrollbar { display: none; }
.app { flex: 1 0 0; min-width: 0; max-width: 230px; padding: 0; background: transparent; text-align: center; }
.app + .app { margin-left: 16px; }
.tile { position: relative; display: flex; align-items: center; justify-content: center; height: 10vh; min-height: 58px; max-height: 118px; border-radius: 18px; border: 1px solid rgba(255,255,255,.14); overflow: hidden; box-shadow: 0 8px 20px var(--shadow); transition: transform .2s ease; will-change: transform; }
.tile::after { content: ''; position: absolute; top: 0; right: 0; bottom: 0; left: 0; border-radius: 18px; background: linear-gradient(160deg, rgba(255,255,255,.3), rgba(255,255,255,0) 46%); box-shadow: inset 0 1px 0 rgba(255,255,255,.4); pointer-events: none; }
.wordmark { position: relative; font-size: 17px; font-weight: bold; padding: 0 4px; }
.app-name { display: block; font-size: 12px; line-height: 18px; height: 18px; margin-top: 8px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app[data-available="false"] .tile { opacity: .4; }
.app.focused .tile { -webkit-transform: scale(1.08) translateY(-3px); transform: scale(1.08) translateY(-3px); box-shadow: 0 10px 18px var(--shadow), 0 0 0 3px var(--focus); }
.app.focused .app-name { color: var(--fg); font-weight: 600; }
.hint { flex: 0 0 auto; margin-top: 1vh; color: var(--muted); font-size: 12px; text-align: center; }
.hint span { margin: 0 8px; }
.toast { position: fixed; z-index: 30; left: 25%; right: 25%; bottom: 4vh; text-align: center; padding: 14px 22px; color: var(--fg); background: var(--panel); border-radius: 22px; font-size: 16px; font-weight: 600; opacity: 0; pointer-events: none; -webkit-transform: translateY(10px); transform: translateY(10px); transition: opacity .25s ease, transform .25s ease; }
.toast.show { opacity: 1; -webkit-transform: none; transform: none; }

.tv-library-backdrop { position:fixed; top:0;right:0;bottom:0;left:0;z-index:20;background:rgba(0,0,0,.55);display:flex;align-items:center;justify-content:center; }
.tv-library-dialog { width:86%;max-width:1250px;max-height:88%;overflow-y:auto;padding:28px 34px;background:var(--panel);border-radius:28px; }
.tv-library-heading { display:flex;align-items:center;justify-content:space-between;margin-bottom:16px; }
.tv-library-heading h2 { margin:0;font-size:28px;letter-spacing:-.6px; }
.tv-library-dialog button,.tv-library-dialog input { min-height:46px;padding:11px 20px;border:1px solid var(--line);border-radius:23px;background:var(--surface);color:var(--fg);font-size:18px;margin:5px;transition:transform .15s ease; }
.tv-library-dialog input { border-radius:12px; }
.tv-library-dialog button:focus { background:var(--button);color:var(--button-fg);-webkit-transform:scale(1.04);transform:scale(1.04);box-shadow:0 8px 20px var(--shadow); }
.tv-library-dialog input:focus { outline:3px solid var(--focus);outline-offset:2px; }
.tv-library-dialog p { color:var(--muted);font-size:17px;line-height:1.5; }
.tv-library-dialog label { font-size:18px;display:block;margin-top:18px; }
.tv-library-dialog input { display:block;width:70%; }
.tv-library-actions { display:flex;flex-wrap:wrap;margin:12px -5px; }
.tv-library-row { display:block;width:98%;text-align:left; }
.tv-library-dialog .tv-library-row { border-radius:14px; }
.tv-library-dialog h3 { margin:24px 0 10px;font-size:20px; }
.tv-about { margin:0;max-width:900px; }
.tv-about-row { display:flex;padding:11px 0;border-bottom:1px solid var(--line);font-size:18px; }
.tv-about-row dt { flex:0 0 260px;color:var(--muted); }
.tv-about-row dd { margin:0;color:var(--fg);font-variant-numeric:tabular-nums; }

@media (min-width: 1600px) { .hero-title { font-size: 70px; } .hero-content > * + * { margin-top: 16px; } .synopsis { font-size: 20px; } .cta { font-size: 21px; min-height: 58px; padding: 14px 32px; border-radius: 30px; } .wordmark { font-size: 23px; } .app-name { font-size: 15px; } }
@media (max-height: 650px) { .hero-title { font-size: 34px; } .hero-content > * + * { margin-top: 7px; } .synopsis { -webkit-line-clamp: 1; } .ratings { display: none; } }
@media (max-width: 800px) { .date, .demo-chip { display: none; } .app { flex: 0 0 120px; } .hero-content { width: 85%; } .hero-title { font-size: 32px; } .wordmark { font-size: 15px; } .hint { font-size: 10px; } .cta { font-size: 14px; padding: 10px 16px; } }
@media (prefers-reduced-motion: reduce) { .tile, .cta, .backdrop, .toast { transition: none; } .hero-content.enter { -webkit-animation: none; animation: none; } }

/* Fileiras da biblioteca (abaixo da primeira dobra) e tela de detalhes. */
.shelves { padding: 1vh 3vw 8vh; }
.shelf + .shelf { margin-top: 3vh; }
.shelf-title { margin: 0 0 4px; font-size: 22px; font-weight: 700; letter-spacing: -.4px; }
.shelf-note { color: var(--muted); font-size: 15px; margin: 10px 0 0; }
.shelf-row { display: flex; padding: 14px 10px 16px; margin: 0 -10px; overflow-x: auto; overflow-y: hidden; }
.shelf-row::-webkit-scrollbar { display: none; }
.shelf-card { -webkit-flex: 0 0 150px; flex: 0 0 150px; width: 150px; min-width: 0; max-width: 150px; padding: 0; background: transparent; text-align: left; color: var(--fg); }
.shelf-card + .shelf-card { margin-left: 18px; }
.shelf-art { display: flex; align-items: center; justify-content: center; width: 150px; height: 225px; border-radius: 16px; overflow: hidden; background: linear-gradient(160deg, var(--glass-strong), var(--glass)); border: 1px solid var(--glass-line); box-shadow: inset 0 1px 0 var(--glass-hi), 0 10px 22px var(--shadow); transition: transform .2s ease; will-change: transform; }
.shelf-art img { width: 100%; height: 100%; object-fit: cover; }
.shelf-fallback { padding: 12px; font-size: 16px; font-weight: 700; text-align: center; color: var(--muted); }
.shelf-card strong { display: block; margin-top: 10px; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shelf-card small { display: block; margin-top: 3px; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shelf-card.focused .shelf-art { -webkit-transform: scale(1.08) translateY(-4px); transform: scale(1.08) translateY(-4px); box-shadow: 0 14px 26px var(--shadow), 0 0 0 3px var(--focus); }
.shelf-card.focused strong { color: var(--fg); }
.shelf-card.action { -webkit-flex-basis: auto; flex-basis: auto; width: auto; max-width: none; min-height: 56px; padding: 14px 26px; border-radius: 28px; background: linear-gradient(160deg, var(--glass-strong), var(--glass)); border: 1px solid var(--glass-line); box-shadow: inset 0 1px 0 var(--glass-hi), 0 8px 20px var(--shadow); transition: transform .18s ease; }
.shelf-card.action strong { margin: 0; font-size: 17px; }
.shelf-card.action small { margin-top: 2px; }
.shelf-card.action.focused { -webkit-transform: scale(1.06); transform: scale(1.06); background: var(--button); color: var(--button-fg); }
.shelf-card.action.focused strong { color: var(--button-fg); }
.shelf-card.action.focused small { color: var(--button-fg); opacity: .7; }
.tv-detail { background-size: cover; background-position: center; }
.tv-detail .tv-library-dialog { max-width: 1100px; background: linear-gradient(90deg, rgba(8,10,15,.94), rgba(8,10,15,.78)); color: #fff; }
.tv-detail .tv-library-heading h2 { font-size: 40px; letter-spacing: -1px; }
.tv-detail-meta { margin: 4px 0 !important; color: #c9cfda !important; }
.tv-detail-progress { color: #70daca !important; font-weight: 700; font-size: 20px !important; margin: 8px 0 !important; }
.tv-detail-syn { color: #dfe3ea !important; max-width: 900px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tv-detail-message { color: #70daca !important; }
.tv-detail .tv-library-dialog button { color: #fff; background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); }
.tv-detail .tv-library-dialog button[aria-pressed="true"] { border-color: #70daca; color: #70daca; }
.tv-detail .tv-library-dialog button:focus { background: #fff; color: #0b0d12; }
.tv-detail .tv-library-dialog .tv-primary { background: #fff; color: #0b0d12; font-weight: 700; }
.tv-library-dialog button[aria-pressed="true"] { border-color: #70daca; }
.tv-pair { display: flex; align-items: center; }
.tv-pair-qr { flex: 0 0 auto; width: 300px; height: 300px; border-radius: 18px; background: #fff; image-rendering: pixelated; margin-right: 40px; }
.tv-pair-steps { flex: 1 1 auto; }
.tv-library-dialog .tv-pair-step { color: var(--fg); font-size: 22px; margin: 0 0 12px; }
.tv-library-dialog .tv-pair-alt { margin: 26px 0 4px; }
.tv-library-dialog .tv-pair-code { margin: 0; color: var(--fg); font-size: 64px; font-weight: 800; letter-spacing: 8px; font-variant-numeric: tabular-nums; }
.tv-library-dialog .tv-pair-wait { margin: 8px 0 14px; }
