/* Surface-only presentation for the hostless TV catalogue.
   Shared structure and tokens live in catalogue.css. */
.catalogue-back{font-size:0}
body[data-tv="true"]{height:100dvh;min-height:100dvh;overflow:hidden}
body[data-tv="true"] main{height:100%;min-height:0;max-height:100%;overflow:hidden}
body[data-tv="true"] .home-action{background:var(--red);color:#fff;border-color:var(--red)}
body[data-tv="true"] .home-action small{color:#fff;opacity:.92}
.home-action-wordmark{display:inline-block;width:min(190px,46vw);height:auto;max-height:32px;object-fit:contain;vertical-align:middle}
.home-action:focus-visible,.config-card:focus-visible,.modal-actions button:focus-visible,.modal-close:focus-visible,.intro-image-cta:focus-visible{outline:4px solid rgba(255,255,255,.95);outline-offset:3px}

/* TV and HDMI geometry. */
@media (min-width:701px){
  body[data-tv="true"] .modal-backdrop{padding:12px 18px 22px;overflow:hidden}
  body[data-tv="true"] .modal{max-height:calc(100dvh - 34px);overflow:hidden}
  body[data-tv="true"] .modal-wordmark{width:min(280px,30vw);max-height:70px;margin:0 auto 12px}
  body[data-tv="true"] .modal-close{left:12px;top:10px}
  body[data-tv="true"] #create-modal .config-card,
  body[data-tv="true"] #drawing-modal .config-card{
    display:grid;
    grid-template-rows:minmax(0,1fr) auto auto;
    align-content:stretch;
    gap:5px;
    height:clamp(190px,23dvh,230px);
    min-height:190px;
    aspect-ratio:auto;
    padding:14px 16px 12px;
    overflow:hidden;
    background:linear-gradient(to bottom,rgba(255,255,255,.12) 0 67%,rgba(7,92,255,.92) 67% 100%);
  }
  body[data-tv="true"] #create-modal .option-icon,
  body[data-tv="true"] #drawing-modal .option-icon{width:100%;height:auto;min-height:0;flex:none;overflow:hidden}
  body[data-tv="true"] #create-modal .option-icon img,
  body[data-tv="true"] #drawing-modal .option-icon img{width:100%;height:100%;object-fit:contain}
  body[data-tv="true"] #create-modal .config-card strong,
  body[data-tv="true"] #create-modal .config-card small,
  body[data-tv="true"] #drawing-modal .config-card strong,
  body[data-tv="true"] #drawing-modal .config-card small{position:relative;z-index:2;width:100%;margin:0;color:#fff;text-shadow:0 1px 2px rgba(0,0,0,.28)}
  body[data-tv="true"] #create-modal .config-card strong,
  body[data-tv="true"] #drawing-modal .config-card strong{font-size:1.05rem;line-height:1.05}
  body[data-tv="true"] #create-modal .config-card small,
  body[data-tv="true"] #drawing-modal .config-card small{min-height:1.2em;font-size:.76rem;line-height:1.1}
}
@media (orientation:landscape) and (min-width:701px) and (max-height:900px){
  body[data-tv="true"] #background-modal .config-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
  body[data-tv="true"] #background-modal .config-card{height:clamp(118px,17dvh,150px);min-height:118px}
}
@media (min-width:701px) and (max-height:760px){
  body[data-tv="true"] .modal-backdrop{padding:10px 18px}
  body[data-tv="true"] .modal{max-height:calc(100dvh - 20px);padding:8px 14px}
  body[data-tv="true"] .modal-wordmark{max-height:44px;margin-bottom:5px}
  body[data-tv="true"] .modal h2{margin-bottom:10px}
  body[data-tv="true"] .config-grid{gap:10px}
  body[data-tv="true"] .config-card{padding:10px 12px}
  body[data-tv="true"] .option-icon{height:clamp(64px,12vh,100px);min-height:64px;flex-basis:clamp(64px,12vh,100px)}
  body[data-tv="true"] #background-modal .option-icon{height:58px;min-height:58px;flex-basis:58px}
  body[data-tv="true"] .modal-actions{margin-top:10px;padding-top:10px}
}

/* Mobile creator: same choices and assets, purpose-built phone geometry. */
@media (max-width:700px){
  html,body{height:100dvh;min-height:100dvh;overflow:hidden}
  body[data-tv="true"]{padding-top:0;height:100dvh;max-height:100dvh}
  body[data-tv="true"] main{width:100%;height:100dvh;min-height:0;max-height:100dvh;padding:max(10px,env(safe-area-inset-top)) 14px max(10px,env(safe-area-inset-bottom));display:flex;flex-direction:column;gap:8px}
  body[data-tv="true"] .catalogue-header{flex:0 0 40px;min-height:40px}
  body[data-tv="true"] .catalogue-back{font-size:0}
  body[data-tv="true"] .catalogue-back img{width:36px;height:36px}
  body[data-tv="true"] .catalogue-wordmark{width:min(196px,52vw);max-height:46px}
  body[data-tv="true"] .hero{display:none}
  body[data-tv="true"] .home-panel{display:grid;place-items:center;flex:1;min-height:0}
  body[data-tv="true"] .home-actions{display:block;width:100%;max-width:360px}
  body[data-tv="true"] .home-action{width:100%;min-height:94px;padding:18px 20px;border-radius:22px;box-shadow:0 12px 28px rgba(4,8,28,.22)}
  body[data-tv="true"] .home-action strong{font-size:1.25rem}
  body[data-tv="true"] .home-foot{flex:0 0 auto;margin:0;font-size:.68rem}

  body[data-tv="true"] .modal-backdrop{inset:0;top:0;height:100dvh;padding:max(8px,env(safe-area-inset-top)) 12px max(8px,env(safe-area-inset-bottom));overflow:hidden;background:var(--blue);backdrop-filter:none}
  body[data-tv="true"] .modal{width:100%;height:100%;max-height:none;overflow:hidden;padding:2px 0 0;color:#fff;display:grid;grid-template-rows:auto auto auto minmax(0,1fr) auto;align-content:stretch}
  body[data-tv="true"] .modal-wordmark{width:min(178px,48vw);height:44px;max-height:44px;margin:0 auto 2px}
  body[data-tv="true"] .modal-close{top:3px;left:0;width:38px;height:38px;background:rgba(255,255,255,.16)}
  body[data-tv="true"] .modal-close img{padding:6px}
  body[data-tv="true"] .modal-kicker{font-size:.62rem;margin:1px 0 3px;color:#ffb0aa}
  body[data-tv="true"] .modal h2{font-size:clamp(1.75rem,8vw,2.15rem);line-height:.95;margin:0 42px 12px;letter-spacing:-.045em}

  body[data-tv="true"] .config-grid{min-height:0;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;align-content:center}
  body[data-tv="true"] .config-card{
    display:grid;
    grid-template-rows:minmax(0,1fr) auto 2.3em;
    align-items:center;
    justify-items:center;
    gap:5px;
    min-height:0;
    aspect-ratio:auto;
    height:clamp(150px,24dvh,190px);
    padding:10px 7px 9px;
    border:2px solid rgba(255,255,255,.42);
    border-radius:18px;
    background:#fff;
    color:var(--ink);
    box-shadow:0 7px 16px rgba(4,8,28,.16);
  }
  body[data-tv="true"] .config-card.selected{border-color:var(--red);background:var(--red);color:#fff;box-shadow:0 0 0 3px rgba(255,255,255,.24),0 8px 18px rgba(4,8,28,.22)}
  body[data-tv="true"] .config-card .check{display:grid;place-items:center;top:7px;right:7px;width:22px;height:22px;border-radius:50%;background:var(--red);color:#fff;font-size:.78rem;opacity:0}
  body[data-tv="true"] .config-card.selected .check{background:#fff;color:var(--red);opacity:1}
  body[data-tv="true"] .option-icon{width:100%;height:auto;min-height:0;max-height:86px;flex:none;overflow:hidden}
  body[data-tv="true"] .option-icon img{width:100%;height:100%;object-fit:contain}
  body[data-tv="true"] .config-card strong{font-size:.88rem;line-height:1.05}
  body[data-tv="true"] .config-card small{min-height:2.3em;color:#66728c;font-size:.67rem;line-height:1.12}
  body[data-tv="true"] .config-card.selected small{color:#fff}

  body[data-tv="true"] #drawing-modal .config-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  body[data-tv="true"] #drawing-modal .config-card{height:clamp(190px,34dvh,260px);padding:14px 10px 12px}
  body[data-tv="true"] #drawing-modal .option-icon{max-height:132px}

  body[data-tv="true"] #background-modal .config-grid{grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(3,minmax(0,1fr));gap:7px;align-content:stretch}
  body[data-tv="true"] #background-modal .config-card{height:auto;min-height:0;grid-template-rows:minmax(42px,1fr) auto auto;padding:8px 9px 7px;border-radius:15px}
  body[data-tv="true"] #background-modal .option-icon{max-height:none}
  body[data-tv="true"] #background-modal .track-scene{border-radius:9px}
  body[data-tv="true"] #background-modal .config-card strong{font-size:.8rem}
  body[data-tv="true"] #background-modal .config-card small{min-height:1.15em;font-size:.61rem;white-space:nowrap}

  body[data-tv="true"] .modal-actions{margin-top:10px;padding-top:10px;gap:9px;border-top-color:rgba(255,255,255,.28)}
  body[data-tv="true"] .modal-actions button{min-width:0;min-height:46px;flex:1;padding:11px 12px;font-size:.9rem}
  body[data-tv="true"] .modal-actions .secondary{background:rgba(255,255,255,.14);border:2px solid rgba(255,255,255,.65);color:#fff}

  body[data-tv="true"] .intro-backdrop{padding:4px}
  body[data-tv="true"] .intro-image-modal{height:min(calc(100dvh - 8px),1536px);max-width:calc(100vw - 8px)}
}

@media (max-width:390px) and (max-height:720px){
  body[data-tv="true"] .modal-wordmark{height:36px;max-height:36px}
  body[data-tv="true"] .modal h2{font-size:1.55rem;margin-bottom:8px}
  body[data-tv="true"] .config-card{height:132px;padding:7px 5px}
  body[data-tv="true"] #drawing-modal .config-card{height:170px}
  body[data-tv="true"] .config-card small{font-size:.6rem}
  body[data-tv="true"] .modal-actions{margin-top:7px;padding-top:7px}
  body[data-tv="true"] .modal-actions button{min-height:42px}
}

/* Keep TV artwork inside its grid row; intrinsic image ratio must not push into copy. */
@media (min-width:701px){
  body[data-tv="true"] #create-modal .config-card,
  body[data-tv="true"] #drawing-modal .config-card{
    grid-template-rows:minmax(0,1fr) auto auto !important;
    min-height:0 !important;
  }
  body[data-tv="true"] #create-modal .option-icon,
  body[data-tv="true"] #drawing-modal .option-icon{
    align-self:stretch;
    height:100% !important;
    min-height:0 !important;
    max-height:none !important;
  }
  body[data-tv="true"] #create-modal .option-icon img,
  body[data-tv="true"] #drawing-modal .option-icon img{
    display:block;
    width:100%;
    height:100%;
    min-height:0;
    max-height:100%;
    object-fit:contain;
  }
  body[data-tv="true"] #create-modal .config-card strong,
  body[data-tv="true"] #create-modal .config-card small,
  body[data-tv="true"] #drawing-modal .config-card strong,
  body[data-tv="true"] #drawing-modal .config-card small{
    overflow:hidden;
    text-overflow:ellipsis;
  }
}
/* Phone cards must not inherit intrinsic artwork dimensions. */
@media (max-width:700px){
  body[data-tv="true"] .config-grid{width:100%;min-width:0}
  body[data-tv="true"] .config-card{
    width:100%;
    min-width:0;
    overflow:hidden;
  }
  body[data-tv="true"] .config-card .option-icon{
    width:100%;
    min-width:0;
    min-height:0;
    height:100% !important;
    max-height:none !important;
    align-self:stretch;
    overflow:hidden;
  }
  body[data-tv="true"] .config-card .option-icon img{
    display:block;
    width:100%;
    min-width:0;
    min-height:0;
    height:100%;
    max-width:100%;
    max-height:100%;
    object-fit:contain;
  }
  body[data-tv="true"] #background-modal .config-card .option-icon{
    height:100% !important;
  }
}


/* TV catalogue home: clear, spacious first screen for remote use. */
@media (min-width:701px){
  body[data-tv="true"] main{
    width:100%;height:100dvh;min-height:0;max-height:100dvh;
    padding:clamp(34px,5vh,64px) clamp(40px,7vw,128px) clamp(24px,4vh,48px);
    display:grid;grid-template-rows:auto auto minmax(0,1fr) auto;align-content:stretch;
    gap:clamp(18px,3vh,34px);overflow:hidden;
  }
  body[data-tv="true"] .catalogue-header{min-height:clamp(68px,11vh,112px)}
  body[data-tv="true"] .catalogue-back img{width:clamp(44px,4vw,64px);height:clamp(44px,4vw,64px)}
  body[data-tv="true"] .catalogue-wordmark{width:min(44vw,620px);max-height:clamp(76px,13vh,136px)}
  body[data-tv="true"] .hero{align-self:center;text-align:center}
  body[data-tv="true"] .hero h1{font-size:clamp(3.8rem,7.2vw,8rem);line-height:.9;margin:0 0 clamp(12px,2vh,22px)}
  body[data-tv="true"] .hero p{font-size:clamp(1.15rem,1.8vw,1.8rem);line-height:1.3}
  body[data-tv="true"] .home-panel{width:min(100%,940px);max-width:940px;align-self:center}
  body[data-tv="true"] .home-actions{grid-template-columns:minmax(0,1fr)}
  body[data-tv="true"] .home-action{
    width:100%;min-height:clamp(118px,16vh,184px);padding:clamp(24px,3vw,42px);
    display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;
    border:3px solid rgba(255,255,255,.9);border-radius:28px;text-align:center;
    box-shadow:0 14px 34px rgba(4,8,28,.24);
  }
  body[data-tv="true"] .home-action strong{justify-content:center;gap:16px;margin:0;font-size:clamp(1.8rem,2.8vw,3rem);line-height:1.05}
  body[data-tv="true"] .home-action-arrow{font-size:1.35em;line-height:.7;transition:transform .16s ease}
  body[data-tv="true"] .home-action:focus-visible .home-action-arrow{transform:translateX(8px)}
  body[data-tv="true"] .home-action small{font-size:clamp(1rem,1.35vw,1.35rem);line-height:1.25}
  body[data-tv="true"] .home-foot{margin:0;font-size:clamp(.8rem,1vw,1rem)}
}
@media (min-width:701px) and (max-height:760px){
  body[data-tv="true"] main{padding-top:clamp(28px,4vh,40px);gap:clamp(12px,2vh,20px)}
  body[data-tv="true"] .catalogue-header{min-height:68px}
  body[data-tv="true"] .catalogue-wordmark{max-height:76px}
  body[data-tv="true"] .hero h1{font-size:clamp(3.4rem,6.4vw,5.8rem)}
  body[data-tv="true"] .home-action{min-height:112px}
}
