* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", Arial, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(99,102,241,.20), transparent 35%),
        linear-gradient(135deg, #eef2ff, #fafafa);
    color: #111827;
}

.page {
    width: min(1320px, calc(100% - 36px));
    margin: 28px auto;
}

.hero {
    background: linear-gradient(135deg, #4338ca, #7c3aed);
    color: white;
    border-radius: 28px;
    padding: 32px;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    box-shadow: 0 18px 45px rgba(67,56,202,.25);
}

.eyebrow {
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: .12em;
    font-weight: 800;
    opacity: .85;
}

h1 {
    margin: 0;
    font-size: clamp(34px, 4vw, 56px);
}

.subtitle {
    font-size: 20px;
    line-height: 1.45;
    max-width: 900px;
    opacity: .93;
}

.counter {
    background: rgba(255,255,255,.18);
    border: 1px solid rgba(255,255,255,.25);
    border-radius: 20px;
    padding: 18px 22px;
    font-size: 25px;
    font-weight: 900;
    white-space: nowrap;
}

.task-card,
.final-card,
.case-card,
.finish-card {
    background: rgba(255,255,255,.96);
    border-radius: 28px;
    padding: 26px;
    margin-top: 22px;
    box-shadow: 0 16px 40px rgba(15,23,42,.10);
    border: 1px solid #ddd6fe;
}

.task-label {
    color: #6d28d9;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .1em;
    text-align: center;
    margin-bottom: 12px;
}

.fraction-task {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
    font-size: 42px;
    font-weight: 900;
}

.frac {
    display: inline-grid;
    grid-template-rows: auto auto;
    text-align: center;
    min-width: 180px;
}

.frac span:first-child {
    border-bottom: 4px solid #111827;
    padding: 0 20px 8px;
}

.frac span:last-child {
    padding-top: 8px;
}

.sign {
    color: #4f46e5;
}

.cases {
    display: grid;
    grid-template-columns: 1fr 80px 1fr;
    gap: 20px;
    align-items: center;
}

.case-card h2,
.final-card h2 {
    font-size: 30px;
    margin: 0 0 18px;
    color: #312e81;
}

.union-symbol {
    text-align: center;
    font-size: 64px;
    color: #7c3aed;
    font-weight: 900;
}

.row {
    display: grid;
    grid-template-columns: 1fr 50px 1fr;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.math-symbol {
    text-align: center;
    font-size: 36px;
    font-weight: 900;
    color: #7c3aed;
}

input {
    width: 100%;
    border: 2px solid #cbd5e1;
    border-radius: 16px;
    padding: 14px 16px;
    font-size: 21px;
    outline: none;
    background: #f8fafc;
}

input:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 4px rgba(124,58,237,.14);
    background: white;
}

.drawing-title {
    font-weight: 900;
    font-size: 20px;
    margin: 18px 0 12px;
    color: #334155;
}

.controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

button {
    border: none;
    border-radius: 15px;
    padding: 13px 18px;
    font-size: 18px;
    font-weight: 900;
    cursor: pointer;
    background: white;
    color: #312e81;
    box-shadow: 0 8px 18px rgba(15,23,42,.12);
}

button.active,
.final-row button {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
}

.axis {
    position: relative;
    height: 260px;
    background: #f8fafc;
    border-radius: 22px;
    overflow: hidden;
}

.line {
    position: absolute;
    top: 150px;
    left: 32px;
    right: 32px;
    height: 5px;
    background: #111827;
    border-radius: 999px;
}

.tick {
    position: absolute;
    top: 141px;
    transform: translateX(-50%);
    cursor: pointer;
}

.tickline {
    width: 3px;
    height: 22px;
    background: #111827;
    margin: auto;
}

.label {
    margin-top: 10px;
    font-size: 14px;
    font-weight: 800;
    color: #475569;
}

.interval {
    position: absolute;
    border-radius: 8px;
    pointer-events: none;
}

.layerA {
    top: 72px;
    height: 62px;
    background: repeating-linear-gradient(
        0deg,
        rgba(37,99,235,.65),
        rgba(37,99,235,.65) 3px,
        transparent 3px,
        transparent 9px
    );
    border-top: 5px solid #2563eb;
}

.layerB {
    top: 100px;
    height: 62px;
    background: repeating-linear-gradient(
        90deg,
        rgba(124,58,237,.65),
        rgba(124,58,237,.65) 3px,
        transparent 3px,
        transparent 9px
    );
    border-top: 5px solid #7c3aed;
}

.overlap {
    top: 72px;
    height: 90px;
    background:
        repeating-linear-gradient(
            0deg,
            rgba(37,99,235,.55),
            rgba(37,99,235,.55) 3px,
            transparent 3px,
            transparent 9px
        ),
        repeating-linear-gradient(
            90deg,
            rgba(124,58,237,.55),
            rgba(124,58,237,.55) 3px,
            transparent 3px,
            transparent 9px
        );
    border: 3px solid #16a34a;
    z-index: 5;
}

.hidden {
    display: none;
}

.final-card {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 24px;
    align-items: center;
}

.final-card p {
    font-size: 18px;
    color: #475569;
}

.final-row {
    display: flex;
    gap: 14px;
}

.message {
    margin-top: 18px;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 18px;
    padding: 18px;
    text-align: center;
    font-size: 24px;
    font-weight: 900;
}

.finish {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 85vh;
}

.finish-card {
    text-align: center;
    width: min(720px, 100%);
}

.score {
    font-size: 44px;
    font-weight: 900;
    margin: 35px 0 20px;
}

.grade {
    font-size: 48px;
    color: #4f46e5;
    font-weight: 900;
    margin-bottom: 35px;
}

@media (max-width: 1050px) {
    .cases,
    .final-card {
        grid-template-columns: 1fr;
    }

    .union-symbol {
        font-size: 44px;
    }

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

    .final-row {
        flex-direction: column;
    }
}
.error{
    border:3px solid #dc2626 !important;
    background:#fee2e2 !important;
}
.frac{
    display:flex;
    flex-direction:column;
    align-items:center;
    font-size:42px;
    font-weight:800;
    color:#4338ca;
    min-width:180px;
}

.top{
    border-bottom:4px solid #111827;
    padding:0 25px 10px 25px;
}

.bottom{
    padding-top:10px;
}
.fraction-task{
    display:flex;
    justify-content:center;
    align-items:center;
    gap:25px;
}

.frac{
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    font-size:42px;
    font-weight:800;
    color:#4f46e5;
    min-width:220px;
}

.top{
    width:100%;
    text-align:center;
    border-bottom:4px solid #111827;
    padding-bottom:10px;
}

.bottom{
    width:100%;
    text-align:center;
    padding-top:10px;
}

.sign{
    font-size:54px;
    font-weight:900;
    color:#4f46e5;
}