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

:root {
    --dark-bg:rgba(7, 2, 13, 0.75);

    --darker-bg: rgba(6, 2, 12, 0.9);
    --panel-bg: rgba(7, 2, 13, 0.75);
    --border-color: rgba(255, 138, 101, 0.25);
    --orange-primary: #ff7b54;
    --orange-hover: #ff9a76;
    --orange-glow: rgba(255, 123, 84, 0.45);
    --purple-accent: #6a4cff;
    --purple-glow: rgba(106, 76, 255, 0.3);
    --text-primary: #f8f2ff;
    --text-secondary: #c7bce0;
    --success: #57d38c;
    --error: #ff6f76;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background:
        radial-gradient(circle at 10% 20%, rgba(143, 91, 255, 0.25) 0%, transparent 60%),
        radial-gradient(circle at 80% -10%, rgba(255, 123, 84, 0.2) 0%, transparent 55%),
        linear-gradient(135deg, #05010b 0%, #12061d 45%, #1c0f2a 100%);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

body::before,
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -2;
}

body::before {
    background-image:
        radial-gradient(2px 2px at 20px 20px, rgba(255, 255, 255, 0.15) 0, transparent 55%),
        radial-gradient(3px 3px at 40px 60px, rgba(255, 255, 255, 0.07) 0, transparent 60%),
        radial-gradient(2px 2px at 80px 120px, rgba(255, 255, 255, 0.08) 0, transparent 65%);
    background-size: 120px 120px;
    opacity: 0.5;
    animation: twinkle 18s linear infinite;
}

body::after {
    background:
        radial-gradient(closest-side at 85% 15%, rgba(255, 246, 189, 0.25), transparent),
        radial-gradient(closest-side at 12% 85%, rgba(255, 123, 84, 0.18), transparent),
        repeating-linear-gradient(120deg, rgba(255, 123, 84, 0.05) 0, rgba(255, 123, 84, 0.05) 2px, transparent 2px, transparent 12px);
    mix-blend-mode: screen;
    opacity: 0.65;
    animation: drift 28s ease-in-out infinite;
}

header {
    background: linear-gradient(130deg, rgba(18, 10, 28, 0.95), rgba(12, 4, 20, 0.9));
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.55);
    position: relative;
}

header::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 85%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--orange-primary), transparent);
    opacity: 0.7;
}

.header-content {
    max-width: 1800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(145deg, #ffb347, #ff7b54);
    border-radius: 12px 12px 18px 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.5rem;
    box-shadow: 0 0 20px var(--orange-glow), inset 0 -4px 10px rgba(0, 0, 0, 0.35);
    position: relative;
}

.logo-icon::after {
    content: '';
    position: absolute;
    top: 6px;
    width: 12px;
    height: 6px;
    border-radius: 50% 50% 0 0;
    background: rgba(0, 0, 0, 0.35);
}

h1 {
    font-family: 'Creepster', cursive;
    font-size: 2.1rem;
    letter-spacing: 1px;
    color: #ffb347;
    text-shadow:
        0 0 14px rgba(255, 179, 71, 0.8),
        0 0 28px rgba(106, 76, 255, 0.55);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.25rem;
    letter-spacing: 0.4px;
}

.container {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
    max-width: 1800px;
    margin: 0 auto;
    width: 100%;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.panel {
    background: linear-gradient(155deg, rgba(24, 14, 37, 0.95), rgba(9, 3, 17, 0.88));
    border-radius: 16px;
    border: 1px solid transparent;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
}

.panel::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(140deg, rgba(255, 123, 84, 0.35), rgba(106, 76, 255, 0.25));
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0.75;
}

.panel-header {
    padding: 1rem 1.5rem;
    background: linear-gradient(120deg, rgba(255, 123, 84, 0.18), rgba(24, 14, 37, 0.6));
    border-bottom: 1px solid rgba(255, 123, 84, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-title {
    font-weight: 600;
    color: var(--orange-primary);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.panel-title::before {
    content: '🕸';
    font-size: 1rem;
    filter: drop-shadow(0 0 6px var(--purple-glow));
}

.editor-wrapper {
    flex: 1;
    overflow: hidden;
    position: relative;
    border-radius: 0 0 16px 16px;
    background: rgba(7, 2, 13, 0.75) important;
    
}

.CodeMirror {
    height: 100%;
    font-size: 14px;
    line-height: 1.6;
    background: rgba(7, 2, 13, 0.75);
    color: var(--text-primary);
}

.cm-s-monokai.CodeMirror {
    background: rgba(7, 2, 13, 0.75);
}

.CodeMirror-gutters {
    background: transparent;
    border: none;
    border-right: 1px solid rgba(255, 123, 84, 0.15);
}

.cm-s-monokai .CodeMirror-gutters {
    background: rgba(7, 2, 13, 0.75);
    border-right: 1px solid rgba(255, 123, 84, 0.15);
}

.CodeMirror-cursor {
    border-left: 2px solid var(--orange-primary);
}

.cm-s-monokai .CodeMirror-linenumber {
    color: rgba(255, 255, 255, 0.3);
}

.output-content {
    flex: 1;
    padding: 1.5rem;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    background: rgba(7, 2, 13, 0.75);
    box-shadow: inset 0 0 25px rgba(0, 0, 0, 0.35);
}

.output-content::-webkit-scrollbar {
    width: 8px;
}

.output-content::-webkit-scrollbar-track {
    background: var(--panel-bg);
}

.output-content::-webkit-scrollbar-thumb {
    background: var(--orange-primary);
    border-radius: 4px;
}

.output-content::-webkit-scrollbar-thumb:hover {
    background: var(--orange-hover);
}

.controls {
    padding: 1rem 1.5rem;
    background: linear-gradient(120deg, rgba(24, 14, 37, 0.85), rgba(9, 3, 17, 0.9));
    border-top: 1px solid rgba(255, 123, 84, 0.2);
    display: flex;
    gap: 1rem;
    align-items: center;
}

button {
    padding: 0.75rem 2rem;
    background: linear-gradient(125deg, rgba(255, 123, 84, 0.95), rgba(255, 179, 71, 0.85));
    color: #1b061b;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 12px 25px var(--orange-glow);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

button::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(120deg, rgba(255, 255, 255, 0.35), transparent 60%);
    mix-blend-mode: screen;
    opacity: 0;
    transition: opacity 0.3s ease;
}

button:hover {
    transform: translateY(-3px) scale(1.01);
    box-shadow: 0 18px 30px var(--orange-glow);
}

button:hover::after {
    opacity: 0.55;
}

button:active {
    transform: translateY(0);
}

button:disabled {
    background: #555;
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
}

.clear-btn {
    background: transparent;
    border: 1px solid rgba(255, 123, 84, 0.4);
    box-shadow: none;
    color: var(--text-secondary);
    text-transform: none;
    letter-spacing: normal;
}

.clear-btn:hover {
    border-color: var(--orange-primary);
    color: var(--orange-primary);
    background: rgba(255, 123, 84, 0.08);
    transform: none;
}

.status {
    margin-left: auto;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
}

.status.success {
    background: rgba(87, 211, 140, 0.18);
    color: var(--success);
}

.status.error {
    background: rgba(255, 111, 118, 0.18);
    color: var(--error);
}

.status.running {
    background: rgba(255, 107, 53, 0.2);
    color: var(--orange-primary);
}

.placeholder {
    color: var(--text-secondary);
    font-style: italic;
}

.examples {
    padding: 1rem 1.5rem;
    background: linear-gradient(130deg, rgba(24, 14, 37, 0.75), rgba(9, 3, 17, 0.65));
    border-top: 1px solid rgba(255, 123, 84, 0.2);
}

.examples-title {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.example-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.example-btn {
    padding: 0.4rem 0.8rem;
    background: transparent;
    border: 1px solid rgba(106, 76, 255, 0.35);
    color: var(--text-secondary);
    font-size: 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: none;
    text-transform: none;
    letter-spacing: normal;
}

.example-btn:hover {
    border-color: var(--orange-primary);
    color: var(--text-primary);
    background: rgba(255, 123, 84, 0.15);
    transform: none;
}

@media (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr;
    }
}

@media (max-width: 720px) {
    header {
        padding: 1.25rem;
    }

    .container {
        padding: 1rem;
        gap: 1rem;
    }

    button {
        padding: 0.65rem 1.5rem;
    }
}

@keyframes drift {
    0% {
        transform: translate3d(0, 0, 0) scale(1);
    }
    50% {
        transform: translate3d(2%, -2%, 0) scale(1.02);
    }
    100% {
        transform: translate3d(0, 0, 0) scale(1);
    }
}

@keyframes twinkle {
    0%,
    100% {
        opacity: 0.35;
    }
    50% {
        opacity: 0.6;
    }
}
