:root {
    --primary: #FD79A8;
    --secondary: #FDCB6E;
    --accent: #6C5CE7;
    --background: #1A0A12;
    --text: #FFFFFF;
    --glass: rgba(255, 255, 255, 0.1);
    --glass-hover: rgba(255, 255, 255, 0.2);
    --border: rgba(255, 255, 255, 0.2);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--background);
    color: var(--text);
    font-family: var(--font-family);
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

#app {
    width: 100%;
    max-width: 600px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
    background: radial-gradient(circle at top right, #3A1C29, var(--background));
    position: relative;
}

h1, h2, h3 {
    margin: 10px 0;
    text-align: center;
}

.screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease;
    width: 100%;
}

.hidden {
    display: none !important;
    opacity: 0;
}

.glass-card {
    background: var(--glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin: 10px 0;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.btn {
    background: var(--glass);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    margin: 10px;
    transition: all 0.2s ease;
    width: 100%;
    max-width: 300px;
    text-align: center;
}

.btn:hover {
    background: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(253, 121, 168, 0.4);
}

.btn:active {
    transform: translateY(0);
}

.btn.secondary {
    border-color: var(--secondary);
}

.btn.secondary:hover {
    background: var(--secondary);
    color: #000;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Header */
.header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 10px;
    background: var(--glass);
    border-radius: 12px;
}

.score-board {
    display: flex;
    flex-direction: column;
}

#player-name {
    font-weight: bold;
    color: var(--secondary);
}

.timer-container {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    width: 120px;
    height: 20px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#timer-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: var(--accent);
    width: 100%;
    transition: width 1s linear, background-color 0.3s ease;
    z-index: 1;
}

#timer-text {
    position: relative;
    z-index: 2;
    font-size: 0.8rem;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Grid for Categories and Answers */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    width: 100%;
    margin-top: 20px;
}

.category-btn {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05));
}

.answer-btn {
    height: 60px;
    font-size: 0.95rem;
    white-space: normal; /* Allow text wrapping */
}

/* Difficulty Buttons */
.difficulty-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    align-items: center;
}

/* Feedback Overlay */
.feedback-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 30px;
    border-radius: 16px;
    font-size: 1.5rem;
    font-weight: bold;
    z-index: 1000;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    width: 80%;
    max-width: 400px;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.feedback-overlay.correct {
    border: 2px solid #00CEC9;
    color: #00CEC9;
}

.feedback-overlay.incorrect {
    border: 2px solid #FF7675;
    color: #FF7675;
}

/* Answer Highlight */
.answer-btn.correct {
    background: #00CEC9 !important;
    border-color: #00CEC9 !important;
    color: #000 !important;
    font-weight: bold;
}

.answer-btn.incorrect {
    background: #FF7675 !important;
    border-color: #FF7675 !important;
    color: #000 !important;
}

/* Result Screen */
.score-entry {
    display: flex;
    justify-content: space-between;
    padding: 15px;
    margin: 10px 0;
    width: 100%;
    font-size: 1.1rem;
}

.rank {
    font-weight: bold;
    color: var(--secondary);
    margin-right: 10px;
}

.name {
    flex: 1;
    text-align: left;
}

.score {
    color: var(--primary);
    font-weight: bold;
}

@media (max-width: 480px) {
    .grid-container {
        grid-template-columns: 1fr;
    }

    .category-btn {
        height: 60px;
    }
}
