:root {
    --bg-dark: #0a0a1a;
    --primary: #4f46e5;
    --primary-glow: rgba(79, 70, 229, 0.4);
    --secondary: #10b981;
    --accent: #f59e0b;
    --text-main: #f8fafc;
    --text-dim: #94a3b8;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --font-heading: 'Pretendard', 'Outfit', 'Noto Sans KR', sans-serif;
    --font-body: 'Pretendard', 'Outfit', 'Noto Sans KR', sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    user-select: none;
}

#app {
    height: 100%;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #1e1b4b 0%, #0a0a1a 100%);
}

#game-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease;
    opacity: 0;
}

.screen.active {
    display: flex;
    opacity: 1;
}

/* Glassmorphism Panel */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 3rem;
    width: 90%;
    max-width: 600px;
    text-align: center;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.title {
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.accent {
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 1.25rem;
    color: var(--text-dim);
    margin-bottom: 2.5rem;
}

/* Inputs & Buttons */
.input-group {
    margin-bottom: 2rem;
    text-align: left;
}

.input-group label {
    display: block;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    color: var(--text-dim);
    margin-left: 0.5rem;
}

input[type="text"] {
    width: 100%;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
    color: white;
    font-size: 1.125rem;
    outline: none;
    transition: border-color 0.3s ease;
}

input[type="text"]:focus {
    border-color: var(--primary);
}

.btn-primary {
    background: var(--primary);
    color: white;
    padding: 1rem 2.5rem;
    border-radius: 12px;
    border: none;
    font-size: 1.25rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-glow);
}

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

/* Calibration */
.progress-bar-container {
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
    margin: 2rem 0;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 0.1s linear;
}

#mic-viz-container {
    width: 100%;
    height: 100px;
    margin-top: 1rem;
}

canvas {
    width: 100%;
    height: 100%;
}

/* Game Interface */
#game-canvas-container {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

#game-ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: auto;
}

.user-info,
.level-indicator {
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    font-weight: 600;
}

.btn-icon {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    cursor: pointer;
    backdrop-filter: blur(8px);
}

.top-controls {
    display: flex;
    gap: 1rem;
}

.feedback-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 4rem;
    font-weight: 800;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    text-align: center;
    pointer-events: none;
    opacity: 0;
}

/* Teacher Dashboard */
#teacher-dashboard {
    position: fixed;
    right: 20px;
    top: 20px;
    width: 250px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid #ff0055;
    padding: 1rem;
    border-radius: 12px;
    z-index: 1000;
    font-family: monospace;
}

.hidden {
    display: none !important;
}

/* Animations */
@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.pulse {
    animation: pulse 2s infinite;
}

/* Error Panel */
.error-panel {
    border-color: #ef4444;
}

.error-title {
    color: #ef4444;
    font-size: 2rem;
    margin-bottom: 1rem;
}

.error-msg {
    color: var(--text-dim);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.menu-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 100;
    min-width: 400px;
    text-align: center;
}

.menu-panel h2 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: white;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.menu-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    text-decoration: none;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.menu-item i {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    color: var(--primary);
}

.menu-item span {
    font-size: 1.2rem;
    font-weight: 600;
}