.panda-lab {
    --pl-ink: #202e2b;
    --pl-muted: #51605b;
    --pl-accent: #d9ef99;
    --pl-accent-ink: #263c20;
    --pl-line: #d1d9d1;
    --pl-paper: #fffefa;
    --pl-radius: 18px;
    --pl-pad: clamp(2px, .8vw, 12px);
    --pl-scroll-offset: 84px;
    container: panda-lesson / inline-size;
    box-sizing: border-box;
    width: min(100%, 1110px);
    min-width: 0;
    margin: 0 auto;
    padding: 0 var(--pl-pad) var(--pl-pad);
    color: var(--pl-ink);
    font-family: "DM Sans", "Aptos", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 16px;
    line-height: 1.55;
    text-align: start;
    overflow-wrap: break-word;
    -webkit-text-size-adjust: 100%;
}
.panda-lab *, .panda-lab *::before, .panda-lab *::after { box-sizing: border-box; }
.panda-lab :where(h1,h2,p,figure,ol) { margin: 0; }
.panda-lab img { max-width: 100%; }
.panda-lab .panda-image-trigger {
    display: block;
    width: 100%;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 4px;
    color: inherit;
    background: transparent;
    cursor: zoom-in;
    appearance: none;
}
.panda-lab .pl-mat .panda-image-trigger { height: 100%; min-height: 0; }
.panda-lab a:focus-visible, .panda-lab button:focus-visible {
    outline: 3px solid #21659d;
    outline-offset: 3px;
}
.panda-lab .pl-button, .panda-lab .pl-link, .panda-lab .pl-template-link {
    font: inherit;
    font-weight: 650;
    text-decoration: none;
    text-shadow: none;
    box-shadow: none;
}
/* The drawer paints the activity row. Extend its native link over that same box. */
:is(#course-index-cm-326, #course-index-cm-322, #course-index-cm-325) {
    position: relative;
}
:is(#course-index-cm-326, #course-index-cm-322, #course-index-cm-325) > a[data-for="cm_name"] {
    position: static;
    flex: 1 1 auto;
}
:is(#course-index-cm-326, #course-index-cm-322, #course-index-cm-325) > a[data-for="cm_name"][href]::after {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: 7px;
}
/* In edit mode Moodle uses the leading space to drag activities into order. */
body.editing :is(#course-index-cm-326, #course-index-cm-322, #course-index-cm-325) > a[data-for="cm_name"][href]::after {
    inset-inline-start: 2rem;
}
a.panda-language-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    flex: 0 0 auto;
    box-sizing: border-box;
    min-height: 36px;
    min-width: 44px;
    padding: .25rem .65rem;
    border: 1px solid #b7c7bd;
    border-radius: 8px;
    background: #fff;
    color: #263c2d;
    font-size: .875rem;
    font-weight: 600;
    line-height: 1.25;
    text-decoration: none;
    white-space: nowrap;
}
a.panda-language-button:hover { background: #edf2eb; color: #1c3423; text-decoration: none; }
a.panda-language-button:focus-visible { outline: 3px solid #21659d; outline-offset: 2px; }
.panda-lab .pl-title { padding: clamp(6px, 1.2vw, 14px) 0 clamp(18px, 2.7vw, 30px); }
.panda-lab h1, .panda-lab h2 { font-family: inherit; color: var(--pl-ink); font-weight: 730; }
.panda-lab h1 { font-size: clamp(1.95rem, 4.2vw, 3.22rem); letter-spacing: -.043em; line-height: 1.14; }
.panda-lab h2 { font-size: clamp(1.2rem, 2.15vw, 1.55rem); line-height: 1.24; letter-spacing: -.025em; }
.panda-lab:lang(zh-Hans) h1, .panda-lab:lang(zh-Hans) h2 { letter-spacing: -.02em; }
.panda-lab .pl-title p { max-width: 64ch; margin: .55em 0 0; color: var(--pl-muted); font-size: clamp(1rem,1.6vw,1.12rem); }
.panda-lab .pl-equation {
    display: grid;
    grid-template-columns: minmax(0,1fr) auto minmax(0,1fr) auto minmax(0,1.19fr);
    align-items: stretch;
    gap: clamp(4px, 1.1vw, 14px);
    padding: clamp(10px, 2.2vw, 25px);
    border: 1px solid #ced9c9;
    border-radius: var(--pl-radius);
    background: #f1f4e8;
}
.panda-lab .pl-tile { display: flex; min-width: 0; margin: 0; flex-direction: column; }
.panda-lab .pl-mat {
    display: grid;
    place-items: center;
    min-width: 0;
    height: clamp(145px, 22.5vw, 244px);
    padding: clamp(9px, 1.7vw, 20px);
    border: 1px solid #cbd4cc;
    border-radius: 11px;
    background: #e2e9e9;
}
.panda-lab .pl-mat img {
    display: block;
    width: 100%;
    height: 100%;
    max-height: calc(clamp(145px, 22.5vw, 244px) - clamp(9px, 1.7vw, 20px) * 2 - 2px);
    object-fit: contain;
}
.panda-lab .pl-template .pl-mat img { rotate: -3deg; }
.panda-lab .pl-portrait .pl-mat { background: #f2ded1; border-color: #dfcfc2; }
.panda-lab .pl-portrait .pl-mat img { rotate: 2deg; }
.panda-lab .pl-result .pl-mat { background: var(--pl-accent); border-color: #bfce91; }
.panda-lab .pl-tile figcaption { padding-top: .65em; font-size: .94rem; color: var(--pl-ink); font-weight: 650; text-align: center; line-height: 1.3; }
.panda-lab .pl-op { align-self: center; margin-bottom: 1.1em; font-weight: 550; font-size: clamp(1rem, 2.3vw, 1.7rem); color: #6c795c; }
.panda-lab .pl-brief-bottom { display: grid; grid-template-columns: 1.2fr 1fr; align-items: stretch; gap: 14px; margin-top: 16px; }
.panda-lab .pl-handoff, .panda-lab .pl-alt {
    display: flex;
    padding: clamp(17px, 2.1vw, 24px);
    border: 1px solid var(--pl-line);
    border-radius: var(--pl-radius);
}
.panda-lab .pl-handoff { flex-flow: column; align-items: flex-start; justify-content: center; background: var(--pl-paper); }
.panda-lab .pl-handoff p, .panda-lab .pl-step-text p { margin: .5em 0 .92em; color: var(--pl-muted); }
.panda-lab .pl-handoff p { max-width: 50ch; }
.panda-lab .pl-button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: .75em;
    padding: .58em 1em;
    color: #fff;
    background: var(--pl-ink);
    border: 1px solid var(--pl-ink);
    border-radius: 8px;
    line-height: 1.45;
    font-size: .94rem;
    cursor: pointer;
}
.panda-lab a.pl-button::after { content: "→"; }
.panda-lab .pl-button:hover { color: #fff; background: #3d5545; }
.panda-lab .pl-alt { align-items: center; gap: 15px; margin: 0; background: #f6eadf; border-color: #e0d4c8; }
.panda-lab .pl-alt figcaption { max-width: 15ch; color: #5e4c40; font-size: .94rem; font-weight: 650; line-height: 1.4; }
.panda-lab .pl-sticker { width: min(47%, 150px); flex: none; padding: 5px 5px 7px; background: #fff; border-radius: 4px; box-shadow: 1px 3px 0 #d5bda7; text-align: center; }
.panda-lab .pl-sticker img { display: block; width: 100%; max-height: 102px; object-fit: contain; }
.panda-lab .pl-sticker span { display: block; margin-top: 3px; font-size: clamp(.83rem,1.4vw,1.05rem); font-weight: 750; line-height: 1.2; color: #172220; }
.panda-lab .pl-sequence { padding: 0; margin: 0; list-style: none; counter-reset: panda-step; }
.panda-lab .pl-step {
    counter-increment: panda-step;
    display: grid;
    grid-template-columns: minmax(0,.8fr) minmax(0,1.2fr);
    gap: clamp(18px, 3.1vw, 40px);
    align-items: center;
    padding: clamp(21px, 3.05vw, 38px) 0;
    border-top: 1px solid var(--pl-line);
}
.panda-lab .pl-step:first-child { padding-top: 18px; }
.panda-lab .pl-step h2::before {
    content: counter(panda-step) ".";
    margin-inline-end: .38em;
    color: #527237;
    font-variant-numeric: tabular-nums;
}
.panda-lab .pl-step-text { min-width: 0; }
.panda-lab .pl-step-text p:last-child { margin-bottom: 0; }
.panda-lab .pl-step-text .pl-note { font-size: .88rem; color: #5c6758; }
.panda-lab .pl-step-text .pl-link { margin-inline-start: .7em; }
.panda-lab .pl-link, .panda-lab .pl-template-link { color: #31513c; text-underline-offset: .21em; text-decoration: underline; }
.panda-lab .pl-link:hover, .panda-lab .pl-template-link:hover { color: #142c22; }
.panda-lab .pl-template-tray {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 9px;
    min-width: 0;
    padding: clamp(12px,2.3vw,26px);
    border: 1px solid #d6dfc4;
    border-radius: 14px;
    background: #f1f4e6;
}
.panda-lab .pl-template-tray > div { display: flex; flex: 1 1 0; flex-flow: column; align-items: center; gap: 7px; min-width: 0; }
.panda-lab .pl-template-tray img { display: block; width: 100%; height: clamp(70px, 11.2vw, 126px); object-fit: contain; border-radius: 4px; background: #fff; }
.panda-lab .pl-template-link { font-size: .8rem; text-align: center; line-height: 1.35; }
.panda-lab .pl-visual {
    display: grid;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: clamp(10px, 1.65vw, 19px);
    border: 1px solid var(--pl-line);
    border-radius: 14px;
    background: #edf1ec;
}
.panda-lab .pl-pair { grid-template-columns: repeat(auto-fit,minmax(min(100%,140px),1fr)); }
.panda-lab .pl-stack { grid-template-columns: 1.65fr 1fr; }
.panda-lab .pl-tools { grid-template-columns: minmax(0,.9fr) minmax(0,1.1fr); }
.panda-lab .pl-frame { min-width: 0; margin: 0; text-align: center; }
.panda-lab .pl-frame img { display: block; width: 100%; max-height: 258px; object-fit: contain; border-radius: 3px; }
.panda-lab .pl-frame figcaption { margin-top: 7px; color: var(--pl-muted); font-size: .85rem; font-weight: 600; }
.panda-lab .pl-levels { background: #edf1f4; border-color: #d4dbdc; }
.panda-lab .pl-levels .pl-frame img { min-height: 0; }
.panda-lab .pl-end { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 21px; border-top: 1px solid var(--pl-line); }
.panda-lab .pl-submit-title { padding-bottom: 20px; }
.panda-lab .pl-steps-title .pl-guideswitch {
    display: inline-flex;
    max-width: 100%;
    margin-top: 18px;
}
.panda-lab .pl-guideswitch a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 5px clamp(12px, 2vw, 24px);
    border: 1px solid #cbd4c7;
    background: #f0f3eb;
    color: var(--pl-muted);
    font-family: inherit;
    font-size: .94rem;
    font-weight: 650;
    line-height: 1.25;
    text-decoration: none;
}
.panda-lab .pl-guideswitch a:first-child { border-radius: 10px 0 0 10px; }
.panda-lab .pl-guideswitch a:last-child { border-radius: 0 10px 10px 0; border-inline-start: 0; }
.panda-lab .pl-guideswitch a:hover { background: #e2e9da; color: var(--pl-ink); }
.panda-lab .pl-guideswitch a[aria-current] {
    border-color: #bdce9a;
    background: var(--pl-accent);
    color: var(--pl-accent-ink);
}
.panda-lab .pl-steps-title > p { margin-top: 14px; }
.panda-lab .pl-guide-tools {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 16px;
    padding: 12px clamp(14px, 2vw, 22px);
    border: 1px solid var(--pl-line);
    border-radius: 12px;
    background: #f5f6ef;
}
.panda-lab .pl-guide-contents { min-width: 0; flex: 1 1 190px; }
.panda-lab .pl-guide-contents summary { width: fit-content; max-width: 100%; cursor: pointer; font-weight: 650; }
.panda-lab .pl-guide-contents summary:focus-visible { outline: 3px solid #21659d; outline-offset: 3px; }
.panda-lab .pl-guide-contents ol { padding-inline-start: 1.6em; margin: 12px 0 2px; }
.panda-lab .pl-guide-contents li { padding: 3px 0; }
.panda-lab .pl-guide-contents a { color: #31513c; text-decoration: underline; text-underline-offset: .2em; }
.panda-lab .pl-guide-tools > .pl-link { white-space: nowrap; }
.panda-lab .pl-detail-chapter {
    display: grid;
    grid-template-columns: minmax(155px,.8fr) minmax(0,2.4fr);
    align-items: start;
    gap: clamp(16px, 3vw, 38px);
    padding: clamp(28px, 4vw, 52px) 0;
    scroll-margin-top: var(--pl-scroll-offset);
}
.panda-lab .pl-detail-chapter + .pl-detail-chapter { border-top: 1px solid var(--pl-line); }
.panda-lab .pl-detail-chapter > h2 { position: sticky; top: var(--pl-scroll-offset); margin: 0; line-height: 1.35; }
.panda-lab .pl-chapter-number { margin-inline-end: .1em; color: #527237; font-variant-numeric: tabular-nums; }
.panda-lab .pl-detail-body, .panda-lab .pl-detail-item { min-width: 0; }
.panda-lab .pl-detail-item + .pl-detail-item { margin-top: 27px; }
.panda-lab .pl-detail-item > p { max-width: 68ch; margin: 0; color: var(--pl-ink); line-height: 1.65; }
.panda-lab .pl-shotset { display: grid; grid-template-columns: minmax(0,1fr); gap: 13px; margin-top: 10px; }
.panda-lab .pl-shotset:not([data-count="1"]) { grid-template-columns: repeat(auto-fit,minmax(min(100%,205px),1fr)); }
.panda-lab .pl-shotset[data-count="5"] { grid-template-columns: repeat(5,minmax(0,1fr)); gap: 9px; }
.panda-lab .pl-detail-shot { min-width: 0; margin: 0; }
.panda-lab .pl-detail-shot .panda-image-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    max-width: 100%;
    min-height: 44px;
    padding: 7px;
    border: 1px solid #d2d9d4;
    border-radius: 8px;
    background: #edf1ed;
    cursor: zoom-in;
}
.panda-lab .pl-detail-shot .panda-image-trigger:hover { border-color: #71856a; }
.panda-lab .pl-detail-shot img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: contain;
    border-radius: 3px;
}
.panda-lab .pl-detail-shot figcaption { margin-top: 5px; color: var(--pl-muted); font-size: .84rem; line-height: 1.45; }
.panda-lab .pl-shotset[data-count="5"] .panda-image-trigger { width: 100%; background: #f1f4e6; }
.panda-lab .pl-shotset[data-count="5"] img { height: clamp(62px,8vw,100px); }
.panda-lab .pl-detail-shot .pl-cropped { width: min(100%,calc(var(--pl-crop-width) + 16px)); }
.panda-lab .pl-crop-viewport {
    display: block;
    position: relative;
    width: 100%;
    aspect-ratio: var(--pl-crop-ratio);
    overflow: hidden;
    border-radius: 3px;
}
.panda-lab .pl-shotset[data-count="5"] .pl-crop-viewport {
    max-width: calc(clamp(62px,8vw,100px) * var(--pl-crop-ratio));
}
.panda-lab .pl-detail-shot .pl-crop-viewport img {
    position: absolute;
    inset: 0 auto auto 0;
    width: var(--pl-img-w);
    height: var(--pl-img-h);
    max-width: none;
    max-height: none;
    transform: translate(var(--pl-img-x),var(--pl-img-y));
}
@container panda-lesson (max-width: 720px) {
    .panda-lab .pl-detail-chapter { grid-template-columns: minmax(0,1fr); gap: 16px; }
    .panda-lab .pl-detail-chapter > h2 { position: static; }
    .panda-lab .pl-detail-item + .pl-detail-item { margin-top: 22px; }
    .panda-lab .pl-step { grid-template-columns: minmax(0,1fr); gap: 15px; }
    .panda-lab .pl-step-text p { margin-bottom: .65em; }
    .panda-lab .pl-template-tray img { height: 105px; }
    .panda-lab .pl-brief-bottom { grid-template-columns: 1.15fr 1fr; }
    .panda-lab .pl-alt { flex-flow: column; align-items: center; justify-content: center; gap: 9px; }
    .panda-lab .pl-sticker { width: min(95%, 145px); }
    .panda-lab .pl-alt figcaption { max-width: 24ch; text-align: center; }
}
@container panda-lesson (max-width: 520px) {
    .panda-lab .pl-steps-title .pl-guideswitch { margin-top: 12px; }
    .panda-lab .pl-guide-tools { align-items: baseline; padding: 10px 12px; }
    .panda-lab .pl-guide-contents { flex-basis: 130px; }
    .panda-lab .pl-shotset[data-count="5"] { grid-template-columns: repeat(3,minmax(0,1fr)); }
    .panda-lab .pl-detail-shot .panda-image-trigger { padding: 5px; }
    .panda-lab .pl-title { padding: 8px 0 17px; }
    .panda-lab .pl-title p { font-size: .95rem; }
    .panda-lab .pl-equation { padding: 9px 6px; gap: 3px; }
    .panda-lab .pl-mat { height: clamp(77px,24vw,120px); padding: 3px; border-radius: 5px; }
    .panda-lab .pl-mat img { max-height: calc(clamp(77px,24vw,120px) - 8px); }
    .panda-lab .pl-tile figcaption { padding-top: 6px; font-size: .74rem; line-height: 1.25; }
    .panda-lab .pl-op { margin-bottom: 1.4em; font-size: .9rem; }
    .panda-lab .pl-brief-bottom { grid-template-columns: minmax(0,1fr); gap: 10px; margin-top: 10px; }
    .panda-lab .pl-alt { flex-flow: row; justify-content: flex-start; padding: 12px 16px; gap: 18px; }
    .panda-lab .pl-sticker { width: 95px; }
    .panda-lab .pl-sticker img { max-height: 62px; }
    .panda-lab .pl-alt figcaption { text-align: start; }
    .panda-lab .pl-end { align-items: flex-start; flex-flow: column; }
    .panda-lab .pl-pair { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .panda-lab .pl-levels { grid-template-columns: minmax(0,1fr); }
    .panda-lab .pl-template-tray { gap: 6px; padding: 8px; }
    .panda-lab .pl-template-tray img { height: 70px; }
}
.panda-lab #panda-image-dialog {
    width: min(710px, calc(100vw - 28px));
    max-width: calc(100vw - 28px);
    max-height: 90vh;
    max-height: 90dvh;
    margin: auto;
    padding: 10px 14px 13px;
    overflow: auto;
    overscroll-behavior: contain;
    border: 1px solid #ccd6cf;
    border-radius: 15px;
    background: #fff;
    color: #202e2b;
    box-shadow: 0 18px 70px rgb(0 0 0 / 30%);
}
#panda-image-dialog::backdrop { background: rgb(12 23 21 / 62%); }
#panda-image-dialog .panda-dialog-head { display: flex; justify-content: flex-end; gap: 7px; margin-bottom: 7px; }
#panda-image-dialog .panda-dialog-head button {
    min-height: 36px;
    padding: 4px 14px;
    border: 1px solid #b7c7bd;
    border-radius: 8px;
    background: #f3f5ef;
    color: #23392a;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
#panda-image-dialog .panda-dialog-head button:hover { background: #e4eadd; }
#panda-image-dialog .panda-dialog-canvas {
    display: flex;
    width: 100%;
    aspect-ratio: var(--panda-image-ratio, 4 / 3);
    min-height: min(95px, 22vh);
    max-height: min(56vh, 460px);
    max-height: min(56dvh, 460px);
    overflow: hidden;
    overscroll-behavior: contain;
}
#panda-image-dialog .panda-dialog-canvas img {
    display: block;
    flex: none;
    margin: auto;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
#panda-image-dialog .panda-dialog-canvas.is-zoomed { overflow: auto; }
#panda-image-dialog .panda-dialog-canvas.is-zoomed img { width: var(--panda-zoom-width); height: auto; max-width: none; }
#panda-image-dialog #panda-image-caption {
    margin: 8px 0 0;
    color: #48564d;
    text-align: center;
    font-size: .93rem;
    overflow-wrap: anywhere;
}
@media print {
    .panda-lab { max-width: none; padding: 0; }
    a.panda-language-button { display: none; }
    .panda-lab .pl-step, .panda-lab .pl-equation { break-inside: avoid; }
    .panda-lab .pl-detail-chapter > h2 { position: static; }
    .panda-lab .pl-guideswitch, .panda-lab .pl-guide-tools { display: none; }
    .panda-lab .pl-detail-shot { break-inside: avoid; }
}
