:root {
    --bg-color: #0f172a;
    --panel-bg: rgba(30, 41, 59, 0.7);
    --panel-border: rgba(255, 255, 255, 0.1);
    --primary: #38bdf8;
    --primary-hover: #0ea5e9;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --code-bg: #020617;
    --success: #10b981;
    --error: #ef4444;
}

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

body {
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.1) 0px, transparent 50%);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.top-nav {
    width: 100%;
    padding: 1rem 2rem;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--panel-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--primary);
}

#app {
    width: 100%;
    max-width: 1400px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 2rem;
    margin-top: 1rem;
}

header {
    text-align: center;
    margin-bottom: 1rem;
    animation: fadeInDown 0.8s ease-out;
}

header h1 {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #f8fafc, #38bdf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-flex;
    align-items: center;
    gap: 1rem;
}

.badge {
    font-size: 1rem;
    background: rgba(56, 189, 248, 0.2);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    border: 1px solid rgba(56, 189, 248, 0.4);
    color: #38bdf8;
    -webkit-text-fill-color: #38bdf8;
    vertical-align: middle;
}

header p {
    color: var(--text-muted);
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.playground-links {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.playground-links a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

.playground-links a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.preset-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.preset-controls {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.preset-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--panel-border);
    color: var(--text-main);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.preset-btn:hover {
    background: rgba(56, 189, 248, 0.15);
    border-color: rgba(56, 189, 248, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.2);
}

main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    height: 60vh;
    animation: fadeInUp 0.8s ease-out;
}

.panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.panel:hover {
    transform: translateY(-5px);
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.6);
}

.panel-header {
    padding: 1rem 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--panel-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
}

.status-indicator {
    font-size: 0.85rem;
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.status-indicator::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--success);
}

textarea, .output-container {
    flex: 1;
    width: 100%;
    padding: 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: none;
    outline: none;
}

.output-container {
    background: var(--code-bg);
    overflow-y: auto;
    max-height: 250px;
    border-bottom: 1px solid var(--panel-border);
}

.hardware-visualizer {
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.3);
}

.hardware-visualizer h3 {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-weight: 600;
}

.core-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.core-box {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 0.8rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.core-box small {
    font-size: 0.7rem;
    font-weight: 400;
    opacity: 0.7;
}

.core-box.active {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--success);
    color: var(--success);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
}

.core-box.paused {
    background: rgba(245, 158, 11, 0.2);
    border-color: #f59e0b;
    color: #f59e0b;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.3);
}

pre {
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Syntax Highlighting Classes for the output */
.key { color: #38bdf8; }
.string { color: #a7f3d0; }
.number { color: #f472b6; }
.boolean { color: #facc15; }

/* Animations */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@media (max-width: 900px) {
    main {
        grid-template-columns: 1fr;
        height: auto;
    }
    textarea, .output-container {
        min-height: 300px;
    }
}
