:root {
    --bg-color: #f0f2f5;
    --text-color: #333;
    --card-bg: #ffffff;
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #10b981;
    --danger-color: #ef4444;
    --border-radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #e5e5e5;
    --card-bg: #2d2d2d;
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.header {
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--card-bg);
    box-shadow: var(--shadow);
    z-index: 10;
}

.game-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

#phaser-game {
    width: 100%;
    height: 100%;
}

.ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Allow clicks to pass through to canvas by default */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.card {
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    pointer-events: auto; /* Re-enable clicks for UI elements */
    max-width: 400px;
    width: 90%;
    text-align: center;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.setup-card {
    z-index: 20;
}

.hidden {
    display: none !important;
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.file-upload-label {
    display: block;
    padding: 1rem;
    border: 2px dashed var(--primary-color);
    border-radius: var(--border-radius);
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.file-upload-label:hover {
    background-color: rgba(79, 70, 229, 0.1);
}

input[type="file"] {
    display: none;
}

input[type="range"] {
    width: 100%;
    margin-top: 0.5rem;
}

.btn-primary, .btn-secondary, .btn-danger {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
    font-size: 1rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    width: 100%;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: var(--card-bg);
    border: 1px solid var(--text-color);
    color: var(--text-color);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.btn-icon:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.hud {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background-color: rgba(255, 255, 255, 0.9); /* Translucent */
    padding: 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    pointer-events: auto;
    display: flex;
    gap: 1rem;
    align-items: center;
}

[data-theme="dark"] .hud {
    background-color: rgba(45, 45, 45, 0.9);
}

.hud-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hud-item .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.7;
}

.hud-item .value {
    font-size: 1.25rem;
    font-weight: bold;
    font-variant-numeric: tabular-nums;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: var(--shadow);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.footer {
    padding: 1rem;
    text-align: center;
    font-size: 0.8rem;
    opacity: 0.6;
}
