@font-face {
    font-family: 'SuperMario';
    src: url('src/assets/fonts/super-mario-bros/super-mario-bros-nes.otf.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Outfit';
    src: url('src/assets/fonts/outfit/OutfitRegular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'Outfit';
    src: url('src/assets/fonts/outfit/OutfitBold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
}

:root {
    --bg-dark: #0f172a;
    --primary: #38bdf8;
    --accent: #f472b6;
    --text: #f8fafc;
    --glass: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
}

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

body {
    background-color: var(--bg-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
    font-family: 'SuperMario', 'Outfit', sans-serif;
    color: var(--text);
}

#app-wrapper {
    display: flex;
    align-items: flex-end;
    /* Align to bottom like it was before? Or center? */
    gap: 24px;
}

#game-container {
    position: relative;
    width: 800px;
    height: 600px;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5), 0 0 0 4px var(--glass-border);
    background: linear-gradient(to bottom, #1e293b, #0f172a);
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #1e3a8a 0%, #3b82f6 100%);
    /* Placeholder sky */
}

#ui-layer {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}

.stat-box {
    /* Removed box styling - just text on background */
    display: flex;
    flex-direction: column;
    align-items: center;
}

.label {
    font-size: 0.8rem;
    font-weight: normal;
    letter-spacing: 0.1rem;
    color: white;
    margin-bottom: 4px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

#score,
#world {
    font-size: 0.8rem;
    font-weight: normal;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.center-box {
    max-width: 400px;
    text-align: left;
    /* Left-align the labels */
}

#concept-labels {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.8rem;
    color: white;
}

#label-primary,
#label-2,
#label-3,
#label-4 {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

#overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    transition: opacity 0.3s ease;
}

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

.hidden-layout {
    display: none !important;
}

.overlay-content {
    text-align: center;
}

#overlay-title {
    font-size: 4rem;
    font-weight: 700;
    margin-bottom: 10px;
    background: linear-gradient(45deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

#overlay-stats {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 40px;
    margin: 20px 0 30px 0;
    padding: 20px 40px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
}

#overlay-score-box, #overlay-tree-box {
    display: flex;
    flex-direction: column;
    align-items: center;
}

#overlay-score-label {
    font-size: 0.9rem;
    color: var(--primary);
    margin-bottom: 10px;
    letter-spacing: 2px;
}

#overlay-score-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 0 20px rgba(56, 189, 248, 0.5);
}

#overlay-tree-canvas {
    width: 200px;
    height: 175px;
    image-rendering: pixelated;
}

#overlay-tree-label {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.8);
    letter-spacing: 1px;
    margin-top: 5px;
}

#transition-overlay {
    position: absolute;
    inset: 0;
    background: black;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    transition: opacity 0.5s ease;
}

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

.transition-content {
    text-align: center;
    color: white;
}

#transition-title,
#transition-subtitle,
#transition-lives {
    font-size: 1.5rem;
    /* Ensure all text is the same size per request */
    margin: 15px 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.key {
    background: var(--text);
    color: var(--bg-dark);
    padding: 4px 12px;
    border-radius: 8px;
    font-weight: 700;
}

#side-panel {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 15px;
    height: 600px;
    /* Match #game-container */
    width: 440px;
}

#tree-container {
    width: 100%;
    /* Match side-panel width */
    flex: 1;
    /* Stretch to fill side-panel height and align bottom */
    background: var(--glass);
    backdrop-filter: blur(4px);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* Center tree and label vertically in the taller box */
    padding: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

#tree-canvas {
    width: 400px;
    height: 350px;
    image-rendering: pixelated;
}

#tree-label {
    font-size: 0.6rem;
    margin-top: 4px;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.05rem;
}

#controls-legend {
    width: 100%;
    margin-bottom: 0;
    padding: 15px;
    background: var(--glass);
    backdrop-filter: blur(4px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    font-size: 0.9rem;
    color: white;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    font-family: 'SuperMario', 'Outfit', sans-serif;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.legend-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.legend-key {
    color: var(--primary);
    margin-right: 5px;
}

.legend-label {
    text-align: right;
    white-space: nowrap;
}

/* ── Startup Screen ──────────────────────────────────────────── */
#startup-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #0f172a;
    z-index: 100;
}

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

#startup-canvas {
    display: block;
    image-rendering: pixelated;
    border-radius: 24px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.6), 0 0 0 4px rgba(255, 255, 255, 0.15);
}