:root {
    --tm-blue: #026cdf;
    --tm-blue-dark: #001f68;
    --tm-navy: #061747;
    --tm-purple: #7c3aed;
    --success: #36b537;
    --warning: #f59e0b;
    --danger: #ef4444;
    --ink: #10183f;
    --muted: #657089;
    --card: rgba(255, 255, 255, 0.96);
    --line: #d9e2f1;
    --shadow: 0 24px 70px rgba(0, 20, 80, 0.35);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: white;
    background:
        radial-gradient(circle at 20% 10%, rgba(2, 108, 223, 0.9), transparent 32%),
        radial-gradient(circle at 80% 0%, rgba(124, 58, 237, 0.55), transparent 30%),
        linear-gradient(135deg, #001445 0%, #052a79 50%, #001137 100%);
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        radial-gradient(circle, rgba(255, 255, 255, 0.8) 0 2px, transparent 2px),
        radial-gradient(circle, rgba(255, 255, 255, 0.45) 0 1px, transparent 1px);
    background-size: 120px 120px, 80px 80px;
    background-position: 10px 20px, 45px 60px;
    opacity: 0.28;
    pointer-events: none;
}

.app {
    position: relative;
    z-index: 1;
    width: min(1220px, 94vw);
    margin: 0 auto;
    padding: 28px 0 36px;
}

header {
    display: grid;
    grid-template-columns: 260px 1fr 170px;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
    animation: slideDown 0.55s ease both;
}

.brand {
    font-size: clamp(1.65rem, 3vw, 2.25rem);
    font-weight: 900;
    letter-spacing: -0.06em;
    font-style: italic;
    text-shadow: 0 5px 18px rgba(0, 0, 0, 0.2);
}

.brand span {
    font-size: 0.7em;
    font-weight: 600;
    letter-spacing: -0.02em;
    font-style: normal;
    margin-left: 4px;
}

.hero-title {
    text-align: center;
}

.hero-title h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3.4rem);
    line-height: 1;
    letter-spacing: -0.055em;
}

.hero-title p {
    margin: 12px 0 0;
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: rgba(255, 255, 255, 0.9);
}

.score-card {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 13, 55, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 16px;
    padding: 14px 18px;
    box-shadow: 0 18px 35px rgba(0, 0, 0, 0.28);
}

.star {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    font-size: 2rem;
    filter: drop-shadow(0 7px 10px rgba(255, 211, 0, 0.3));
    animation: starPulse 1.5s ease-in-out infinite;
}

.score-card strong {
    display: block;
    font-size: 1.85rem;
    line-height: 1;
}

.score-card span {
    display: block;
    opacity: 0.9;
    font-weight: 700;
}

.layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 22px;
    align-items: stretch;
}

.fan-panel,
.quiz-shell,
.tip-card {
    border: 1px solid rgba(255, 255, 255, 0.24);
    box-shadow: var(--shadow);
}

.fan-column {
    display: grid;
    gap: 16px;
    animation: slideInLeft 0.55s ease both 0.1s;
}

.fan-panel {
    position: relative;
    overflow: hidden;
    min-height: 535px;
    border-radius: 18px;
    background:
        radial-gradient(circle at 45% 28%, rgba(240, 255, 156, 0.85), transparent 30%),
        linear-gradient(160deg, rgba(49, 185, 112, 0.86), rgba(3, 77, 122, 0.92));
}

.fan-badge {
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(180deg, #7ed957, #43b02a);
    color: white;
    border-radius: 0 0 14px 14px;
    padding: 12px 24px;
    font-size: 1.05rem;
    font-weight: 900;
    letter-spacing: 0.02em;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18);
    z-index: 3;
}

.sparkle {
    position: absolute;
    color: #ffd84c;
    font-size: 2.2rem;
    animation: twinkle 1.7s ease-in-out infinite;
}

.sparkle.one {
    left: 30px;
    top: 85px;
}

.sparkle.two {
    right: 36px;
    top: 120px;
    animation-delay: 0.4s;
}

.sparkle.three {
    right: 24px;
    top: 190px;
    font-size: 2.8rem;
    animation-delay: 0.8s;
}

.character-wrap {
    position: absolute;
    inset: 70px 22px 150px;
    display: grid;
    place-items: center;
}

.character {
    position: relative;
    width: 215px;
    height: 300px;
    animation: bob 2.4s ease-in-out infinite;
    transform-origin: center bottom;
}

.hair {
    position: absolute;
    width: 148px;
    height: 92px;
    left: 34px;
    top: 16px;
    background: #5a2b17;
    border-radius: 58% 42% 45% 40%;
    transform: rotate(-8deg);
    box-shadow: inset -18px 10px 0 #3b1d11;
    z-index: 3;
}

.hair::before {
    content: "";
    position: absolute;
    width: 84px;
    height: 60px;
    left: -14px;
    top: 8px;
    border-radius: 50%;
    background: #6b351c;
    box-shadow: 36px -18px 0 #4a2314, 75px 0 0 #4a2314;
}

.face {
    position: absolute;
    width: 150px;
    height: 170px;
    left: 32px;
    top: 64px;
    background: #ffd0a6;
    border: 4px solid rgba(84, 45, 27, 0.25);
    border-radius: 48% 48% 44% 44%;
    z-index: 2;
}

.ear {
    position: absolute;
    width: 30px;
    height: 42px;
    top: 130px;
    background: #f6b98f;
    border-radius: 50%;
    z-index: 1;
}

.ear.left {
    left: 22px;
}

.ear.right {
    right: 22px;
}

.eye {
    position: absolute;
    top: 128px;
    width: 28px;
    height: 34px;
    background: white;
    border-radius: 50%;
    z-index: 4;
}

.eye.left {
    left: 74px;
}

.eye.right {
    right: 74px;
}

.eye::after {
    content: "";
    position: absolute;
    width: 12px;
    height: 16px;
    left: 8px;
    top: 10px;
    background: #25130e;
    border-radius: 50%;
    transition: all 0.25s ease;
}

.brow {
    position: absolute;
    top: 111px;
    width: 34px;
    height: 8px;
    background: #3d2014;
    border-radius: 999px;
    z-index: 5;
    transition: all 0.25s ease;
}

.brow.left {
    left: 70px;
    transform: rotate(-8deg);
}

.brow.right {
    right: 70px;
    transform: rotate(8deg);
}

.mouth {
    position: absolute;
    left: 85px;
    top: 180px;
    width: 48px;
    height: 28px;
    border-radius: 0 0 50px 50px;
    background: #421313;
    z-index: 5;
    transition: all 0.25s ease;
    overflow: hidden;
}

.mouth::after {
    content: "";
    position: absolute;
    bottom: 3px;
    left: 12px;
    width: 26px;
    height: 9px;
    background: #ff7a8a;
    border-radius: 50%;
}

.body {
    position: absolute;
    left: 31px;
    bottom: 0;
    width: 155px;
    height: 105px;
    background: #0867d8;
    border-radius: 45px 45px 22px 22px;
    z-index: 1;
    box-shadow: inset -18px 0 0 rgba(0, 36, 115, 0.28);
}

.body::before,
.body::after {
    content: "";
    position: absolute;
    top: 28px;
    width: 4px;
    height: 60px;
    background: rgba(255, 255, 255, 0.55);
    border-radius: 999px;
}

.body::before {
    left: 56px;
    transform: rotate(8deg);
}

.body::after {
    right: 56px;
    transform: rotate(-8deg);
}

.speech {
    position: absolute;
    left: 20px;
    right: 20px;
    bottom: 95px;
    background: white;
    color: #10183f;
    border-radius: 14px;
    padding: 16px 18px;
    font-size: 1.05rem;
    line-height: 1.35;
    font-weight: 800;
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.22);
    z-index: 4;
    animation: pop 0.35s ease both;
}

.mood-strip {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 14px 16px 18px;
    background: rgba(3, 48, 79, 0.55);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.mood-strip strong {
    display: block;
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.faces {
    position: relative;
    display: flex;
    justify-content: space-between;
    background: rgba(0, 29, 74, 0.45);
    border-radius: 10px;
    padding: 10px;
}

.mood-face {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-size: 1.35rem;
    filter: grayscale(0.15);
    opacity: 0.68;
    transition: transform 0.25s ease, opacity 0.25s ease, box-shadow 0.25s ease;
}

.mood-face.active {
    opacity: 1;
    transform: translateY(-6px) scale(1.18);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
}

.tip-card {
    border-radius: 18px;
    background: var(--card);
    color: var(--ink);
    padding: 20px;
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: 14px;
    align-items: start;
}

.tip-icon {
    font-size: 2.1rem;
}

.tip-card h3 {
    margin: 0 0 8px;
    color: #075cd8;
    font-size: 1rem;
    letter-spacing: 0.02em;
}

.tip-card p {
    margin: 0;
    color: #1f2a4b;
    line-height: 1.45;
    font-weight: 600;
}

.quiz-shell {
    overflow: hidden;
    border-radius: 18px;
    background: var(--card);
    color: var(--ink);
    animation: slideInRight 0.55s ease both 0.15s;
}

.stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr 160px;
    border-bottom: 1px solid var(--line);
}

.stat-box {
    padding: 22px 28px;
    display: grid;
    grid-template-columns: 46px 1fr;
    gap: 14px;
    align-items: center;
    border-right: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 248, 255, 0.88));
}

.stat-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    font-size: 1.8rem;
    background: #e9f2ff;
}

.stat-label {
    margin-bottom: 8px;
    color: #075cd8;
    font-weight: 900;
    text-transform: uppercase;
    font-size: 0.9rem;
}

.difficulty .stat-label {
    color: #6d28d9;
}

.bar-line {
    display: grid;
    grid-template-columns: 1fr 48px;
    gap: 8px;
    align-items: center;
}

.bar {
    height: 18px;
    border-radius: 999px;
    overflow: hidden;
    background: #edf2fb;
    border: 2px solid #b7c3d7;
}

.fill {
    height: 100%;
    width: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #1692ff, #075cd8);
    transition: width 0.45s cubic-bezier(.2, .8, .2, 1);
}

.difficulty .fill {
    background: linear-gradient(90deg, #a855f7, #7c3aed);
}

.percent {
    color: #075cd8;
    font-weight: 900;
    font-size: 1.05rem;
}

.difficulty .percent {
    color: #6d28d9;
}

.question-count {
    display: grid;
    place-items: center;
    padding: 18px;
    background: linear-gradient(180deg, #ffffff, #f6f8fd);
    text-align: center;
}

.question-count span {
    display: block;
    text-transform: uppercase;
    color: #172554;
    font-weight: 900;
    font-size: 0.85rem;
    margin-bottom: 6px;
}

.question-count strong {
    display: block;
    font-size: 2.2rem;
    color: #11194a;
}

.question-area {
    padding: 34px 38px 36px;
    position: relative;
}

.question-line {
    display: grid;
    grid-template-columns: 56px 1fr 120px;
    gap: 22px;
    align-items: start;
    margin-bottom: 28px;
}

.question-mark {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(180deg, #2f83ff, #075cd8);
    color: white;
    font-size: 2rem;
    font-weight: 900;
    box-shadow: 0 12px 28px rgba(7, 92, 216, 0.28);
}

.question {
    margin: 0;
    font-size: clamp(1.35rem, 2.6vw, 2.05rem);
    line-height: 1.28;
    letter-spacing: -0.035em;
    animation: questionIn 0.34s ease both;
}

.topic-icon {
    font-size: 4.4rem;
    opacity: 0.34;
    text-align: center;
    filter: grayscale(0.25);
}

.answers {
    display: grid;
    gap: 12px;
}

.answer {
    width: 100%;
    display: grid;
    grid-template-columns: 34px 1fr 34px;
    gap: 16px;
    align-items: center;
    text-align: left;
    border: 2px solid #dde5f0;
    background: white;
    color: #11194a;
    border-radius: 15px;
    padding: 16px 20px;
    font-size: 1.08rem;
    font-weight: 750;
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
    animation: answerIn 0.28s ease both;
}

.answer:hover:not(:disabled) {
    transform: translateY(-2px);
    border-color: #8eb8f7;
    box-shadow: 0 12px 26px rgba(7, 92, 216, 0.13);
}

.answer:disabled {
    cursor: not-allowed;
}

.radio {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 3px solid #cbd5e1;
    display: grid;
    place-items: center;
}

.radio::after {
    content: "";
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: transparent;
}

.result-icon {
    font-size: 1.65rem;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s ease;
    text-align: right;
}

.answer.correct {
    background: #effbec;
    border-color: #72d672;
    color: #0f6a1a;
}

.answer.correct .radio {
    border-color: var(--success);
    background: var(--success);
}

.answer.correct .radio::after {
    background: white;
}

.answer.correct .result-icon {
    opacity: 1;
    transform: scale(1);
}

.answer.wrong {
    background: #fff1f2;
    border-color: #fb7185;
    color: #9f1239;
    animation: shake 0.35s ease both;
}

.answer.wrong .radio {
    border-color: var(--danger);
}

.answer.wrong .result-icon {
    opacity: 1;
    transform: scale(1);
}

.footer-row {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 26px;
    align-items: center;
    margin-top: 28px;
    padding-top: 18px;
    border-top: 1px solid #e7eef8;
}

.feedback {
    min-height: 82px;
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 14px;
    align-items: center;
    padding: 16px 18px;
    border-radius: 15px;
    background: #f8fbff;
    border: 2px solid #dce8f7;
}

.feedback.good {
    background: #effbec;
    border-color: #8bdc8b;
}

.feedback.bad {
    background: #fff7ed;
    border-color: #fdba74;
}

.feedback .big-icon {
    font-size: 2.15rem;
}

.feedback h3 {
    margin: 0 0 4px;
    font-size: 1.2rem;
}

.feedback p {
    margin: 0;
    color: #30405f;
    font-weight: 650;
    line-height: 1.35;
}

.next-btn,
.restart-btn {
    border: 0;
    border-radius: 15px;
    padding: 18px 22px;
    font-size: 1.2rem;
    font-weight: 900;
    color: white;
    background: linear-gradient(180deg, #0d6efd, #004ecb);
    box-shadow: 0 14px 28px rgba(0, 86, 210, 0.28);
    cursor: pointer;
    transition: transform 0.18s ease, filter 0.18s ease;
}

.next-btn:hover,
.restart-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.04);
}

.next-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.hidden {
    display: none;
}

.end-screen {
    min-height: 440px;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 42px;
    animation: pop 0.45s ease both;
}

.end-screen h2 {
    margin: 0 0 12px;
    font-size: clamp(2rem, 4vw, 3.2rem);
    letter-spacing: -0.045em;
}

.end-screen p {
    max-width: 620px;
    margin: 0 auto 24px;
    color: #334155;
    font-weight: 650;
    font-size: 1.1rem;
    line-height: 1.5;
}

.confetti {
    position: fixed;
    top: -20px;
    width: 10px;
    height: 16px;
    border-radius: 3px;
    background: #facc15;
    animation: fall 1.6s linear forwards;
    z-index: 5;
}

.face-happy .mouth {
    width: 58px;
    height: 32px;
    left: 80px;
    border-radius: 0 0 55px 55px;
}

.face-happy .eye::after {
    top: 12px;
}

.face-neutral .mouth {
    height: 8px;
    top: 191px;
    border-radius: 999px;
    background: #421313;
}

.face-neutral .mouth::after {
    display: none;
}

.face-worried .brow.left {
    transform: rotate(12deg);
}

.face-worried .brow.right {
    transform: rotate(-12deg);
}

.face-worried .mouth {
    height: 20px;
    top: 194px;
    border-radius: 50px 50px 0 0;
    background: transparent;
    border-top: 6px solid #421313;
}

.face-worried .mouth::after {
    display: none;
}

.face-sad .brow.left {
    transform: rotate(20deg);
    top: 114px;
}

.face-sad .brow.right {
    transform: rotate(-20deg);
    top: 114px;
}

.face-sad .eye {
    height: 30px;
}

.face-sad .mouth {
    width: 48px;
    height: 24px;
    top: 194px;
    border-radius: 50px 50px 0 0;
    background: transparent;
    border-top: 7px solid #421313;
}

.face-sad .mouth::after {
    display: none;
}

.face-delighted .character {
    animation: bounce 0.75s ease infinite;
}

.face-delighted .mouth {
    width: 66px;
    height: 38px;
    left: 76px;
    border-radius: 0 0 55px 55px;
}

.face-delighted .brow.left {
    transform: rotate(-16deg);
    top: 106px;
}

.face-delighted .brow.right {
    transform: rotate(16deg);
    top: 106px;
}

.react-good {
    animation: goodFlash 0.55s ease;
}

.react-bad {
    animation: badFlash 0.45s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-18px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-22px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(22px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes bob {

    0%,
    100% {
        transform: translateY(0) rotate(-1deg);
    }

    50% {
        transform: translateY(-8px) rotate(1deg);
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-14px) scale(1.02);
    }
}

@keyframes twinkle {

    0%,
    100% {
        opacity: 0.55;
        transform: scale(0.9) rotate(0deg);
    }

    50% {
        opacity: 1;
        transform: scale(1.2) rotate(14deg);
    }
}

@keyframes pop {
    from {
        opacity: 0;
        transform: scale(0.94);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes questionIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes answerIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-7px);
    }

    50% {
        transform: translateX(7px);
    }

    75% {
        transform: translateX(-4px);
    }
}

@keyframes goodFlash {

    0%,
    100% {
        box-shadow: var(--shadow);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(54, 181, 55, 0.35), var(--shadow);
    }
}

@keyframes badFlash {

    0%,
    100% {
        box-shadow: var(--shadow);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(245, 158, 11, 0.38), var(--shadow);
    }
}

@keyframes starPulse {

    0%,
    100% {
        transform: scale(1) rotate(0deg);
    }

    50% {
        transform: scale(1.12) rotate(6deg);
    }
}

@keyframes fall {
    to {
        transform: translateY(110vh) rotate(540deg);
        opacity: 0.9;
    }
}

@media (max-width: 980px) {
    header {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .score-card {
        justify-self: center;
    }

    .layout {
        grid-template-columns: 1fr;
    }

    .fan-panel {
        min-height: 490px;
    }

    .stats-row {
        grid-template-columns: 1fr;
    }

    .stat-box {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .footer-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .question-area {
        padding: 24px 18px;
    }

    .question-line {
        grid-template-columns: 48px 1fr;
    }

    .topic-icon {
        display: none;
    }

    .answer {
        grid-template-columns: 28px 1fr 28px;
        font-size: 0.98rem;
        padding: 14px;
    }
}
/* ========================= */
/* Module selector + rank UI */
/* ========================= */

.module-bar {
    display: grid;
    grid-template-columns: 1fr minmax(220px, 280px) minmax(190px, 240px);
    gap: 16px;
    align-items: center;
    margin-bottom: 22px;
    padding: 16px 18px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 18px;
    background: rgba(0, 13, 55, 0.48);
    box-shadow: 0 18px 35px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(10px);
    animation: slideDown 0.55s ease both 0.08s;
}

.module-label,
.module-select-wrap span,
.rank-pill span {
    display: block;
    margin-bottom: 5px;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.72);
}

#moduleTitle,
#rankLabel {
    font-size: 1.05rem;
    color: white;
}

.module-select-wrap {
    display: block;
}

#bankSelect {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    padding: 12px 14px;
    color: #0f1b4d;
    background: white;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16);
}

.rank-pill {
    justify-self: end;
    width: 100%;
    border-radius: 14px;
    padding: 12px 15px;
    background: linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0.08));
    border: 1px solid rgba(255, 255, 255, 0.2);
}

@media (max-width: 980px) {
    .module-bar {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .rank-pill {
        justify-self: stretch;
    }
}
