:root {
    --purple: #6c5ce7;
    --pink: #fd79a8;
    --yellow: #ffe66d;
    --green: #00b894;
    --blue: #0984e3;
    --ink: #263238;
    --paper: rgba(255,255,255,.94);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; font-family: "Trebuchet MS", Arial, sans-serif; color: var(--ink); overflow-x: hidden; }
button, input { font: inherit; }
button { cursor: pointer; }
.home-page, .game-page {
    background: linear-gradient(160deg, #74b9ff 0%, #a29bfe 48%, #fd79a8 100%);
    position: relative;
}
.game-sky { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.cloud { position: absolute; font-size: clamp(4rem, 9vw, 8rem); opacity: .75; animation: drift 18s linear infinite; }
.cloud-one { top: 7%; left: -15%; }
.cloud-two { top: 34%; left: -25%; animation-duration: 25s; animation-delay: -8s; }
.floating-star, .planet { position: absolute; font-size: clamp(2rem, 5vw, 4rem); animation: bob 2.8s ease-in-out infinite; }
.star-one { top: 14%; right: 12%; }
.star-two { bottom: 18%; left: 12%; animation-delay: .7s; }
.planet { top: 12%; right: 8%; }
.mascot { position: fixed; bottom: 2%; font-size: clamp(5rem, 12vw, 10rem); animation: bounce 2s ease-in-out infinite; filter: drop-shadow(0 10px 8px rgba(0,0,0,.2)); }
.mascot-left { left: 2%; }
.mascot-right { right: 2%; animation-delay: .5s; }
.page-shell, .game-shell { position: relative; z-index: 2; min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.hero-card, .panel {
    width: min(820px, 94vw); background: var(--paper); border: 5px solid rgba(255,255,255,.65); border-radius: 36px;
    padding: clamp(24px, 5vw, 52px); box-shadow: 0 25px 70px rgba(45,35,90,.28); backdrop-filter: blur(12px);
}
.hero-card { text-align: center; }
.brand-badge { display: inline-block; background: var(--yellow); padding: 10px 18px; border-radius: 999px; font-weight: 900; transform: rotate(-2deg); }
h1 { font-size: clamp(2.6rem, 8vw, 5.8rem); line-height: .95; margin: 24px 0 12px; color: var(--purple); text-shadow: 3px 3px 0 #fff, 6px 6px 0 rgba(108,92,231,.18); }
.hero-text { font-size: clamp(1.1rem, 2.5vw, 1.55rem); font-weight: 700; }
.registration-form { max-width: 520px; margin: 30px auto 0; text-align: left; display: grid; gap: 12px; }
label { font-size: 1.15rem; font-weight: 900; }
input { width: 100%; border: 3px solid #dfe6e9; border-radius: 18px; padding: 17px 20px; font-size: 1.25rem; outline: none; background: white; }
input:focus { border-color: var(--purple); box-shadow: 0 0 0 5px rgba(108,92,231,.15); }
.primary-button, .secondary-button, .operation-card, .level-button { border: 0; border-radius: 18px; font-weight: 900; transition: transform .15s ease, box-shadow .15s ease; }
.primary-button { background: linear-gradient(135deg, var(--purple), var(--pink)); color: white; padding: 18px 24px; font-size: 1.25rem; box-shadow: 0 10px 0 #5546bf; margin-top: 10px; }
.primary-button:hover { transform: translateY(-3px); }
.primary-button:active { transform: translateY(5px); box-shadow: 0 5px 0 #5546bf; }
.form-message { min-height: 24px; text-align: center; color: #d63031; font-weight: 800; }
.topbar { position: relative; z-index: 5; display: flex; justify-content: space-between; align-items: center; padding: 18px clamp(18px,4vw,50px); color: white; }
.logo { color: white; text-decoration: none; font-size: clamp(1.25rem,3vw,2rem); font-weight: 900; }
.player-chip { display: flex; gap: 8px; align-items: center; background: rgba(255,255,255,.2); padding: 10px 16px; border-radius: 999px; backdrop-filter: blur(8px); }
.game-shell { min-height: calc(100vh - 76px); padding-top: 0; }
.panel-heading { text-align: center; }
.panel-heading h1 { font-size: clamp(2.2rem,6vw,4.3rem); }
.eyebrow { color: var(--green); font-size: 1.1rem; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.operation-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin: 28px 0; }
.operation-card { min-height: 130px; background: #f8f9ff; padding: 16px; font-size: 1.05rem; border: 4px solid transparent; }
.operation-card span { display: block; font-size: 2.5rem; margin-bottom: 8px; }
.operation-card.selected { border-color: var(--purple); background: #eeeaff; transform: translateY(-5px); box-shadow: 0 10px 0 rgba(108,92,231,.18); }
.level-section h2 { text-align: center; font-size: 1.5rem; }
.level-grid { display: grid; grid-template-columns: repeat(5,1fr); gap: 10px; }
.level-button { padding: 14px 8px; background: #dfe6e9; }
.level-button.selected { background: var(--yellow); box-shadow: 0 6px 0 #e4c84e; transform: translateY(-3px); }
.wide-button { width: 100%; margin-top: 28px; }
.hidden { display: none !important; }
.status-row { display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: 12px; }
.status-box, .timer-box { background: #f5f6fa; border-radius: 18px; padding: 13px; text-align: center; }
.status-box small, .timer-box small { display: block; font-weight: 900; color: #636e72; }
.status-box strong, .timer-box strong { display: block; font-size: 2rem; color: var(--purple); }
.timer-track { height: 18px; background: #dfe6e9; border-radius: 999px; overflow: hidden; margin: 18px 0 26px; }
.timer-bar { height: 100%; width: 100%; background: linear-gradient(90deg, var(--green), var(--yellow), var(--pink)); transition: width .3s linear; }
.question-zone { text-align: center; }
.mission-label { font-weight: 900; color: var(--blue); font-size: 1.15rem; }
.question-text { font-size: clamp(3rem, 10vw, 7rem); font-weight: 900; color: var(--ink); margin: 25px 0; letter-spacing: .02em; }
.answer-form { display: grid; grid-template-columns: 1fr auto; gap: 12px; max-width: 650px; margin: 0 auto; }
.answer-form input { text-align: center; font-size: 2rem; font-weight: 900; }
.answer-form .primary-button { margin: 0; }
.feedback-text { min-height: 34px; font-size: 1.25rem; font-weight: 900; margin: 20px 0 0; }
.feedback-text.correct { color: #00a878; }
.feedback-text.incorrect { color: #d63031; }
.quiz-actions { display: flex; justify-content: center; gap: 10px; margin-top: 22px; }
.secondary-button { padding: 12px 18px; background: #eef0f7; color: var(--ink); }
.celebration { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; font-size: clamp(5rem,18vw,12rem); animation: pop .8s ease; pointer-events: none; }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(140vw); } }
@keyframes bob { 50% { transform: translateY(-20px) rotate(8deg); } }
@keyframes bounce { 50% { transform: translateY(-18px) rotate(-3deg); } }
@keyframes pop { 0% { transform: scale(.2); opacity: 0; } 55% { transform: scale(1.1); opacity: 1; } 100% { transform: scale(1); opacity: 0; } }
@media (max-width: 760px) {
    .mascot { opacity: .38; }
    .operation-grid { grid-template-columns: repeat(2,1fr); }
    .level-grid { grid-template-columns: repeat(2,1fr); }
    .level-button:last-child { grid-column: 1 / -1; }
    .answer-form { grid-template-columns: 1fr; }
    .status-row { grid-template-columns: repeat(3,1fr); }
    .status-box strong, .timer-box strong { font-size: 1.45rem; }
    .quiz-actions { flex-wrap: wrap; }
}
