html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background: #000000;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
canvas { display: block; }

#loader {
    position: fixed;
    inset: 0;
    background: #050508;
    background-image: 
        linear-gradient(#00e5c806 1px, transparent 1px),
        linear-gradient(90deg, #00e5c806 1px, transparent 1px);
    background-size: 40px 40px;
    background-position: center center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    transition: opacity 0.8s ease, filter 0.8s ease;
    color: #a0aabf;
}
#loader.fade-out {
    opacity: 0;
    filter: blur(10px);
    pointer-events: none;
}

/* Sandbox Frame */
.sandbox-frame {
    position: relative;
    width: 800px;
    max-width: 90vw;
    border: 1px solid #1e2430;
    background: #000000c0;
    backdrop-filter: blur(16px);
    padding: 40px;
    border-radius: 4px;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.9), inset 0 0 20px rgba(0, 229, 200, 0.03);
    opacity: 0;
    transform: scale(0.98);
    animation: frame-reveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.sandbox-frame::after {
    content: "WASM_SANDBOX_ENV // NATIVE EXECUTION // NO SYSCALLS";
    position: absolute;
    top: -10px;
    left: 24px;
    background: #050508;
    padding: 0 12px;
    color: #00e5c8;
    font-size: 11px;
    letter-spacing: 2px;
    font-weight: 600;
}

/* Header Layout: Left (Title), Right (Badges) */
.loader-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px dashed #1e2430;
    padding-bottom: 30px;
}

.title-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.loader-title {
    color: #00e5c8;
    font-size: 56px;
    font-weight: 200;
    letter-spacing: 12px;
    line-height: 1;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    text-shadow: 0 0 20px rgba(0, 229, 200, 0.4);
}
.loader-title span {
    color: #4b5871; /* brighter against black */
    text-shadow: none;
}
.loader-workshop {
    color: #a78bfc; /* brighter purple for better contrast */
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 4px;
    text-transform: uppercase;
}

.isolation-badges {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
    margin-top: 6px;
}
.iso-badge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 220px; /* fixed width for perfect column alignment */
    font-size: 10px;
    letter-spacing: 1.5px;
    padding: 4px 12px; /* bit more padding */
    border: 1px solid #1e2430;
    border-radius: 2px;
    color: #72849d; /* slightly brighter text */
    background: rgba(0, 0, 0, 0.5);
    text-transform: uppercase;
}
.iso-badge .status {
    color: #00e5c8;
    font-weight: 600;
}
.iso-badge .status.warn {
    color: #ffb86c;
}

/* Terminal area */
.terminal {
    background: #020205;
    border: 1px solid #10141d;
    border-radius: 2px;
    padding: 16px;
    height: 160px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    position: relative;
}

.terminal-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(2,2,5,1) 0%, rgba(2,2,5,0) 25%);
    pointer-events: none;
    z-index: 10;
}

.log-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-family: "JetBrains Mono", Consolas, Menlo, Monaco, monospace;
}

.log-line {
    font-size: 11px;
    line-height: 1.5;
    color: #5c6c80;
    opacity: 0;
    animation: line-reveal 0.1s ease forwards;
    display: flex;
    align-items: flex-start;
}
.log-line .timestamp { color: #5c6c80; margin-right: 12px; flex-shrink: 0; }
.log-line .tag { color: #896FFF; margin-right: 8px; flex-shrink: 0; width: 62px;}
.log-line .tag.ok { color: #00e5c8; }
.log-line .tag.warn { color: #ffb86c; }
.log-line.active { color: #ffffff; text-shadow: 0 0 5px rgba(255,255,255,0.4); }

.cursor {
    display: inline-block;
    width: 7px;
    height: 12px;
    background: #00e5c8;
    margin-left: 6px;
    vertical-align: middle;
    animation: blink 1s step-end infinite;
}

/* Progress Bar */
.progress-container {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 20px; /* added more breathing room below terminal */
}
.loader-bar-track {
    flex-grow: 1;
    height: 2px;
    background: #1e2430;
    border-radius: 1px;
    overflow: hidden;
    position: relative;
}
.loader-bar-fill {
    width: 0%;
    height: 100%;
    background: #00e5c8;
    box-shadow: 0 0 10px #00e5c888;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-text {
    font-family: "JetBrains Mono", Consolas, Menlo, Monaco, monospace;
    font-size: 11px;
    color: #ffffff;
    text-shadow: 0 0 8px rgba(0, 229, 200, 0.6);
    font-weight: 600;
    width: 48px;
    text-align: right;
    letter-spacing: 1px;
}

@keyframes frame-reveal {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes line-reveal {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Wrap canvas so it acts like a floating desktop window */
#canvas-wrapper {
    opacity: 0;
    transition: opacity 1.2s ease;
    width: 900px;
    height: 600px;
    max-width: 95vw;
    max-height: 95vh;
    border: 1px solid #1e2430;
    border-radius: 8px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.9), 0 0 30px rgba(0, 37, 255, 0.1);
    overflow: hidden;
}
#canvas-wrapper.visible {
    opacity: 1;
}
