:root {
    --ink: #2b3e47;
    --muted: #5d7079;
    --blue: #1e5b8f;
    --blue-dark: #154269;
    --blue-light: #eaf4fe;
    --teal: #174d62;
    --gold: #d98a1c;
    --green: #217a4b;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100dvh;
    background-color: #0c8be8;
    font: 14px/1.5 'DM Sans', sans-serif;
    color: var(--ink);
    display: flex;
    flex-direction: column;
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -10;
    background:  #fdf6ec url("../clean-plain-bg.webp") center / cover no-repeat;
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
    will-change: transform;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: high-quality;
    pointer-events: none;
}

button,
select,
input,
textarea {
    font: inherit;
}

button {
    border: 0;
    cursor: pointer;
}

a {
    text-decoration: none;
    color: inherit;
}

button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 3px;
}

/* Header */
.pb-header {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    gap: 18px;
    padding: 14px 28px 10px;
    max-width: 1380px;
    width: 100%;
    margin: 0 auto;
}

.pb-header .back {
    position: absolute;
    left: 28px;
}

@media (max-width: 600px) {
    .pb-header .back {
        position: static;
    }
}

.header-titles {
    text-align: center;
}

h1 {
    font: 800 clamp(28px, 3.4vw, 42px)/1.15 'Manrope', sans-serif;
    letter-spacing: -1px;
    color: #164e78;
    text-shadow: 0 0 16px rgba(160, 220, 255, 0.95), 0 0 32px rgba(255, 255, 255, 0.9), 0 2px 4px rgba(0, 30, 60, 0.35);
    margin: 0;
}

h1 span {
    color: #164e78;
    text-shadow: 0 0 16px rgba(160, 220, 255, 0.95), 0 0 32px rgba(255, 255, 255, 0.9), 0 2px 4px rgba(0, 30, 60, 0.35);
}

.pb-header p {
    margin: 5px 0 0;
    color: #112e5e;
    font-size: 15px;
    font-weight: 800;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.95), 0 1px 3px rgba(255, 255, 255, 0.9);
}

.pill {
    background: #ffffff;
    border-radius: 24px;
    padding: 10px 18px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--teal);
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(23, 77, 98, 0.12);
    transition: background .2s, transform .2s, box-shadow .2s;
}

.pill:hover {
    background: var(--blue);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(23, 77, 98, 0.18);
}

.pill.back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #a92559 0%, #7a133c 100%);
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 5px 15px rgba(169, 37, 89, 0.45);
}

.pill.back:hover {
    background: linear-gradient(135deg, #c22b67 0%, #8f1747 100%);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 7px 18px rgba(169, 37, 89, 0.6);
}

/* Main Layout */
.pb-main {
    display: grid;
    grid-template-columns: 315px minmax(0, 1fr);
    gap: 20px;
    width: calc(100% - 48px);
    max-width: 1340px;
    margin: 0 auto 24px;
    align-items: start;
}

.panel {
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(10px);
    border: 3px solid #ffffff;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 7px 0 #9badad66, 0 16px 36px rgba(19, 58, 70, 0.16);
}

/* Left Sidebar */
.sidebar-panel {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 14px;
}

.cover-wrap {
    position: relative;
    margin: 7px 7px 0;
    height: 112px;
    border-radius: 18px 18px 12px 12px;
    overflow: hidden;
}

.cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cover-tag {
    position: absolute;
    left: 10px;
    bottom: 8px;
    background: rgba(15, 48, 63, 0.85);
    backdrop-filter: blur(6px);
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.sidebar-body {
    padding: 12px 16px 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.sidebar-body h2 {
    font: 800 18px/1.25 'Manrope', sans-serif;
    letter-spacing: -0.4px;
    margin: 0 0 2px;
    color: var(--teal);
}

.sidebar-body > p {
    color: var(--muted);
    font-size: 11.5px;
    margin: 0 0 10px;
}

.exercise-nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ex-tab {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7.5px 10px;
    border-radius: 11px;
    background: #f3f7fb;
    border: 1.5px solid #e3edf6;
    color: var(--ink);
    font-size: 12px;
    font-weight: 700;
    text-align: left;
    transition: all .18s ease;
}

.tab-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-icon {
    font-style: normal;
    width: 22px;
    height: 22px;
    border-radius: 7px;
    background: #dbe9f6;
    color: var(--blue-dark);
    font: 800 11px/1 'Manrope', sans-serif;
    display: grid;
    place-items: center;
}

.ex-tab.active .tab-icon {
    background: rgba(255, 255, 255, 0.24);
    color: #ffffff;
}

.ex-tab small {
    background: #dfebf5;
    color: #2c5578;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 9px;
}

.ex-tab:hover {
    background: #e6f1fc;
    border-color: #c5dcf2;
    transform: translateX(2px);
}

.ex-tab.active {
    background: linear-gradient(135deg, #1e5b8f 0%, #15456e 100%);
    border-color: #15456e;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(30, 91, 143, 0.25);
}

.ex-tab.active small {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
}

/* Score Card */
.score-card {
    margin-top: 10px;
    background: linear-gradient(145deg, #f6fafe 0%, #ebf3fb 100%);
    border: 1.5px solid #d6e6f5;
    border-radius: 14px;
    padding: 10px 12px;
}

.score-top {
    display: flex;
    align-items: center;
    gap: 9px;
}

.score-trophy {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: #fff3d6;
    border: 1px solid #f5d791;
    display: grid;
    place-items: center;
    font-size: 17px;
}

.score-numbers {
    flex: 1;
}

.score-numbers strong {
    display: block;
    font: 800 18px/1.1 'Manrope', sans-serif;
    color: var(--blue-dark);
}

.score-numbers span {
    font-size: 10.5px;
    color: var(--muted);
    font-weight: 600;
}

.score-pct {
    background: #dcebfa;
    color: var(--blue);
    font-size: 11px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 10px;
}

.score-bar {
    height: 7px;
    background: #dbe7f3;
    border-radius: 7px;
    overflow: hidden;
    margin-top: 8px;
}

.score-bar i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #1e5b8f, #2eb872);
    transition: width .4s ease;
}

.sidebar-actions {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.primary-btn {
    width: 100%;
    padding: 11px 16px;
    border-radius: 22px;
    background: linear-gradient(135deg, #1e5b8f 0%, #14436b 100%);
    color: #ffffff;
    font-size: 12.5px;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(20, 67, 107, 0.25);
    transition: transform .2s, filter .2s;
}

.primary-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.sub-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
}

.secondary-btn {
    padding: 7.5px 10px;
    border-radius: 16px;
    background: #edf4fa;
    color: var(--blue-dark);
    font-size: 11px;
    font-weight: 700;
    transition: background .2s;
}

.secondary-btn:hover {
    background: #dceaf7;
}

.secondary-btn.reset {
    background: #f5f6f7;
    color: var(--muted);
}

.secondary-btn.reset:hover {
    background: #e9ecef;
    color: var(--ink);
}

/* Workbook Right Panel */
.workbook-panel {
    display: flex;
    flex-direction: column;
    min-height: 670px;
}

.workbook-hero {
    position: relative;
    isolation: isolate;
    margin: 8px 8px 0;
    padding: 18px 24px;
    border-radius: 18px;
    background-color: #16485d;
    background-image:
        linear-gradient(90deg, rgba(14, 48, 66, 0.88) 0%, rgba(20, 66, 92, 0.72) 55%, rgba(16, 52, 72, 0.52) 100%),
        url('../background.png');
    background-size: cover;
    background-position: center 45%;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.hero-badges {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.ch-pill {
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #a9f5c9;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.8px;
    padding: 3px 10px;
    border-radius: 20px;
}

.sec-indicator {
    background: rgba(10, 32, 44, 0.55);
    color: #ffe299;
    font-size: 10.5px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
}

.workbook-hero h2 {
    font: 800 22px/1.2 'Manrope', sans-serif;
    margin: 0 0 4px;
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.workbook-hero p {
    margin: 0;
    font-size: 12.5px;
    color: #e4f4fb;
}

.stat-pill {
    background: rgba(11, 37, 51, 0.72);
    backdrop-filter: blur(8px);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    padding: 8px 16px;
    text-align: center;
    min-width: 96px;
}

.stat-pill strong {
    display: block;
    font: 800 18px/1.1 'Manrope', sans-serif;
    color: #ffe299;
}

.stat-pill span {
    font-size: 10.5px;
    color: #d6ecf6;
}

/* Exercise Sections */
.ex-section {
    padding: 16px 22px 12px;
    flex: 1;
}

/* Word Bank Bar */
.word-bank {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    background: linear-gradient(90deg, #fff9eb 0%, #fef4dc 100%);
    border: 1.5px dashed #e6c173;
    border-radius: 14px;
    padding: 9px 14px;
    margin-bottom: 14px;
}

.wb-title {
    font-size: 12px;
    font-weight: 800;
    color: #8c580c;
}

.wb-chips {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
}

.wb-chips span {
    background: #ffffff;
    border: 1px solid #ebd094;
    color: #6e4407;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 11px;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.wb-chips span.used {
    opacity: 0.45;
    text-decoration: line-through;
}

/* Question Rows */
.questions-list {
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.pb-item {
    background: #f8fbfe;
    border: 1.5px solid #e1ecf6;
    border-radius: 15px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: border-color .2s, background .2s, box-shadow .2s;
}

.pb-item.col-item {
    flex-direction: column;
    align-items: stretch;
}

.pb-item:hover {
    border-color: #c2daf0;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(30, 91, 143, 0.06);
}

.pb-item.correct {
    border-color: #2eb872;
    background: #effbf4;
}

.pb-item.wrong {
    border-color: #e05252;
    background: #fff4f4;
}

.pb-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.pb-num {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    background: #e3effa;
    color: var(--blue);
    font: 800 12px/1 'Manrope', sans-serif;
    display: grid;
    place-items: center;
}

.pb-item.correct .pb-num {
    background: #2eb872;
    color: #ffffff;
}

.pb-item.wrong .pb-num {
    background: #e05252;
    color: #ffffff;
}

.pb-text {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.55;
    color: var(--ink);
}

.blank-select {
    display: inline-block;
    margin: 0 4px;
    padding: 5px 11px;
    border-radius: 10px;
    border: 2px solid #9ec3e6;
    background: #ffffff;
    color: var(--blue-dark);
    font-weight: 800;
    font-size: 13px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(30, 91, 143, 0.08);
    transition: border-color .2s;
}

/* Section B: MCQ Options Grid */
.mcq-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 8px;
    padding-left: 40px;
}

.mcq-opt {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 11px;
    background: #ffffff;
    border: 1.5px solid #d9e6f2;
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    transition: all .18s;
}

.mcq-opt:hover {
    background: #edf5fc;
    border-color: #b3d1ed;
}

.mcq-opt.selected {
    background: var(--blue);
    border-color: var(--blue);
    color: #ffffff;
}

.mcq-opt b {
    font-weight: 800;
}

/* Section C: True or False */
.tf-group {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.tf-btn {
    padding: 7px 15px;
    border-radius: 18px;
    background: #eef4f9;
    color: var(--ink);
    font-size: 12px;
    font-weight: 800;
    border: 1.5px solid #d7e4f0;
    transition: all .18s;
}

.tf-btn:hover {
    background: #e0ecf7;
}

.tf-btn.selected[data-val="True"] {
    background: #1f7a4c;
    border-color: #1f7a4c;
    color: #ffffff;
}

.tf-btn.selected[data-val="False"] {
    background: #b83b3b;
    border-color: #b83b3b;
    color: #ffffff;
}

/* Match Header */
.match-header-row {
    display: flex;
    justify-content: space-between;
    padding: 0 16px 6px;
    font-size: 11.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--muted);
}

/* Section E, F, H: Written Input & Model Answer */
.written-controls {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-top: 8px;
    padding-left: 40px;
}

.written-input {
    flex: 1;
    padding: 9px 12px;
    border: 1.5px solid #cfe0ef;
    border-radius: 10px;
    font-size: 13px;
    color: var(--ink);
    background: #ffffff;
}

textarea.written-input {
    min-height: 62px;
    resize: vertical;
}

.ans-toggle-btn {
    padding: 8px 13px;
    border-radius: 10px;
    background: #eef5fc;
    color: var(--blue);
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
}

.ans-toggle-btn:hover {
    background: #dbeaf8;
}

.model-answer {
    margin: 8px 0 0 40px;
    padding: 10px 14px;
    border-radius: 10px;
    background: #effaf3;
    border-left: 4px solid #2eb872;
    font-size: 12.8px;
    color: #1c4b33;
}

/* Section G: Complete the Table */
.table-wrap {
    overflow-x: auto;
}

.pb-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1.5px solid #dce8f3;
    border-radius: 14px;
    overflow: hidden;
}

.pb-table th,
.pb-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid #e5eef7;
}

.pb-table th {
    background: #eef5fc;
    color: var(--teal);
    font: 800 13px 'Manrope', sans-serif;
}

.pb-table tr:last-child td {
    border-bottom: 0;
}

.pb-table td strong {
    color: var(--teal);
}

.pb-table select.correct {
    border-color: #2eb872;
    background: #effbf4;
    color: #19613b;
}

.pb-table select.wrong {
    border-color: #e05252;
    background: #fff4f4;
    color: #a12828;
}

/* Section I: Activity Sketchpad */
.activity-workspace {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 14px;
    margin-top: 10px;
    padding-left: 40px;
}

.sketch-box {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sketch-canvas {
    width: 100%;
    height: 150px;
    background: #fffdf7;
    border: 2px dashed #cbb88d;
    border-radius: 12px;
    cursor: crosshair;
    touch-action: none;
}

.clear-canvas-btn {
    align-self: flex-end;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 8px;
    background: #f2ece1;
    color: #6b5331;
}

/* Footer */
.workbook-footer {
    margin-top: auto;
    padding: 12px 22px 16px;
    border-top: 1px solid #e6eef5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

#feedback-banner {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--blue);
    text-align: center;
}

.nav-step-btn {
    padding: 8px 15px;
    border-radius: 18px;
    background: #eef4fa;
    color: var(--teal);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    transition: background .2s;
}

.nav-step-btn:hover {
    background: #dbe9f6;
}

.nav-step-btn.next {
    background: var(--blue-light);
    color: var(--blue);
}

[hidden] {
    display: none !important;
}

@media (max-width: 960px) {
    .pb-main {
        grid-template-columns: 1fr;
        width: calc(100% - 28px);
    }
    .sidebar-panel {
        position: static;
    }
    .activity-workspace {
        grid-template-columns: 1fr;
        padding-left: 0;
    }
}

@media (max-width: 600px) {
    .pb-header {
        padding: 12px 14px;
        flex-wrap: wrap;
    }
    .header-titles {
        width: 100%;
        order: -1;
    }
    .mcq-options {
        grid-template-columns: 1fr;
        padding-left: 0;
    }
    .written-controls,
    .model-answer {
        padding-left: 0;
        margin-left: 0;
    }
}

/* Chapter Switcher Bar */
.chapter-nav-bar {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.ch-switch-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 700;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.7);
    color: var(--teal);
    border: 1px solid rgba(23, 77, 98, 0.2);
    box-shadow: 0 2px 5px rgba(0,0,0,0.04);
    transition: all 0.2s ease;
}

.ch-switch-link:hover {
    background: #ffffff;
    border-color: var(--teal);
    transform: translateY(-1px);
}

.ch-switch-link.active {
    background: var(--teal);
    color: #ffffff;
    border-color: var(--teal);
}

/* Print Styles */
@media print {
    body {
        background: #ffffff !important;
        color: #000000 !important;
    }

    .pb-header .back,
    .sidebar-panel .sidebar-actions,
    .chapter-nav-bar,
    .workbook-footer,
    .exercise-nav {
        display: none !important;
    }

    .pb-main {
        display: block !important;
        padding: 0 !important;
    }

    .panel {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
        background: #ffffff !important;
    }

    .sidebar-panel {
        display: none !important;
    }

    .workbook-panel {
        width: 100% !important;
        padding: 0 !important;
    }

    .ex-section {
        display: block !important;
        page-break-after: always;
        margin-bottom: 24px;
    }

    .blank-select {
        border-bottom: 1.5px solid #000 !important;
        background: transparent !important;
        color: #000 !important;
        -webkit-appearance: none;
    }
}

/* Hero Illustration Card */
.hero-center-art {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 14px;
    flex-shrink: 0;
}

.hero-art-img {
    height: 76px;
    max-width: 220px;
    object-fit: cover;
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
    transition: transform 0.2s ease;
}

.hero-art-img:hover {
    transform: scale(1.04);
}

@media (max-width: 950px) {
    .hero-center-art {
        display: none;
    }
}


/* =========================================================================
   COMPREHENSIVE RESPONSIVE ENHANCEMENTS (Desktop, Tablet, Mobile)
   ========================================================================= */

/* Tablets & Medium Screens (<= 960px) */
@media (max-width: 960px) {
    .pb-main {
        grid-template-columns: 1fr;
        width: calc(100% - 24px);
        max-width: 840px;
        gap: 16px;
        margin-bottom: 20px;
    }
    .sidebar-panel {
        position: static;
        border-radius: 20px;
    }
    .sidebar-body {
        padding: 18px 20px 22px;
    }
    .cover-wrap {
        height: 160px;
    }
    .exercise-nav {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 8px;
        padding-bottom: 6px;
        scrollbar-width: thin;
    }
    .ex-tab {
        flex: 0 0 auto;
        min-width: 140px;
        padding: 10px 14px;
    }
    .workbook-panel {
        border-radius: 20px;
    }
}

/* Mobile Devices (<= 640px) */
@media (max-width: 640px) {
    body {
        font-size: 13.5px;
    }
    .pb-header {
        padding: 12px 14px;
        flex-wrap: wrap;
        gap: 10px;
    }
    .pb-header .pill.back {
        position: static;
        order: -1;
    }
    .header-titles {
        width: 100%;
        text-align: center;
    }
    .header-titles h1 {
        font-size: 22px;
    }
    .header-titles p {
        font-size: 12px;
    }
    
    .pb-main {
        width: calc(100% - 16px);
        gap: 12px;
        margin-bottom: 16px;
    }
    .panel {
        border-radius: 16px;
        border-width: 2px;
    }
    
    /* Compact Sidebar on Mobile */
    .cover-wrap {
        height: 120px;
    }
    .cover-tag {
        font-size: 10px;
        padding: 3px 8px;
    }
    .sidebar-body {
        padding: 14px 14px 18px;
    }
    .sidebar-body h2 {
        font-size: 17px;
    }
    .sidebar-body p {
        font-size: 12px;
        margin-bottom: 12px;
    }
    
    /* Touch-friendly Horizontal Tabs */
    .exercise-nav {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 8px;
        padding: 4px 2px 8px;
        margin-bottom: 12px;
    }
    .ex-tab {
        flex: 0 0 auto;
        min-width: 130px;
        padding: 8px 12px;
        border-radius: 12px;
    }
    .tab-left {
        gap: 7px;
    }
    .tab-icon {
        width: 22px;
        height: 22px;
        font-size: 11px;
    }
    .ex-tab span {
        font-size: 12px;
    }
    .ex-tab small {
        font-size: 10.5px;
    }
    
    /* Compact Scorecard */
    .score-card {
        padding: 10px 12px;
        margin-bottom: 12px;
    }
    .score-trophy {
        font-size: 20px;
    }
    .score-numbers strong {
        font-size: 17px;
    }
    .score-numbers span {
        font-size: 10.5px;
    }
    
    /* Action Buttons in Grid */
    .sidebar-actions {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    .primary-btn {
        padding: 11px;
        font-size: 13.5px;
    }
    .sub-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .sub-actions button {
        padding: 9px 6px;
        font-size: 12px;
    }
    #print-sheet-btn {
        padding: 9px;
        font-size: 12px;
    }

    /* Top Workbook Banner */
    .workbook-hero {
        margin: 6px 6px 0;
        padding: 12px 14px;
        border-radius: 14px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .hero-badges {
        flex-wrap: wrap;
        gap: 6px;
    }
    .ch-pill, .sec-indicator {
        font-size: 10px;
        padding: 3px 8px;
    }
    .workbook-hero h2 {
        font-size: 17px;
    }
    .workbook-hero p {
        font-size: 12px;
    }
    .hero-stats {
        width: 100%;
        display: flex;
        justify-content: flex-end;
    }
    .stat-pill {
        padding: 5px 12px;
        min-width: 76px;
    }
    .stat-pill strong {
        font-size: 15px;
    }
    
    /* Section Contents */
    .ex-section {
        padding: 12px 12px 16px;
    }
    
    /* Word Bank */
    .word-bank {
        padding: 8px 10px;
        gap: 6px;
    }
    .wb-title {
        font-size: 11.5px;
        width: 100%;
    }
    .wb-chips {
        gap: 5px;
    }
    .wb-chips span {
        font-size: 11px;
        padding: 3px 8px;
    }
    
    /* Questions Items */
    .pb-item {
        padding: 10px 8px;
        gap: 8px;
    }
    .pb-num {
        width: 22px;
        height: 22px;
        font-size: 11px;
    }
    .pb-text {
        font-size: 13px;
        line-height: 1.6;
    }
    .blank-select {
        font-size: 12.5px;
        padding: 4px 6px;
        max-width: 100%;
    }
    
    /* MCQ Options */
    .mcq-options {
        grid-template-columns: 1fr;
        gap: 6px;
        padding-left: 0;
        margin-top: 8px;
    }
    .mcq-opt {
        padding: 9px 11px;
        font-size: 12.5px;
        min-height: 40px;
        text-align: left;
    }
    
    /* True / False */
    .tf-item {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .tf-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        width: 100%;
    }
    .tf-btn {
        padding: 9px 0;
        text-align: center;
        font-size: 12.5px;
    }
    
    /* Match the Following */
    .match-header-row {
        display: none;
    }
    .match-item {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }
    .match-col.a-col {
        width: 100%;
        font-size: 13px;
    }
    .match-col.b-col {
        width: 100%;
    }
    .match-select {
        width: 100%;
    }
    
    /* Comparative Table */
    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 12px;
        padding-bottom: 4px;
        border: 1px solid #dce8f3;
    }
    .pb-table {
        min-width: 480px;
        font-size: 12px;
        border: 0;
    }
    .pb-table th, .pb-table td {
        padding: 8px 10px;
    }
    .tbl-select {
        width: 100%;
        min-width: 120px;
        font-size: 11.5px;
    }
    
    /* Bottom Navigation Footer */
    .workbook-footer {
        flex-wrap: wrap;
        padding: 10px 12px 14px;
        gap: 8px;
    }
    #feedback-banner {
        width: 100%;
        order: -1;
        font-size: 11.5px;
        padding: 6px 8px;
        background: #f0f7fd;
        border-radius: 8px;
        text-align: center;
    }
    .nav-step-btn {
        flex: 1 1 45%;
        text-align: center;
        padding: 9px 8px;
        font-size: 12px;
        min-height: 40px;
    }
}


/* =========================================================================
   ADDITIONAL ROBUST RESPONSIVE & PRINT ENHANCEMENTS
   ========================================================================= */

html, body {
    max-width: 100vw;
    overflow-x: hidden;
}

.print-header,
.sec-print-title {
    display: none;
}

.print-btn {
    margin-top: 10px;
    width: 100%;
    border: 1.5px dashed var(--muted);
    background: rgba(255, 255, 255, 0.85);
    font-weight: 700;
}

#tf-container .pb-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

#match-container .pb-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

@media (max-width: 768px) {
    #tf-container .pb-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    #tf-container .tf-group {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        width: 100%;
    }
    #match-container .pb-item {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    #match-container .match-select {
        width: 100%;
        max-width: 100%;
    }
    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        max-width: 100%;
    }
    .pb-table {
        min-width: 480px;
    }
}

@media print {
    .print-header {
        display: block !important;
        margin-bottom: 20px;
    }
    .sec-print-title {
        display: block !important;
        margin-top: 14px;
        margin-bottom: 8px;
    }
    .print-btn {
        display: none !important;
    }
}

/* English Explorer - 3 Practice Book Responsive & Interactive Enhancements */
.case-passage-card {
    background: linear-gradient(90deg, #fff9eb 0%, #fef4dc 100%);
    border: 1.5px dashed #e6c173;
    border-radius: 14px;
    padding: 12px 16px;
    margin-bottom: 14px;
    color: #5c3b09;
    font-size: 13.5px;
    line-height: 1.55;
}
.case-passage-card p {
    margin: 0;
}
.match-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}
.match-right {
    flex-shrink: 0;
}
.match-select {
    min-width: 240px;
    max-width: 100%;
}
@media (max-width: 768px) {
    .pb-main {
        grid-template-columns: 1fr;
        width: calc(100% - 20px);
        gap: 14px;
    }
    .sidebar-panel {
        position: static;
    }
    .workbook-hero {
        flex-direction: column;
        align-items: flex-start;
        padding: 16px 18px;
    }
    .hero-stats {
        align-self: stretch;
    }
    .stat-pill {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 8px 14px;
    }
    .ex-section {
        padding: 14px 14px 12px;
    }
}
@media (max-width: 640px) {
    .pb-item {
        flex-wrap: wrap;
        padding: 11px 13px;
    }
    .pb-left {
        align-items: center;
        flex-wrap: wrap;
    }
    .blank-select {
        max-width: 100%;
        margin: 4px 2px;
        font-size: 12.5px;
        padding: 5px 8px;
    }
    .mcq-options {
        grid-template-columns: 1fr;
        padding-left: 0;
        width: 100%;
    }
    .tf-group {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-top: 6px;
    }
    .tf-btn {
        width: 100%;
        text-align: center;
        padding: 9px 10px;
    }
    .match-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .match-right,
    .match-select {
        width: 100%;
        min-width: 0;
    }
    .workbook-footer {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        gap: 8px;
    }
    .nav-step-btn {
        width: 100%;
        text-align: center;
    }
}