:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #ec4899;
    --bg-dark: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --success: #10b981;
    --danger: #ef4444;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Background Animation */
.background-animation {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.15), transparent 40%),
                radial-gradient(circle at 80% 20%, rgba(236, 72, 153, 0.15), transparent 30%);
    animation: rotateBg 20s linear infinite;
    z-index: -1;
}

@keyframes rotateBg {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Glass Panel */
.app-container {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 40px;
    width: 90%;
    max-width: 750px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.screen {
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.screen.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* Typography & Elements */
h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 800;
}
h1 span {
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

p {
    color: var(--text-muted);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.input-group {
    margin-bottom: 2rem;
    text-align: left;
}
.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}
input[type="number"], input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: white;
    font-size: 1.1rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.3s;
}
input:focus {
    border-color: var(--primary);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    padding: 14px 28px;
    border-radius: 12px;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: transform 0.2s, box-shadow 0.2s;
    font-family: inherit;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -10px var(--secondary);
}
.btn-primary:active {
    transform: translateY(0);
}

/* Start Grid */
.start-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 20px;
    text-align: left;
}

@media (min-width: 650px) {
    .start-grid {
        grid-template-columns: 1fr 1.2fr;
        gap: 30px;
    }
}

.rules-column {
    display: flex;
    flex-direction: column;
}

.rules-box {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    height: 100%;
}

.form-column {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Quiz Screen */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}
.timer {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.score {
    font-size: 1.2rem;
    font-weight: 600;
}

.question-container {
    margin-bottom: 2rem;
}
#question-text {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 1px;
}
.decimal-note {
    font-size: 1rem;
    color: var(--text-muted);
    display: block;
    margin-top: 5px;
    font-weight: 400;
}

.answer-container {
    display: flex;
    gap: 10px;
    margin-bottom: 1.5rem;
}
.answer-container input {
    flex: 1;
}
.answer-container button {
    width: auto;
}

.feedback {
    font-weight: 600;
    font-size: 1.1rem;
    min-height: 24px;
}
.feedback.correct { color: var(--success); }
.feedback.partial { color: #f59e0b; }
.feedback.wrong { color: var(--danger); }

/* End Screen */
.final-results {
    margin: 2rem 0;
    font-size: 1.2rem;
}
.highlight {
    font-size: 3.5rem;
    font-weight: 800;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: block;
    margin: 1rem 0;
}

/* SweetAlert2 Theme Override */
.swal2-popup {
    background: var(--bg-dark) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 24px !important;
    color: var(--text-main) !important;
    font-family: 'Outfit', sans-serif !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8) !important;
}
.swal2-title {
    color: var(--text-main) !important;
    font-weight: 800 !important;
}
.swal2-html-container {
    color: var(--text-muted) !important;
}
.swal2-confirm, .swal2-cancel, .swal2-deny {
    border-radius: 12px !important;
    font-weight: 600 !important;
    padding: 12px 28px !important;
    font-family: 'Outfit', sans-serif !important;
}
.swal2-cancel {
    background: rgba(255, 255, 255, 0.1) !important;
    color: var(--text-main) !important;
}
.swal2-icon.swal2-warning {
    border-color: var(--secondary) !important;
    color: var(--secondary) !important;
}
.swal2-icon.swal2-success {
    border-color: var(--success) !important;
    color: var(--success) !important;
}
.swal2-icon.swal2-error {
    border-color: var(--danger) !important;
    color: var(--danger) !important;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 8px;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.4);
}
