/* ══ Reset & Base ══════════════════════════════════════════ */
html,
body {
    height: 100%;
    overflow: hidden;
}

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

body {
    font-family: 'Oxanium', sans-serif;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1a3e 50%, #0d1b2a 100%);
    color: #00ff88;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ══ Header ════════════════════════════════════════════════ */
.header {
    font-family: 'Jersey 15', sans-serif;
    background: rgba(0, 255, 136, 0.1);
    border-bottom: 2px solid #00ff88;
    padding: 0.55rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.2rem;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
    flex-shrink: 0;
}

.header h1 {
    font-size: 2.5rem;
    text-shadow: 0 0 10px #00ff88, 0 0 20px #ff006e;
    letter-spacing: 3px;
    color: #00ffff;
}

.header-sub {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.header-sub .subtitle {
    font-family: 'Oxanium', sans-serif;
    font-size: 0.68rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(0, 255, 136, 0.45);
}

#mapClock {
    margin-left: auto;
    font-family: 'Jersey 15', monospace;
    font-size: 1.5rem;
    padding: 3px 16px;
    border-radius: 6px;
    border: 1px solid rgba(0, 255, 136, 0.3);
    background: rgba(0, 0, 0, 0.35);
    letter-spacing: 2px;
    transition: color 0.5s, border-color 0.5s, text-shadow 0.5s;
}

#mapClock.day {
    color: #f5d060;
    border-color: rgba(245, 208, 96, 0.4);
    text-shadow: 0 0 12px #f5d060;
}

#mapClock.night {
    color: #8899cc;
    border-color: rgba(136, 153, 204, 0.4);
    text-shadow: 0 0 12px #8899cc;
}

/* ══ Layout ════════════════════════════════════════════════ */
.container {
    display: flex;
    flex: 1;
    gap: 1rem;
    padding: 1rem;
    overflow: hidden;
}

/* ══ Left Panel (Editor) ═══════════════════════════════════ */
.left-content {
    flex: 0 0 420px;
    min-width: 290px;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    background: rgba(0, 255, 136, 0.04);
    border: 1px solid #00ff88;
    border-radius: 8px;
    box-shadow: inset 0 0 20px rgba(0, 255, 136, 0.07), 0 0 18px rgba(0, 255, 136, 0.1);
    overflow: hidden;
}

/* Editor top bar */
.editor-header {
    display: flex;
    align-items: center;
    padding: 7px 12px;
    background: rgba(0, 255, 136, 0.08);
    border-bottom: 1px solid rgba(0, 255, 136, 0.22);
    gap: 8px;
    flex-shrink: 0;
}

.lang-badge {
    font-family: 'Oxanium', monospace;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(55, 118, 171, 0.18);
    color: #4ea8d4;
    border: 1px solid rgba(55, 118, 171, 0.45);
}

.lang-badge.js-badge {
    background: rgba(0, 255, 136, 0.1);
    color: #4af080;
    border-color: rgba(74, 240, 128, 0.4);
}

.file-name {
    font-family: 'Oxanium', monospace;
    font-size: 11px;
    color: rgba(0, 255, 136, 0.4);
}

/* CodeMirror */
.cm-wrap {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.CodeMirror {
    height: 100% !important;
    font-family: 'Oxanium', 'Courier New', monospace;
    font-size: 12.5px;
    line-height: 1.75;
    background: #08080f !important;
}

.CodeMirror-gutters {
    background: #06060c !important;
    border-right: 1px solid rgba(0, 255, 136, 0.12) !important;
}

.CodeMirror-linenumber {
    color: rgba(0, 255, 136, 0.22) !important;
}

.CodeMirror-cursor {
    border-left: 2px solid #00ff88 !important;
}

.CodeMirror-selected {
    background: rgba(0, 255, 136, 0.1) !important;
}

/* JS preview pane */
.js-preview {
    display: none;
    flex-direction: column;
    flex: 0 0 170px;
    border-top: 1px solid rgba(0, 255, 136, 0.18);
}

.js-preview.visible {
    display: flex;
}

.js-preview-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    background: rgba(0, 255, 136, 0.05);
    border-bottom: 1px solid rgba(0, 255, 136, 0.15);
    flex-shrink: 0;
}

.js-preview-header .label {
    font-size: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(74, 240, 128, 0.5);
}

.js-code {
    flex: 1;
    overflow-y: auto;
    padding: 7px 12px;
    font-family: 'Oxanium', monospace;
    font-size: 10.5px;
    line-height: 1.8;
    color: #3add7a;
    white-space: pre;
    background: #050810;
}

.js-code::-webkit-scrollbar {
    width: 3px;
}

.js-code::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 136, 0.3);
}

/* Run bar */
.run-bar {
    display: flex;
    align-items: center;
    padding: 7px 10px;
    gap: 6px;
    background: rgba(0, 255, 136, 0.06);
    border-top: 1px solid rgba(0, 255, 136, 0.2);
    flex-shrink: 0;
}

.btn {
    font-family: 'Oxanium', monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    padding: 6px 14px;
    transition: all 0.14s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-run {
    background: #00ff88;
    color: #040e12;
    box-shadow: 0 0 12px rgba(0, 255, 136, 0.4);
}

.btn-run:hover {
    background: #33ffaa;
    box-shadow: 0 0 24px rgba(0, 255, 136, 0.65);
    transform: translateY(-1px);
}

.btn-run:active {
    transform: translateY(0);
}

.btn-run.running {
    animation: pulse-neon 0.5s ease infinite alternate;
}

@keyframes pulse-neon {
    from {
        box-shadow: 0 0 8px rgba(0, 255, 136, 0.4);
    }

    to {
        box-shadow: 0 0 30px rgba(0, 255, 136, 0.95), 0 0 60px rgba(0, 255, 136, 0.3);
    }
}

.btn-clear {
    background: transparent;
    color: #ff006e;
    border: 1px solid #ff006e;
}

.btn-clear:hover {
    background: rgba(255, 0, 110, 0.12);
    box-shadow: 0 0 14px rgba(255, 0, 110, 0.3);
}

.btn-js {
    background: transparent;
    color: #4af080;
    border: 1px solid rgba(74, 240, 128, 0.45);
}

.btn-js:hover {
    background: rgba(74, 240, 128, 0.08);
}

.run-hint {
    margin-left: auto;
    font-size: 9.5px;
    color: rgba(0, 255, 136, 0.25);
    letter-spacing: 0.5px;
}

/* Output log */
.output-panel {
    border-top: 1px solid rgba(0, 255, 136, 0.18);
    flex-shrink: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
    background: rgba(0, 0, 0, 0.28);
}

.output-panel.expanded {
    max-height: 155px;
}

.output-panel.collapsed {
    max-height: 0;
}

.output-header {
    display: flex;
    align-items: center;
    padding: 5px 12px;
    background: rgba(0, 255, 136, 0.07);
    border-bottom: 1px solid rgba(0, 255, 136, 0.12);
    cursor: pointer;
    user-select: none;
    gap: 8px;
}

.output-header .label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(0, 255, 136, 0.45);
}

.badge {
    font-family: 'Oxanium', monospace;
    font-size: 10px;
    padding: 1px 7px;
    border-radius: 3px;
    margin-left: auto;
}

.badge-ok {
    background: rgba(0, 255, 136, 0.1);
    color: #00ff88;
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.badge-err {
    background: rgba(255, 0, 110, 0.1);
    color: #ff006e;
    border: 1px solid rgba(255, 0, 110, 0.3);
}

.badge-info {
    background: rgba(0, 200, 255, 0.1);
    color: #00c8ff;
    border: 1px solid rgba(0, 200, 255, 0.3);
}

.output-body {
    max-height: 118px;
    overflow-y: auto;
    padding: 5px 12px;
    font-family: 'Oxanium', monospace;
    font-size: 11px;
    line-height: 1.9;
}

.output-body::-webkit-scrollbar {
    width: 3px;
}

.output-body::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 136, 0.3);
}

.log-ok {
    color: #00ff88;
}

.log-err {
    color: #ff006e;
}

.log-info {
    color: #00c8ff;
}

.log-warn {
    color: #f5a623;
}

/* Library panel */
.lib-panel {
    border-top: 1px solid rgba(0, 255, 136, 0.18);
    flex-shrink: 0;
    background: rgba(0, 255, 136, 0.02);
}

.lib-header {
    display: flex;
    align-items: center;
    padding: 5px 12px;
    background: rgba(0, 255, 136, 0.07);
    cursor: pointer;
    user-select: none;
    gap: 7px;
    border-bottom: 1px solid rgba(0, 255, 136, 0.12);
}

.lib-header .label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(255, 200, 0, 0.65);
}

.lib-header .toggle-icon {
    margin-left: auto;
    color: rgba(0, 255, 136, 0.35);
    font-size: 9px;
}

.lib-body {
    padding: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    max-height: 120px;
    overflow-y: auto;
}

.lib-body::-webkit-scrollbar {
    width: 3px;
}

.lib-body::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 136, 0.3);
}

.lib-fn-card {
    background: rgba(0, 255, 136, 0.04);
    border: 1px solid rgba(0, 255, 136, 0.18);
    border-radius: 5px;
    padding: 4px 9px;
    cursor: pointer;
    transition: all 0.13s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.lib-fn-card:hover {
    border-color: #f5a623;
    background: rgba(245, 166, 35, 0.08);
    box-shadow: 0 0 10px rgba(245, 166, 35, 0.2);
    transform: translateY(-1px);
}

.lib-fn-card .fn-emoji {
    font-size: 14px;
}

.lib-fn-card .fn-name {
    font-family: 'Oxanium', monospace;
    font-size: 11px;
    font-weight: 700;
    color: #f5a623;
}

/* ══ Right Panel (Map) ═════════════════════════════════════ */
.right-content {
    flex: 1 1 0;
    min-width: 0;
    background: rgba(255, 0, 110, 0.05);
    border: 1px solid #ff006e;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 0 30px rgba(255, 0, 110, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#mapContainer {
    flex: 1 1 0;
    width: 100%;
    min-height: 0;
    position: relative;
    overflow: hidden;
    border-radius: 4px;
}

#mapContainer canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

/* Reset button (kept from original style.css) */
#mapResetBtn {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    background: rgba(10, 14, 39, 0.85);
    color: #00ff88;
    border: 1px solid #00ff88;
    border-radius: 6px;
    padding: 6px 14px;
    font-family: 'Oxanium', sans-serif;
    font-size: 0.78rem;
    letter-spacing: 1px;
    cursor: pointer;
    backdrop-filter: blur(4px);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.2);
    transition: background 0.15s, box-shadow 0.15s, color 0.15s;
    user-select: none;
}

#mapResetBtn:hover {
    background: rgba(0, 255, 136, 0.15);
    box-shadow: 0 0 18px rgba(0, 255, 136, 0.45);
}

#mapResetBtn.active,
#mapResetBtn:active {
    background: rgba(0, 255, 136, 0.3);
    color: #ffffff;
    box-shadow: 0 0 24px rgba(0, 255, 136, 0.7);
}

/* Map hints (kept from original style.css) */
#mapHints {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    gap: 16px;
    background: rgba(10, 14, 39, 0.75);
    border: 1px solid rgba(0, 255, 136, 0.25);
    border-radius: 6px;
    padding: 5px 14px;
    backdrop-filter: blur(4px);
    pointer-events: none;
    opacity: 0.7;
    transition: opacity 0.3s;
}

#mapContainer:hover #mapHints {
    opacity: 1;
}

#mapHints span {
    font-family: 'Oxanium', sans-serif;
    font-size: 0.7rem;
    color: #00ff88;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* ══ Footer ════════════════════════════════════════════════ */
.footer {
    background: rgba(0, 255, 136, 0.1);
    border-top: 2px solid #00ff88;
    display: flex;
    align-items: center;
    padding: 0.4rem 1.5rem;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
    flex-shrink: 0;
    gap: 12px;
}

.footer p {
    font-size: 0.7rem;
    color: rgba(0, 255, 136, 0.45);
    letter-spacing: 0.5px;
}

#footerStatus {
    margin-left: auto;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    transition: color 0.3s, text-shadow 0.3s;
}

#footerStatus.ready {
    color: #00ff88;
    text-shadow: 0 0 8px rgba(0, 255, 136, 0.5);
}

#footerStatus.running {
    color: #f5a623;
    text-shadow: 0 0 8px rgba(245, 166, 35, 0.5);
}

#footerStatus.error {
    color: #ff006e;
    text-shadow: 0 0 8px rgba(255, 0, 110, 0.5);
}

/* ══ Scrollbars (from original style.css) ═════════════════ */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #0a0e27;
}

::-webkit-scrollbar-thumb {
    background: #00ff88;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #ff006e;
}

/* ══ Tooltip ═══════════════════════════════════════════════ */
.fn-tooltip {
    position: fixed;
    z-index: 300;
    background: #0a0e27;
    border: 1px solid rgba(0, 255, 136, 0.35);
    border-radius: 7px;
    padding: 10px 14px;
    max-width: 270px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.75), 0 0 20px rgba(0, 255, 136, 0.12);
    font-size: 11.5px;
    line-height: 1.65;
    display: none;
    pointer-events: none;
}

.fn-tooltip .tt-name {
    font-weight: 700;
    color: #f5a623;
    margin-bottom: 3px;
    font-size: 12.5px;
}

.fn-tooltip .tt-sig {
    font-family: 'Oxanium', monospace;
    font-size: 10.5px;
    color: #4ea8d4;
    margin-bottom: 5px;
}

.fn-tooltip .tt-desc {
    color: rgba(0, 255, 136, 0.8);
    margin-bottom: 4px;
}

.fn-tooltip .tt-param {
    font-size: 10.5px;
    color: rgba(0, 255, 136, 0.4);
}

.fn-tooltip .tt-param span {
    color: #00ff88;
}

.fn-tooltip .tt-hint {
    margin-top: 6px;
    font-size: 10px;
    color: rgba(245, 166, 35, 0.55);
}