/* Duo on the board (content/duo-board.js): the setup card, the full-screen board and the end
   postcard are the Cloodit DAY theme — the student Duo page's look (activity-theme.css, duo.css,
   levels-trail.css) so students would see the same cards, keys and explanations. The page around
   it stays the corpus night shell. Two palettes on purpose, copied as they are: the question area
   uses Duo's own older values (#2C3E50 text, #7FB069 green), the chrome the trail's (#2B1C50 ink,
   #77C043 green). The class editor panel reuses the shared night board look (bingo-board.css). */

#duoApp {
    --d-paper: #FBF6EA; --d-paper-line: #E6DCC4; --d-paper-rule: #D8CDB2; --d-paper-muted: #8A7A5A; --d-paper-gold: #B7791F;
    --d-ink: #2B1C50; --d-purple: #7C2BF5; --d-purple-hover: #8F45FF; --d-gold: #FBBF24;
    --d-good-ink: #4E9E1E; --d-low-ink: #E06A24; --d-low-bg: #FDE9D6;
    --d-glass: rgba(20,10,40,.62); --d-glass-hover: rgba(20,10,40,.78);
    --d-text: #2C3E50; --d-green: #7FB069; --d-green-line: #6A9B5A; --d-red: #E76B74; --d-red-line: #D5565F;
    --d-display: 'Baloo 2', 'Fredoka', ui-rounded, system-ui, sans-serif;
    --d-body: 'Nunito Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --d-script: 'Caveat', cursive;
    --d-mono: Monaco, 'Courier New', monospace;
}

/* ── The sky: one layer per biome, used by the setup card and the board ───── */
.d-sky {
    --sky: #96C4D8;
    position: absolute; inset: 0; overflow: hidden; background-color: var(--sky);
    pointer-events: none;
}
.d-sky[data-biome="reef"] { --sky: #81C4D7; }
.d-sky[data-biome="deepsea"] { --sky: #002C59; }
.d-sky[data-biome="space"] { --sky: #000; }
.d-sky img { position: absolute; display: block; height: auto; }
.d-sky .sky-sun { right: 2%; bottom: 12%; width: clamp(80px, 12%, 170px); }
.d-sky .cloud-c1a { left: 5%; top: 16%; width: clamp(70px, 11.6%, 130px); opacity: .95; }
.d-sky .cloud-c6a { left: 82%; top: 42%; width: clamp(64px, 10.7%, 120px); opacity: .95; }
.d-sky .cloud-c2a { left: 10%; top: 52%; width: clamp(54px, 8.6%, 96px); opacity: .9; }
.d-sky .cloud-c5a { left: 62%; bottom: 16%; width: clamp(80px, 13.4%, 150px); opacity: .95; }
.d-sky .cloud-c1b { left: 87%; top: 24%; width: clamp(44px, 7.1%, 80px); opacity: .85; }
.d-sky .cloud-c6b { left: 30%; bottom: 20%; width: clamp(46px, 7.5%, 84px); opacity: .85; }
.d-sky .cloud-c2b { left: 2%; bottom: 14%; width: clamp(60px, 9.8%, 110px); opacity: .9; }
.d-sky .sky-fish { top: 64%; width: 40%; transform: translateY(-50%); opacity: .9; }
.d-sky .fish-right { right: -12%; }
.d-sky .fish-left { left: -12%; }
.d-sky .sky-planets { left: -3%; top: 62%; width: clamp(110px, 14%, 220px); transform: translateY(-60%); opacity: .95; }
.d-shade { position: absolute; left: 0; right: 0; top: 0; height: 130px; background: linear-gradient(180deg, rgba(11,16,32,.55), rgba(11,16,32,0)); pointer-events: none; }
.d-strip { position: absolute; left: 0; right: 0; bottom: 0; height: 60px; background-repeat: repeat-x; background-position: left bottom; background-size: auto 60px; pointer-events: none; }
.d-strip.is-space { background-repeat: no-repeat; background-size: cover; }

/* ── Setup: one paper postcard on the sky ─────────────────────────────────── */
.d-setup { position: relative; min-height: 460px; border-radius: 20px; overflow: hidden; display: grid; place-items: center; padding: 34px 16px 78px; box-shadow: 0 20px 44px rgba(11,16,32,.35); }
.d-paper {
    position: relative; width: min(100%, 640px);
    background: var(--d-paper); color: var(--d-ink); border: 1px solid var(--d-paper-line); border-radius: 16px;
    padding: 22px 26px 20px; box-shadow: 0 14px 0 -6px rgba(0,0,0,.08), 0 18px 34px rgba(0,0,0,.25);
}
.d-kicker { font: 700 1.35rem/1 var(--d-script); color: var(--d-paper-gold); }
.d-h { margin: 2px 0 4px; font: 800 1.7rem/1.15 var(--d-display); color: var(--d-ink); }
.d-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 12px 0 4px; }
.d-label { font-size: .72rem; letter-spacing: 1.5px; font-weight: 900; color: var(--d-paper-muted); text-transform: uppercase; min-width: 96px; }
.d-note { margin: 0; font-size: .88rem; color: var(--d-paper-muted); font-weight: 600; }
.d-note.is-warn { color: var(--d-low-ink); }

.d-stepper { display: flex; align-items: center; gap: 8px; width: 100%; }
.d-step {
    appearance: none; cursor: pointer; flex: none; width: 40px; height: 40px; border-radius: 12px;
    border: 1px solid var(--d-paper-rule); background: #fff; color: var(--d-ink); font: 800 1.3rem/1 var(--d-display);
}
.d-step:hover:not(:disabled) { background: #F4EEDC; }
.d-step:disabled { opacity: .4; cursor: default; }
.d-select {
    flex: 1; min-width: 0; height: 40px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--d-paper-rule);
    background: #fff; color: var(--d-ink); font: 800 .95rem/1 var(--d-body);
}
.d-select option:disabled { color: #aaa; }

.d-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.d-pill {
    appearance: none; cursor: pointer; padding: 7px 14px; border-radius: 999px;
    border: 1px solid var(--d-paper-rule); background: #fff; color: var(--d-ink); font: 800 .9rem/1.2 var(--d-body);
}
.d-pill[aria-pressed="true"] { background: var(--d-purple); border-color: transparent; color: #fff; }
.d-pill:disabled { opacity: .45; cursor: default; }

.d-more { margin-top: 12px; border-top: 1px dashed var(--d-paper-rule); padding-top: 8px; }
.d-more > summary { cursor: pointer; list-style: none; font: 800 .92rem/1.2 var(--d-body); color: var(--d-purple); padding: 4px 0; }
.d-more > summary::-webkit-details-marker { display: none; }
.d-more > summary::after { content: ' ▾'; }
.d-more[open] > summary::after { content: ' ▴'; }

.d-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 16px; }
.d-btn {
    appearance: none; cursor: pointer; border: 0; border-radius: 14px; padding: 12px 26px;
    background: var(--d-purple); color: #fff; font: 800 1.1rem/1.2 var(--d-display); box-shadow: 0 4px 0 rgba(0,0,0,.2);
}
.d-btn:hover:not(:disabled) { background: var(--d-purple-hover); }
.d-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,.2); }
.d-btn:disabled { opacity: .45; cursor: default; }
.d-btn--green { background: #77C043; color: #16330a; }
.d-btn--green:hover:not(:disabled) { background: #88D152; }
.d-link {
    appearance: none; cursor: pointer; background: none; border: 0; padding: 4px 2px;
    font: 800 .92rem/1.2 var(--d-body); color: var(--d-purple); text-decoration: underline;
}
.d-link:hover { color: var(--d-purple-hover); }
.d-resume { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 14px; padding: 10px 14px; border-radius: 12px; background: #fff; border: 1px solid var(--d-paper-rule); font-weight: 700; }
.d-empty { margin: 0; padding: 20px 0; font-weight: 700; color: var(--d-paper-muted); }

#duoApp .bg-names { margin-top: 14px; }

/* ── The board (full screen) ──────────────────────────────────────────────── */
html.bg-no-scroll, html.bg-no-scroll body { overflow: hidden; }
.d-stage {
    position: fixed; inset: 0; z-index: 2000; overflow: hidden; container-type: size;
    font-family: var(--d-body); color: var(--d-text);
}
.d-stage[data-sky="dark"] { --d-onsky: #EAE4FF; }
.d-stage { --d-onsky: var(--d-text); }
.d-hud {
    position: absolute; z-index: 5; left: 2cqw; right: 2cqw; top: 1.6cqh;
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1.5cqw;
}
.d-hud-l, .d-hud-r { display: flex; align-items: center; gap: .8cqw; }
.d-hud-r { justify-content: flex-end; }
.d-title { font: 800 2.9cqh/1 var(--d-display); color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,.4); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 44cqw; }
.d-chip {
    appearance: none; cursor: pointer; display: inline-flex; align-items: center; gap: .5cqw;
    background: var(--d-glass); color: #fff; border: 1px solid rgba(255,255,255,.16); border-radius: 16px;
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    padding: 1cqh 1.4cqw; font: 800 2.1cqh/1.1 var(--d-display); text-shadow: 0 1px 6px rgba(0,0,0,.35);
}
.d-chip:hover:not(:disabled) { background: var(--d-glass-hover); }
.d-chip:disabled { opacity: .4; cursor: default; }
.d-chip:focus-visible, .d-btn:focus-visible, .d-pill:focus-visible, .d-step:focus-visible, .d-link:focus-visible, .d-select:focus-visible, .d-card:focus-visible { outline: 3px solid var(--d-gold); outline-offset: 2px; }
.d-chip svg { width: 2.6cqh; height: 2.6cqh; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.d-chip.is-off .d-ic-on { display: none; }
.d-chip:not(.is-off) .d-ic-off { display: none; }
.d-chip .d-fs-exit { display: none; }
.d-chip.is-full .d-fs-enter { display: none; }
.d-chip.is-full .d-fs-exit { display: inline; }

.d-tracker { position: absolute; z-index: 4; right: 2cqw; top: 12cqh; display: grid; gap: .9cqh; }
.d-box {
    width: 4cqh; height: 4cqh; border-radius: 8px; display: grid; place-items: center;
    background: #e2e8f0; border: 2px solid #cbd5e1; color: #64748b; font: 800 1.9cqh/1 var(--d-body);
}
.d-box.is-now { box-shadow: 0 0 0 3px var(--d-gold); }
.d-box.is-right { background: var(--d-green); border-color: var(--d-green-line); color: #fff; }
.d-box.is-wrong { background: #FFB3BA; border-color: #FF4757; color: #7a1020; }
.d-box.is-none { background: #e2e8f0; border: 2px solid #9B8AC4; }

.d-mid {
    position: absolute; z-index: 3; left: 6cqw; right: 8cqw; top: 11cqh; bottom: 11cqh;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3cqh; text-align: center;
}
.d-code {
    max-width: 100%; max-height: 24cqh; overflow: hidden; margin: 0; padding: 2cqh 2.4cqw; border-radius: 14px;
    background: rgba(255,255,255,.55); font: 600 3.2cqh/1.35 var(--d-mono); color: var(--d-text); text-align: left; white-space: pre;
}
.d-q { margin: 0; max-width: 88cqw; font: 600 4.5cqh/1.28 var(--d-body); color: var(--d-onsky); text-shadow: none; white-space: pre-line; }
.d-q code, .d-ex code { font: 600 .92em/1 var(--d-mono); color: #5B8DEE; background: rgba(91,141,238,.1); border: 1px solid rgba(91,141,238,.25); border-radius: 6px; padding: 0 .3em; }
.d-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 3cqw; width: min(100%, 86cqw); }
.d-card {
    position: relative; display: grid; grid-template-rows: 1fr auto; justify-items: center; align-items: center; gap: 1cqh;
    min-height: 26cqh; max-height: 32cqh; padding: 2.4cqh 2cqw 1.6cqh; border-radius: 20px; background: #fff; color: var(--d-text);
    border: 3px solid transparent; box-shadow: 0 8px 24px rgba(0,0,0,.08), 0 1.1cqh 0 rgba(88,119,140,.55);
    font-family: var(--d-mono); font-weight: 700; cursor: pointer; overflow: hidden;
}
.d-card:hover { border-color: #9B8AC4; }
.d-ans { font-size: 4.6cqh; line-height: 1.25; text-align: center; white-space: pre-wrap; overflow-wrap: normal; word-break: normal; hyphens: none; max-width: 100%; }
.d-arrow { font: 700 4cqh/1 var(--d-body); color: #95A5A6; }
.d-card.is-right { background: var(--d-green); border-color: var(--d-green-line); color: #fff; animation: d-up .6s ease both; }
.d-card.is-wrong { background: var(--d-red); border-color: var(--d-red-line); color: #fff; animation: d-down .6s ease both; }
.d-card.is-right .d-arrow, .d-card.is-wrong .d-arrow { color: #fff; }
.d-card.is-dim { opacity: .4; }
@keyframes d-up { 0% { transform: translateY(0); } 40% { transform: translateY(-4cqh) scale(1.04); } 100% { transform: translateY(-3cqh) scale(1.04); } }
@keyframes d-down { 0% { transform: translateY(0); } 20% { transform: translateY(1.4cqh) scale(.95) rotate(-2deg); } 40% { transform: translateY(1cqh) scale(.95) rotate(2deg); } 100% { transform: none; } }

.d-why { padding: .8cqh 2cqw; border-radius: 999px; background: #3C4B66; color: #fff; font: 800 3cqh/1.2 var(--d-display); }
.d-ex-box {
    width: min(100%, 76cqw); max-height: 34cqh; overflow: hidden; padding: 3cqh 3cqw 2.4cqh; border-radius: 20px; background: #fff; color: var(--d-text);
    box-shadow: 0 8px 24px rgba(0,0,0,.12), 0 1.1cqh 0 rgba(88,119,140,.55);
    opacity: 0; transform: translateY(1.5cqh); transition: opacity .35s, transform .35s;
}
.d-ex-box.is-in { opacity: 1; transform: none; }
.d-ex { margin: 0; font: 500 3.1cqh/1.6 var(--d-body); color: var(--d-text); }
.d-ex .w { opacity: 0; transition-property: opacity; transition-timing-function: ease; }
.d-ex .w.on { opacity: 1; }
.d-ex-foot { display: flex; align-items: center; justify-content: center; gap: 2cqw; margin-top: 1.8cqh; min-height: 6cqh; }
.d-ex-mark { font: 800 4cqh/1 var(--d-body); }
.d-ex-mark.is-right { color: var(--d-green-line); }
.d-ex-mark.is-wrong { color: var(--d-red-line); }
.d-next { padding: 1.4cqh 3cqw; font-size: 3cqh; border-radius: 16px; }
.d-next:disabled { opacity: .45; }

.d-lock { position: absolute; z-index: 6; left: 50%; top: 11cqh; transform: translateX(-50%); padding: 1.2cqh 2.4cqw; border-radius: 18px; background: var(--d-glass); color: #fff; font: 800 4cqh/1 var(--d-display); backdrop-filter: blur(8px); }
.d-lock b { color: var(--d-gold); }
.d-toast { position: absolute; z-index: 8; left: 50%; bottom: 9cqh; transform: translateX(-50%); padding: 1cqh 2cqw; border-radius: 14px; background: var(--d-glass); color: #fff; font: 800 2.2cqh/1.2 var(--d-body); }
.d-strip-host { position: absolute; left: 0; right: 0; bottom: 0; height: 60px; }

/* ── The end postcard: the class stamp on paper, the offer as its own smaller card ── */
.d-pc { position: absolute; z-index: 7; inset: 0; display: grid; place-items: center; padding: 4cqh 3cqw; background: rgba(11,16,32,.25); }
.d-pc-set { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 3cqh 4cqw; max-width: 100%; max-height: 100%; }
.d-pc-card, .d-pc-offer {
    box-sizing: border-box; max-height: 100%; overflow: auto; background: var(--d-paper); color: var(--d-ink);
    border: 1px solid var(--d-paper-line); border-radius: 16px; box-shadow: 0 14px 0 -6px rgba(0,0,0,.1), 0 24px 50px rgba(0,0,0,.35);
}
.d-pc-card { width: min(100%, 72cqh); padding: 4cqh 3.4cqw 3.4cqh; transform: rotate(-.6deg); }
.d-pc-offer {
    position: relative; overflow: visible; width: min(100%, 44cqh); display: grid; justify-items: center; gap: 2.4cqh; text-align: center;
    padding: 3.4cqh 3cqh; transform: rotate(3deg);
}
.d-pc-offer .d-pc-head { font-size: 3.1cqh; }
/* Postage stamp on the offer card's corner (the Badges page's .pc-stamp, in board units). */
.d-post {
    position: absolute; top: -4cqh; right: -3cqh; width: 9cqh; height: 11cqh; padding: .6cqh; box-sizing: border-box;
    background: #fff; border: 2px dashed var(--d-paper-rule); transform: rotate(9deg); box-shadow: 0 .6cqh 1.4cqh rgba(0,0,0,.22);
}
.d-post-art { width: 100%; height: 100%; overflow: hidden; background: #E9E3D3; }
/* The badge art is a round picture on white: zoomed so the scene fills the stamp. */
.d-post-art img { display: block; width: 100%; height: 100%; object-fit: cover; transform: scale(1.4); }
.d-pc-l { display: grid; justify-items: center; align-content: center; gap: 1.4cqh; text-align: center; }
.d-stamp {
    width: 15cqh; height: 15cqh; border-radius: 50%; display: grid; place-items: center; position: relative;
    border: .6cqh solid var(--d-good-ink); color: var(--d-good-ink); outline: .35cqh dashed var(--d-good-ink); outline-offset: -1.5cqh; transform: rotate(-8deg);
}
.d-stamp.is-low { border-color: var(--d-low-ink); color: var(--d-low-ink); outline-color: var(--d-low-ink); }
.d-stamp small { position: absolute; top: 3.4cqh; font: 800 1.7cqh/1 var(--d-body); letter-spacing: .4em; }
.d-stamp b { font: 800 6.5cqh/1 var(--d-display); margin-top: 2cqh; }
.d-pc-topic { font: 700 3.4cqh/1.1 var(--d-script); color: var(--d-paper-gold); }
.d-pc-score { font: 800 7.4cqh/1 var(--d-display); color: var(--d-good-ink); }
.d-pc-score.is-low { color: var(--d-low-ink); }
.d-pc-sub { margin: 0; font: 700 2.1cqh/1.3 var(--d-body); color: var(--d-paper-muted); }
.d-pc-btns { display: grid; justify-items: center; gap: 1cqh; }
.d-pc-btn {
    appearance: none; cursor: pointer; padding: 1.3cqh 2.6cqw; border-radius: 14px; border: 1px solid var(--d-paper-rule); background: #fff;
    color: var(--d-ink); font: 800 2.7cqh/1.2 var(--d-display); box-shadow: 0 .5cqh 0 rgba(0,0,0,.2);
}
.d-pc-btn.is-main { background: var(--d-purple); border-color: transparent; color: #fff; }
.d-pc-btn.is-main:hover { background: var(--d-purple-hover); }
.d-pc-btn:focus-visible { outline: 3px solid var(--d-gold); outline-offset: 3px; }
.d-pc-quiet { appearance: none; cursor: pointer; background: none; border: 0; font: 800 2cqh/1.2 var(--d-body); color: var(--d-paper-muted); text-decoration: underline; padding: .4cqh; }
.d-pc-head { margin: 0; font: 800 4.2cqh/1.15 var(--d-display); color: var(--d-ink); }

@media (prefers-reduced-motion: reduce) {
    .d-card.is-right, .d-card.is-wrong { animation: none; }
    .d-ex-box { transition: opacity .2s; transform: none; }
    .d-pc-card, .d-pc-offer { transform: none; }
}

@media (max-width: 640px) {
    .d-paper { padding: 18px 16px 16px; }
    .d-label { min-width: 0; width: 100%; }
}

/* Embedded in the class-progress page: only the board. */
html.bg-embed .hm-aside { display: none !important; }
