* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    font-family: Arial, sans-serif;
    background: radial-gradient(circle at top, #263b73 0%, #10131a 55%, #080a0f 100%);
    color: white;
    overflow-x: hidden;
}

.game-border-wrap {
    position: relative;
    width: 100%;
    max-width: 400px;
    border-radius: 22px;
    padding: 2px;
    background: linear-gradient(90deg, #3a7bd5, #00d2ff, #8b5cf6, #3a7bd5);
    background-size: 300% 100%;
    animation: rgbBorderAnimation 4s linear infinite;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
    margin-bottom: 40px;
}

@keyframes rgbBorderAnimation {
    0% { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}

.game {
    width: 100%;
    padding: 24px;
    background: #171b26;
    border-radius: 20px;
    text-align: center;
}

.header-bar {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 46px;
    margin-bottom: 24px;
}

h1 {
    margin: 0;
    font-size: 24px;
    color: #ffffff;
    text-shadow: 0 0 15px rgba(79, 124, 255, 0.5);
    z-index: 2;
}

#soundButton {
    position: absolute;
    right: 0;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid #30384d;
    border-radius: 12px;
    background: #1c2230;
    font-size: 20px;
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
    color: white;
}

#soundButton:active {
    transform: scale(0.92);
}

#soundButton:hover {
    background: #252d3d;
}

.info {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.info > div {
    padding: 8px 4px;
    background: #11151f;
    border: 1px solid #2c3447;
    border-radius: 10px;
    font-size: 11px;
    color: #9fa8ba;
}

.info > div span {
    display: block;
    margin-top: 2px;
    font-size: 16px;
    font-weight: bold;
    color: white;
}

.sub-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding: 6px 12px;
    background: rgba(255, 216, 77, 0.05);
    border: 1px solid rgba(255, 216, 77, 0.15);
    border-radius: 10px;
    font-size: 13px;
    font-weight: bold;
}

.best-score {
    color: #ffd84d;
}

.best-score span {
    color: white;
}

.streak-display {
    color: #ff9f43;
}

.level-info {
    margin-bottom: 20px;
}

.level-title {
    margin-bottom: 6px;
    font-size: 15px;
    font-weight: bold;
    color: #ffd84d;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(255, 216, 77, 0.25);
}

.progress-container {
    width: 100%;
    height: 10px;
    background: #0d1119;
    border: 1px solid #2c3447;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.4);
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #4cff88, #20d96b);
    border-radius: 10px;
    transition: width 0.35s ease, background 0.3s ease;
    box-shadow: 0 0 10px rgba(76, 255, 136, 0.4);
}

.progress-text {
    margin-top: 4px;
    font-size: 12px;
    color: #aeb4c0;
}

.question {
    margin: 20px 0;
    min-height: 70px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 38px;
    font-weight: bold;
    color: #ffffff;
    letter-spacing: 2px;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.15);
}

input {
    width: 100%;
    padding: 14px;
    border: 2px solid #30384d;
    border-radius: 12px;
    background: #0e1118;
    color: white;
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus {
    border-color: #4f7cff;
    box-shadow: 0 0 15px rgba(79, 124, 255, 0.25);
}

input::placeholder {
    color: #626b7d;
}

button {
    width: 100%;
    padding: 14px;
    margin-top: 12px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #5b86ff, #4169e1);
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(65, 105, 225, 0.3);
    transition: transform 0.15s, box-shadow 0.15s;
}

button:hover {
    box-shadow: 0 10px 25px rgba(65, 105, 225, 0.45);
}

button:active {
    transform: scale(0.97);
}

.message {
    min-height: 20px;
    margin-top: 10px;
    font-size: 15px;
    font-weight: bold;
    text-align: center;
}

.game-over, .game-screen {
    display: none;
}

.start-screen {
    display: block;
    padding: 10px 0;
}

.start-screen p {
    margin: 15px 0 20px;
    color: #aeb4c0;
}

.game-over p {
    margin: 10px 0;
    font-size: 16px;
    color: #aeb4c0;
}

.game-over strong {
    color: white;
}

#time { color: #63d8ff; }
#lives { color: #ff6b81; }
#score { color: #69f0ae; }
#newRecordMessage { color: #ffd84d; font-weight: bold; font-size: 18px; margin-top: 15px; }

.correct-animation { animation: correctPop 0.35s ease; }
.wrong-animation { animation: wrongShake 0.35s ease; }

@keyframes correctPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

@keyframes wrongShake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    50% { transform: translateX(8px); }
    75% { transform: translateX(-5px); }
    100% { transform: translateX(0); }
}

.level-up-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(8, 10, 15, 0.85);
    opacity: 0;
    visibility: hidden;
    z-index: 999;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.level-up-overlay.show {
    opacity: 1;
    visibility: visible;
}

.level-up-content {
    text-align: center;
    transform: scale(0.7);
    transition: transform 0.3s ease;
}

.level-up-overlay.show .level-up-content {
    transform: scale(1);
}

.level-up-icon {
    font-size: 60px;
    margin-bottom: 8px;
    animation: levelUpBounce 0.6s ease;
}

.level-up-title {
    font-size: 28px;
    font-weight: bold;
    color: #ffd84d;
    text-shadow: 0 0 20px rgba(255, 216, 77, 0.7);
}

.level-up-number {
    margin-top: 8px;
    font-size: 18px;
    color: white;
}

@keyframes levelUpBounce {
    0% { transform: scale(0); }
    60% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.site-footer {
    text-align: center;
    color: #626b7d;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.site-footer .brand {
    display: block;
    font-weight: bold;
    color: #8b9bb4;
    margin-bottom: 5px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.site-footer .tagline {
    display: block;
}