body {
    font-family: 'Inter', Arial, sans-serif;
    background: #111827;
    color: #222;
    margin: 0;
    text-align: center;
}

h1 {
    font-family: 'Orbitron', Arial, sans-serif;
    font-size: 2.3em;
    margin-top: 28px;
    letter-spacing: 1px;
    color: #0099cc;
    text-shadow: 0 2px 10px #00eaff25;
}

/* NEW: Aligned Level Indicator and Roadmap Bar */
.level-header-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin: 18px 0 2px 0;
    position: relative;
}

#level-indicator {
    color: #00eaff;
    font-family: 'Orbitron', Arial, sans-serif;
    font-size: 1.2em;
    background: #0a054099;
    padding: 6px 18px;
    border-radius: 14px;
    box-shadow: 0 0 8px #00eaff40;
    /* Removed position: absolute */
}

#roadmap-bar {
    display: flex;
    justify-content: center;
    gap: 14px;
    /* Removed margin, now handled by header row */
}

.main-container {
    display: flex;
    flex-direction: row;
    justify-content: stretch;
    align-items: flex-start;
    width: 100vw;
    min-height: 100vh;
    margin: 0;
    gap: 0 !important;
}

.side {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: calc(100vh - 60px);
    box-sizing: border-box;
    padding-top: 20px;
}

.grid-side {
    flex: 1.3 1 0;
    min-width: 620px;
    max-width: 700px;
    justify-content: center;
}

.grid-container {
    width: 600px;
    min-width: 600px;
    max-width: 600px;
    background: linear-gradient(135deg, #0a0540 0%, #0d1a3c 100%);
    border: 4px solid #00eaff;
    box-shadow: 0 0 40px #00eaff, 0 0 2px #fff;
    border-radius: 18px;
    padding: 18px 8px;
    position: relative;
}

.grid-container canvas {
    display: block;
    margin: 0 auto;
    background: transparent;
    border: 2px solid #39ff14;
    border-radius: 12px;
    box-shadow: 0 0 24px #00eaff80;
}

.toolbox-side {
    flex: 0.7 1 0;
    min-width: 240px;
    max-width: 280px;
    justify-content: flex-start;
    background: #1f2229;
    box-shadow: inset 0 0 12px #101215;
    padding: 16px;
    position: relative;
    overflow: hidden;
    border-radius: 10px;
}

.toolbox-side h3 {
    font-family: 'Inter', Arial, sans-serif;
    font-size: 1.1em;
    color: #e5e7eb;
    font-weight: 600;
    margin-bottom: 14px;
    letter-spacing: 0.4px;
    border-bottom: 1px solid #2c2f36;
    padding-bottom: 6px;
}

#toolbox {
    overflow-y: auto;
    max-height: 85vh;
    min-height: 400px;
    width: 100%;
    border: none;
    background: #1f2229;
    color: #f3f4f6;
    padding: 16px 10px;
    border-radius: 6px;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.block {
    background: #31363e;
    color: #f3f4f6;
    padding: 10px 13px;
    margin: 9px 0;
    border-radius: 6px;
    border: 1px solid #363b43;
    cursor: grab;
    font-family: 'Inter', monospace;
    user-select: none;
    font-size: 1em;
    box-shadow: 0 2px 8px #22262b10;
    transition: background 0.2s;
}

.block input {
    width: 45px;
    margin-left: 5px;
    border: 1px solid #343943;
    background: #23272f;
    color: #f3f4f6;
    border-radius: 4px;
    font-family: 'Inter', monospace;
    font-size: 1em;
}

.block.active {
    background: #2fffe6;
    color: #181a1f;
    border-color: #00eaff;
    box-shadow: 0 0 8px #00eaff30;
}

/* Loop block */
.loop-block {
    background: #31363e;
    color: #f3f4f6;
    border-radius: 6px;
    border: 1px solid #6366f1;
    margin: 7px 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    font-family: 'Inter', monospace;
    padding: 7px;
    box-shadow: 0 0 6px #6366f140;
}

.loop-header {
    color: #00eaff;
    font-size: 15px;
    margin-bottom: 7px;
}

.varname-input, .expr-input {
    width: 34px !important;
    margin-right: 5px;
    margin-left: 5px;
    border: 1px solid #343943;
    background: #23272f;
    color: #f3f4f6;
    border-radius: 4px;
    font-family: 'Inter', monospace;
}

.loop-body {
    background: #24262e;
    min-height: 30px;
    width: 92%;
    margin-left: 14px;
    border-radius: 6px;
    padding: 7px;
    border: 1px dashed #6366f1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* IF block styling */
.if-block {
    background: #31363e;
    color: #f3f4f6;
    border-radius: 6px;
    border: 1px solid #ef4444;
    margin: 7px 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    font-family: 'Inter', monospace;
    padding: 7px;
    box-shadow: 0 0 6px #ef444440;
}

.if-header {
    color: #ff7171;
    font-size: 15px;
    margin-bottom: 7px;
}

.cond-input {
    width: 70px !important;
    margin-right: 5px;
    margin-left: 5px;
    border: 1px solid #343943;
    background: #23272f;
    color: #f3f4f6;
    border-radius: 4px;
    font-family: 'Inter', monospace;
}

.if-body {
    background: #24262e;
    min-height: 30px;
    width: 92%;
    margin-left: 14px;
    border-radius: 6px;
    padding: 7px;
    border: 1px dashed #ef4444;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.program-side {
    flex: 1.4 1 0;
    min-width: 320px;
    max-width: none;
    justify-content: flex-start;
    background: #fff;
    box-shadow: 0 2px 18px #9ca3af10;
    padding-bottom: 0;
    position: relative;
    overflow: visible;
}

.program-side h3 {
    font-family: 'Inter', Arial, sans-serif;
    font-size: 1.2em;
    color: #374151;
    font-weight: 600;
    margin-bottom: 10px;
    margin-top: 0;
}

/* Subtle grey circle grid background for program area */
.program-side #program-area {
    border: 1px solid #cbd5e1;
    background-color: #fff;
    background-image: radial-gradient(circle, #9ca3af 2.5px, transparent 2.5px),
                      radial-gradient(circle, #9ca3af 2.5px, transparent 2.5px);
    background-size: 32px 32px;
    background-position: 0 0, 16px 16px;
    padding: 18px 12px 18px 12px;
    min-height: 350px;
    max-height: 400px;
    width: 95%;
    border-radius: 7px;
    margin-bottom: 12px;
    box-shadow: 0 2px 6px #6b72801a;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    overflow-y: auto;
}

/* Trash */
#trash {
    margin-top: 10px;
    border: 1px dashed #991b1b;
    color: #991b1b;
    padding: 10px;
    min-height: 32px;
    border-radius: 6px;
    background: #fff1f2;
    box-shadow: 0 0 8px #991b1b20;
    font-size: 1em;
    position: relative;
    z-index: 101;
}

/* Futuristic Vibrant Button Style */
.fancy-btn {
    font-family: 'Orbitron', monospace;
    font-size: 1.4em;
    font-weight: 700;
    background: linear-gradient(135deg, #00eaff 0%, #39ff14 80%, #0a0540 100%);
    color: #fff;
    border: none;
    border-radius: 20px;
    margin: 14px 20px 0 0;
    padding: 0;
    width: 8vw;
    min-width: 110px;
    max-width: 170px;
    height: 8vw;
    min-height: 110px;
    max-height: 170px;
    cursor: pointer;
    box-shadow: 0 0 26px #00eaff70, 0 0 12px #39ff1460;
    transition:
      box-shadow 0.22s,
      transform 0.13s,
      background 0.22s;
    outline: none;
    position: relative;
    text-shadow: 0 0 8px #39ff14, 0 0 3px #00eaff;
    letter-spacing: 1px;
    z-index: 102;
}

.fancy-btn:hover, .fancy-btn:focus {
    box-shadow: 0 0 70px #39ff14b0, 0 0 32px #00eaffc0, 0 0 12px #39ff14;
    background: linear-gradient(135deg, #39ff14 0%, #00eaff 80%, #0a0540 100%);
    transform: scale(1.08) rotate(-1deg);
    color: #181a1f;
}

/* Reset Button Style (modern neutral) */
.reset-btn {
    font-family: 'Orbitron', monospace;
    font-size: 1.4em;
    font-weight: 700;
    background: #2d2d2d;
    color: #fff;
    border: none;
    border-radius: 20px;
    margin: 14px 0 0 0;
    padding: 0;
    width: 8vw;
    min-width: 110px;
    max-width: 170px;
    height: 8vw;
    min-height: 110px;
    max-height: 170px;
    cursor: pointer;
    box-shadow: 0 0 12px #9ca3af90;
    transition: box-shadow 0.2s, transform 0.12s;
    outline: none;
    position: relative;
    z-index: 102;
}

.reset-btn:hover, .reset-btn:focus {
    box-shadow: 0 0 30px #9ca3afc0, 0 0 8px #6366f1;
    background: #343943;
    transform: scale(1.05) rotate(1deg);
    color: #39ff14;
}

/* Buttons container in program area */
.program-side .button-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 24px;
    margin-top: 10px;
    margin-bottom: 10px;
    position: relative;
    z-index: 102;
}

/* Blue gradient for the bottom of each panel, behind trash and buttons */
/* Revised to fully cover bottom of program-side (including #program-area, trash, buttons) */
.program-side .bottom-gradient {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    /* Only cover the bottom controls area: estimate with height */
    height: 160px;
    min-height: 120px;
    max-height: 220px;
    background: linear-gradient(
        to top,
        #4fd5ff 0%,
        #b3f0ff 33%,
        #e0f7ff 80%,
        #e0f7ff 100%
    );
    border-top: 2px solid #bfc7d1;
    z-index: 100;
    pointer-events: none;
}

/* Responsive adjustments for small screens */
@media (max-width: 1100px) {
    .main-container {
        flex-direction: column;
        align-items: center;
        gap: 0 !important;
    }
    .side {
        min-width: 260px !important;
        max-width: 98vw !important;
        width: 98vw !important;
        padding-top: 10px;
        height: auto;
    }
    .grid-container {
        min-width: 98vw !important;
        max-width: 98vw !important;
        width: 98vw !important;
    }
    .program-side .button-row {
        flex-direction: column;
        gap: 20px;
        width: 100%;
        align-items: center;
    }
    .fancy-btn, .reset-btn {
        width: 65vw;
        min-width: 110px;
        max-width: 98vw;
        height: 65vw;
        min-height: 60px;
        max-height: 170px;
    }
    .program-side .bottom-gradient {
        bottom: 62px;
        height: 80px;
    }
    .toolbox-side .avatar-img-container {
        display: none !important;
    }
}