:root {
    --bg-deep: #082f49;
    --bg-surface: #0c4a6e;
    --primary: #0ea5e9;
    --accent: #38bdf8;
    --text-main: #f0f9ff;
    --text-muted: #bae6fd;
    --border: rgba(56, 189, 248, 0.2);
    --glass: rgba(12, 74, 110, 0.8);
}

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

body {
    background-color: var(--bg-deep);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

.ocean-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Header */
.game-header {
    height: 60px;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--glass);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    z-index: 100;
}

.back-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--accent);
}

.stats-group {
    display: flex;
    gap: 2rem;
}

.stat-item {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    color: var(--accent);
}

/* Main Stage */
#game-stage {
    flex-grow: 1;
    position: relative;
    width: 100%;
    background: linear-gradient(180deg, #0ea5e9 0%, #0c4a6e 100%);
    overflow: hidden;
}

#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* HUD */
#math-hud {
    position: absolute;
    top: 5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    z-index: 90;
    width: 90%;
}

.question-box {
    background: var(--glass);
    padding: 1.5rem 2.5rem;
    border-radius: 20px;
    border: 1px solid var(--border);
    text-align: center;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    width: 100%;
    max-width: 400px;
}

#question-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -1px;
    color: #fff;
}

.answer-display {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid var(--accent);
    border-radius: 12px;
    padding: 0.5rem 2rem;
    min-width: 100px;
    text-align: center;
    font-size: 3rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    color: #fff;
    text-shadow: 0 0 10px var(--accent);
}

/* Virtual Keyboard */
.virtual-keyboard {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 90%;
    max-width: 350px;
    background: var(--glass);
    padding: 15px;
    border-radius: 24px;
    border: 1px solid var(--border);
    backdrop-filter: blur(12px);
    z-index: 100;
}

.kb-row {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.kb-key {
    flex: 1;
    height: 60px;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: all 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.kb-key:active {
    background: var(--primary);
    transform: scale(0.95);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.3);
}

.kb-key[data-key="clear"] {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.kb-key[data-key="clear"]:active {
    background: #ef4444;
    color: white;
}

.kb-key[data-key="back"] {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
}

.kb-key[data-key="back"]:active {
    background: #f59e0b;
    color: white;
}

/* Overlay */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(8, 47, 73, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    transition: opacity 0.3s;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.overlay-content {
    background: var(--bg-surface);
    padding: 3rem;
    border-radius: 24px;
    border: 1px solid var(--border);
    text-align: center;
    max-width: 500px;
}

h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 3rem;
    color: var(--accent);
    margin-bottom: 1rem;
}

.instructions {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    text-align: left;
}

.instructions p {
    margin-bottom: 0.8rem;
    color: var(--text-muted);
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
}

.btn-primary:hover {
    background-color: var(--accent);
    transform: translateY(-2px);
}

/* Hide Spinners in input number */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
