/* Shared teaching navigation. Keep each course model and local styles in its HTML.
   Original shell variants are selected with body[data-course-shell]. */

/* COURSE_NAV_STYLE_START */
.course-side-nav {
    position: fixed;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 126px;
    padding: 7px;
    border: 3px solid #e0a216;
    border-radius: 12px;
    background: #fff7c7;
    box-shadow: 0 8px 22px rgba(91, 55, 18, 0.24);
    box-sizing: border-box;
    z-index: 8500;
    font-family: 'Microsoft YaHei', '楷体', sans-serif;
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    touch-action: pan-y;
}
.course-side-nav a {
    display: block;
    margin: 5px 0;
    padding: 10px 5px;
    border: 1px solid #e8bf4d;
    border-radius: 7px;
    background: #fff1a6;
    color: #843b25;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
    text-decoration: none;
    box-sizing: border-box;
    cursor: pointer;
    touch-action: manipulation;
    transition: background-color 0.16s ease, transform 0.16s ease;
}
.course-side-nav a:hover,
.course-side-nav a:focus-visible {
    background: #ffe37c;
    outline: 3px solid rgba(159, 76, 35, 0.24);
    transform: translateX(-2px);
}
.course-side-nav .return-index {
    background: #f3c85b;
    border-color: #cf9018;
}
.course-nav-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px 170px 24px 24px;
    background: rgba(30, 24, 16, 0.58);
    box-sizing: border-box;
    z-index: 9500;
    font-family: 'Microsoft YaHei', '楷体', sans-serif;
    touch-action: pan-y;
}
.course-nav-modal:target { display: flex; }
.course-nav-dialog {
    position: relative;
    width: min(720px, 100%);
    max-height: 84vh;
    padding: 32px 38px 30px;
    overflow-y: auto;
    border: 4px solid #e0a216;
    border-radius: 16px;
    background: #fffdf0;
    color: #3f2a20;
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.34);
    box-sizing: border-box;
    touch-action: pan-y;
}
.course-nav-dialog.course-nav-practice-dialog { width: min(880px, 100%); }
.course-nav-dialog h2 {
    margin: 0 42px 22px 0;
    color: #843b25;
    font-size: 30px;
    line-height: 1.25;
    text-align: left;
    text-shadow: none;
}
.course-nav-dialog ol { margin: 0; padding-left: 1.7em; }
.course-nav-dialog li { margin: 13px 0; font-size: 22px; line-height: 1.55; }
.course-nav-close {
    position: absolute;
    top: 12px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: 2px solid #d5a135;
    border-radius: 50%;
    background: #fff1a6;
    color: #843b25;
    font-size: 29px;
    font-weight: 700;
    line-height: 34px;
    text-align: center;
    text-decoration: none;
    box-sizing: border-box;
    touch-action: manipulation;
}
.course-nav-close:hover,
.course-nav-close:focus-visible { background: #ffe37c; outline: 3px solid rgba(159, 76, 35, 0.24); }
.course-nav-question {
    margin: 0 0 22px;
    padding: 18px 20px;
    border: 2px solid #eed17a;
    border-radius: 12px;
    background: #fff9d9;
}
.course-nav-question legend {
    padding: 0 6px;
    color: #5d3323;
    font-size: 21px;
    font-weight: 700;
    line-height: 1.45;
}
.course-nav-option {
    display: block;
    margin: 9px 0;
    padding: 9px 12px;
    border-radius: 7px;
    color: #3f2a20;
    font-size: 19px;
    line-height: 1.35;
    cursor: pointer;
    touch-action: manipulation;
}
.course-nav-option:hover { background: #fff0a4; }
.course-nav-option input {
    width: 19px;
    height: 19px;
    margin: 0 9px 0 0;
    vertical-align: -2px;
    accent-color: #a34b28;
}
.course-nav-feedback {
    display: block;
    min-height: 26px;
    margin-top: 8px;
    font-size: 18px;
    font-weight: 700;
}
.course-nav-feedback.is-correct { color: #20723b; }
.course-nav-feedback.is-retry { color: #a04328; }
.course-nav-feedback.is-empty { color: #755319; }
.course-nav-submit {
    display: block;
    min-width: 180px;
    margin: 6px auto 0;
    padding: 13px 25px;
    border: 0;
    border-radius: 9px;
    background: #a34b28;
    color: #fffdf0;
    box-shadow: 0 4px 0 #6e301d;
    font-family: inherit;
    font-size: 21px;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
}
.course-nav-submit:active { transform: translateY(3px); box-shadow: 0 1px 0 #6e301d; }
.course-nav-level {
    min-height: 34px;
    margin: 20px 0 0;
    color: #843b25;
    font-size: 25px;
    font-weight: 800;
    text-align: center;
}
@media (max-width: 1000px), (max-height: 680px) {
    .course-side-nav { right: 10px; width: 112px; }
    .course-side-nav a { margin: 4px 0; padding: 8px 4px; font-size: 16px; }
    .course-nav-modal { padding: 16px 138px 16px 16px; }
    .course-nav-dialog { max-height: 90vh; padding: 26px 28px 24px; }
    .course-nav-dialog h2 { font-size: 25px; }
    .course-nav-dialog li,
    .course-nav-question legend { font-size: 18px; }
}
.course-learning-card,
.course-target-card {
  margin: 20px 0 0;
  padding: 16px 18px;
  border: 2px dashed #d6ae4f;
  border-radius: 12px;
  background: #fff9d9;
}

.course-learning-card h3,
.course-target-card h3 {
  margin: 0 0 12px;
  color: #843b25;
  font-size: 22px;
}

.course-learning-card p {
  margin: 8px 0;
  color: #4a3024;
  font-size: 18px;
  line-height: 1.6;
}

.course-target-card ol {
  margin: 0;
  padding-left: 1.5em;
}

.course-target-card li {
  margin: 10px 0;
  color: #4a3024;
  font-size: 18px;
  line-height: 1.6;
}
/* COURSE_NAV_STYLE_END */


/* Preserved variant: compact-right (duifanglitituxing.html). */

:where([data-course-shell="compact-right"]) .course-side-nav {
    right: 12px;
    top: 56%;
    width: 118px;
    max-height: calc(100vh - 20px);
    z-index: 100000;
}

:where([data-course-shell="compact-right"]) .course-side-nav a {
    padding: 9px 4px;
    font-size: 17px;
}

:where([data-course-shell="compact-right"]) .course-nav-modal {
    padding: 20px 150px 20px 20px;
    z-index: 100100;
}

:where([data-course-shell="compact-right"]) .course-nav-dialog {
    max-height: 86vh;
    padding: 30px 36px 28px;
}

:where([data-course-shell="compact-right"]) .course-nav-dialog h2 {
    margin: 0 42px 20px 0;
    font-size: 29px;
}

:where([data-course-shell="compact-right"]) .course-nav-dialog li {
    margin: 12px 0;
    font-size: 21px;
    line-height: 1.5;
}

:where([data-course-shell="compact-right"]) .course-nav-close {
    top: 11px;
    right: 15px;
}

:where([data-course-shell="compact-right"]) .course-nav-question {
    margin: 0 0 20px;
    padding: 17px 19px;
}

:where([data-course-shell="compact-right"]) .course-nav-question legend {
    font-size: 20px;
}

:where([data-course-shell="compact-right"]) .course-nav-option {
    margin: 8px 0;
    padding: 8px 11px;
    font-size: 18px;
}

:where([data-course-shell="compact-right"]) .course-nav-feedback {
    min-height: 25px;
    margin-top: 7px;
}

@media(max-width:1000px),(max-height:680px) {
    :where([data-course-shell="compact-right"]) .course-side-nav {
        right: 8px;
        width: 108px;
    }
    :where([data-course-shell="compact-right"]) .course-side-nav a {
        padding: 7px 3px;
        font-size: 15px;
    }
    :where([data-course-shell="compact-right"]) .course-nav-modal {
        padding: 14px 126px 14px 14px;
    }
    :where([data-course-shell="compact-right"]) .course-nav-dialog {
        max-height: 91vh;
        padding: 25px 26px 23px;
    }
    :where([data-course-shell="compact-right"]) .course-nav-dialog h2 {
        font-size: 24px;
    }
    :where([data-course-shell="compact-right"]) .course-nav-dialog li,
    :where([data-course-shell="compact-right"]) .course-nav-question legend {
        font-size: 17px;
    }
}


/* Preserved variant: topbar-left (baichulitituxing.html). */

:where([data-course-shell="topbar-left"]) .course-side-nav {
    left: 16px;
    top: 12px;
    right: auto;
    bottom: auto;
    transform: none;
    width: auto;
    max-width: calc(100vw - 360px);
    max-height: none;
    overflow: visible;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 8px;
    z-index: 9998;
}

:where([data-course-shell="topbar-left"]) .course-side-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    margin: 0;
    padding: 7px 8px;
    font-size: 14px;
    line-height: 1.2;
    white-space: nowrap;
}

:where([data-course-shell="topbar-left"]) .course-side-nav a:hover,
:where([data-course-shell="topbar-left"]) .course-side-nav a:focus-visible {
    transform: translateY(-2px);
}

:where([data-course-shell="topbar-left"]) .course-nav-modal {
    padding: 76px 20px 20px 20px;
    z-index: 100100;
}

:where([data-course-shell="topbar-left"]) .course-nav-dialog {
    max-height: 86vh;
    padding: 30px 36px 28px;
}

:where([data-course-shell="topbar-left"]) .course-nav-dialog h2 {
    margin: 0 42px 20px 0;
    font-size: 29px;
}

:where([data-course-shell="topbar-left"]) .course-nav-dialog li {
    margin: 12px 0;
    font-size: 21px;
    line-height: 1.5;
}

:where([data-course-shell="topbar-left"]) .course-nav-close {
    top: 11px;
    right: 15px;
}

:where([data-course-shell="topbar-left"]) .course-nav-question {
    margin: 0 0 20px;
    padding: 17px 19px;
}

:where([data-course-shell="topbar-left"]) .course-nav-question legend {
    font-size: 20px;
}

:where([data-course-shell="topbar-left"]) .course-nav-option {
    margin: 8px 0;
    padding: 8px 11px;
    font-size: 18px;
}

:where([data-course-shell="topbar-left"]) .course-nav-feedback {
    min-height: 25px;
    margin-top: 7px;
}

@media(max-width:1000px),(max-height:680px) {
    :where([data-course-shell="topbar-left"]) .course-side-nav {
        left: 10px;
        top: 8px;
        right: 330px;
        width: auto;
        max-width: calc(100vw - 350px);
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        padding: 5px 6px;
    }
    :where([data-course-shell="topbar-left"]) .course-side-nav a {
        min-width: 64px;
        margin: 0;
        padding: 6px 5px;
        font-size: 13px;
    }
    :where([data-course-shell="topbar-left"]) .course-nav-modal {
        padding: 72px 14px 14px 14px;
    }
    :where([data-course-shell="topbar-left"]) .course-nav-dialog {
        max-height: 91vh;
        padding: 25px 26px 23px;
    }
    :where([data-course-shell="topbar-left"]) .course-nav-dialog h2 {
        font-size: 24px;
    }
    :where([data-course-shell="topbar-left"]) .course-nav-dialog li,
    :where([data-course-shell="topbar-left"]) .course-nav-question legend {
        font-size: 17px;
    }
}


/* Preserved variant: left (guancajiandandelitituxing.html). */

:where([data-course-shell="left"]) .course-side-nav {
    left: 18px;
    right: auto;
    width: 112px;
    padding: 6px;
    z-index: 9998;
}

:where([data-course-shell="left"]) .course-side-nav a {
    padding: 7px 4px;
    font-size: 14px;
}


/* Preserved variant: grid-right (guancawutixiaozhengfangtiduidie.html). */

:where([data-course-shell="grid-right"]) .course-side-nav {
    right: 10px;
    left: auto;
    top: 76px;
    bottom: auto;
    transform: none;
    width: 208px;
    max-height: calc(100vh - 20px);
    padding: 5px;
    z-index: 9998;
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 3px;
}

:where([data-course-shell="grid-right"]) .course-side-nav a {
    margin: 1px 0;
    padding: 3px;
    font-size: 14px;
}

:where([data-course-shell="grid-right"]) .course-side-nav .return-index {
    grid-column: 1 / -1;
}

:where([data-course-shell="grid-right"]) .course-nav-modal {
    padding: 20px 150px 20px 20px;
    z-index: 100100;
}

:where([data-course-shell="grid-right"]) .course-nav-dialog {
    max-height: 86vh;
    padding: 30px 36px 28px;
}

:where([data-course-shell="grid-right"]) .course-nav-dialog h2 {
    margin: 0 42px 20px 0;
    font-size: 29px;
}

:where([data-course-shell="grid-right"]) .course-nav-dialog li {
    margin: 12px 0;
    font-size: 21px;
    line-height: 1.5;
}

:where([data-course-shell="grid-right"]) .course-nav-close {
    top: 11px;
    right: 15px;
}

:where([data-course-shell="grid-right"]) .course-nav-question {
    margin: 0 0 20px;
    padding: 17px 19px;
}

:where([data-course-shell="grid-right"]) .course-nav-question legend {
    font-size: 20px;
}

:where([data-course-shell="grid-right"]) .course-nav-option {
    margin: 8px 0;
    padding: 8px 11px;
    font-size: 18px;
}

:where([data-course-shell="grid-right"]) .course-nav-feedback {
    min-height: 25px;
    margin-top: 7px;
}

@media(max-width:1000px),(max-height:680px) {
    :where([data-course-shell="grid-right"]) .course-side-nav {
        right: 8px;
        left: auto;
        top: 34px;
        bottom: auto;
        transform: none;
        width: 184px;
        padding: 4px;
        gap: 2px;
    }
    :where([data-course-shell="grid-right"]) .course-side-nav a {
        margin: 1px 0;
        padding: 3px 2px;
        font-size: 13px;
    }
    :where([data-course-shell="grid-right"]) .course-nav-modal {
        padding: 14px 126px 14px 14px;
    }
    :where([data-course-shell="grid-right"]) .course-nav-dialog {
        max-height: 91vh;
        padding: 25px 26px 23px;
    }
    :where([data-course-shell="grid-right"]) .course-nav-dialog h2 {
        font-size: 24px;
    }
    :where([data-course-shell="grid-right"]) .course-nav-dialog li,
    :where([data-course-shell="grid-right"]) .course-nav-question legend {
        font-size: 17px;
    }
}


/* Preserved variant: offset-right (zenmetongzhizuikuai.html). */

:where([data-course-shell="offset-right"]) .course-side-nav {
    right: calc(25% + 18px);
}


/* Dialog sizing uses the available viewport, including mobile browser chrome and
   safe areas. The backdrop stays above every preserved navigation variant. */
.course-nav-modal {
    --course-shell-gap-top: 24px;
    --course-shell-gap-right: 170px;
    --course-shell-gap-bottom: 24px;
    --course-shell-gap-left: 24px;
    --course-shell-dialog-limit: 84vh;
    --course-shell-viewport-height: 100vh;
    padding: max(var(--course-shell-gap-top), env(safe-area-inset-top, 0px))
             max(var(--course-shell-gap-right), env(safe-area-inset-right, 0px))
             max(var(--course-shell-gap-bottom), env(safe-area-inset-bottom, 0px))
             max(var(--course-shell-gap-left), env(safe-area-inset-left, 0px));
    overflow: hidden;
    z-index: 100100;
}
:where([data-course-shell="compact-right"], [data-course-shell="grid-right"]) .course-nav-modal {
    --course-shell-gap-top: 20px;
    --course-shell-gap-right: 150px;
    --course-shell-gap-bottom: 20px;
    --course-shell-gap-left: 20px;
    --course-shell-dialog-limit: 86vh;
}
:where([data-course-shell="topbar-left"]) .course-nav-modal {
    --course-shell-gap-top: 76px;
    --course-shell-gap-right: 20px;
    --course-shell-gap-bottom: 20px;
    --course-shell-gap-left: 20px;
    --course-shell-dialog-limit: 86vh;
}
.course-nav-dialog {
    min-width: 0;
    max-height: min(var(--course-shell-dialog-limit), calc(var(--course-shell-viewport-height) - max(var(--course-shell-gap-top), env(safe-area-inset-top, 0px)) - max(var(--course-shell-gap-bottom), env(safe-area-inset-bottom, 0px))));
    overscroll-behavior: contain;
    overflow-wrap: anywhere;
}
.course-nav-question { min-width: 0; }
.course-nav-submit {
    min-height: 44px;
    min-width: min(180px, 100%);
    max-width: 100%;
    box-sizing: border-box;
}
.course-nav-close {
    width: 44px;
    height: 44px;
    line-height: 40px;
}
.course-side-nav a:focus-visible,
.course-nav-close:focus-visible,
.course-nav-submit:focus-visible,
.course-nav-option:focus-within {
    outline: 3px solid #843b25;
    outline-offset: 2px;
}
.course-nav-option:focus-within { background: #fff0a4; }
.course-side-nav { overscroll-behavior: contain; }
.course-dialog-open .modal { z-index: 100100 !important; }
.course-dialog-open .course-side-nav { visibility: hidden; }
.course-dialog-open .modal .modal-content {
    box-sizing: border-box;
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
    overflow: auto;
    overscroll-behavior: contain;
    overflow-wrap: anywhere;
}
.course-dialog-open .modal .close-btn {
    display: grid;
    place-items: center;
    min-width: 44px;
    min-height: 44px;
}
.course-dialog-open .modal :is(.close-btn, .star):focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 2px;
}
.course-evaluation-status {
    position: fixed;
    z-index: 100102;
    left: 50%;
    bottom: max(48px, env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    width: max-content;
    max-width: calc(100vw - 32px);
    box-sizing: border-box;
    padding: 12px 18px;
    border: 1px solid #93c5fd;
    border-radius: 12px;
    background: #eff6ff;
    color: #1e3a8a;
    font: 500 16px/1.5 "Microsoft YaHei", sans-serif;
    text-align: center;
    box-shadow: 0 4px 18px #1e3a8a22;
    pointer-events: none;
}

@supports (height: 100dvh) {
    .course-nav-modal {
        --course-shell-viewport-height: 100dvh;
        --course-shell-dialog-limit: 84dvh;
    }
    :where([data-course-shell="compact-right"], [data-course-shell="grid-right"], [data-course-shell="topbar-left"]) .course-nav-modal {
        --course-shell-dialog-limit: 86dvh;
    }
    .course-side-nav { max-height: calc(100dvh - 24px); }
    :where([data-course-shell="compact-right"]) .course-side-nav { max-height: calc(100dvh - 20px); }
    :where([data-course-shell="topbar-left"]) .course-side-nav { max-height: none; }
    :where([data-course-shell="grid-right"]) .course-side-nav { max-height: calc(100dvh - 88px - env(safe-area-inset-bottom, 0px)); }
}

/* On small or short screens the modal occupies the available width. The side
   navigation is already behind the backdrop, so no right gutter is needed. */
@media (max-width: 1000px), (max-height: 680px) {
    :where([data-course-shell="offset-right"]) .course-side-nav { right: 10px; }
    :where([data-course-shell="left"]) .course-side-nav a { padding: 8px 4px; font-size: 16px; }
    .course-nav-modal {
        --course-shell-gap-top: 16px;
        --course-shell-gap-right: 16px;
        --course-shell-gap-bottom: 16px;
        --course-shell-gap-left: 16px;
        --course-shell-dialog-limit: 90vh;
    }
    :where([data-course-shell="compact-right"], [data-course-shell="grid-right"], [data-course-shell="topbar-left"]) .course-nav-modal {
        --course-shell-gap-top: 14px;
        --course-shell-gap-right: 14px;
        --course-shell-gap-bottom: 14px;
        --course-shell-gap-left: 14px;
        --course-shell-dialog-limit: 91vh;
    }
    @supports (height: 100dvh) {
        .course-nav-modal { --course-shell-dialog-limit: 90dvh; }
        :where([data-course-shell="compact-right"], [data-course-shell="grid-right"], [data-course-shell="topbar-left"]) .course-nav-modal { --course-shell-dialog-limit: 91dvh; }
        :where([data-course-shell="grid-right"]) .course-side-nav { max-height: calc(100dvh - 46px - env(safe-area-inset-bottom, 0px)); }
    }
}

@media (max-width: 600px) {
    .course-dialog-open .modal .modal-content { margin: 24px auto; padding: 24px 18px; }
    .course-nav-modal {
        --course-shell-gap-top: 12px;
        --course-shell-gap-right: 12px;
        --course-shell-gap-bottom: 12px;
        --course-shell-gap-left: 12px;
    }
    .course-nav-dialog { padding: 24px 18px 20px; border-width: 3px; }
    .course-nav-dialog h2 { margin-right: 44px; font-size: 23px; }
    .course-nav-close { top: 8px; right: 8px; }
    .course-nav-question { padding: 12px; }
    .course-nav-option { padding: 10px 8px; }
    :where([data-course-shell="topbar-left"]) .course-side-nav {
        left: max(8px, env(safe-area-inset-left, 0px));
        right: max(8px, env(safe-area-inset-right, 0px));
        max-width: none;
    }
}

@media (pointer: coarse), (max-width: 600px) {
    .course-side-nav a {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 44px;
    }
    .course-nav-option { min-height: 44px; box-sizing: border-box; }
}

@media (prefers-reduced-motion: reduce) {
    .course-side-nav a { transition: none; }
}
