/* Paez440Pro · Televisor viejo (CRT) · v1 · 8-oct-2026
   Estilos de shared/academy/tv-player-v1.js. TODO es CSS + SVG vectorial: sin imágenes, sin fuentes externas.
   Prefijo "ptv". Variable de color de acento: --tv-accent (azul Audio #2aa4ff / verde Video #32d17d / magenta Luces #e30098).
   Ganchos de QA visual: .ptvCab[data-power=on|off]  .ptvScreen[data-mode=off|warmup|static|card|loading|playing|fallback|nosignal]
   .ptvScreen.is-osd (indicador CH/VOL)  .ptvScreen.is-offanim (apagado)  .ptvCard  .ptvExtWrap (enlace de último recurso). */

.p440tv {
  --tv-accent: #7dff9a;
  --tv-wood-a: #8a5a30; --tv-wood-b: #6b4122; --tv-wood-c: #4c2c15;
  --tv-cream: #e5d9bf; --tv-ink: #1a1814;
  container-type: inline-size;
  display: block; width: 100%; max-width: 900px; margin: 0 auto;
  color: #f1ead9; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
.p440tv *, .p440tv *::before, .p440tv *::after { box-sizing: border-box; }
.p440tv [hidden] { display: none !important; }

.ptvSr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

/* ---------- mueble ---------- */
.ptvCab { position: relative; margin-top: clamp(46px, 9cqw, 84px); outline: none; }
.ptvCab:focus-visible { outline: 3px solid var(--tv-accent); outline-offset: 6px; border-radius: 16px; }
.ptvEars { position: absolute; left: 50%; top: 2px; width: clamp(110px, 27cqw, 250px); height: auto; transform: translate(-50%, -93%); pointer-events: none; filter: drop-shadow(0 3px 2px rgba(0,0,0,.5)); }
.ptvBody {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) clamp(138px, 22cqw, 176px); gap: clamp(8px, 2cqw, 18px); align-items: stretch;
  padding: clamp(10px, 3cqw, 26px); border-radius: 18px 18px 10px 10px;
  background:
    repeating-linear-gradient(92deg, rgba(0,0,0,.07) 0 2px, rgba(255,255,255,.035) 2px 5px, rgba(0,0,0,.05) 5px 6px),
    linear-gradient(180deg, var(--tv-wood-a) 0%, var(--tv-wood-b) 46%, var(--tv-wood-c) 100%);
  box-shadow: inset 0 2px 0 rgba(255,220,170,.28), inset 0 -4px 8px rgba(0,0,0,.55), inset 0 0 0 1px rgba(0,0,0,.35), 0 20px 34px rgba(0,0,0,.55), 0 0 0 2px #2a170a;
}
.ptvFeet { position: relative; height: 14px; margin: 0 7%; }
.ptvFeet::before, .ptvFeet::after { content: ""; position: absolute; top: 0; width: 17%; height: 100%; background: linear-gradient(#3a2210, #160d06); border-radius: 0 0 8px 8px; box-shadow: 0 6px 8px rgba(0,0,0,.5); }
.ptvFeet::before { left: 0; } .ptvFeet::after { right: 0; }

/* ---------- marco de plástico y pantalla curva ---------- */
.ptvBezel { padding: clamp(8px, 2.6cqw, 22px); border-radius: 16px; background: linear-gradient(160deg, #2c2a26, #11100e 70%); box-shadow: inset 0 0 0 2px #000, inset 0 5px 12px rgba(0,0,0,.85), 0 1px 0 rgba(255,220,170,.22); align-self: start; }
.ptvScreen {
  position: relative; aspect-ratio: 4 / 3; overflow: hidden; container-type: inline-size;
  border-radius: 7% / 9.3%; background: #000;
  box-shadow: inset 0 0 36px rgba(0,0,0,.95), 0 0 0 3px #000, 0 0 18px rgba(0,0,0,.6);
}
/* el tamaño de letra sale del ANCHO DE LA PANTALLA (contenedor): cqw se resuelve contra .ptvScreen, no contra el televisor entero */
.ptvInner { position: absolute; inset: 0; background: #000; transform-origin: 50% 50%; font-size: clamp(11px, 3.1cqw, 21px); }
.ptvNoise { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; image-rendering: pixelated; opacity: 0; filter: contrast(1.15) brightness(.82); pointer-events: none; }
.ptvVideo { position: absolute; inset: 0; z-index: 2; display: none; background: #000; }
.ptvFrame { display: block; width: 100%; height: 100%; border: 0; background: #000; }
.ptvCard { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: .55em; padding: 9% 9%; text-align: center; overflow: auto;
  background: radial-gradient(ellipse at 50% 38%, rgba(20,34,52,.93), rgba(4,8,14,.96) 78%); }
.ptvCard > * { margin: 0; max-width: 100%; }
.ptvChLine { font: 700 .8em/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .14em; color: var(--tv-accent); text-shadow: 0 0 8px var(--tv-accent); }
.ptvTitle { font-size: 1.32em; line-height: 1.2; font-weight: 800; color: #fff; text-wrap: balance; overflow-wrap: anywhere; }
.ptvMeta { font-size: .82em; letter-spacing: .06em; color: #b8c2cf; }
.ptvMsg { font-size: .9em; line-height: 1.4; color: #dcd5c5; }
.ptvNo { display: block; color: #ffd86b; letter-spacing: .04em; font-size: 1em; margin-bottom: .25em; }
.ptvNoSub { color: #c9c2b2; }
.ptvBadges { display: flex; flex-wrap: wrap; gap: .35em; justify-content: center; }
.ptvBadges:empty { display: none; }
.ptvBadge { padding: .18em .6em; border: 1px solid #66707d; border-radius: 99px; font: 700 .66em/1.2 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .1em; color: #cdd5df; background: rgba(255,255,255,.05); }
.ptvBadge.is-ok { border-color: #3fbf7a; color: #86e6b0; }
.ptvBadge.is-warn { border-color: #d9a93a; color: #f2c94c; }
.ptvActions { display: flex; flex-direction: column; align-items: center; gap: .7em; }
.ptvExtWrap { display: flex; flex-direction: column; align-items: center; gap: .3em; padding: .55em .8em; border: 1px dashed #8a6d2a; border-radius: 8px; }
.ptvExtTag { font: 700 .62em/1.2 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .12em; color: #d9a93a; }
.ptvExt { font-size: .82em !important; opacity: .92; }

/* estados de pantalla */
.ptvScreen[data-mode="static"] .ptvNoise, .ptvScreen[data-mode="loading"] .ptvNoise, .ptvScreen[data-mode="nosignal"] .ptvNoise { opacity: .95; }
.ptvScreen[data-mode="nosignal"] .ptvNoise { opacity: .55; }
.ptvScreen[data-mode="loading"] .ptvVideo, .ptvScreen[data-mode="playing"] .ptvVideo { display: block; }
.ptvScreen[data-mode="loading"] .ptvFrame { opacity: 0; }
.ptvScreen[data-mode="nosignal"] .ptvCard { background: rgba(0,0,0,.6); }
.ptvScreen[data-mode="off"] .ptvInner { background: #050607; }

/* línea de encendido / apagado */
.ptvLine { position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: 5; background: #f4f8ff; opacity: 0; transform: scale(0, .004); pointer-events: none; }
.ptvScreen[data-mode="warmup"] .ptvLine { animation: ptvOn .43s ease-out forwards; }
.ptvScreen.is-offanim .ptvInner { animation: ptvOff .32s ease-in forwards; }
@keyframes ptvOn { 0% { opacity: 1; transform: scale(0, .004); } 50% { opacity: 1; transform: scale(1, .004); } 100% { opacity: 0; transform: scale(1, 1); } }
@keyframes ptvOff { 0% { transform: scale(1, 1); filter: brightness(1); } 60% { transform: scale(1, .012); filter: brightness(3); } 100% { transform: scale(0, .012); filter: brightness(4); opacity: 0; } }

/* líneas de barrido, vidrio y reflejo (no bloquean los clics) */
.ptvScan { position: absolute; inset: 0; z-index: 6; pointer-events: none; background: repeating-linear-gradient(to bottom, rgba(0,0,0,.30) 0 1px, rgba(0,0,0,0) 1px 3px); mix-blend-mode: multiply; }
.ptvScreen[data-mode="playing"] .ptvScan { opacity: .32; }
.ptvScreen[data-mode="card"] .ptvScan, .ptvScreen[data-mode="fallback"] .ptvScan { opacity: .55; }
.ptvGlass { position: absolute; inset: 0; z-index: 7; pointer-events: none;
  background: radial-gradient(120% 80% at 26% 8%, rgba(255,255,255,.16), rgba(255,255,255,0) 46%), radial-gradient(ellipse at 50% 50%, rgba(0,0,0,0) 56%, rgba(0,0,0,.6) 100%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); }

/* indicador en pantalla (OSD) */
.ptvOsd { position: absolute; z-index: 4; left: 6.5%; top: 7.5%; display: none; flex-direction: column; gap: .12em; pointer-events: none;
  font: 700 2.1em/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .06em; color: var(--tv-accent); text-shadow: 0 0 7px var(--tv-accent), 2px 2px 0 #000; }
.ptvScreen.is-osd .ptvOsd { display: flex; }
.ptvOsdVol { font-size: .5em; letter-spacing: 0; }
.ptvOsdTxt { font-size: .5em; letter-spacing: .08em; max-width: 24em; }
.ptvOsd span:empty { display: none; }

/* ---------- panel de controles ---------- */
.ptvPanel { display: flex; flex-direction: column; align-items: center; gap: clamp(8px, 1.8cqw, 14px); padding: clamp(8px, 1.6cqw, 14px) 6px; border-radius: 10px; background: linear-gradient(180deg, rgba(0,0,0,.28), rgba(0,0,0,.12)); box-shadow: inset 0 0 0 1px rgba(0,0,0,.45), inset 0 2px 5px rgba(0,0,0,.4); }
.ptvBrand { text-align: center; line-height: 1.1; }
.ptvBrand b { display: block; font: 800 13px/1 system-ui, sans-serif; letter-spacing: .08em; color: #e8c777; text-shadow: 0 1px 0 #000, 0 0 6px rgba(232,199,119,.35); }
.ptvBrand small { display: block; margin-top: 3px; font: 700 9px/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .24em; color: #b9a67e; }
.ptvCtl { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; }
.ptvRow { display: flex; align-items: center; justify-content: center; gap: 6px; }
.ptvLabel { font: 700 10px/1 system-ui, sans-serif; letter-spacing: .16em; text-transform: uppercase; color: var(--tv-cream); text-shadow: 0 1px 0 #000; }

.ptvPower { position: relative; width: 42px; height: 42px; padding: 0; border-radius: 50%; border: 2px solid #1b0907; cursor: pointer;
  background: radial-gradient(circle at 35% 30%, #d85548, #7d130c 72%); box-shadow: 0 3px 0 #2c0b07, 0 5px 8px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.35); }
.ptvPower:active { transform: translateY(2px); box-shadow: 0 1px 0 #2c0b07, inset 0 1px 0 rgba(255,255,255,.25); }
.ptvPowerLed { position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: #3a0f0b; box-shadow: inset 0 1px 2px rgba(0,0,0,.7); }
.ptvCab[data-power="on"] .ptvPower { box-shadow: 0 3px 0 #2c0b07, 0 0 16px rgba(255,59,48,.75), inset 0 1px 0 rgba(255,255,255,.4); }
.ptvCab[data-power="on"] .ptvPowerLed { background: #ffd2cc; box-shadow: 0 0 8px #ff6a5c, 0 0 14px #ff3b30; }

/* teclas y flechas */
.ptvArrow, .ptvKey, .ptvBtn { font: 800 12px/1 system-ui, -apple-system, "Segoe UI", sans-serif; letter-spacing: .06em; color: var(--tv-ink); cursor: pointer; border: 1px solid #2a2620; border-radius: 7px;
  background: linear-gradient(#d9d1bf, #9a927f); box-shadow: 0 2px 0 #3d382f, 0 4px 6px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.55); text-shadow: 0 1px 0 rgba(255,255,255,.4); }
.ptvArrow { width: 34px; height: 34px; padding: 0; border-radius: 50%; font-size: 13px; }
.ptvKey { min-height: 34px; padding: 0 12px; width: 100%; max-width: 150px; }
.ptvBtn { min-height: 36px; padding: 0 1em; font-size: 1em; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; text-align: center; }
.ptvBtn.ptvPlayBig { font-size: 1.1em; padding: .55em 1.4em; min-height: 0; border-color: #000; background: linear-gradient(#f2e6c4, #b79c55); }
.ptvArrow:active, .ptvKey:active, .ptvBtn:active { transform: translateY(2px); box-shadow: 0 0 0 #3d382f, inset 0 1px 0 rgba(255,255,255,.4); }
.ptvArrow:disabled, .ptvKey:disabled { opacity: .42; cursor: not-allowed; transform: none; }
.ptvKey[aria-pressed="true"] { background: linear-gradient(#a79f8c, #d9d1bf); box-shadow: inset 0 2px 4px rgba(0,0,0,.45); }
.ptvPower:focus-visible, .ptvArrow:focus-visible, .ptvKey:focus-visible, .ptvBtn:focus-visible { outline: 3px solid var(--tv-accent); outline-offset: 2px; }
.ptvCard .ptvBtn:focus-visible { outline-color: #fff; }

/* perillas */
.ptvDial { position: relative; width: 58px; height: 58px; border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #ddd6c6, #7b7466 62%, #36322a); box-shadow: 0 4px 8px rgba(0,0,0,.6), inset 0 0 0 3px #1a1814, inset 0 0 0 4px #b9b1a0; }
.ptvRing { position: absolute; inset: 6px; border-radius: 50%; transform: rotate(var(--ptv-ch-rot, 0deg)); transition: transform .28s cubic-bezier(.3,1.3,.5,1);
  background: repeating-conic-gradient(#8d8576 0 7deg, #c4bcab 7deg 14deg); box-shadow: inset 0 0 0 1px rgba(0,0,0,.5); }
.ptvDialVol .ptvRing { transform: rotate(var(--ptv-vol-rot, -135deg)); }
.ptvRing i { position: absolute; left: 50%; top: 1px; width: 4px; height: 11px; margin-left: -2px; border-radius: 2px; background: var(--tv-accent); box-shadow: 0 0 5px var(--tv-accent); }
.ptvDial output { position: absolute; inset: 15px; display: grid; place-items: center; border-radius: 50%; background: #14110d; color: var(--tv-accent);
  font: 800 13px/1 ui-monospace, Menlo, Consolas, monospace; text-shadow: 0 0 5px var(--tv-accent); box-shadow: inset 0 0 6px #000; }
.ptvCab[data-power="off"] .ptvDial output { color: #3b362c; text-shadow: none; }

/* parrilla del altavoz */
.ptvGrille { flex: 1 1 auto; align-self: stretch; min-height: 0; margin: 2px 6px 0; border-radius: 8px; overflow: hidden;
  background: repeating-linear-gradient(to bottom, #0c0a08 0 3px, #2c2822 3px 6px); box-shadow: inset 0 3px 6px rgba(0,0,0,.8), 0 1px 0 rgba(255,220,170,.18); }

/* ---------- ancho angosto: los controles pasan debajo de la pantalla ---------- */
@container (max-width: 620px) {
  .ptvBody { grid-template-columns: minmax(0, 1fr); }
  .ptvPanel { flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 10px 16px; }
  .ptvBrand, .ptvGrille { display: none; }
  .ptvCtl { width: auto; }
  .ptvCtlPlay { flex-basis: 100%; }
  .ptvKey { max-width: 220px; }
  .ptvDial { width: 52px; height: 52px; }
  .ptvDial output { inset: 13px; }
}
@container (max-width: 380px) {
  .ptvArrow { width: 38px; height: 38px; }
  .ptvPanel { gap: 10px 10px; }
}

/* ---------- movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  .ptvScreen[data-mode="warmup"] .ptvLine, .ptvScreen.is-offanim .ptvInner { animation: none; }
  .ptvRing { transition: none; }
}
@media (forced-colors: active) {
  .ptvArrow, .ptvKey, .ptvBtn, .ptvPower { forced-color-adjust: none; border: 2px solid ButtonText; }
  .ptvCab:focus-visible, .ptvArrow:focus-visible, .ptvKey:focus-visible, .ptvBtn:focus-visible { outline: 3px solid Highlight; }
}
