.display-controls {
    display:flex;
    align-items:center;
    justify-content:flex-end;
    gap:24px;
    max-width:1600px;
    margin:0 auto;
    padding:0 32px 16px;
}
.display-controls .app-button { min-height:48px; font-size:18px; padding:10px 18px; }
.display-controls p { margin:0; }
.tv-mode { font-size:26px; }
.tv-mode .app-main,.tv-mode .app-header,.tv-mode .app-footer,.tv-mode .display-controls {
    max-width:none;
    width:92%;
    padding-left:16px;
    padding-right:16px;
}
.tv-mode .app-header { padding-top:20px; padding-bottom:16px; }
.tv-mode .display-controls { justify-content:space-between; }
.tv-mode .display-controls p { font-size:22px; }
.tv-mode .app-button,.tv-mode .app-nav a { min-height:64px; font-size:26px; }
.tv-mode :focus { outline:5px solid #0759bb; outline-offset:5px; box-shadow:0 0 0 11px white; }
.tv-mode .content-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
.tv-mode .card-body { padding:20px; }
.tv-mode .card-body h2 { font-size:32px; }
.tv-mode .card-image,.tv-mode .card-art { height:22vh; }
.tv-mode .content-description,.tv-mode .message-body { font-size:32px; line-height:1.5; }
.tv-mode .page-heading { padding:16px 0 24px; }
.tv-mode .page-heading h1 { font-size:42px; }
.tv-mode .login-shell { margin:16px auto; gap:40px; grid-template-columns:1fr 440px; }
.tv-mode .login-card { padding:24px; }
.tv-mode .number-pad button { min-height:54px; }
.tv-mode .login-card input { height:64px; }
.tv-mode .login-intro h1 { font-size:48px; }
@media(max-width:900px) {
    .tv-mode .content-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .tv-mode .login-shell { display:block; max-width:540px; }
    .tv-mode .login-intro { display:none; }
    .tv-mode .display-controls { flex-wrap:wrap; }
}

@media(min-width:901px) and (max-height:800px) {
    .tv-mode .app-header { padding-top:12px; padding-bottom:12px; }
    .tv-mode .app-brand__logo { width:200px; }
    .tv-mode .display-controls .app-button { min-height:48px; padding:8px 16px; font-size:22px; }
    .tv-mode .login-shell { margin:0 auto; }
    .tv-mode .login-card { padding:20px; }
    .tv-mode .login-card input { height:56px; }
    .tv-mode .field-help { margin:8px 0 12px; }
    .tv-mode .number-pad { gap:8px; }
    .tv-mode .number-pad button { min-height:48px; }
    .tv-mode .start-button { margin-top:12px; }
}

/* Use the browser's available height, including when TV browser chrome or zoom reduces it. */
.tv-mode[data-signed-in="1"] { display:flex; flex-direction:column; min-height:100vh; }
.tv-mode[data-signed-in="1"] .app-header { order:0; }
.tv-mode[data-signed-in="1"] .app-main { order:1; padding-bottom:16px; }
.tv-mode[data-signed-in="1"] .display-controls { order:2; padding-top:16px; }
.tv-mode[data-signed-in="1"] .app-footer { order:3; }
.tv-mode .app-header--signed-in {
    display:flex;
    width:94%;
    height:88px;
    padding:12px 16px;
    gap:20px;
}
.tv-mode .app-header--signed-in .app-brand { flex:none; }
.tv-mode .app-header--signed-in .app-brand__logo { width:160px; }
.tv-mode .app-header--signed-in .app-nav {
    order:1;
    flex:1;
    width:auto;
    min-width:0;
    flex-wrap:nowrap;
    justify-content:center;
    gap:12px;
}
.tv-mode .app-header--signed-in .app-nav a { min-width:0; flex:none; min-height:52px; padding:10px 18px; font-size:24px; }
.tv-mode .app-header--signed-in .app-person { order:2; flex:none; font-size:24px; max-width:18%; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.tv-mode .app-main { width:94%; }
.tv-mode .programme,
.browser-watching .programme {
    display:flex;
    flex-direction:column;
    height:calc(100vh - 104px);
    min-height:260px;
    margin:0;
}
.tv-mode .programme-toolbar,
.browser-watching .programme-toolbar {
    order:2;
    flex:none;
    display:flex;
    align-items:center;
    justify-content:center;
    flex-wrap:wrap;
    margin:0;
    padding:16px 0 0;
    gap:12px;
}
.tv-mode #programme-help,
.browser-watching #programme-help { display:none; }
.tv-mode .programme-buttons,
.browser-watching .programme-buttons { gap:16px; }
.tv-mode .programme-toolbar .app-button,
.browser-watching .programme-toolbar .app-button { min-height:52px; padding:10px 24px; font-size:24px; }
.tv-mode .programme-toolbar .programme-status,
.browser-watching .programme-toolbar .programme-status { margin:0; font-size:20px; }
.tv-mode .programme-stage,
.browser-watching .programme-stage {
    flex:1;
    min-height:0;
    padding:16px;
    overflow:auto;
}
.tv-mode .programme-item,
.browser-watching .programme-item { display:flex; flex-direction:column; height:100%; min-height:0; }
.tv-mode .programme-item h1,
.browser-watching .programme-item h1 { flex:none; margin:0 0 12px; font-size:30px; }
.tv-mode .programme-item>.content-image,
.browser-watching .programme-item>.content-image,
.tv-mode .programme-item video,
.browser-watching .programme-item video {
    flex:1;
    min-height:0;
    height:0;
    width:100%;
    max-height:none;
    margin:0 auto;
    object-fit:contain;
}
.tv-mode .programme-item .programme-poster,
.browser-watching .programme-item .programme-poster { display:none; }
.tv-mode .programme-item[data-kind="audio"] .programme-poster,
.browser-watching .programme-item[data-kind="audio"] .programme-poster { display:block; }
.tv-mode .programme-item .content-description,
.browser-watching .programme-item .content-description {
    flex:0 1 auto;
    min-height:0;
    max-height:28%;
    overflow:auto;
    margin:12px auto 0;
    width:100%;
    font-size:26px;
    line-height:1.4;
}
.tv-mode .programme-item[data-kind="text"] .content-description,
.browser-watching .programme-item[data-kind="text"] .content-description { flex:1; max-height:none; }
.tv-mode .programme-item .content-description p,
.browser-watching .programme-item .content-description p { margin:0 0 12px; }
.tv-mode .programme-item .video-frame,
.browser-watching .programme-item .video-frame { flex:1; min-height:0; padding:0; margin:0; }
.tv-mode .programme-stage iframe { pointer-events:none; }
.tv-mode .programme-item .programme-art,
.browser-watching .programme-item .programme-art { flex:1; min-height:0; }
.tv-mode .programme-item .audio-slideshow,
.browser-watching .programme-item .audio-slideshow { flex:1; min-height:0; margin:0; }
.tv-mode .programme-item .audio-slideshow figure,
.browser-watching .programme-item .audio-slideshow figure { display:flex; flex-direction:column; min-height:0; }
.tv-mode .programme-item .audio-slideshow .content-image,
.browser-watching .programme-item .audio-slideshow .content-image { flex:1; min-height:0; height:0; max-height:none; margin:0; }
.tv-mode .programme-item figcaption,
.browser-watching .programme-item figcaption { flex:none; padding-top:8px; font-size:20px; }
.tv-mode.tv-watching .app-header,
.tv-mode.tv-watching .display-controls,
.tv-mode.tv-watching .app-footer { display:none; }
.tv-mode.tv-watching .app-main { padding-top:16px; }
.tv-mode.tv-watching .programme { height:calc(100vh - 32px); }
.tv-mode.tv-watching .programme-toolbar { order:2; padding:16px 0 0; }
.tv-mode .messages-heading { padding:0; }
.tv-mode .messages-heading h1,.tv-mode .messages-heading p { display:none; }
.tv-mode .message-carousel { display:flex; flex-direction:column; height:calc(100vh - 104px); min-height:260px; }
.tv-mode .message-carousel-controls { flex:none; margin:0; padding:8px 0 16px; gap:12px; }
.tv-mode .message-carousel-controls .app-button { min-height:52px; padding:10px 20px; font-size:24px; }
.tv-mode .message-carousel-help { display:none; }
.tv-mode .message-stage { flex:1; min-height:0; display:block; }
.tv-mode .message-stage .message-featured[hidden] { display:none!important; }
.tv-mode .message-featured,
.tv-mode .message-featured.message-illustrated[style] { height:100%; min-height:0; padding:16px; }
.tv-mode .message-featured.message-illustrated[style] {
    padding:clamp(16px,3vh,44px) clamp(20px,2.5vw,72px);
}
.tv-mode .message-featured.message-illustrated[style] .message-readable {
    background:rgba(255,255,255,.9);
}
.tv-mode .message-featured .message-readable {
    display:flex;
    flex-direction:column;
    height:100%;
    min-height:0;
    padding:20px;
}
.tv-mode .message-featured .message-meta { flex:none; align-items:center; gap:12px; margin:0 0 16px; }
.tv-mode .message-featured .message-meta strong { font-size:26px; }
.tv-mode .message-featured .message-meta time { font-size:20px; }
.tv-mode .message-featured .message-body {
    flex:1;
    min-height:0;
    overflow:auto;
    margin:0;
    font-size:30px;
    line-height:1.45;
}
.tv-mode .message-with-photo .message-readable {
    display:grid;
    grid-template-columns:minmax(0,1fr) minmax(0,1.2fr);
    grid-template-rows:auto minmax(0,1fr);
    gap:0 24px;
}
.tv-mode .message-with-photo .message-meta { grid-column:1 / 3; }
.tv-mode .message-with-photo .message-body { grid-column:1; grid-row:2; }
.tv-mode .message-featured .message-photo {
    grid-column:2;
    grid-row:2;
    width:100%;
    height:100%;
    max-height:100%;
    min-height:0;
    margin:0;
    object-fit:contain;
}
.tv-mode .message-picker { margin-top:24px; }
.tv-mode .connection-message { bottom:16px; }
@media(max-width:1000px) {
    .tv-mode .app-header--signed-in { gap:12px; }
    .tv-mode .app-header--signed-in .app-brand__logo { width:120px; }
    .tv-mode .app-header--signed-in .app-nav a { font-size:22px; padding:10px 12px; }
    .tv-mode .message-featured .message-body { font-size:26px; }
}

.tv-mode .programme-toolbar .programme-position { margin:0; font-size:20px; }

/* Browser playback uses the same fitted stage as TV playback. */
.browser-watching { overflow:hidden; }
.browser-watching .app-header,
.browser-watching .display-controls,
.browser-watching .app-footer { display:none; }
.browser-watching .app-main { width:100%; max-width:none; padding:16px; }
.browser-watching .programme { height:calc(100vh - 32px); height:calc(100dvh - 32px); min-height:0; }
.browser-watching .programme-toggle { min-width:0; }
.browser-watching .programme-buttons { width:auto; }
.browser-watching .programme-toolbar .programme-position { margin:0; font-size:20px; }
.browser-watching .programme-item .content-description { font-size:clamp(18px,2.2vw,26px); }
@media(max-width:650px), (max-height:500px) {
    .browser-watching .app-main { padding:8px; }
    .browser-watching .programme { height:calc(100vh - 16px); height:calc(100dvh - 16px); }
    .browser-watching .programme-stage { padding:12px; }
    .browser-watching .programme-item h1 { font-size:22px; margin-bottom:8px; }
    .browser-watching .programme-toolbar { gap:8px; padding-top:8px; }
    .browser-watching .programme-buttons { gap:8px; }
    .browser-watching .programme-toolbar .app-button { min-height:44px; padding:8px 12px; font-size:18px; width:auto; }
    .browser-watching .programme-toolbar .programme-position,
    .browser-watching .programme-toolbar .programme-status { font-size:16px; }
}
