* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background-color: #f4f7fb;
    color: #1f2937;
    line-height: 1.6;
}

.site-header {
    background-color: #0f172a;
    color: white;
    padding: 24px 0;
    text-align: center;
}

.site-header h1 {
    margin: 0;
    font-size: 2rem;
}

.subtitle {
    margin: 8px 0 0;
    font-size: 1rem;
    opacity: 0.9;
}

.top-nav {
    background-color: #1d4ed8;
}

.nav-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
}

.top-nav a {
    color: white;
    text-decoration: none;
    padding: 10px 14px;
    border-radius: 6px;
    font-weight: bold;
}

.top-nav a:hover,
.top-nav a.active {
    background-color: rgba(255, 255, 255, 0.2);
}

.wrap {
    width: min(1000px, 92%);
    margin: 0 auto;
}

.card {
    background-color: white;
    margin: 24px 0;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

.intro {
    margin-bottom: 20px;
    color: #555;
}

.task-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 22px;
}

.task-box {
    background-color: #eaf1ff;
    border: 1px solid #c9dafc;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: visible;
    min-height: 320px;
    height: 320px;
}

.task-box-content {
    flex-grow: 1;
}

.task-box h3 {
    margin-top: 0;
    margin-bottom: 8px;
    padding-right: 0;
    font-size: 1.2rem;
}

.badge-container {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0;
    position: absolute;
    right: 12px;
    top: -12px;
    z-index: 2;
}

.badge-container.hidden {
    display: none;
}

.task-box p {
    margin-bottom: 14px;
}

.task-box ul {
    margin: 0 0 18px 22px;
}

.task-btn {
    display: inline-block;
    margin-top: auto;
    align-self: flex-start;
    padding: 10px 14px;
    background-color: #4b67e2;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
}

.task-btn:hover {
    background-color: #3d56c4;
}

.instructions-box {
    background-color: #eef4ff;
    border: 1px solid #c7d2fe;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

textarea {
    width: 100%;
    min-height: 260px;
    margin-top: 10px;
    padding: 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-family: Consolas, monospace;
    font-size: 0.95rem;
    resize: vertical;
}

button {
    margin-top: 16px;
    padding: 12px 18px;
    font-size: 1rem;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    background-color: #2563eb;
    color: white;
    cursor: pointer;
}

button:hover {
    background-color: #1d4ed8;
}

.hint {
    font-size: 0.9rem;
    color: #666;
    margin-top: 8px;
}

.results {
    margin-top: 20px;
    padding: 16px;
    background-color: #f8fafc;
    border: 1px solid #dbeafe;
    border-radius: 10px;
}

.hidden {
    display: none;
}

.pass {
    color: #15803d;
    font-weight: bold;
}

.fail {
    color: #b91c1c;
    font-weight: bold;
}

.note {
    margin-top: 12px;
    font-weight: bold;
}

code {
    background-color: #eef2ff;
    padding: 2px 6px;
    border-radius: 4px;
}

/* output section css*/

.preview {
    margin-top: 20px;
}

.preview-box {
    width: 100%;
    height: 250px;
    margin-top: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background-color: white;
    margin-bottom: 20px;
}

.result-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.result-list li {
    padding: 6px 0;
}

.task-status {
    border: none;
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    margin-bottom: 12px;
}

.task-status .pass {
    color: #15803d;
    font-weight: bold;
    margin: 0;
}

.completion {
    margin-top: 16px;
    padding: 12px;
    border: 1px solid #c7d2fe;
    border-radius: 10px;
    background-color: #eef2ff;
}

.completion-summary {
    width: 100%;
    min-height: 96px;
    margin-top: 12px;
    padding: 10px;
    font-family: Consolas, monospace;
    font-size: 0.9rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    resize: vertical;
}

.copy-button {
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    border: none;
    background-color: #4b67e2;
    color: white;
    font-weight: bold;
    cursor: pointer;
}

.copy-button:hover {
    background-color: #3d56c4;
}

.completion-badge {
    display: inline-flex;
    align-items: center;
    padding: 0;
    border-radius: 0;
    background-color: transparent;
    border: none;
    margin-bottom: 14px;
    gap: 10px;
    background-color: #d1fae5;
    border-radius: 10px;
    padding: 4px 8px;
}

.badge-icon {
    font-size: 1.2rem;
}

.badge-text {
    font-weight: bold;
    color: #1f2937;
}

.task-badge {
    display: inline-block;
    background-color: #ecfdf5;
    color: #065f46;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    margin-left: 0;
    font-weight: bold;
    border: 1px solid #86efac;
    box-shadow: 0 3px 10px rgba(5, 150, 105, 0.18);
}

.grade-panel {
    margin-top: 28px;
    padding: 18px;
    border: 1px solid #dbeafe;
    border-radius: 12px;
    background-color: #f8fbff;
}

.grade-panel h3 {
    margin-top: 0;
    margin-bottom: 10px;
}

.grade-summary-line {
    margin: 4px 0;
}

.overall-grade {
    display: inline-block;
    min-width: 34px;
    text-align: center;
    padding: 2px 8px;
    border-radius: 999px;
    background-color: #e0e7ff;
    color: #1e3a8a;
    font-weight: 700;
}

.table-wrap {
    margin-top: 12px;
    overflow-x: auto;
}

.score-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.score-table th,
.score-table td {
    border: 1px solid #e5e7eb;
    padding: 8px 10px;
    text-align: left;
}

.score-table th {
    background-color: #eef2ff;
}

.integrity-panel {
    margin-top: 20px;
}

.single-line-input {
    width: 100%;
    margin-top: 8px;
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.95rem;
}

.integrity-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.certificate-box {
    margin-top: 16px;
    border: 2px solid #bfdbfe;
    background: #eff6ff;
    border-radius: 12px;
    padding: 16px;
}

.certificate-box h3 {
    margin-top: 0;
}

#certToken {
    font-family: Consolas, monospace;
    font-size: 0.85rem;
    word-break: break-all;
}

#verifyTokenInput {
    min-height: 90px;
    font-size: 0.85rem;
}

@media print {
    body * {
        visibility: hidden;
    }

    #certificateBox,
    #certificateBox * {
        visibility: visible;
    }

    #certificateBox {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        background: white;
        border: 2px solid #000;
    }
}

/* Bonus checks styling */
#task1Hidden, #task2Hidden, #task3Hidden, #task4Hidden, #task5Hidden,
#task6Hidden, #task7Hidden, #task8Hidden, #task9Hidden, #task10Hidden {
    margin-top: 20px;
    padding: 16px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid #f59e0b;
    border-radius: 12px;
    animation: bonusReveal 0.5s ease-out;
}

#task1Hidden h4, #task2Hidden h4, #task3Hidden h4, #task4Hidden h4, #task5Hidden h4,
#task6Hidden h4, #task7Hidden h4, #task8Hidden h4, #task9Hidden h4, #task10Hidden h4 {
    color: #92400e;
    margin: 0 0 12px 0;
    font-size: 1.2rem;
    font-weight: bold;
}

@keyframes bonusReveal {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}
