#rumiPanel[hidden]{display:none}
.rumi-region-layer{position:fixed;inset:0;pointer-events:none;z-index:9001}
.rumi-region-box{position:fixed;pointer-events:auto;border:2px solid #08788a;background:#26bdd322;cursor:pointer;padding:0;min-width:0;min-height:0}
.rumi-region-box[hidden]{display:none}.rumi-region-box span{position:absolute;top:-20px;left:-2px;background:#08788a;color:white;padding:1px 6px;border-radius:4px;font:700 13px/18px system-ui}
.rumi-region-box.selected{border:3px solid #cf8800;background:#ffc74544;box-shadow:0 0 0 2px #fff9}.rumi-region-box.selected span{background:#875900}
#rumiText .rumi-linked-text{display:block;width:100%;text-align:left;background:#eef8f8;border:1px solid #3a8b96;border-left:5px solid #08788a;padding:12px 14px;margin:12px 0 20px;white-space:pre-wrap;line-height:1.85;font-size:inherit}
#rumiText .rumi-linked-text strong{display:block;font-size:14px;color:#056074;margin-bottom:8px}#rumiText .rumi-linked-text span{display:block;overflow-wrap:anywhere}
#rumiText .rumi-linked-text.selected{background:#fff1c9;border-color:#bf8200}#rumiText p{max-width:65ch}
#rumiPanel{position:fixed;z-index:10001;top:74px;right:16px;bottom:16px;width:40vw;display:flex;flex-direction:column;background:#faf6ed;color:#242921;border:1px solid #cab98e;border-radius:14px;box-shadow:0 12px 40px #0005;padding:18px;gap:12px;font:16px/1.5 system-ui,sans-serif;direction:ltr}
#rumiPanel header,#rumiSearch div,.rumi-tools{display:flex;gap:8px;align-items:center}#rumiPanel header{justify-content:space-between}
#rumiPanel button,#rumiPanel input{font:inherit;border:1px solid #b7ad96;border-radius:7px;padding:7px 10px;background:#fffdf7;color:#252a23;min-height:38px}
#rumiPanel button{cursor:pointer}#rumiPanel button:hover{background:#eee3c9}#rumiPanel input{min-width:0;width:100%}
#rumiSearch label{font-size:13px}#rumiStatus{margin:0;font-size:13px;color:#635e50}
#rumiText{overflow:auto;flex:1;min-height:0;overscroll-behavior:contain;font-size:var(--rumi-font,18px);touch-action:pan-y}
#rumiText h3{font-size:16px;margin:10px 0;color:#77581c}#rumiText h4{font-size:14px;color:#526052}#rumiText p{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.9;margin:10px 0 24px}
#rumiText .rumi-result{display:block;width:100%;text-align:left;margin:8px 0;white-space:pre-wrap;overflow-wrap:anywhere}#rumiResize{display:none}
body.rumi-open .wrapper{width:58vw;padding:80px 16px 48px}body.rumi-open #flipbook{max-width:100%;width:100%;height:calc(var(--kiosk-height,100dvh) - 128px);max-height:calc(var(--kiosk-height,100dvh) - 128px)}
body.rumi-open .counter{left:29vw}body.rumi-open .viewer-hint{display:none}
#toggleRumi[aria-expanded="true"]{background:#c79a3d;color:#17120b}
@media(max-width:760px){
    .topbar{left:10px;right:10px;justify-content:flex-end;gap:5px}.topbar .btn{padding:7px 8px;font-size:12px}
    #rumiPanel{top:auto;left:8px;right:8px;bottom:8px;width:auto;height:var(--rumi-height,42dvh);padding:10px;gap:7px}
    #rumiResize{display:block;height:14px;flex-shrink:0;cursor:ns-resize;touch-action:none;border-top:4px solid #b6a373;width:65px;align-self:center;border-radius:4px}
    body.rumi-open .wrapper{width:100vw;height:calc(var(--kiosk-height,100dvh) - var(--rumi-height,42dvh) - 16px);padding:88px 12px 28px}
    body.rumi-open #flipbook{height:100%;max-height:100%;max-width:100%}body.rumi-open .counter{left:50%;bottom:calc(var(--rumi-height,42dvh) + 20px);font-size:11px}
}
/* Compact reading controls for phones, including landscape. */
.rumi-mobile-controls{display:none}
#rumiFocus[hidden],#rumiText[hidden]{display:none!important}
#rumiFocus{display:flex;flex:1;min-height:0;flex-direction:column;gap:8px}
#rumiFocus nav{display:flex;align-items:center;justify-content:space-between;gap:4px;flex-shrink:0}
#rumiFocus nav button{font-size:12px;padding:6px;min-height:36px}#rumiExcerptCount{font-size:12px;white-space:nowrap}
#rumiFocusScroll{overflow:auto;min-height:0;flex:1;overscroll-behavior:contain;touch-action:pan-y;font-size:var(--rumi-font,18px)}
#rumiFocusTitle{font-size:13px;color:#77581c;margin:4px 0 10px}#rumiFocusBody{white-space:pre-wrap;line-height:1.85;overflow-wrap:anywhere;margin:10px 0 24px}
#rumiSource summary{cursor:pointer;font-size:13px;color:#056074;padding:6px 0}#rumiSourceCanvas{max-width:100%;height:auto;display:block;background:#ede4cf}
@media(max-width:760px),(max-width:1100px) and (max-height:600px){
    .rumi-mobile-controls{display:flex;gap:4px;margin-left:auto}
    #rumiPanel header{gap:5px;flex-shrink:0}#rumiPanel header strong{font-size:14px}#rumiPanel header button{font-size:11px;padding:5px 7px;min-height:34px}
    #rumiPanel:not(.show-rumi-options) #rumiSearch,#rumiPanel:not(.show-rumi-options) .rumi-tools{display:none}
    body.rumi-focus-mode #rumiStatus{display:none}
    #rumiPanel.show-rumi-options #rumiSearch{flex-shrink:0}#rumiPanel.show-rumi-options .rumi-tools{flex-shrink:0}
    body.rumi-expanded #rumiPanel{position:fixed;top:84px;bottom:8px;left:8px;right:8px;width:auto;height:auto}
    body.rumi-expanded #rumiResize{display:none}
    body.rumi-expanded .rumi-region-layer{visibility:hidden}
}
@media(min-width:761px) and (max-width:1100px) and (max-height:600px){
    .kiosk-brand{display:none}.kiosk-title{left:12px;right:12px;top:8px;width:auto;transform:none;text-align:left;font-size:13px}
    .topbar{top:30px;right:10px;gap:5px}.topbar .btn{font-size:12px;padding:6px 8px;min-height:32px}
    #rumiPanel{top:72px;bottom:8px;right:8px;width:52vw;padding:10px;gap:5px}
    body.rumi-open .wrapper{width:46vw;padding:74px 8px 28px;height:var(--kiosk-height,100dvh)}
    body.rumi-open #flipbook{height:100%;max-height:100%;max-width:100%}
    body.rumi-open .counter{left:23vw;bottom:6px;font-size:10px}
}
@media(min-width:761px) and (max-width:1100px) and (max-height:600px){
    body .kiosk-brand{display:none}body .kiosk-title{left:12px;right:12px;top:8px;width:auto;transform:none;text-align:left;font-size:13px}
    body .topbar{top:30px;right:10px;gap:5px}
}

/* Wide screens: each transcript stays beside its physical manuscript leaf. */
@media(min-width:1200px) and (min-aspect-ratio:4/3){
 #rumiPanel{inset:70px 16px 16px;width:auto;padding:0;border:0;background:transparent;box-shadow:none;pointer-events:none;display:grid;grid-template-columns:1fr 2fr 1.5fr;grid-template-rows:48px 36px 1fr;gap:8px}
 #rumiPanel>header,#rumiPanel>#rumiSearch,#rumiPanel>.rumi-tools,#rumiPanel>#rumiStatus{pointer-events:auto;background:#faf6ed;border-radius:8px;padding:6px 12px;min-width:0}
 #rumiPanel>header{grid-column:1}#rumiPanel>#rumiSearch{grid-column:2;display:flex;align-items:center;gap:8px}#rumiSearch label{white-space:nowrap}#rumiSearch div{flex:1;min-width:0}
 #rumiPanel>.rumi-tools{grid-column:3}#rumiPanel>#rumiStatus{grid-column:1/-1}
 #rumiPanel:not(.rumi-searching) #rumiText{display:contents}
 #rumiText .rumi-page{position:fixed;top:174px;bottom:16px;width:23vw;overflow:auto;overscroll-behavior:contain;pointer-events:auto;padding:16px;background:#faf6ed;border:1px solid #cab98e;border-radius:12px;font-size:var(--rumi-font,18px);box-shadow:0 8px 24px #0004}
 #rumiText .rumi-page-left{left:16px}#rumiText .rumi-page-right{right:16px}
 body.rumi-open .wrapper{width:50vw;margin-left:25vw;padding:174px 8px 48px}
 body.rumi-open #flipbook{height:calc(var(--kiosk-height,100dvh) - 222px);max-height:calc(var(--kiosk-height,100dvh) - 222px)}
 body.rumi-open .counter{left:50%}
 #rumiPanel.rumi-searching #rumiText{grid-column:1/-1;pointer-events:auto;background:#faf6ed;border-radius:12px;padding:16px;max-width:700px;justify-self:end;width:100%}
}
#rumiKind{font:inherit;min-width:0;max-width:100%;border:1px solid #b7ad96;border-radius:7px;padding:7px;background:#fffdf7;color:#252a23}
.rumi-tools{flex-wrap:wrap}
