/* =========================================
   AI SERTIFIKAT — GRADIENT EDITION
   Full responsive CSS
========================================= */

:root {
    --page-bg: #eef3ff;
    --page-bg-2: #e7edff;
    --surface: rgba(255, 255, 255, 0.94);
    --surface-solid: #ffffff;
    --surface-soft: #f4f6ff;

    --text: #1c2b50;
    --text-secondary: #526487;
    --muted: #8290ad;

    --blue: #3678f6;
    --blue-dark: #2757d9;
    --purple: #7955ed;
    --purple-dark: #6240d2;
    --mint: #15bda1;
    --green: #079b7c;

    --border: #dfe6fa;
    --border-strong: #cdd8f6;

    --shadow: 0 16px 45px rgba(53, 78, 151, 0.09);

    --gradient:
        linear-gradient(
            115deg,
            #3678f6 0%,
            #7655ef 55%,
            #9b5cf6 100%
        );

    --gradient-soft:
        linear-gradient(
            135deg,
            #edf3ff 0%,
            #f5efff 100%
        );
}

/* RESET */

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
    background: var(--page-bg);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);

    background:
        radial-gradient(
            ellipse at 10% 0%,
            rgba(113, 163, 255, 0.19),
            transparent 38%
        ),
        radial-gradient(
            ellipse at 90% 10%,
            rgba(169, 117, 255, 0.15),
            transparent 36%
        ),
        linear-gradient(
            145deg,
            #eef4ff 0%,
            #edf0ff 48%,
            #f5efff 100%
        );

    font-family: "Inter", "Manrope", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.65;

    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button,
input,
textarea {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: var(--blue);
    text-decoration: none;
}

::selection {
    color: #ffffff;
    background: #7955ed;
}

/* MAIN */

.essay-page {
    position: relative;
    min-height: 80vh;
    padding: 30px 0 72px;
}

.essay-container {
    width: min(1200px, calc(100% - 48px));
    margin: 0 auto;
}

/* PAGE HEADER */

.page-title {
    position: relative;
    isolation: isolate;
    overflow: hidden;

    margin: 0 0 30px;
    padding: 27px 30px 29px;

    border: 1px solid rgba(255, 255, 255, 0.85);
    border-radius: 24px;

    background:
        radial-gradient(
            circle at 85% 10%,
            rgba(146, 119, 255, 0.18),
            transparent 30%
        ),
        linear-gradient(
            125deg,
            rgba(255, 255, 255, 0.82),
            rgba(245, 244, 255, 0.79)
        );

    box-shadow: 0 14px 40px rgba(58, 80, 153, 0.055);
}

.subject-badge {
    display: flex;
    flex-wrap: wrap;
    gap: 7px 16px;

    margin-bottom: 18px;

    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 650;
}

.title-layout {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
}

.title-layout > div:first-child {
    position: relative;
    z-index: 2;
    max-width: 820px;
}

.eyebrow {
    display: flex;
    align-items: center;
    gap: 8px;

    margin-bottom: 12px;

    color: var(--purple-dark);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.5px;
}

.eyebrow-dot {
    width: 7px;
    height: 7px;
    flex: 0 0 7px;

    border-radius: 50%;
    background: var(--purple);

    box-shadow: 0 0 0 4px rgba(121, 85, 237, 0.12);
}

.page-title h1 {
    max-width: 800px;
    margin: 0 0 13px;

    color: #1c2b50;
    font-family: "Manrope", "Inter", Arial, sans-serif;

    font-size: clamp(32px, 4vw, 47px);
    font-weight: 800;
    line-height: 1.16;
    letter-spacing: -1.7px;
}

.page-title h1 span {
    color: transparent;
    background: var(--gradient);
    background-clip: text;
    -webkit-background-clip: text;
}

.exam-subtitle {
    margin: 0 0 5px;

    color: #354a75;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.7;
}

.page-title .subtitle {
    max-width: 730px;
    margin: 0;

    color: var(--muted);
    font-size: 13px;
    line-height: 1.9;
}

/* DECORATIVE AI ILLUSTRATION */

.title-art {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 170px;
    height: 150px;
    flex: 0 0 170px;
}

.art-orbit {
    position: absolute;
    border: 1px solid rgba(113, 103, 242, 0.18);
    border-radius: 50%;
}

.orbit-one {
    width: 142px;
    height: 142px;
}

.orbit-two {
    width: 110px;
    height: 110px;
    border-style: dashed;
}

.art-document {
    position: relative;
    z-index: 2;

    width: 72px;
    height: 92px;
    padding: 23px 12px 12px;

    border: 1px solid rgba(115, 113, 239, 0.2);
    border-radius: 13px;

    background: linear-gradient(145deg, #ffffff, #f2f0ff);
    box-shadow: 0 15px 30px rgba(80, 86, 173, 0.17);

    transform: rotate(-8deg);
}

.document-line {
    display: block;

    width: 100%;
    height: 5px;
    margin-bottom: 8px;

    border-radius: 6px;
    background: #dbe3fb;
}

.document-line.line-long {
    width: 88%;
    background: #9db8ff;
}

.document-line.line-short {
    width: 62%;
}

.document-highlight {
    display: block;

    width: 100%;
    height: 9px;
    margin: 2px 0 8px;

    border-radius: 4px;

    background: linear-gradient(
        90deg,
        rgba(54, 120, 246, 0.23),
        rgba(121, 85, 237, 0.28)
    );
}

.art-ai {
    position: absolute;
    z-index: 3;

    top: 14px;
    right: 8px;

    display: grid;
    place-items: center;

    width: 43px;
    height: 43px;

    border: 3px solid rgba(255, 255, 255, 0.8);
    border-radius: 14px;

    background: var(--gradient);
    color: #ffffff;

    font-size: 13px;
    font-weight: 900;

    box-shadow: 0 8px 22px rgba(91, 85, 225, 0.28);

    transform: rotate(8deg);
}

.art-sparkle {
    position: absolute;
    color: #8d68f5;
    font-size: 24px;
}

.sparkle-one {
    left: 8px;
    top: 23px;
}

.sparkle-two {
    right: 10px;
    bottom: 16px;
    color: #4e91fa;
}

/* =========================================
   MAIN GRID
   ESSAY AND CRITERIA CARDS
========================================= */

.content {
    display: grid;

    grid-template-columns: minmax(0, 1fr) 315px;

    /* Ikkala ustunni bir xil qator balandligiga cho'zadi */
    align-items: stretch;

    gap: 24px;
}

.essay-main,
.criteria-sidebar {
    min-width: 0;
    min-height: 0;
}

/* CARDS */

.card {
    min-width: 0;

    padding: 25px;

    border: 1px solid rgba(255, 255, 255, 0.95);
    border-radius: 20px;

    background: var(--surface);
    box-shadow: var(--shadow);

    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.essay-card {
    margin: 0 0 24px;
}

.card-title {
    margin: 0;

    color: var(--text);
    font-family: "Manrope", "Inter", Arial, sans-serif;

    font-size: 17px;
    font-weight: 800;
    line-height: 1.4;
    letter-spacing: -0.35px;
}

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

.heading-icon {
    display: grid;
    place-items: center;

    width: 42px;
    height: 42px;
    flex: 0 0 42px;

    border: 1px solid #e2e6ff;
    border-radius: 13px;

    background: linear-gradient(135deg, #eaf1ff, #f2eaff);
    color: var(--purple);

    font-size: 19px;
    font-weight: 800;
}

.section-caption {
    margin: 4px 0 0;

    color: var(--muted);
    font-size: 11px;
    line-height: 1.6;
}

/* ESSAY HEADER */

.essay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;

    gap: 18px;
    margin-bottom: 23px;
}

.student-field {
    display: flex;
    flex-direction: column;
    gap: 6px;

    min-width: 170px;
}

.student-field label {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
}

.student-field label span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 500;
}

.student-field input {
    width: 190px;
    max-width: 100%;
    height: 40px;

    padding: 0 12px;

    border: 1px solid var(--border);
    border-radius: 10px;
    outline: none;

    background: #fbfcff;
    color: var(--text);

    font-size: 12px;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.student-field input::placeholder {
    color: #a0abc4;
}

.student-field input:focus {
    border-color: #8d7bf4;
    box-shadow: 0 0 0 4px rgba(121, 85, 237, 0.1);
}

/* TOPIC */

.topic-box {
    margin-bottom: 19px;
    padding: 17px;

    border: 1px solid #dce5ff;
    border-left: 3px solid var(--blue);
    border-radius: 14px;

    background: linear-gradient(135deg, #f1f6ff, #f8f5ff);
}

.topic-box label,
.input-heading label {
    display: block;
    margin-bottom: 9px;

    color: #596c9c;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
}

.topic-input {
    display: block;
    width: 100%;
    min-height: 84px;

    padding: 12px 14px;
    resize: vertical;

    border: 1px solid #e0e7f7;
    border-radius: 10px;
    outline: none;

    background: rgba(255, 255, 255, 0.92);
    color: var(--text);

    font-size: 13px;
    line-height: 1.7;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.topic-input::placeholder {
    color: #9aa8c3;
}

.topic-input:focus {
    border-color: #8873ef;
    box-shadow: 0 0 0 3px rgba(121, 85, 237, 0.09);
}

/* FILE UPLOAD */

.ocr-upload {
    position: relative;

    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;

    gap: 13px;
    margin: 20px 0;
    padding: 18px;

    border: 1px dashed #b8c8fb;
    border-radius: 15px;

    background: linear-gradient(120deg, #eff6ff, #f5f0ff);

    transition:
        border-color 0.2s ease,
        background 0.2s ease;
}

.ocr-upload:hover {
    border-color: #8b7af0;
    background: linear-gradient(120deg, #eaf2ff, #f2ebff);
}

.upload-icon {
    display: grid;
    place-items: center;

    width: 43px;
    height: 43px;

    border: 1px solid #d5e2ff;
    border-radius: 12px;

    background: #ffffff;
    color: var(--blue);

    font-size: 24px;
    font-weight: 700;
}

.upload-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
}

.upload-copy strong {
    color: #354a75;
    font-size: 12px;
    font-weight: 750;
}

.upload-copy small {
    color: var(--muted);
    font-size: 10px;
}

.ocr-upload-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 38px;
    padding: 9px 13px;

    border: 1px solid #dce3ff;
    border-radius: 10px;

    background: #ffffff;
    color: var(--purple-dark);

    font-size: 11px;
    font-weight: 800;

    cursor: pointer;
    transition: 0.2s ease;
}

.ocr-upload-label:hover {
    border-color: #9c8af4;
    background: #f8f6ff;
    transform: translateY(-1px);
}

.ocr-upload input[type="file"] {
    position: absolute;

    width: 1px;
    height: 1px;

    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

#ocrStatus {
    grid-column: 1 / -1;

    display: block;
    margin: 0;

    color: var(--muted);
    font-size: 10px;
    line-height: 1.7;
}

/* ESSAY INPUT */

.essay-input-group {
    margin-top: 22px;
}

.input-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;

    gap: 6px 12px;
    margin-bottom: 8px;
}

.input-heading label {
    margin: 0;
}

.input-hint {
    color: var(--muted);
    font-size: 10px;
}

#essayText {
    display: block;
    width: 100%;
    min-height: 270px;

    padding: 17px;
    resize: vertical;

    border: 1px solid #dce4f6;
    border-radius: 13px;
    outline: none;

    background: #ffffff;
    color: var(--text);

    font-size: 13px;
    line-height: 1.9;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

#essayText::placeholder {
    color: #9aa8c2;
}

#essayText:focus {
    border-color: #8873ef;
    box-shadow: 0 0 0 4px rgba(121, 85, 237, 0.09);
}

/* COUNTERS */

.counters {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));

    gap: 10px;
    margin-top: 13px;
}

.counter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;

    min-height: 45px;
    padding: 9px 12px;

    border: 1px solid #e0e7fa;
    border-radius: 11px;

    background: linear-gradient(135deg, #f1f6ff, #f8f5ff);
}

.counter span {
    color: var(--purple-dark);
    font-size: 15px;
    font-weight: 850;
    font-variant-numeric: tabular-nums;
}

.counter small {
    color: var(--muted);
    font-size: 10px;
}

/* WORD STATUS */

.word-status {
    margin-top: 12px;
    padding: 12px 14px;

    border: 1px solid #e0e7fa;
    border-radius: 10px;

    font-size: 11px;
    line-height: 1.7;
}

.word-status.neutral {
    background: #f2f6ff;
    color: #687da6;
}

.word-status.warning {
    background: #fff7e9;
    color: #9a6718;
    border-color: #f5e2b9;
}

.word-status.success {
    background: #e9faf4;
    color: #087c66;
    border-color: #c8eee1;
}

/* CHECK BUTTON */

.check-btn {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;

    width: 100%;
    min-height: 52px;
    margin-top: 16px;
    padding: 13px 46px;

    overflow: hidden;

    border: 0;
    border-radius: 13px;

    background: var(--gradient);
    color: #ffffff;

    font-size: 13px;
    font-weight: 800;

    cursor: pointer;

    box-shadow: 0 10px 23px rgba(93, 88, 222, 0.22);

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        filter 0.2s ease;
}

.check-btn::before {
    position: absolute;

    top: 0;
    left: -100%;

    width: 70%;
    height: 100%;

    content: "";

    background: linear-gradient(
        100deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );

    transition: left 0.55s ease;
}

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

    box-shadow: 0 14px 28px rgba(93, 88, 222, 0.27);

    filter: saturate(1.08);
}

.check-btn:hover::before {
    left: 130%;
}

.check-btn:active {
    transform: translateY(0);
}

.check-btn:disabled {
    opacity: 0.65;
    cursor: wait;
    transform: none;
    box-shadow: none;
}

.button-search-icon {
    font-size: 21px;
    line-height: 1;
}

.button-arrow {
    position: absolute;
    right: 18px;

    font-size: 18px;
    opacity: 0.9;
}

.form-note {
    display: flex;
    align-items: flex-start;
    gap: 7px;

    margin: 13px 0 0;

    color: var(--muted);
    font-size: 10px;
    line-height: 1.7;
}

/* =========================================
   CRITERIA SIDEBAR
   MUHIM: BALANDLIK ASOSIY BLOK BILAN TENG
========================================= */

.criteria-sidebar {
    display: flex;
    flex-direction: column;
    align-self: stretch;
    min-width: 0;
}

.criteria-sidebar .criteria-card {
    position: static;

    width: 100%;
    height: 100%;

    flex: 1 1 auto;

    padding: 23px;
    margin: 0;

    top: auto;
}

.criteria-card-heading {
    display: flex;
    align-items: center;
    gap: 12px;

    margin-bottom: 19px;
}

.criteria-card-heading .heading-icon {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
}

.criteria {
    display: flex;
    flex-direction: column;
}

.criterion {
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr) auto;
    align-items: center;

    gap: 8px;
    padding: 14px 0;

    border-bottom: 1px solid #edf0fb;
}

.criterion-number {
    display: grid;
    place-items: center;

    width: 24px;
    height: 24px;

    border: 1px solid #e0e5ff;
    border-radius: 8px;

    background: #f0f2ff;
    color: var(--purple-dark);

    font-size: 9px;
    font-weight: 800;
}

.criterion span {
    color: #58698d;
    font-size: 11px;
    line-height: 1.6;
}

.criterion strong {
    padding: 4px 7px;

    border: 1px solid #dfe5ff;
    border-radius: 7px;

    background: #f1f3ff;
    color: var(--purple-dark);

    font-size: 10px;
    font-weight: 850;

    white-space: nowrap;
}

.criterion-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    margin-top: 16px;
    padding: 14px;

    border: 1px solid #dfe3ff;
    border-radius: 12px;

    background: linear-gradient(120deg, #edf4ff, #f3ecff);
}

.criterion-total > div:first-child {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.criterion-total span {
    color: var(--muted);
    font-size: 10px;
}

.criterion-total strong {
    color: #34477a;
    font-size: 15px;
    font-weight: 850;
}

.total-icon {
    display: grid;
    place-items: center;

    width: 35px;
    height: 35px;
    flex: 0 0 35px;

    border-radius: 11px;

    background: var(--gradient);
    color: #ffffff;

    font-size: 18px;
}

/* INFO BOX */

.info-box {
    display: flex;
    align-items: flex-start;
    gap: 11px;

    margin-top: 17px;
    padding: 15px;

    border: 1px solid #d9e5ff;
    border-radius: 13px;

    background: linear-gradient(135deg, #eff6ff, #f4efff);
}

.info-icon {
    display: grid;
    place-items: center;

    width: 25px;
    height: 25px;
    flex: 0 0 25px;

    border-radius: 8px;

    background: #e0e9ff;
    color: var(--blue-dark);

    font-size: 12px;
    font-weight: 900;
}

.info-box strong {
    display: block;
    margin-bottom: 5px;

    color: #394e7c;
    font-size: 11px;
    font-weight: 800;
}

.info-box p {
    margin: 0;

    color: #7182a3;
    font-size: 10px;
    line-height: 1.8;
}

.privacy-note {
    display: flex;
    align-items: flex-start;
    gap: 7px;

    margin-top: 15px;

    color: #8794b0;
    font-size: 10px;
    line-height: 1.7;
}

/* RESULT */

.result {
    display: none;
    margin-top: 24px;
    animation: resultReveal 0.35s ease;
}

.result.show {
    display: block;
}

@keyframes resultReveal {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;

    margin-bottom: 20px;
}

.result-status-icon {
    display: grid;
    place-items: center;

    width: 42px;
    height: 42px;
    flex: 0 0 42px;

    border: 1px solid #c7eee2;
    border-radius: 14px;

    background: #e6faf3;
    color: #079b7c;

    font-size: 21px;
    font-weight: 800;
}

.result-score {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    padding: 22px;

    border: 1px solid #dce3ff;
    border-radius: 15px;

    background: linear-gradient(125deg, #edf5ff, #f2edff);
}

.score-label {
    margin-bottom: 5px;

    color: var(--text-secondary);
    font-size: 12px;
}

.score-number {
    color: var(--purple-dark);

    font-size: 40px;
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: -1.2px;
}

.score-max {
    color: #8b95b0;
    font-size: 20px;
    font-weight: 600;
}

.score-scale-note {
    margin-top: 7px;

    color: var(--muted);
    font-size: 10px;
}

.score-badge {
    padding: 7px 10px;

    border: 1px solid #d9dcff;
    border-radius: 8px;

    background: rgba(255, 255, 255, 0.7);
    color: var(--purple-dark);

    font-size: 9px;
    font-weight: 850;
    letter-spacing: 0.8px;
}

/* REVIEW AND RESULT SECTIONS */

.review-box,
.essay-review-section,
.errors-section,
.recommendations-section {
    margin-top: 18px;
    padding: 18px;

    border: 1px solid var(--border);
    border-radius: 14px;

    background: #ffffff;
}

.review-box h3,
.essay-review-section h3,
.errors-section h3,
.recommendations-section h3 {
    margin: 0 0 11px;

    color: var(--text);
    font-family: "Manrope", "Inter", Arial, sans-serif;

    font-size: 14px;
    font-weight: 800;
}

.review-box p {
    margin: 0;

    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.9;
}

.highlighted-essay {
    min-height: 40px;

    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.9;

    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.criteria-result {
    margin-top: 18px;
}

.result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;

    padding: 12px 0;

    border-bottom: 1px solid #edf0fb;
}

.result-item span {
    color: var(--text-secondary);
    font-size: 12px;
}

.result-item strong {
    color: var(--purple-dark);
    font-size: 12px;
    white-space: nowrap;
}

.error-item {
    padding: 12px 0;

    border-bottom: 1px solid #f1e5ef;

    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.8;
}

.error-item:last-child {
    border-bottom: none;
}

.recommendation-item {
    padding: 7px 0;

    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.8;
}

/* ERROR HIGHLIGHTING */

.essay-error {
    border-radius: 3px;

    background: #fff0f3;
    color: #c43f65;

    text-decoration: underline wavy #e55d81;
    text-decoration-thickness: 1.5px;

    cursor: pointer;
}

/* FOCUS */

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(121, 85, 237, 0.25);
    outline-offset: 3px;
}

/* SCROLLBAR */

::-webkit-scrollbar {
    width: 9px;
}

::-webkit-scrollbar-track {
    background: #edf1ff;
}

::-webkit-scrollbar-thumb {
    border: 2px solid #edf1ff;
    border-radius: 20px;
    background: #c6ccef;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8b1e6;
}

/* =========================================
   TABLET
========================================= */

@media (max-width: 1000px) {
    .content {
        grid-template-columns: minmax(0, 1fr) 285px;
        align-items: stretch;
        gap: 18px;
    }

    .card {
        padding: 21px;
    }

    .title-art {
        width: 135px;
        flex-basis: 135px;
        transform: scale(0.9);
    }

    .page-title {
        padding: 24px;
    }
}

/* =========================================
   MOBILE / SMALL TABLET
========================================= */

@media (max-width: 800px) {
    .essay-page {
        padding-top: 22px;
    }

    .content {
        grid-template-columns: minmax(0, 1fr);
        align-items: start;
    }

    .essay-main,
    .criteria-sidebar {
        width: 100%;
        align-self: auto;
    }

    .criteria-sidebar {
        display: flex;
        flex-direction: column;
    }

    .criteria-sidebar .criteria-card {
        position: static;
        height: auto;
        flex: initial;
    }

    .title-layout {
        gap: 10px;
    }

    .title-art {
        width: 115px;
        height: 125px;
        flex-basis: 115px;

        transform: scale(0.82);
        transform-origin: center right;
    }

    .page-title h1 {
        font-size: clamp(28px, 5vw, 39px);
    }
}

/* =========================================
   PHONE
========================================= */

@media (max-width: 560px) {
    .essay-container {
        width: calc(100% - 24px);
    }

    .essay-page {
        padding: 16px 0 40px;
    }

    .page-title {
        margin-bottom: 17px;
        padding: 19px 17px;
        border-radius: 17px;
    }

    .subject-badge {
        flex-direction: column;
        gap: 4px;

        margin-bottom: 14px;

        font-size: 11px;
    }

    .title-layout {
        display: block;
    }

    .title-layout > div:first-child {
        max-width: none;
    }

    .title-art {
        position: absolute;

        right: -10px;
        bottom: -20px;

        width: 90px;
        height: 90px;

        opacity: 0.22;

        transform: scale(0.72);
        transform-origin: bottom right;
    }

    .eyebrow {
        font-size: 9px;
        letter-spacing: 1px;
    }

    .page-title h1 {
        max-width: 100%;
        margin-bottom: 12px;

        font-size: 29px;
        letter-spacing: -0.9px;
    }

    .exam-subtitle {
        font-size: 12px;
    }

    .page-title .subtitle {
        font-size: 12px;
        line-height: 1.8;
    }

    .content {
        gap: 16px;
    }

    .card {
        padding: 17px;
        border-radius: 16px;
    }

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

        gap: 15px;
        margin-bottom: 19px;
    }

    .section-heading {
        align-items: flex-start;
    }

    .card-title {
        font-size: 15px;
    }

    .heading-icon {
        width: 37px;
        height: 37px;
        flex-basis: 37px;

        border-radius: 11px;

        font-size: 16px;
    }

    .student-field {
        width: 100%;
    }

    .student-field input {
        width: 100%;
    }

    .topic-box {
        padding: 13px;
    }

    .ocr-upload {
        grid-template-columns: auto minmax(0, 1fr);
        gap: 10px;
        padding: 13px;
    }

    .upload-icon {
        width: 38px;
        height: 38px;
    }

    .upload-copy strong {
        font-size: 11px;
    }

    .ocr-upload-label {
        grid-column: 1 / -1;
        width: 100%;
    }

    #ocrStatus {
        grid-column: 1 / -1;
    }

    #essayText {
        min-height: 240px;
        padding: 13px;
        font-size: 13px;
    }

    .counters {
        gap: 6px;
    }

    .counter {
        flex-direction: column;
        gap: 2px;

        min-height: 52px;
        padding: 7px 4px;
    }

    .counter span {
        font-size: 14px;
    }

    .counter small {
        font-size: 9px;
    }

    .check-btn {
        min-height: 49px;
        padding: 12px 36px;
        font-size: 12px;
    }

    .button-arrow {
        right: 13px;
    }

    .criteria-sidebar .criteria-card {
        padding: 18px;
    }

    .criterion {
        grid-template-columns: 25px minmax(0, 1fr) auto;
        gap: 7px;
    }

    .criterion span {
        font-size: 11px;
    }

    .result-score {
        align-items: flex-start;
        padding: 16px;
    }

    .score-number {
        font-size: 34px;
    }

    .score-badge {
        font-size: 8px;
    }
}

/* =========================================
   ACCESSIBILITY — REDUCED MOTION
========================================= */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}


/* =========================================
   AI SERTIFIKAT — LAYOUT FIX
   HTML class: essay-layout
========================================= */

.essay-layout {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 315px;
    align-items: stretch;
    gap: 24px;
    width: 100%;
    margin: 0;
    padding: 0;
}

.essay-layout > .essay-main,
.essay-layout > .criteria-sidebar {
    display: flex;
    flex-direction: column;
    align-self: stretch;
    align-items: stretch;

    width: 100%;
    min-width: 0;
    min-height: 0;

    margin: 0 !important;
    padding: 0;
    transform: none;
}

.essay-layout > .essay-main > .essay-card,
.essay-layout > .criteria-sidebar > .criteria-card {
    width: 100%;
    min-width: 0;
    margin-top: 0 !important;
    box-sizing: border-box;
}

.essay-layout > .criteria-sidebar > .criteria-card {
    position: static;
    top: auto;

    height: 100%;
    flex: 1 1 auto;
}

/* Planshet */
@media (max-width: 1000px) {
    .essay-layout {
        grid-template-columns: minmax(0, 1fr) 285px;
        gap: 18px;
    }
}

/* Telefon va kichik planshet */
@media (max-width: 800px) {
    .essay-layout {
        grid-template-columns: minmax(0, 1fr);
        align-items: start;
        gap: 16px;
    }

    .essay-layout > .essay-main,
    .essay-layout > .criteria-sidebar {
        width: 100%;
    }

    .essay-layout > .criteria-sidebar > .criteria-card {
        height: auto;
        flex: 0 1 auto;
    }
}

.score-level {
    display: block;
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    background: #e3f7f1;
    color: #087f68;
    font-size: 18px;
    font-weight: 700;
}


/* Esse rasmlari: ixcham va yonma-yon */
.image-preview-list {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(110px, 130px));
    gap: 10px;
    align-items: start;
    width: 100%;
    margin-top: 14px;
}

.image-preview-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    min-width: 0;
    padding: 8px;
    border: 1px solid #dbe4f0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.45);
}

.image-preview-item img {
    width: 100% !important;
    max-width: none !important;
    height: 110px !important;
    object-fit: contain;
    border-radius: 6px;
    background: #f1f5f9;
}

.image-preview-item small {
    overflow-wrap: anywhere;
    font-size: 10px;
    line-height: 1.4;
}

.image-preview-item button {
    align-self: flex-start;
    padding: 5px 8px;
    font-size: 11px;
}

@media (max-width: 480px) {
    .image-preview-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 7px;
    }

    .image-preview-item {
        padding: 5px;
    }

    .image-preview-item img {
        height: 85px !important;
    }
}
