:root {
    --primary: #6546d7;
    --primary-dark: #4930ae;
    --secondary: #12b8ad;
    --accent: #ffca55;
    --ink: #20243b;
    --muted: #788197;
    --bg: #f7f7fc;
    --white: #fff;
    --border: #e9e8f2;
    --shadow: 0 12px 35px rgba(48, 39, 100, .08);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background:
        radial-gradient(circle at 10% 5%, rgba(101,70,215,.07), transparent 25%),
        radial-gradient(circle at 95% 30%, rgba(18,184,173,.06), transparent 25%),
        var(--bg);
    color: var(--ink);
    font-family: Vazirmatn, Tahoma, sans-serif;
    line-height: 1.9;
}

a {
    transition: .2s ease;
}

.topbar {
    position: relative;
    z-index: 10;
    background: rgba(35, 29, 76, .97);
    color: white;
    padding: 14px max(18px, calc((100% - 1120px)/2));
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    box-shadow: 0 5px 22px rgba(30, 22, 75, .15);
}

.brand {
    font-size: 23px;
    font-weight: 900;
    color: white;
    text-decoration: none;
    letter-spacing: -.5px;
}

.brand span {
    display: block;
    font-size: 10px;
    color: #70e3d4;
    letter-spacing: 1px;
    line-height: 1.5;
}

.topbar nav {
    display: flex;
    gap: 9px;
    flex-wrap: wrap;
    align-items: center;
}

.topbar nav a {
    color: #eeeaff;
    text-decoration: none;
    font-size: 14px;
    padding: 7px 13px;
    border-radius: 10px;
}

.topbar nav a:hover {
    background: rgba(255,255,255,.13);
    color: #fff;
}

.container {
    max-width: 1120px;
    margin: 34px auto;
    padding: 0 18px;
    min-height: 70vh;
}

.hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(125deg, #34236f 0%, #6546d7 55%, #258fbd 100%);
    color: white;
    border-radius: 27px;
    padding: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    box-shadow: 0 18px 40px rgba(83, 58, 175, .2);
}

.hero::before,
.hero::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
    pointer-events: none;
}

.hero::before {
    width: 230px;
    height: 230px;
    left: -65px;
    top: -100px;
}

.hero::after {
    width: 150px;
    height: 150px;
    right: 35%;
    bottom: -110px;
}

.hero > * {
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: clamp(25px, 4vw, 39px);
    line-height: 1.6;
    margin: 0 0 10px;
    font-weight: 900;
}

.hero p {
    color: #e9e5ff;
    margin: 0;
}

.hero .robot {
    font-size: 78px;
    filter: drop-shadow(0 8px 12px rgba(0,0,0,.15));
}

.section-title {
    margin: 32px 0 15px;
    font-size: 21px;
    font-weight: 900;
    color: #30265d;
}

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

.card {
    background: rgba(255,255,255,.96);
    border: 1px solid var(--border);
    border-radius: 21px;
    padding: 22px;
    box-shadow: var(--shadow);
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 17px 35px rgba(48,39,100,.12);
    border-color: #c9bdf7;
}

.subject-card {
    display: block;
    color: inherit;
    text-decoration: none;
}

.subject-icon {
    display: inline-flex;
    width: 62px;
    height: 62px;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    background: #f0edff;
    border-radius: 18px;
    margin-bottom: 10px;
}

.subject-card:nth-child(3n+2) .subject-icon {
    background: #e5faf6;
}

.subject-card:nth-child(3n) .subject-icon {
    background: #fff5df;
}

.muted {
    color: var(--muted);
    font-size: 14px;
}

.btn,
button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 7px;
    border: 0;
    border-radius: 13px;
    background: linear-gradient(120deg, var(--primary), #8063ed);
    color: white;
    padding: 11px 21px;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 6px 15px rgba(101,70,215,.18);
    transition: .2s ease;
}

.btn:hover,
button:hover {
    transform: translateY(-2px);
    box-shadow: 0 9px 20px rgba(101,70,215,.25);
}

.btn.secondary {
    background: #e9f8f6;
    color: #087d75;
    box-shadow: none;
}

.field {
    margin: 16px 0;
}

.field label {
    display: block;
    font-weight: 700;
    margin-bottom: 7px;
    color: #35334e;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    border: 1px solid #deddeb;
    border-radius: 13px;
    padding: 13px 15px;
    font: inherit;
    background: #fff;
    color: var(--ink);
    outline: none;
    transition: .2s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(101,70,215,.10);
}

.alert {
    padding: 13px 17px;
    border-radius: 13px;
    margin: 16px 0;
    background: #edf4ff;
    border: 1px solid #dce9ff;
}

.alert.error {
    background: #fff0ef;
    color: #9a3424;
    border-color: #ffd9d5;
}

.alert.success {
    background: #eaf9f0;
    color: #17683a;
    border-color: #d1f0dc;
}

.stat {
    font-size: 30px;
    font-weight: 900;
    color: var(--primary);
    line-height: 1.5;
}

.chatbox {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 22px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.messages {
    height: 470px;
    overflow-y: auto;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background:
        radial-gradient(circle at 90% 10%, rgba(101,70,215,.04), transparent 25%),
        #fcfbff;
}

.bubble {
    max-width: 85%;
    padding: 13px 18px;
    border-radius: 19px;
    white-space: pre-wrap;
    line-height: 2;
    overflow-wrap: anywhere;
}

.bubble.user {
    background: #e5f7f4;
    color: #145c55;
    align-self: flex-start;
    border-bottom-right-radius: 5px;
}

.bubble.assistant {
    background: #f0edff;
    color: #33265f;
    align-self: flex-end;
    border-bottom-left-radius: 5px;
}

.chatform {
    display: flex;
    gap: 11px;
    padding: 15px;
    border-top: 1px solid var(--border);
    background: #fff;
}

.chatform input {
    flex: 1;
    min-width: 0;
    border: 1px solid #deddeb;
    border-radius: 13px;
    padding: 12px 15px;
    font: inherit;
    outline: none;
}

.chatform input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(101,70,215,.09);
}

.footer {
    text-align: center;
    padding: 30px 18px;
    color: #85849a;
    font-size: 13px;
    border-top: 1px solid var(--border);
    margin-top: 35px;
}

@media (max-width: 650px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
        padding: 13px 18px;
    }

    .topbar nav {
        gap: 4px;
    }

    .topbar nav a {
        font-size: 13px;
        padding: 6px 9px;
    }

    .container {
        margin: 22px auto;
        padding: 0 13px;
    }

    .hero {
        padding: 24px 21px;
        border-radius: 21px;
    }

    .hero h1 {
        font-size: 25px;
    }

    .hero .robot {
        font-size: 49px;
    }

    .grid {
        grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
        gap: 12px;
    }

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

    .chatform {
        flex-direction: column;
    }

    .bubble {
        max-width: 95%;
    }

    .messages {
        height: 60vh;
        padding: 14px;
    }
}

/* Houshino colorful subject cards */
.subject-card {
    position: relative;
    overflow: hidden;
    min-height: 190px;
    padding: 23px;
    border: 1px solid transparent;
    border-radius: 23px;
    box-shadow: 0 9px 25px rgba(35, 30, 80, .07);
}

.subject-card::after {
    content: "";
    position: absolute;
    width: 115px;
    height: 115px;
    left: -35px;
    bottom: -48px;
    border-radius: 50%;
    background: rgba(255,255,255,.38);
}

.subject-card:hover {
    transform: translateY(-7px) rotate(-.3deg);
    box-shadow: 0 17px 35px rgba(35, 30, 80, .13);
}

.subject-icon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 66px;
    height: 66px;
    margin-bottom: 10px;
    border-radius: 21px;
    background: rgba(255,255,255,.82);
    box-shadow: 0 7px 18px rgba(40,30,80,.08);
    font-size: 35px;
    transition: transform .25s ease;
}

.subject-card:hover .subject-icon-badge {
    transform: scale(1.12) rotate(-7deg);
}

.subject-card h3 {
    margin: 5px 0;
    font-size: 18px;
    font-weight: 900;
}

.subject-card .muted {
    color: #555b70;
}

.subject-tone-1  { background: #eee9ff; border-color: #d9ccff; }
.subject-tone-2  { background: #e3f8f5; border-color: #b9eee5; }
.subject-tone-3  { background: #fff4d9; border-color: #ffe4a0; }
.subject-tone-4  { background: #e4f1ff; border-color: #c4ddff; }
.subject-tone-5  { background: #ffe9f1; border-color: #ffcddd; }
.subject-tone-6  { background: #fff0e1; border-color: #ffdbb9; }
.subject-tone-7  { background: #e8f5df; border-color: #cce9b9; }
.subject-tone-8  { background: #f2eaff; border-color: #dfccff; }
.subject-tone-9  { background: #ffe7e4; border-color: #ffc9c2; }
.subject-tone-10 { background: #e1f5ff; border-color: #b9e7ff; }
.subject-tone-11 { background: #fff5df; border-color: #ffe5ae; }
.subject-tone-12 { background: #e4f7e9; border-color: #c2eacb; }

@media (max-width: 650px) {
    .subject-card {
        min-height: 165px;
        padding: 17px;
    }
    .subject-icon-badge {
        width: 57px;
        height: 57px;
        font-size: 30px;
    }
}
