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

:root {
    --blue: #3158f5;
    --purple: #6d3bea;
    --navy: #102047;
    --text: #17233f;
    --muted: #68738a;
    --border: #e4e7ef;
    --soft: #f8f9ff;
}

body {
    min-height: 100vh;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 5% 0%, rgba(83, 102, 246, .13), transparent 28%),
        radial-gradient(circle at 96% 2%, rgba(155, 91, 241, .13), transparent 30%),
        linear-gradient(135deg, #fafbff 0%, #f6f7fd 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 40% 20%, rgba(255,255,255,.8), transparent 35%);
}

.page {
    width: min(1450px, 94%);
    margin: auto;
    padding: 28px 0 48px;
}

/* HEADER */
.top-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    margin-bottom: 30px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 17px;
}

.brand-icon {
    width: 56px;
    height: 56px;
    flex: 0 0 56px;
    display: grid;
    place-items: center;
    color: var(--blue);
}

.brand-icon svg {
    width: 50px;
    height: 50px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.brand h1 {
    font-size: clamp(27px, 2.8vw, 35px);
    line-height: 1.1;
    letter-spacing: -1.1px;
    font-weight: 800;
    color: #102047;
}

.brand h1 span {
    color: #3158e9;
}

.brand p {
    margin-top: 7px;
    color: #69748a;
    font-size: 15px;
}

.security-note {
    min-width: 290px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px 17px;
    border: 1px solid #e6e5f6;
    border-radius: 30px;
    background: rgba(255,255,255,.72);
    box-shadow: 0 10px 28px rgba(48, 55, 100, .05);
}

.security-note .shield {
    width: 39px;
    height: 39px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #f1f3ff;
    color: #3b5cf2;
}

.security-note svg {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.security-note strong {
    display: block;
    color: #2c4ac7;
    font-size: 12px;
    margin-bottom: 3px;
}

.security-note small {
    display: block;
    color: #6d7588;
    font-size: 11px;
}

/* MAIN */
.layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(500px, 1.03fr);
    gap: 20px;
    align-items: start;
}

.card,
.preview-card {
    border: 1px solid rgba(224, 226, 235, .9);
    border-radius: 18px;
    background: rgba(255,255,255,.91);
    box-shadow:
        0 18px 45px rgba(35, 44, 83, .07),
        0 3px 10px rgba(35, 44, 83, .03);
    backdrop-filter: blur(12px);
}

.form-card {
    padding: 25px;
}

.section-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.heading-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    color: #4b55ed;
}

.heading-icon svg {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.section-heading h2 {
    font-size: 18px;
    color: #122044;
    font-weight: 800;
}

.section-heading p {
    margin-top: 4px;
    font-size: 12px;
    color: #798298;
}

/* STEPS */
.step {
    position: relative;
    padding: 0 0 19px 0;
    margin-bottom: 18px;
    border-bottom: 1px solid #edf0f5;
}

.step:last-of-type {
    margin-bottom: 0;
}

.step-title {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 14px;
}

.step-number {
    width: 29px;
    height: 29px;
    display: grid;
    place-items: center;
    flex: 0 0 29px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3758f6, #6737e9);
    color: white;
    font-size: 12px;
    font-weight: 800;
    box-shadow: 0 6px 14px rgba(74, 72, 235, .22);
}

.step-icon {
    width: 22px;
    height: 22px;
    color: #4356d9;
    display: grid;
    place-items: center;
}

.step-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.step-title h3 {
    font-size: 14px;
    font-weight: 800;
    color: #1a2642;
}

label {
    display: block;
    margin: 0 0 7px;
    color: #27324a;
    font-size: 12px;
    font-weight: 700;
}

.optional {
    color: #9198a8;
    font-weight: 500;
}

input,
select {
    width: 100%;
    height: 43px;
    border: 1px solid #dfe3ec;
    border-radius: 9px;
    outline: none;
    background: #fff;
    color: #263149;
    padding: 0 12px;
    font-family: inherit;
    font-size: 12px;
    transition: .2s ease;
}

input::placeholder {
    color: #9aa1b0;
}

input:focus,
select:focus {
    border-color: #6570ee;
    box-shadow: 0 0 0 3px rgba(91, 95, 236, .1);
}

.select-wrap,
.input-wrap {
    position: relative;
}

.select-wrap select {
    appearance: none;
    padding-right: 35px;
}

.chevron {
    position: absolute;
    right: 13px;
    top: 50%;
    transform: translateY(-56%);
    color: #526078;
    font-size: 18px;
    pointer-events: none;
}

.field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.input-wrap .field-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #8d95a6;
    font-size: 14px;
    z-index: 1;
}

.input-wrap input {
    padding-left: 37px;
}

/* UPLOAD */
.or-divider {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 0 9px;
    color: #7c8598;
    font-size: 11px;
    font-weight: 700;
}

.or-divider::before,
.or-divider::after {
    content: "";
    height: 1px;
    flex: 1;
    background: #e7eaf1;
}

.upload-label {
    margin-bottom: 7px;
    color: #5e6880;
    font-weight: 600;
}

.upload-label span {
    color: #9ba2b1;
    font-weight: 500;
}

.upload-dot {
    display: inline-block;
    width: 5px;
    height: 5px;
    margin-right: 4px;
    border-radius: 50%;
    background: #5870df;
}

.upload-box {
    position: relative;
    height: 72px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 3px;
    border: 1px dashed #cdd3e7;
    border-radius: 9px;
    background: #fbfbff;
    cursor: pointer;
    transition: .2s ease;
}

.upload-box:hover {
    border-color: #6971ed;
    background: #f8f8ff;
}

.upload-box input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-box svg {
    width: 29px;
    height: 29px;
    margin-bottom: 1px;
    fill: none;
    stroke: #6557e9;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.upload-box strong {
    font-size: 12px;
    color: #34405a;
}

.upload-box small {
    font-size: 10px;
    color: #9199aa;
}

.email-help {
    margin-top: 6px;
    font-size: 10px;
    color: #7f8798;
}

/* BUTTONS */
.actions {
    display: flex;
    gap: 12px;
    margin-top: 18px;
}

button {
    border: 0;
    font: inherit;
    cursor: pointer;
}

.generate {
    min-height: 48px;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border-radius: 8px;
    background: linear-gradient(100deg, #285af4, #7235e8);
    color: white;
    font-size: 14px;
    font-weight: 800;
    box-shadow: 0 9px 20px rgba(67, 67, 226, .23);
    transition: .2s ease;
}

.generate:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 25px rgba(67, 67, 226, .3);
}

.generate svg,
.reset svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.reset {
    width: 92px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid #dfe3eb;
    border-radius: 8px;
    background: #fff;
    color: #263149;
    font-size: 12px;
    font-weight: 700;
}

.reset:hover {
    background: #f6f7fa;
}

/* BENEFITS */
.benefits {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin-top: 14px;
    padding: 12px 8px;
    border-radius: 8px;
    background: linear-gradient(90deg, #effcf8, #f0fbf7);
    color: #278c77;
}

.benefits div {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 7px;
    font-size: 11px;
    font-weight: 800;
}

.benefits span {
    font-size: 16px;
}

/* PREVIEW */
.preview-card {
    padding: 16px;
    position: sticky;
    top: 18px;
}

.preview-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 4px 13px;
}

.preview-heading {
    display: flex;
    align-items: center;
    gap: 9px;
}

.eye-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #f0f2ff;
    color: #4457e8;
}

.eye-icon svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.preview-heading h2 {
    font-size: 14px;
    color: #172341;
    font-weight: 800;
}

.preview-heading p {
    margin-top: 3px;
    font-size: 11px;
    color: #7b8497;
}

.preview-controls {
    display: flex;
    align-items: center;
    gap: 9px;
}

.a4-label {
    height: 39px;
    display: flex;
    align-items: center;
    padding: 0 15px;
    border: 1px solid #e0e3eb;
    border-radius: 9px;
    background: #fff;
    color: #28334c;
    font-size: 11px;
    font-weight: 800;
}

.theme-btn {
    width: 39px;
    height: 39px;
    border: 1px solid #e1e4eb;
    border-radius: 50%;
    background: #fff;
    color: #34405a;
    font-size: 16px;
}

.theme-btn.active {
    background: #fff8e6;
    color: #efb327;
    border-color: #f0dfb0;
}

.paper-shell {
    padding: 0 34px 8px;
}

.paper {
    position: relative;
    width: 100%;
    aspect-ratio: 210 / 297;
    min-height: 650px;
    overflow: hidden;
    padding: 10.5% 10%;
    background: #fff;
    border-radius: 5px;
    border: 1px solid #e3e5e9;
    box-shadow:
        0 10px 27px rgba(22, 32, 61, .12),
        0 1px 4px rgba(22, 32, 61, .08);
    color: #17223f;
    transition: .25s ease;
}

.paper::before,
.paper::after {
    content: "";
    position: absolute;
    pointer-events: none;
}

.paper::before {
    inset: 7px;
    border: 1px solid #d4a64c;
    opacity: .9;
}

.paper::after {
    inset: 11px;
    border: 1px solid rgba(212,166,76,.55);
}

/* decorative corners */
.corner {
    position: absolute;
    width: 95px;
    height: 95px;
    z-index: 2;
    pointer-events: none;
}

.corner-tl {
    top: 0;
    left: 0;
    background: linear-gradient(145deg, #102b58 0 47%, transparent 48%);
}

.corner-tl::after,
.corner-br::after {
    content: "";
    position: absolute;
    width: 115px;
    height: 18px;
    background: #d9a747;
    transform: rotate(-40deg);
}

.corner-tl::after {
    top: 18px;
    left: -19px;
}

.corner-tr {
    top: 7px;
    right: 7px;
    border-top: 1px solid #d4a64c;
    border-right: 1px solid #d4a64c;
}

.corner-bl {
    bottom: 7px;
    left: 7px;
    border-bottom: 1px solid #d4a64c;
    border-left: 1px solid #d4a64c;
}

.corner-br {
    right: 0;
    bottom: 0;
    background: linear-gradient(325deg, #102b58 0 47%, transparent 48%);
}

.corner-br::after {
    right: -20px;
    bottom: 18px;
    transform: rotate(-40deg);
}

/* LOGO */
.paper-logo-wrap {
    position: relative;
    z-index: 3;
    width: 100%;
    min-height: 84px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.paper-logo {
    width: 78px;
    height: 78px;
    object-fit: contain;
    display: none;
}

.logo-placeholder {
    width: 58px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed #c8cdd8;
    border-radius: 8px;
    color: #a0a7b4;
    font-size: 8px;
    letter-spacing: 1px;
}

/* PAPER CONTENT */
.university {
    position: relative;
    z-index: 3;
    text-align: center;
    color: #102348;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(18px, 2.1vw, 28px);
    line-height: 1.2;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin: 0 auto;
}

.ornament-line {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 56%;
    margin: 16px auto 0;
}

.ornament-line span,
.bottom-ornament span {
    height: 1px;
    flex: 1;
    background: #d3a64d;
}

.ornament-line i,
.bottom-ornament i {
    color: #d3a64d;
    font-size: 8px;
    font-style: normal;
}

.paper-space {
    height: 14%;
    min-height: 80px;
}

.paper-section {
    position: relative;
    z-index: 3;
    margin-bottom: 12%;
}

.paper-section h3 {
    display: inline-block;
    position: relative;
    margin-bottom: 15px;
    padding-bottom: 8px;
    color: #172c52;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(11px, 1.05vw, 14px);
    letter-spacing: .8px;
    font-weight: 800;
}

.paper-section h3::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 1px;
    background: #d6a64b;
}

.paper-row {
    display: grid;
    grid-template-columns: 70px 12px 1fr;
    align-items: center;
    gap: 7px;
    padding: 7px 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(10px, .95vw, 13px);
}

.paper-row span {
    color: #1c2a42;
}

.paper-row b {
    font-weight: 400;
    color: #1d2941;
}

.paper-row strong {
    min-width: 0;
    padding-bottom: 4px;
    border-bottom: 1px solid #d6d8dc;
    color: #17233b;
    font-weight: 500;
}

.submitted-to {
    margin-top: 4%;
}

.bottom-ornament {
    position: absolute;
    z-index: 3;
    left: 23%;
    right: 23%;
    bottom: 7.5%;
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-tip {
    padding: 7px 0 0;
    text-align: center;
    color: #7b8497;
    font-size: 10px;
}

/* PAPER DARK */
.paper.paper-dark {
    background: #172039;
    color: #f6f7fb;
    border-color: #303a58;
}

.paper.paper-dark .university,
.paper.paper-dark .paper-section h3,
.paper.paper-dark .paper-row span,
.paper.paper-dark .paper-row b,
.paper.paper-dark .paper-row strong {
    color: #f3f5fb;
}

.paper.paper-dark .paper-row strong {
    border-color: #53607b;
}

/* ACCESSIBILITY */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* RESPONSIVE */
@media (max-width: 1100px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .preview-card {
        position: static;
    }

    .paper-shell {
        padding: 0 10%;
    }

    .paper {
        min-height: 0;
    }
}

@media (max-width: 720px) {
    .page {
        width: 92%;
        padding-top: 20px;
    }

    .top-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .security-note {
        width: 100%;
    }

    .field-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .form-card {
        padding: 19px;
    }

    .preview-card {
        padding: 11px;
    }

    .preview-top {
        align-items: flex-start;
        gap: 10px;
        flex-direction: column;
    }

    .preview-controls {
        width: 100%;
    }

    .a4-label {
        flex: 1;
        justify-content: center;
    }

    .paper-shell {
        padding: 0 2px;
    }

    .paper {
        padding-left: 9%;
        padding-right: 9%;
    }

    .benefits {
        grid-template-columns: 1fr;
        gap: 7px;
    }

    .benefits div {
        justify-content: flex-start;
        padding-left: 12px;
    }

    .actions {
        flex-direction: column;
    }

    .reset {
        width: 100%;
        min-height: 44px;
    }
}

@media (max-width: 450px) {
    .brand h1 {
        font-size: 24px;
    }

    .brand p {
        font-size: 12px;
    }

    .paper {
        aspect-ratio: auto;
        min-height: 590px;
    }

    .paper-space {
        min-height: 65px;
    }
}

/* =========================================================
   FINAL COVER PREVIEW ADJUSTMENTS
   Keep the existing website design. Only fix the A4 paper.
   ========================================================= */

/* ASSIGNMENT + SUBMISSION COVER PAGE centered */
.cover-title {
    position: relative;
    z-index: 3;
    width: 100%;
    margin: 27px auto 0;
    text-align: center;
}

.cover-title h2 {
    margin: 0;
    color: #102348;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(20px, 2vw, 25px);
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: .4px;
    text-transform: uppercase;
}

.cover-title p {
    margin: 5px 0 0;
    color: #3d4b63;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 10px;
    line-height: 1.3;
    font-weight: 400;
    text-align: center;
    text-transform: uppercase;
}

/* Move SUBMITTED BY / TO lower on the A4 page */
.paper-space {
    height: 22%;
    min-height: 135px;
}

.paper-section {
    margin-bottom: 12%;
}

.submitted-to {
    margin-top: 5%;
}

/* Keep the bottom ornament in the same PDF-style position */
.bottom-ornament {
    left: 23%;
    right: 23%;
    bottom: 7.5%;
}

@media (max-width: 700px) {
    .cover-title {
        margin-top: 22px;
    }

    .paper-space {
        height: 19%;
        min-height: 105px;
    }
}