/* Shared operator controls, with a separate escape target while touch is locked. */
.board-view-links { display: none; }
.screen-mode #pondok-controls-toggle { display: inline-flex; }
.screen-mode:not(.pondok-controls-open) :is(#bell-enable, #bell-preview, #hard-refresh, .operator-control),
.screen-mode:not(.pondok-controls-open) .screen-status :is(#bell-status, #music-status) {
    display: none;
}
#audio-state-panel[data-audio-state="off"] {
    --audio-bg: #f3f4ec;
    --audio-ink: #304b3e;
    --audio-edge: #7a8e80;
}
#audio-state-panel[data-audio-state="blocked"] {
    --audio-bg: #fff0ee;
    --audio-ink: #841e2a;
    --audio-edge: #ae3543;
}
.screen-mode #audio-state-label { font-size: clamp(12px, 1.45dvh, 25px); }
.screen-mode #touch-lock-toggle {
    position: static;
    min-height: 0;
    pointer-events: auto;
}
.screen-mode.touch-locked #audio-state-panel { z-index: 1001; position: relative; pointer-events: none; }
.pondok-arena.touch-locked #audio-state-panel { position: absolute; }
.screen-mode.touch-locked #touch-lock-toggle {
    display: inline-flex;
    position: fixed;
    z-index: 1001;
    inset: auto;
    inset-inline-end: 16px;
    inset-block-end: 16px;
    min-height: 44px;
}

/* Hide graphics locally while the scheduler and playback stay mounted. */
body.screen-mode.board-visual-hidden {
    display: block;
    background: #12281f;
}
.screen-mode.board-visual-hidden > :is(.site-header, .footer),
.screen-mode.board-visual-hidden > .page > :not(#audio-state-panel, #media-stage) {
    display: none !important;
}
.screen-mode.board-visual-hidden #media-stage {
    visibility: hidden;
    pointer-events: none;
}
.screen-mode.board-visual-hidden > .page {
    position: relative;
    display: block;
    height: 100dvh;
    padding: 0;
    overflow: hidden;
}
.screen-mode.board-visual-hidden #audio-state-panel {
    position: absolute;
    inset: auto;
    inset-inline: 12px;
    inset-block-end: max(12px, env(safe-area-inset-bottom));
    max-width: 46rem;
    margin-inline: auto;
    padding: 12px;
    min-height: 0;
}
.screen-mode.board-visual-hidden .screen-status #board-hidden-note {
    display: block;
    font-size: 13px;
    white-space: normal;
    margin-block-start: 4px;
}
.screen-mode.board-visual-hidden .screen-status :is(#bell-status, #music-status),
.screen-mode.board-visual-hidden .board-tools > :not(#board-visibility-toggle, #bell-recover) {
    display: none !important;
}
.screen-mode #board-visibility-toggle {
    min-height: 34px;
}
.screen-mode.board-visual-hidden #board-visibility-toggle {
    min-height: 44px;
    padding-inline: 12px;
    font-size: 14px;
}

/* Keep the next activity and the countdown together. */
.pondok-upcoming {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    align-items: start;
    gap: 12px;
    background: #fff7df;
    color: #173e32;
    border-radius: 14px;
    border: 1px solid #e8ce88;
    padding: 12px;
}
.pondok-upcoming :is(.pondok-next, .pondok-countdown) {
    position: static;
    width: auto;
    max-height: none;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}
.pondok-sidebar .pondok-upcoming > .pondok-countdown {
    text-align: end;
    border-inline-start: 1px solid #d4c59c;
    padding-inline-start: 12px;
    min-width: 78px;
}
.pondok-arena .pondok-upcoming .pondok-countdown {
    border-inline-start: 1px solid #d4c59c;
    padding-inline-start: 1vw;
}
.pondok-upcoming .pondok-next article { display: grid; grid-template-columns: max-content minmax(0, 1fr); }
.pondok-arena .pondok-next h4 { font-size: clamp(14px, 1.8dvh, 38px); }
.pondok-arena .pondok-next time { font-size: clamp(13px, 1.65dvh, 34px); }
.pondok-arena .pondok-upcoming :is(h3, p) { font-size: clamp(10px, 1.2dvh, 25px); }
.pondok-arena #pondok-remaining { font-size: clamp(24px, 3.3dvh, 68px); }
.pondok-upcoming .urgent #pondok-remaining { color: #8a4b10; }
.pondok-content { position: relative; }
.pondok-mode:not(.pondok-arena) #scenic-navigation { top: 12px; }
.scenic-place:not(.is-active-place, .is-selected, :hover, :focus-visible) {
    background: #183f34dd;
    border-color: #8db09f;
}
.scenic-place:not(.is-active-place, .is-selected, .is-occupied, :hover, :focus-visible) { opacity: .78; }
.scenic-person[aria-hidden="true"] { pointer-events: none; }
.scenic-place:is(.is-active-place, .is-selected) {
    background: #f1d58b;
    color: #213b2b;
    border-color: #fff1c8;
}
.pondok-world:not(.scenic-focused) .scenic-person > span { visibility: hidden; }

#campus-life[data-lesson-watch="true"] .campus-teacher-bay { flex-direction: column; min-height: 0; padding: .7dvh .7vw; }
#campus-life[data-lesson-watch="true"] .campus-teacher-slot {
    align-items: flex-start;
    gap: .45em;
}
#campus-life[data-lesson-watch="true"] .campus-teacher-caption { flex: 1; gap: .35em; }
#campus-life[data-lesson-watch="true"] .campus-teacher-visual { width: auto; }
#campus-life[data-lesson-watch="true"] .campus-teacher-visual:empty { display: none; }
#campus-life[data-lesson-watch="true"] .campus-teacher-visual :is(.campus-person, .campus-teacher-ghost, .campus-scheduled-teacher) {
    display: block;
    width: clamp(30px, 4.6dvh, 75px);
    height: clamp(30px, 4.6dvh, 75px);
}
#campus-life[data-lesson-watch="true"] .campus-teacher-visual :is(.campus-person, .campus-scheduled-teacher) svg { height: 100%; }
#campus-life[data-lesson-watch="true"] .campus-submission { align-self: flex-start; }
#campus-life[data-lesson-watch="true"] :is(.campus-subject, .campus-teacher-caption strong) {
    font-size: clamp(14px, 1.65dvh, 35px);
    line-height: 1.25;
    overflow-wrap: anywhere;
}
.campus-subject { color: #173e32; font-weight: 800; }
#campus-life[data-lesson-watch="true"] :is(.campus-presence, .campus-submission, .campus-teacher-unavailable) {
    font-size: clamp(12px, 1.43dvh, 27px);
    padding: .2em .45em;
    text-align: start;
}
.campus-presence::before { content: '○ '; }
[data-status="present"] .campus-presence::before { content: '✓ '; }
[data-status="elsewhere"] .campus-presence::before { content: '↗ '; }
.campus-submission[data-submission="reopened"]::before { content: '↻ '; }
#campus-life[data-lesson-watch="true"] .campus-grid:not(.is-focused) .campus-room { overflow: auto; }

#campus-life[data-lesson-watch="true"] .has-temporary-teacher .campus-teacher-bay {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
#campus-life[data-lesson-watch="true"] .campus-teacher-slot[data-temporary="true"] {
    border-inline-start-color: #b98b37;
}
#campus-life[data-lesson-watch="true"] .campus-teacher-slot[data-temporary="true"] .campus-presence {
    background: #fff1ce;
    color: #624512;
}

#campus-life[data-lesson-watch="true"] .campus-teacher-slot[data-status="completed"] .campus-scheduled-teacher {
    opacity: .6;
}
#campus-life[data-lesson-watch="true"] .campus-teacher-slot[data-late="true"] .campus-presence {
    background: #fff1ce;
    color: #624512;
}
#campus-life .campus-teacher-slot[data-late="true"] .campus-presence::before {
    content: '! ';
}

@media (max-width: 600px) and (orientation: portrait) {
    .screen-mode>.page {
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 12px;
        overflow: auto;
    }
    .screen-mode>.page > :not([hidden]) { flex-shrink: 0; }
    .screen-mode .board-heading h1 { font-size: 21px; }
    .screen-mode #day-label { font-size: 12px; }
    .screen-mode .clock-box strong { font-size: clamp(24px, 7vw, 34px); }
    .board-view-links {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
        order: 1;
    }
    .screen-mode .daily-board { order: 2; display: flex; flex-direction: column; gap: 8px; }
    .screen-mode .daily-board[hidden] { display: none; }
    .screen-mode #audio-state-panel { order: 3; }
    .screen-mode .daily-board .current { order: -2; }
    .screen-mode .daily-board .next { order: -1; }
    .screen-mode .activity-card { padding: 12px; }
    .screen-mode .activity-main h2 { font-size: 17px; }
    .screen-mode .current .activity-main h2 { font-size: 22px; }
    .screen-mode .activity-time>strong { font-size: 21px; }
    .screen-mode .current .activity-time>strong { font-size: 24px; }
    .screen-mode .activity-time>span, .screen-mode .phase { font-size: 11px; }
    .screen-mode .kbm-grid { grid-auto-rows: auto; }
    .screen-mode .kbm-entry :is(.kbm-subject, .kbm-teacher, .kbm-badge) { font-size: 13px; }
    .screen-mode :is(.board-view-links, .board-tools, .campus-toolbar, #scenic-navigation) button {
        min-height: 44px;
        padding: 8px 9px;
        font-size: 13px;
    }
    .screen-mode #board-visibility-toggle { min-height: 44px; }
    .screen-mode .board-view-links button { padding-inline: 5px; font-size: 12px; line-height: 1.25; }
    .board-view-links button[aria-pressed="true"] { background: #1c4b3e; color: #fff9e8; }
    .screen-mode #audio-state-panel { padding: 10px; min-height: 0; align-items: flex-start; }
    .screen-mode .screen-status :is(p, strong) { white-space: normal; }
    .screen-mode .clock-box > span { font-size: 9px; }
    .screen-mode #prayer-times span { font-size: 11px; }
    .screen-mode #prayer-times strong { font-size: 14px; }

    .pondok-arena>.page { height: 100dvh; color: #fff9e8; }
    .pondok-arena .board-heading { position: static; order: -3; align-items: flex-end; margin-inline-start: auto; }
    .pondok-arena .board-heading h1 { display: none; }
    .pondok-arena .prayer-strip { position: static; order: -2; }
    .pondok-arena .board-view-links { order: -1; }
    .pondok-arena #pondok-simulation { position: static; display: flex; flex-direction: column; gap: 10px; height: auto; }
    .pondok-arena .pondok-arena-brand { top: 12px; inset-inline: 12px auto; max-width: 48%; }
    .pondok-arena .pondok-arena-brand strong { font-size: clamp(10px, 3.1vw, 15px); }
    .pondok-arena .pondok-now {
        position: static;
        width: auto;
        flex-wrap: wrap;
        gap: 8px;
    }
    .pondok-arena .pondok-now > div:first-child { flex: 1 1 100%; }
    .pondok-arena .pondok-time { text-align: start; }
    .pondok-arena #pondok-title { overflow-wrap: break-word; }
    .pondok-arena :is(#pondok-time, #pondok-category) { font-size: 13px; }
    .pondok-arena .pondok-sidebar { display: block; order: -1; }
    .pondok-arena .pondok-content { position: relative; inset: auto; display: flex; flex-direction: column; gap: 8px; order: 2; }
    .pondok-arena #scenic-navigation { position: static; }
    #scenic-navigation :is(#scenic-focus, #scenic-all),
    #scenic-navigation:not(:has(#scenic-back:not([hidden]), #scenic-kbm-return:not([hidden]), #scenic-regions:not([hidden]))),
    #campus-life .campus-toolbar [data-pondok-view="simulation"] { display: none; }
    .pondok-arena .pondok-scene {
        position: relative;
        inset: auto;
        width: 100%;
        min-height: 0;
        aspect-ratio: 16/9;
        border-radius: 12px;
    }
    .pondok-arena .pondok-upcoming { position: static; padding: 12px; }
    .pondok-arena .pondok-sidebar .pondok-upcoming > .pondok-countdown { padding-inline-start: 8px; }
    .pondok-arena .pondok-roster-summary,
    .pondok-arena .pondok-scene-caption { display: none; }
    .pondok-arena .pondok-explore-tools { position: static; flex-wrap: wrap; justify-content: start; }
    .pondok-arena .pondok-explore-tools button { min-height: 44px; font-size: 13px; }
    .pondok-arena .pondok-journey { position: static; order: 3; }
    .pondok-arena .pondok-journey button { font-size: 13px; min-height: 44px; }
    .pondok-arena #audio-state-panel { position: static; }
    .pondok-arena :is(#pondok-preview-controls, #pondok-inspector, #campus-person-detail) {
        position: fixed;
        inset: auto 12px 12px;
        width: auto;
        max-height: min(70dvh, 460px);
        z-index: 20;
        overflow: auto;
        transform: none;
    }
    .pondok-arena #pondok-preview-badge { inset: 8px 8px auto; flex-wrap: wrap; gap: 6px; }
    .pondok-arena #pondok-preview-label { flex-basis: 50%; }
    .pondok-arena #pondok-transition { top: 8px; }
    .pondok-world:not(.scenic-focused) .scenic-place:not(.is-active-place) > span { display: none; }
    .pondok-world:not(.scenic-focused) .scenic-place:not(.is-active-place) { padding: 2px; border-radius: 50%; }
    .pondok-world .scenic-place:is(.is-active-place, .is-selected) { font-size: 12px; }

    .campus-mode .pondok-scene { aspect-ratio: auto; overflow: visible; }
    #campus-life[data-style] { position: static; padding: 8px; }
    #campus-life #campus-grid { grid-template-columns: minmax(0, 1fr) !important; grid-template-rows: none !important; grid-auto-rows: auto !important; overflow: visible; }
    #campus-life .campus-room { grid-row: auto !important; grid-column: auto !important; min-height: 0; }
    #campus-life[data-style] .campus-room-heading { min-height: 44px; font-size: 16px; }
    #campus-life[data-style] .campus-room-heading > span { font-size: 12px; }
    #campus-life[data-style] .campus-floor { min-height: 110px; }
    #campus-life[data-style] .is-focused .campus-floor { min-height: 170px; }
    #campus-life .campus-lesson-summary > span { font-size: 12px; }
    #campus-life .campus-teacher-bay { padding: 8px; }
    .screen-mode.touch-locked .page { overflow: hidden; }
    .pondok-arena.touch-locked #audio-state-panel { position: relative; }
}

.next-bell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .8em;
    padding: .45em .8em;
    border-inline-start: 4px solid #c79332;
    border-radius: 8px;
    background: #fff3cd;
    color: #293e2d;
    font-size: clamp(13px, 1.8dvh, 34px);
    line-height: 1.18;
    text-shadow: none;
}
.next-bell[hidden], .next-bell [hidden] { display: none; }
.next-bell-info { min-width: 0; overflow-wrap: anywhere; }
.next-bell-meta { display: flex; align-items: baseline; flex-wrap: wrap; gap: .15em .55em; font-size: .84em; }
.next-bell-meta strong, #next-bell-pattern { color: #765015; font-weight: 750; }
#next-bell-label { display: block; margin-block-start: .18em; }
#next-bell-counter { flex: none; text-align: end; }
#next-bell-counter small { display: block; font-size: .78em; }
#next-bell-remaining { display: block; font-size: 1.55em; font-variant-numeric: tabular-nums; }
.pondok-upcoming > .next-bell { grid-column: 1 / -1; }
.board-heading > .next-bell { flex: 0 1 40%; }
@media (max-width: 600px) and (orientation: portrait) {
    .screen-mode .board-heading:has(> .next-bell) { flex-wrap: wrap; }
    .board-heading > .next-bell { flex-basis: 100%; order: 1; }
    .next-bell { font-size: 14px; }
}

/* In the arena the timetable, campus controls and map each occupy their own row. */
.pondok-schedule-strip { display: contents; }
.pondok-arena .pondok-schedule-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    gap: clamp(6px, .65vw, 20px);
}
.pondok-schedule-strip > :is(.pondok-now, .pondok-upcoming, .next-bell) {
    min-width: 0;
}
.pondok-arena .pondok-schedule-strip > :is(.pondok-now, .pondok-upcoming, .next-bell) {
    position: static;
    width: auto;
    margin: 0;
    padding: clamp(8px, 1.05dvh, 20px) clamp(10px, 1.05vw, 32px);
    border: 1px solid #587b6e;
    border-radius: clamp(8px, .65vw, 18px);
    box-shadow: none;
    backdrop-filter: none;
    text-align: start;
}
.pondok-schedule-strip .pondok-now {
    background: #ffe2a3;
    color: #183e32;
}
.pondok-arena .pondok-schedule-strip > .pondok-now { border-color: #e4bd67; }
.pondok-schedule-strip :is(#pondok-phase, #pondok-category) { color: #594019; }
.pondok-schedule-strip :is(.pondok-upcoming, .next-bell) {
    background: #244e43;
    color: #e5eee7;
}
.pondok-arena .pondok-schedule-strip > .pondok-upcoming {
    order: -1;
    align-items: center;
}
.pondok-schedule-strip .pondok-next :is(time, h4),
.pondok-schedule-strip #pondok-remaining { color: inherit; }
.pondok-schedule-strip .pondok-countdown.urgent { background: transparent; }
.pondok-schedule-strip .urgent #pondok-remaining { color: #ffe2a3; }
.pondok-schedule-strip .pondok-progress { background: #4c6e61; }
.pondok-schedule-strip #pondok-progress { background: #b5cebd; }
.pondok-arena .pondok-schedule-strip :is(#pondok-phase, .pondok-next h3, .next-bell-meta strong) {
    margin: 0;
    font: 750 clamp(11px, 1.4dvh, 24px)/1.2 system-ui, sans-serif;
    letter-spacing: .04em;
}
.pondok-schedule-strip .pondok-next h3,
.pondok-schedule-strip .pondok-countdown p,
.pondok-schedule-strip .next-bell-meta strong,
.pondok-schedule-strip #next-bell-pattern { color: #c0d5ca; }
.pondok-arena .pondok-schedule-strip #pondok-title { font-size: clamp(17px, 2.7dvh, 52px); }
.pondok-arena .pondok-schedule-strip .pondok-now.long-title #pondok-title { font-size: clamp(15px, 2.2dvh, 44px); }
.pondok-schedule-strip :is(.pondok-time, .pondok-countdown, #next-bell-counter) { text-align: end; }
.pondok-arena .pondok-schedule-strip .pondok-time { max-width: none; }
.pondok-schedule-strip #pondok-next { margin-block-start: .35em; }
.pondok-arena .pondok-schedule-strip .pondok-next { overflow: visible; }
.pondok-arena .pondok-schedule-strip .pondok-next article { align-items: baseline; column-gap: .6em; }
.pondok-arena .pondok-schedule-strip .pondok-next article + article { margin-top: .25em; padding: 0; border: none; }
.pondok-arena .pondok-schedule-strip .pondok-next :is(time, h4) { font-size: clamp(12px, 1.85dvh, 34px); }
.pondok-arena .pondok-schedule-strip .pondok-countdown,
.pondok-schedule-strip #next-bell-counter {
    padding: 0;
    padding-inline-start: clamp(6px, .7vw, 20px);
    border: 0;
    border-inline-start: 1px solid #587b6e;
}
.pondok-arena .pondok-schedule-strip :is(#pondok-remaining, #next-bell-remaining) {
    font-size: clamp(19px, 3dvh, 56px);
    line-height: 1.2;
    white-space: nowrap;
    letter-spacing: -.035em;
}
.pondok-arena .pondok-schedule-strip .pondok-countdown p,
.pondok-schedule-strip #next-bell-counter small { font-size: clamp(9px, 1.1dvh, 20px); }
.pondok-schedule-strip .next-bell-meta { font-size: clamp(11px, 1.36dvh, 25px); }
.pondok-schedule-strip #next-bell-pattern { white-space: nowrap; }
.pondok-schedule-strip #next-bell-label { font-size: clamp(13px, 1.9dvh, 36px); }

@media (min-width: 601px), (orientation: landscape) {
    .pondok-arena #pondok-simulation {
        display: grid;
        grid-template-rows: auto minmax(0, 1fr);
        gap: clamp(5px, .75dvh, 16px);
        padding: 9.5dvh 1.4vw 11.7dvh;
        background: #143d34;
    }
    .pondok-arena .pondok-content {
        position: relative;
        inset: auto;
        display: grid;
        grid-template: auto minmax(0, 1fr) / minmax(0, 1fr) auto;
        column-gap: 12px;
        row-gap: clamp(4px, .6dvh, 12px);
    }
    .pondok-arena #scenic-navigation, .pondok-arena .pondok-explore-tools {
        position: static;
        grid-row: 1;
        align-self: center;
    }
    .pondok-arena .pondok-explore-tools { grid-column: 2; }
    .pondok-arena .pondok-scene {
        position: relative;
        inset: auto;
        grid-area: 2 / 1 / 3 / -1;
        border: 1px solid #548071;
        border-radius: clamp(8px, .7vw, 18px);
        background: #316158;
    }
    .pondok-arena .pondok-scene::after { background: none; }
    .pondok-arena .pondok-roster-summary { top: auto; bottom: .8dvh; left: 1vw; }
    .pondok-arena .pondok-scene-caption { bottom: .8dvh; left: auto; right: 1vw; }
    .campus-mode #campus-life { inset: .6dvh .65vw 3.4dvh; }
    .pondok-arena #scenic-staff-room { inset: 1.5% 2%; }
    .pondok-arena #pondok-inspector { bottom: 2.5dvh; }
    .pondok-arena #pondok-preview-badge, .pondok-arena #pondok-transition { top: 1dvh; }
}
@media (min-width: 601px) and (orientation: portrait) {
    .pondok-arena #pondok-simulation { padding-top: 116px; }
    .pondok-arena .pondok-schedule-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pondok-arena .pondok-schedule-strip > .pondok-now { grid-area: 1 / 1 / 2 / -1; }
    .pondok-arena:not(.campus-mode) .pondok-scene { align-self: center; width: 100%; aspect-ratio: 16/9; max-height: 100%; }
}
@media (max-width: 600px) and (orientation: portrait) {
    .pondok-arena .pondok-schedule-strip { display: flex; flex-direction: column; gap: 6px; }
    .pondok-schedule-strip .pondok-now > div:first-child { flex-basis: auto; }
    .pondok-schedule-strip .pondok-now { flex-wrap: nowrap; }
    .pondok-arena .pondok-schedule-strip > :is(.pondok-now, .pondok-upcoming, .next-bell) { padding: 9px 12px; }
    .pondok-schedule-strip .pondok-now .pondok-time { text-align: end; }
}

@media (max-width: 600px) and (orientation: portrait) {
    .pondok-arena #pondok-simulation:has(.scenic-enabled) .pondok-content { order: -1; }
    .pondok-arena .pondok-scene:has(.scenic-enabled)::after { background: none; }
    .pondok-arena .pondok-scene:has(.scenic-enabled) { aspect-ratio: 1.6; }
    #scenic-regions button { min-height: 36px; padding-inline: 12px; }
}
