@import url("https://fonts.googleapis.com/css2?family=Quicksand:wght@500;700&family=Nunito:wght@500;700;800&display=swap");

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Nunito", Arial, sans-serif;
    background:
        radial-gradient(circle at 14% 16%, rgba(255, 193, 218, 0.55), transparent 36%),
        radial-gradient(circle at 86% 10%, rgba(182, 223, 255, 0.48), transparent 34%),
        linear-gradient(140deg, #fff8fc, #f4f8ff 56%, #f0faff);
    color: #57597a;
    min-height: 100vh;
    padding: 14px;
    overflow: hidden;
}

.page-shell {
    width: min(1180px, 100%);
    height: calc(100vh - 28px);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 14px;
}

.hero {
    border-radius: 28px;
    border: 1px solid #f8dceb;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 12px 28px rgba(169, 186, 222, 0.24);
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
}

.hero-tag {
    font-family: "Quicksand", sans-serif;
    font-size: 12px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: #9d8fb7;
    margin-bottom: 8px;
}

.hero h1 {
    font-size: clamp(1.6rem, 2.9vw, 2.2rem);
    color: #6a688d;
    margin-bottom: 6px;
    font-weight: 800;
}

.hero p {
    color: #8a86ab;
    margin-bottom: 14px;
}

.main-btn {
    padding: 10px 16px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, #ffd8e8, #d4ecff);
    color: #5b5f82;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 16px rgba(172, 195, 230, 0.34);
    transition: 0.2s ease;
}

.main-btn:hover {
    transform: translateY(-2px);
}

.hero-notes {
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.hero-notes span {
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    color: #7b78a0;
    background: #f4f7ff;
    border: 1px solid #e8edff;
}

.activities {
    border-radius: 28px;
    border: 1px solid #e6eeff;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 12px 30px rgba(158, 180, 220, 0.24);
    padding: 16px 14px;
    height: 100%;
    overflow-y: auto;
}

.activities h2 {
    font-size: 1.45rem;
    color: #6a678f;
    margin-bottom: 12px;
}

.exercise {
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #edf1ff;
    box-shadow: 0 8px 18px rgba(166, 181, 216, 0.18);
    margin-bottom: 10px;
    background: #fff;
}

.exercise-header {
    padding: 11px 14px;
    background: linear-gradient(130deg, #e3efff, #ffe4ef);
    color: #5f5c83;
    font-weight: 800;
    font-size: 1.02rem;
    cursor: pointer;
    user-select: none;
}

.exercise-content {
    display: none;
    padding: 12px;
    background: #fdfdff;
    border-top: 1px solid #f0f3ff;
}

.exercise-content.show {
    display: block;
}

.button-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.button-group button {
    padding: 10px 10px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #ffe3ee, #e2f1ff);
    color: #616086;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(172, 195, 230, 0.25);
}

.button-group button:hover {
    transform: translateY(-1px);
}

.week3-panel {
    display: none;
}

.week3-panel.show {
    display: block;
}

.demo-box {
    margin-top: 10px;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid #edf1ff;
    background: #fff;
}

.demo-box h3 {
    color: #6a688f;
    font-size: 16px;
    margin-bottom: 6px;
}

.demo-box p {
    color: #8a86ab;
}

.demo-box input {
    padding: 7px 10px;
    margin: 6px 4px;
    border-radius: 8px;
    border: 1px solid #d8e1f3;
    color: #5f5f85;
    font-family: inherit;
}

.demo-box ul {
    margin-top: 8px;
    list-style-position: inside;
}

.demo-box img {
    border-radius: 10px;
    max-width: 220px;
    margin-top: 8px;
}

#w3activity7 img {
    width: 220px;
    height: 140px;
    object-fit: cover;
    display: block;
    margin: 8px auto 0 auto;
}

#w3activity7 button {
    display: block;
    margin: 10px auto 0 auto;
}

#w3activity8 #todoList {
    text-align: left;
    padding-left: 22px;
    margin-top: 10px;
}

#w3activity8 #todoList li {
    margin-bottom: 5px;
}

.dark-mode {
    background: linear-gradient(145deg, #252638, #2f334a) !important;
    color: #f3f3ff !important;
}

.dark-mode .hero,
.dark-mode .activities,
.dark-mode .exercise,
.dark-mode .demo-box {
    background: rgba(55, 58, 84, 0.95) !important;
    color: #f3f3ff !important;
    border-color: #575f88 !important;
}

.dark-mode .hero-tag,
.dark-mode .hero p,
.dark-mode .demo-box p {
    color: #cfd4ff !important;
}

.dark-mode .hero-notes span {
    background: #454a6b !important;
    border-color: #636b95 !important;
    color: #e8e9ff !important;
}

.dark-mode .exercise-header {
    background: linear-gradient(130deg, #5f6490, #7a628e) !important;
    color: #f7f7ff !important;
}

.dark-mode .exercise-content {
    background: #3f4463 !important;
    border-top-color: #59608c !important;
}

.dark-mode .button-group button,
.dark-mode .demo-box button,
.dark-mode .main-btn {
    background: linear-gradient(135deg, #8ea4ff, #f2a7cb) !important;
    color: #28253f !important;
    box-shadow: 0 8px 16px rgba(27, 20, 45, 0.35) !important;
}

.dark-mode .demo-box input {
    background: #2f3551 !important;
    border-color: #5d6797 !important;
    color: #f2f4ff !important;
}

.dark-mode .activities h2,
.dark-mode .demo-box h3,
.dark-mode .hero h1 {
    color: #f3f4ff !important;
}

@media (max-width: 900px) {
    body {
        overflow: auto;
        padding: 10px;
    }

    .page-shell {
        height: auto;
        grid-template-columns: 1fr;
    }

    .hero {
        padding: 20px 14px;
    }

    .activities {
        height: auto;
        overflow: visible;
    }
}

/* ===== New styles for Exercise 4 ===== */
.week4-panel {
    display: none;
}

.week4-panel.show {
    display: block;
}

.grade-inputs {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 12px 0;
}

.grade-inputs input {
    width: 100%;
}

#calcGradeBtn, #resetGradeBtn {
    margin: 0 5px;
}

.quiz-input {
    width: 100%;
    margin-bottom: 8px;
}

.week4-panel {
    display: none;
}

.week4-panel.show {
    display: block;
}