:root {
    --bg: #0f172a;
    --panel-bg: rgba(30, 41, 59, 0.85);
    --panel-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #f59e0b;
    --accent-hover: #d97706;
    --font-family: 'Inter', sans-serif;
}

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

body {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background-color: var(--bg);
    font-family: var(--font-family);
    color: var(--text-primary);
}

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

#ui-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 220px;
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.back-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s;
}

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

h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

hr {
    border: none;
    height: 1px;
    background-color: var(--panel-border);
}

.section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
}

#level-select {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 14px;
    cursor: pointer;
    width: 100%;
    appearance: auto;
}

#level-select option {
    background: #1e293b;
    color: var(--text-primary);
}

#level-select:focus {
    outline: none;
    border-color: var(--accent);
}

#moves-display {
    font-size: 36px;
    font-weight: 600;
    color: var(--accent);
    line-height: 1;
}

.btn-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.text-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 9px 14px;
    color: var(--text-primary);
    font-weight: 500;
    font-family: var(--font-family);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    font-size: 14px;
    width: 100%;
    text-align: center;
}

.text-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.2);
}

.text-btn.primary {
    background: linear-gradient(135deg, var(--accent), #f97316);
    border-color: transparent;
    color: #0f172a;
    font-weight: 600;
}

.text-btn.primary:hover {
    box-shadow: 0 0 16px 4px rgba(245, 158, 11, 0.4);
}

.hint {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.8;
}

/* Win overlay */
#win-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(4px);
}

#win-overlay.hidden {
    display: none;
}

.win-box {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(245, 158, 11, 0.4);
    border-radius: 20px;
    padding: 40px 56px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    box-shadow: 0 0 60px rgba(245, 158, 11, 0.15);
}

.win-emoji {
    font-size: 48px;
}

.win-title {
    font-size: 42px;
    font-weight: 700;
    background: linear-gradient(135deg, #f59e0b, #f97316);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#win-moves {
    font-size: 16px;
    color: var(--text-secondary);
}
