* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #1b1b1f; overflow: hidden; font-family: "Schibsted Grotesk", sans-serif; }

#viewport { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
#stage { position: absolute; width: 1200px; height: 675px; left: 50%; top: 50%; transform-origin: 0 0; overflow: hidden; background: #fff; }

.slide { position: absolute; inset: 0; overflow: hidden; animation: slideIn .45s ease; }
.slide.popup-layer { background: rgba(0, 0, 0, .55); animation: fadeIn .25s ease; z-index: 100000; }
@keyframes slideIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.el { position: absolute; }
.el.clickable { cursor: pointer; }
.el.clickable:hover { filter: brightness(1.08); }
.el.draggable { cursor: grab; touch-action: none; }
.el.draggable.dragging { cursor: grabbing; }

.img-frame { position: relative; width: 100%; height: 100%; overflow: hidden; }
.img-frame > div { position: absolute; }
.img-frame img { display: block; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; pointer-events: none; }

.svg-box, .svg-box svg { width: 100%; height: 100%; display: block; }

.txt { width: 100%; height: 100%; overflow-wrap: break-word; }
.txt p { margin: 0; }
.txt.ip-medium p { margin-bottom: .5em; }
.txt.ip-big p { margin-bottom: 1em; }
.txt ul, .txt ol { margin: 0; padding-left: 1.3em; }
.txt.text-align-center { text-align: center; }
.txt.text-align-left { text-align: left; }
.txt.text-align-justify { text-align: justify; }

@keyframes scaleInCenter { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.fx-scale-in-center { animation-name: scaleInCenter; animation-fill-mode: both; animation-timing-function: cubic-bezier(.25, .46, .45, .94); }

/* Videos */
.video-box { position: absolute; display: flex; align-items: center; justify-content: center; }
.video-box video { width: 100%; height: 100%; background: #000; border-radius: 10px; box-shadow: 0 4px 18px rgba(0, 0, 0, .35); display: block; }
.el.until-end { visibility: hidden; }

/* Flashcards */
.card { perspective: 1200px; cursor: pointer; }
.card-inner { position: relative; width: 100%; height: 100%; transition: transform .6s; transform-style: preserve-3d; }
.card.flipped .card-inner { transform: rotateY(180deg); }
.card-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; box-shadow: 0 1px 8px rgba(0, 15, 51, .25); }
.card-back { transform: rotateY(180deg); }
.card-flip-icon { position: absolute; right: -8px; bottom: -8px; width: 62px; height: 62px; border-radius: 50%; background: #2f5877; color: #fff; display: flex; align-items: center; justify-content: center; padding: 0 6px 6px 0; z-index: 100000; pointer-events: none; }
.card-flip-icon svg { width: 22px; height: 22px; }
.card:hover .card-inner { box-shadow: none; }
.card.tilt:hover:not(.flipped) .card-inner { transform: rotateX(4deg) rotateY(-6deg); }

/* Quiz */
.quiz { display: flex; flex-direction: column; justify-content: center; gap: 22px; padding: 20px; border-radius: 12px; }
.quiz-q { font-weight: 700; text-align: center; }
.quiz-answers { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.quiz.vertical .quiz-answers { flex-direction: column; align-items: stretch; }
.quiz-a { border: 3px solid transparent; border-radius: 12px; padding: 14px 18px; cursor: pointer; font: inherit; flex: 1 1 0; min-width: 150px; transition: transform .15s, border-color .15s, opacity .2s; }
.quiz-a:hover:not(:disabled) { transform: translateY(-3px); }
.quiz-a:disabled { cursor: default; }
.quiz-a.correct { border-color: #2fbf5b; box-shadow: 0 0 0 3px #2fbf5b; }
.quiz-a.wrong { border-color: #e03131; box-shadow: 0 0 0 3px #e03131; }
.quiz-a.dim { opacity: .45; }
.quiz-a img { display: block; max-width: 100%; max-height: 230px; margin: 0 auto; border-radius: 8px; }
/* Image quizzes: pictures side by side under the question, always fitting the box */
.quiz.image .quiz-answers { flex-direction: row; flex-wrap: nowrap; align-items: stretch; flex: 1 1 auto; min-height: 0; }
.quiz.image .quiz-a { padding: 6px; background: transparent !important; min-width: 0; display: flex; }
.quiz.image .quiz-a img { width: 100%; height: 100%; max-height: none; object-fit: cover; }
.quiz-q.light { text-shadow: 0 2px 6px rgba(0, 0, 0, .75), 0 0 2px rgba(0, 0, 0, .9); }
.quiz-fb {text-align: center; font-weight: 700; min-height: 1.4em; padding: 10px 16px; border-radius: 10px; background: rgba(255, 255, 255, .92); align-self: center; }
.quiz-fb:empty { visibility: hidden; }
.quiz-fb.secret { display: flex; align-items: center; gap: 16px; padding: 10px 14px 10px 20px; border: 3px solid #bd6822; color: #3a2310 !important; animation: pop .35s ease; }
.secret-letter { display: inline-flex; align-items: center; justify-content: center; min-width: 1.9em; height: 1.9em; border-radius: 10px; background: #bd6822; color: #fff; font-size: 1.7em; font-weight: 800; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Find the pair */
.pairs { display: grid; gap: 12px; width: 100%; height: 100%; }
.pair-card { perspective: 800px; cursor: pointer; }
.pair-card .card-inner { border-radius: 10px; }
.pair-card.open .card-inner, .pair-card.done .card-inner { transform: rotateY(180deg); }
.pair-card .card-face { border-radius: 10px; background: #fff center/cover no-repeat; }
.pair-card .card-front { background-size: cover; }
.pair-card .card-back { background-size: contain; }
.pair-card.done { cursor: default; }
.pair-card.done .card-face { box-shadow: 0 0 0 4px #2fbf5b; }

/* Juxtapose */
.jux { position: relative; width: 100%; height: 100%; overflow: hidden; user-select: none; touch-action: none; cursor: ew-resize; }
.jux img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.jux .jux-top { position: absolute; inset: 0; }
.jux .jux-handle { position: absolute; top: 0; bottom: 0; width: 4px; margin-left: -2px; background: #fff; box-shadow: 0 0 6px rgba(0, 0, 0, .5); }
.jux .jux-handle::after { content: "\2039  \203A"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 44px; height: 44px; border-radius: 50%; background: #fff; color: #333; font-size: 22px; line-height: 42px; text-align: center; white-space: pre; box-shadow: 0 1px 6px rgba(0, 0, 0, .4); }

/* Chrome */
.nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 64px; border: 0; border-radius: 10px; background: rgba(40, 40, 46, .75); color: #fff; font-size: 38px; line-height: 1; cursor: pointer; z-index: 10; }
.nav:hover { background: rgba(40, 40, 46, .95); }
.nav:disabled { opacity: 0; pointer-events: none; }
#prev { left: 10px; }
#next { right: 10px; }
#counter { position: absolute; bottom: 8px; right: 14px; color: rgba(255, 255, 255, .7); font-size: 13px; z-index: 10; }

#menu-btn { position: absolute; right: 12px; bottom: 30px; width: 40px; height: 40px; border: 0; border-radius: 10px; background: rgba(40, 40, 46, .75); color: #fff; font-size: 26px; line-height: 1; cursor: pointer; z-index: 10; }
#menu-btn:hover { background: rgba(40, 40, 46, .95); }
#menu { position: fixed; top: 0; right: 0; bottom: 0; width: min(340px, 100vw); background: #fff; z-index: 40; box-shadow: -6px 0 30px rgba(0, 0, 0, .35); display: flex; flex-direction: column; }
#menu[hidden] { display: none; }
.menu-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid #e6e6ea; }
.menu-head strong { flex: 1; font-size: 18px; }
.menu-head button { border: 0; background: #f0f0f4; border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 14px; cursor: pointer; }
#menu-close { font-size: 20px; line-height: 1; }
#menu-list { list-style: none; margin: 0; padding: 6px 0; overflow-y: auto; flex: 1; }
#menu-list button { display: flex; gap: 10px; width: 100%; text-align: left; border: 0; background: none; padding: 9px 16px; font: inherit; font-size: 15px; cursor: pointer; color: #222; }
#menu-list button:hover { background: #f4f1ea; }
#menu-list button.active { background: #f7e3cc; font-weight: 700; }
#menu-list .num { color: #999; min-width: 2em; }
#menu-list .t { display: flex; flex-direction: column; gap: 2px; }
#menu-list small { color: #8a8a8a; font-size: 12.5px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#menu-list small:empty { display: none; }
#menu-list .menu-section { position: sticky; top: 0; z-index: 1; margin-top: 8px; padding: 9px 16px; background: #f7efe3; color: #7a4a1e; font-weight: 700; font-size: 14px; border-top: 1px solid #ecdcc6; border-bottom: 1px solid #ecdcc6; }
#menu-list .menu-section:first-child { margin-top: 0; }

#lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .85); display: flex; align-items: center; justify-content: center; z-index: 50; cursor: zoom-out; }
#lightbox[hidden] { display: none; }
#lightbox img { max-width: 94vw; max-height: 94vh; box-shadow: 0 8px 40px rgba(0, 0, 0, .6); }

#tooltip { position: fixed; z-index: 60; max-width: 320px; padding: 16px 20px; background: #fff; color: #000; border-radius: 10px; box-shadow: 0 4px 20px rgba(0, 0, 0, .3); font-size: 16px; pointer-events: none; }
#tooltip[hidden] { display: none; }
#tooltip p { margin: 0; }

#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 70; }
