/* 📖 the answer on Wikipedia (client/db/wiki.js): its panel's styles — shared by /db and the tossups page's category check
   (the user, 2026-10-29: "make the right sidebar of the category check also able to be turned into the right sidebar of the
   database page"); moved here from /db's page as they were */
/* 📖 the answer on Wikipedia (wiki.js): a panel on the right — beside the questions on wide screens, a sheet above the reader bar on narrow ones */
:root { --wk-w: 360px; }   /* the panel's width: dragged at its left edge (#wk-grip), kept in qb-wiki-w */
#wk-panel { position: fixed; z-index: 1028; right: .75rem; top: var(--wk-top, 4.5rem); bottom: calc(var(--rd-bar, 4rem) + 1rem); width: var(--wk-w); overflow-y: auto;
    background: var(--bs-body-bg, #fff); border: 1px solid rgba(128, 128, 128, .35); border-radius: .6rem; box-shadow: 0 .4rem 1.2rem rgba(0, 0, 0, .15); padding: .6rem .8rem; }
#wk-panel .wk-head { display: flex; align-items: center; gap: .5rem; position: sticky; top: -.6rem; background: inherit; padding: .2rem 0 .4rem; margin-top: -.2rem; }
#wk-panel .wk-title { flex: 1; font-size: .95rem; }
#wk-panel .wk-tabs { display: flex; flex-wrap: wrap; gap: .25rem; margin-bottom: .5rem; }
#wk-panel .wk-tab { font-size: .75rem; border: 1px solid rgba(128, 128, 128, .35); background: none; border-radius: 1rem; padding: .05rem .55rem; color: inherit;
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }   /* (a long page title: cut, whole on hover) */
#wk-panel .wk-tab.on { background: rgba(78, 121, 167, .25); border-color: rgba(78, 121, 167, .6); font-weight: 600; }
#wk-panel .wk-tab.ans { border-color: rgba(63, 178, 127, .6); }
#wk-panel .wk-tab.none { opacity: .5; text-decoration: line-through; }
#wk-panel .wk-tab.clue { border-color: rgba(176, 122, 161, .7); }
#wk-panel .wk-tab.clue.on { background: rgba(176, 122, 161, .25); }
#wk-panel .wk-tab.cl { border-style: dashed; }
#wk-panel .wk-clue { border: 1px solid rgba(176, 122, 161, .45); background: rgba(176, 122, 161, .07); border-radius: .5rem; padding: .5rem .6rem; margin-bottom: .6rem; }
#wk-panel .wk-clue-h { font-weight: 600; font-size: .85rem; margin-bottom: .2rem; }
#wk-panel .wk-exp { font-size: .88rem; margin-bottom: .4rem; }
#wk-panel .wk-terms { font-size: .8rem; padding-left: 1.1rem; margin-bottom: .4rem; }
#wk-panel .wk-pass p { margin: .3rem 0; }
#wk-panel .wk-pics { display: flex; flex-wrap: wrap; gap: .4rem; margin: .2rem 0 .5rem; }
#wk-panel .wk-pics .wk-pic { flex: 1 1 calc(50% - .4rem); min-width: 0; font-size: .72rem; text-align: center; }
#wk-panel .wk-pics .wk-pic:only-child { flex-basis: 100%; }
#wk-panel .wk-pic { position: relative; }
#wk-panel .wk-pic > a { display: block; text-decoration: none; color: inherit; }
#wk-panel .wk-x { position: absolute; top: .25rem; right: .25rem; border: 0; border-radius: 50%; width: 1.5rem; height: 1.5rem; padding: 0; font-size: .72rem; line-height: 1.5rem; background: rgba(0, 0, 0, .55); color: #fff; opacity: 0; transition: opacity .15s; }
#wk-panel .wk-pic:hover .wk-x, #wk-panel .wk-x:focus { opacity: .9; }
@media (hover: none) { #wk-panel .wk-x { opacity: .55; } }
#wk-panel .wk-where { border-left: 3px solid rgba(232, 176, 36, .85); background: rgba(232, 176, 36, .09); border-radius: .25rem; padding: .3rem .55rem; margin-bottom: .6rem; font-size: .88rem; }
#wk-panel .wk-where:empty { display: none; }
#wk-panel .wk-where p { margin: .15rem 0 0; }
#wk-panel mark { background: rgba(232, 176, 36, .42); color: inherit; padding: 0 .08rem; border-radius: .15rem; }
#wk-panel .wk-samel, #wk-panel .wk-morel { margin: .3rem 0 .5rem; }
#wk-panel .wk-samel summary, #wk-panel .wk-morel summary { cursor: pointer; font-weight: 600; }
#wk-panel .wk-samel ul, #wk-panel .wk-morel ul { padding-left: 1.1rem; margin: .25rem 0 .3rem; }
#wk-panel .wk-samel li, #wk-panel .wk-morel li { margin: .2rem 0; line-height: 1.3; }
#wk-panel .wk-morel li.wk-was a { opacity: .65; }
#wk-panel .wk-heard { color: #3fb27f; font-weight: 600; }
#wk-panel .wk-idea-in { border-left: 3px solid rgba(78, 121, 167, .7); background: rgba(78, 121, 167, .08); border-radius: .25rem; padding: .35rem .55rem; margin: .1rem 0 .6rem; font-size: .84rem; }
#wk-panel .wk-idea-in p { margin: .15rem 0; }
#wk-panel .wk-idea-h { font-weight: 600; font-size: .8rem; margin-bottom: .15rem; }
#wk-panel .wk-pics img { width: 100%; height: clamp(220px, 38vh, 520px); object-fit: contain; background: rgba(128, 128, 128, .08); border-radius: .35rem; display: block; }
#wk-panel .wk-pics span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; opacity: .7; margin-top: .1rem; }
#wk-panel .wk-scores { margin: .2rem 0 .5rem; }
#wk-panel .wk-scores .wk-pic { font-size: .72rem; margin-bottom: .4rem; }
#wk-panel .wk-scores img { width: 100%; max-height: min(40vh, 420px); object-fit: contain; background: #fff; border-radius: .35rem; padding: .3rem; display: block; }
#wk-panel .wk-scores span { display: block; opacity: .7; margin-top: .1rem; }
#wk-panel .wk-aud { margin: .2rem 0 .5rem; }
#wk-panel .wk-aud audio { width: 100%; height: 36px; display: block; margin-top: .15rem; }
#wk-panel .wk-sheet { margin: .1rem 0 .6rem; }
#wk-panel .wk-sites { margin-bottom: .4rem; }
#wk-panel .wk-site { margin: .3rem 0; }
#wk-panel .wk-snip { color: var(--bs-secondary-color, #6c757d); font-size: .78rem; line-height: 1.3; }
#wk-panel .wk-caret { animation: wk-blink 1s steps(1) infinite; opacity: .6; }
@keyframes wk-blink { 50% { opacity: 0; } }
#wk-panel .wk-auto { font-size: .75rem; color: #8a919c; display: inline-flex; gap: .25rem; align-items: center; white-space: nowrap; }
#wk-panel .wk-img { width: 100%; max-height: min(62vh, 760px); object-fit: contain; border-radius: .4rem; margin-bottom: .5rem; background: rgba(128, 128, 128, .08); }
#wk-panel .wk-text p { font-size: .88rem; margin-bottom: .5rem; }
#wk-panel .wk-links { margin: .3rem 0 .5rem; }
#wk-panel .wk-more, #wk-panel .wk-src { margin-top: .3rem; }
/* the navigation bar's menus (Tools ▾) open over the panel, not behind it (the user, 2026-11-14) */
.navbar .dropdown-menu { z-index: 1040; }
#wk-sel { position: absolute; z-index: 1030; padding: 0 .35rem; font-size: .85rem; box-shadow: 0 .2rem .5rem rgba(0, 0, 0, .2); }
#wk-grip { position: fixed; z-index: 1029; top: var(--wk-top, 4.5rem); bottom: calc(var(--rd-bar, 4rem) + 1rem); right: calc(.75rem + var(--wk-w) - 6px); width: 12px; cursor: ew-resize; display: none; touch-action: none; }
#wk-grip::after { content: ''; position: absolute; left: 4px; top: 50%; height: 3rem; margin-top: -1.5rem; width: 4px; border-radius: 2px; background: rgba(128, 128, 128, .45); }
#wk-grip:hover::after, #wk-grip.on::after { background: rgba(78, 121, 167, .85); }
@media (min-width: 1200px) {
    body.wk-open #wk-grip { display: block; }
    /* the reader bar centred in the room beside the panel, which then runs the window's full height (wk-tall: the
       bar clears it — wiki.js checks, as the panel is shown, dragged or the window resized) */
    body.wk-open #rd-bar, body.wk-open #rd-now { left: calc((100vw - var(--wk-w) - 30px) / 2); }
    body.wk-open #rd-bar { max-width: calc(100vw - var(--wk-w) - 46px); justify-content: center; }   /* it wraps rather than run off the screen */
    body.wk-open.wk-tall #wk-panel, body.wk-open.wk-tall #wk-grip { bottom: .75rem; }
    /* the questions keep their usual width (≤ 1320 px), centred in the room the panel leaves */
    body.wk-open .container-xl { --wk-col: min(1320px, calc(100vw - var(--wk-w) - 50px)); max-width: var(--wk-col);
        margin-right: calc(var(--wk-w) + 30px); margin-left: max(1rem, calc((100vw - var(--wk-w) - 30px - var(--wk-col)) / 2)); }
}
@media (max-width: 1199px) { #wk-panel { left: .5rem; right: .5rem; width: auto; top: auto; max-height: 45vh; } }
/* a tablet (an iPad, either way up): the panel a column on the right, the reading beside it — not the sheet across the bottom, which
   covered the card it explains (the user, 2026-11-13: "on ipad I want the pictures to show on the right") */
@media (min-width: 768px) and (max-width: 1199px) and (min-height: 501px) {
    /* its width dragged at its left edge, as on a wide screen (the user, 2026-11-13: "I want the ability to adjust the size of the right
       panel") — a wider handle for a finger; 44% of the screen until it is dragged (kept in this browser: qb-wiki-w) */
    :root { --wk-w: min(44vw, 470px); }
    #wk-panel { left: auto; right: .5rem; top: var(--wk-top, 4.5rem); bottom: calc(var(--rd-bar, 4rem) + .6rem); width: var(--wk-w); max-height: none; }
    body.wk-open #wk-grip { display: block; right: calc(.5rem + var(--wk-w) - 14px); width: 28px; bottom: calc(var(--rd-bar, 4rem) + .6rem); }
    body.wk-open #wk-grip::after { left: 11px; width: 6px; height: 4.5rem; margin-top: -2.25rem; background: rgba(128, 128, 128, .7); }
    body.wk-open .container-xl { width: auto; max-width: none; margin-left: .5rem; margin-right: calc(var(--wk-w) + 1rem); }
    body.wk-open #rd-now { left: .5rem; right: calc(var(--wk-w) + 1rem); width: auto; transform: none; }
}
/* a phone turned sideways (short and wide): the panel a column on the right and the reading beside it, the "now reading" box in the
   reading's column — as a sheet above the bar it covered the card (the user, 2026-10-30: "make the snapping to answers and questions
   work properly when my phone is rotated horizontally") */
@media (max-height: 500px) and (pointer: coarse) and (min-width: 568px) {
    #wk-panel { left: auto; right: .5rem; top: .5rem; bottom: calc(var(--rd-bar, 3rem) + .4rem); width: 44vw; max-height: none; }
    body.wk-open .container-xl { width: auto; max-width: none; margin-left: .5rem; margin-right: calc(44vw + 1rem); }
    body.wk-open #rd-now { left: .5rem; right: calc(44vw + 1rem); width: auto; transform: none; }
}
#wk-panel .wk-tab.mn { border-color: rgba(198, 40, 40, .55); }
#wk-panel .wk-mn img { cursor: zoom-in; }
/* the picture's room kept before it arrives (3:2, its own shape once it is in) and a short fade as it lands: the panel's text does not
   jump down under the reader's eyes */
#wk-panel .wk-mn .mn-pic > img { aspect-ratio: auto 3 / 2; background: rgba(128, 128, 128, .12); animation: wk-pic-in .18s ease-out; }
@keyframes wk-pic-in { from { opacity: .35; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { #wk-panel .wk-mn .mn-pic > img { animation: none; } }
