:root {
    --bg-start: #c6b8ff;
    --bg-mid: #a9e4ff;
    --bg-end: #bdf4e6;
    --glass-bg: rgba(255, 255, 255, 0.52);
    --glass-border: rgba(255, 255, 255, 0.7);
    --text-main: #1a2452;
    --text-muted: #42508f;
    --accent: #ffe66d;
    --success: #52d273;
    --error: #ff6b6b;
    --card-front: rgba(255, 255, 255, 0.62);
    --card-back: rgba(255, 255, 255, 0.4);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-main);
    background:
        radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.52), transparent 38%),
        radial-gradient(circle at 82% 12%, rgba(195, 241, 255, 0.46), transparent 42%),
        radial-gradient(circle at 50% 90%, rgba(217, 255, 241, 0.42), transparent 40%),
        linear-gradient(135deg, var(--bg-start) 0%, var(--bg-mid) 54%, var(--bg-end) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background-attachment: fixed;
}

.landing-page {
    padding: 20px;
}

.landing-shell {
    width: min(1280px, 100%);
}

.landing-panel {
    backdrop-filter: blur(14px);
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.92);
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(64, 90, 170, 0.24);
    padding: clamp(18px, 2vw, 30px);
}

.trailer-stage {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    min-height: min(62vh, 620px);
    margin-top: 8px;
    background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.22), rgba(35, 50, 155, 0.55));
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.hero-slider {
    position: absolute;
    inset: 0;
}

.hero-slide {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transform: scale(1.02);
    transition: opacity 1s ease, transform 5s ease;
}

.hero-slide.is-active {
    opacity: 1;
    transform: scale(1);
}

.trailer-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 16px;
    padding: 22px;
    background: linear-gradient(140deg, rgba(24, 34, 92, 0.42), rgba(28, 40, 108, 0.34));
}

.trailer-overlay h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3.2rem);
    color: #ffffff;
    text-shadow: 0 3px 14px rgba(5, 10, 35, 0.45);
}

.trailer-overlay p {
    margin: 0;
    font-size: clamp(1rem, 1.8vw, 1.35rem);
    color: #ffffff;
    font-weight: 600;
    text-shadow: 0 2px 10px rgba(5, 10, 35, 0.35);
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 12px;
    padding: 8px 12px;
}

.play-now-btn {
    text-decoration: none;
    font-size: clamp(1.1rem, 1.8vw, 1.45rem);
    padding: 14px 30px;
}

.topic-list-panel {
    margin-top: 16px;
    border-radius: 22px;
    border: 1px solid rgba(154, 177, 255, 0.5);
    background: linear-gradient(140deg, rgba(255, 255, 255, 0.9), rgba(208, 227, 255, 0.56));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75), 0 12px 28px rgba(70, 99, 189, 0.2);
    padding: 18px;
}

.topic-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.topic-list-panel h2 {
    margin: 0;
    font-size: clamp(1.2rem, 2vw, 1.8rem);
}

.topic-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.topic-card {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 82px;
    padding: 16px;
    border-radius: 18px;
    text-decoration: none;
    color: #1d2d66;
    background: linear-gradient(140deg, rgba(255, 255, 255, 0.74), rgba(203, 233, 255, 0.58));
    border: 1px solid rgba(128, 157, 242, 0.45);
    position: relative;
    overflow: hidden;
    isolation: isolate;
    transition: transform 0.25s ease, filter 0.25s ease, box-shadow 0.25s ease;
}

.topic-card::before {
    content: "";
    position: absolute;
    inset: -60%;
    background: conic-gradient(from 0deg, transparent, rgba(255, 255, 255, 0.26), transparent 30%);
    transform: rotate(0deg);
    transition: transform 0.8s ease;
    z-index: -1;
}

.topic-card:hover {
    transform: translateY(-4px) scale(1.01);
    filter: brightness(1.03);
    box-shadow: 0 14px 34px rgba(70, 98, 185, 0.28);
}

.topic-card:hover::before {
    transform: rotate(180deg);
}

.topic-card strong {
    font-size: 1.18rem;
    letter-spacing: 0.25px;
    text-align: center;
}

.app-shell {
    width: min(1400px, 100%);
}

.glass-panel {
    backdrop-filter: blur(14px);
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.92);
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(60, 90, 170, 0.24);
    padding: clamp(18px, 2vw, 30px);
}

.institutional-banner {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(160, 185, 255, 0.45);
}

.institution-logo {
    width: clamp(62px, 8vw, 96px);
    height: clamp(62px, 8vw, 96px);
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.65);
    background: #ffffff;
    flex-shrink: 0;
}

.institution-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    line-height: 1.2;
    letter-spacing: 0.15px;
    flex: 1;
    text-align: center;
}

.institution-text span:nth-child(1) {
    font-size: clamp(0.95rem, 1.3vw, 1.15rem);
    font-weight: 800;
    color: #1a2a66;
}

.institution-text span:nth-child(2) {
    font-size: clamp(0.95rem, 1.25vw, 1.12rem);
    font-weight: 700;
    color: #223579;
}

.institution-text span:nth-child(3) {
    font-size: clamp(0.9rem, 1.15vw, 1.02rem);
    font-weight: 600;
    color: #334894;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

h1 {
    margin: 0;
    font-size: clamp(2rem, 3vw, 2.8rem);
}

.round-pill {
    padding: 10px 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    font-weight: 600;
}

.status-board {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: 18px 0 8px;
}

.timer-wrap,
.prompt-wrap {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(158, 182, 255, 0.45);
    box-shadow: 0 8px 20px rgba(80, 110, 198, 0.16);
    border-radius: 18px;
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 110px;
}

.label {
    font-size: 0.95rem;
    color: var(--text-muted);
}

#countdown {
    font-size: clamp(2.2rem, 4vw, 4rem);
    font-weight: 800;
    color: var(--accent);
    line-height: 1.1;
}

#targetName {
    text-align: center;
    margin-top: 8px;
    font-size: clamp(1rem, 1.4vw, 1.4rem);
    min-height: 2.7em;
}

.instruction {
    text-align: center;
    margin: 14px 0 18px;
    font-size: clamp(1rem, 1.2vw, 1.2rem);
}

.grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
    perspective: 1100px;
}

.card {
    position: relative;
    width: 100%;
    min-height: clamp(100px, 13vh, 150px);
    cursor: pointer;
    border: none;
    padding: 0;
    background: transparent;
    transform-style: preserve-3d;
    transition: transform 0.45s ease, filter 0.25s ease;
}

.card:hover {
    transform: translateY(-2px) scale(1.01);
    filter: brightness(1.08);
}

.card:active {
    transform: scale(0.98);
}

.card-inner {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    transition: transform 0.7s ease;
}

.card.hidden .card-inner {
    transform: rotateY(180deg);
}

.face {
    position: absolute;
    inset: 0;
    border-radius: 16px;
    border: 1px solid rgba(146, 171, 245, 0.52);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 10px;
    font-size: clamp(0.9rem, 1vw, 1.08rem);
    font-weight: 600;
    backface-visibility: hidden;
    box-shadow: 0 8px 18px rgba(78, 104, 188, 0.16);
}

.front {
    background: var(--card-front);
}

.back {
    background: var(--card-back);
    transform: rotateY(180deg);
    font-size: clamp(2rem, 3vw, 3rem);
}

.card.correct {
    animation: pulse-success 0.8s ease;
    outline: 3px solid var(--success);
    border-radius: 16px;
}

.card.wrong {
    animation: shake-wrong 0.6s ease;
    outline: 3px solid var(--error);
    border-radius: 16px;
}

.result-area {
    margin-top: 20px;
    min-height: 84px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    align-items: center;
}

.result-message {
    margin: 0;
    width: 100%;
    text-align: center;
    font-size: clamp(1.1rem, 1.3vw, 1.4rem);
    font-weight: 700;
}

.result-message.success {
    color: #c4ffd4;
}

.result-message.error {
    color: #ffd0d0;
}

.action-btn {
    border: none;
    border-radius: 14px;
    padding: 12px 22px;
    font-size: 1.05rem;
    font-weight: 700;
    color: #1a1a1a;
    background: var(--accent);
    cursor: pointer;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.action-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

.action-btn.secondary {
    background: #d7e4ff;
}

.wheel-splash {
    position: fixed;
    inset: 0;
    background: rgba(5, 6, 20, 0.75);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    padding: 20px;
}

.wheel-card {
    width: min(520px, 100%);
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 14px 44px rgba(0, 0, 0, 0.35);
    text-align: center;
    padding: 20px 18px 24px;
}

.wheel-card h2 {
    margin: 0 0 10px;
}

#wheelRuleText {
    margin: 0 0 14px;
    color: var(--text-muted);
    font-weight: 600;
}

.wheel-stage {
    position: relative;
    margin: 8px auto 14px;
    width: 270px;
    height: 270px;
}

.discount-wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 6px solid rgba(255, 255, 255, 0.7);
    background: conic-gradient(
        #ffd166 0deg 36deg,
        #ef476f 36deg 72deg,
        #06d6a0 72deg 108deg,
        #118ab2 108deg 144deg,
        #8e6cff 144deg 180deg,
        #ff9f1c 180deg 216deg,
        #3ec1d3 216deg 252deg,
        #7dd87d 252deg 288deg,
        #f08a5d 288deg 324deg,
        #b83b5e 324deg 360deg
    );
    transition: transform 6.6s cubic-bezier(0.12, 0.9, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.discount-wheel::after {
    content: "";
    position: absolute;
    inset: 16%;
    border-radius: 50%;
    background: rgba(15, 20, 60, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.55);
}

.wheel-label {
    position: absolute;
    left: 50%;
    top: 50%;
    transform-origin: center center;
    font-size: 1.05rem;
    font-weight: 800;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);
    pointer-events: none;
    z-index: 3;
    white-space: nowrap;
}

.wheel-pointer {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: -10px;
    width: 0;
    height: 0;
    border-left: 16px solid transparent;
    border-right: 16px solid transparent;
    border-top: 28px solid #ffffff;
    z-index: 2;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
}

.wheel-result {
    min-height: 1.8em;
    font-size: 1.25rem;
    font-weight: 800;
    margin: 8px 0 14px;
}

.confetti-piece {
    position: absolute;
    width: 8px;
    height: 14px;
    border-radius: 2px;
    opacity: 0.95;
    z-index: 25;
    pointer-events: none;
    animation-name: confetti-fall;
    animation-timing-function: ease-out;
    animation-fill-mode: forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translate(0, -10px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translate(var(--drift-x), 95vh) rotate(760deg);
        opacity: 0;
    }
}

@keyframes pulse-success {
    0% { transform: scale(1); }
    35% { transform: scale(1.07); }
    100% { transform: scale(1); }
}

@keyframes shake-wrong {
    0% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    50% { transform: translateX(6px); }
    75% { transform: translateX(-4px); }
    100% { transform: translateX(0); }
}

@media (max-width: 1100px) {
    .institutional-banner {
        flex-direction: column;
        text-align: center;
    }

    .institution-text {
        text-align: center;
    }

    .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .status-board {
        grid-template-columns: 1fr;
    }

    .trailer-stage {
        min-height: 56vh;
    }

    .topic-grid {
        grid-template-columns: 1fr;
    }

}
