:root {
    --bg-dark: #0d1117;
    --bg-editor: #161b22;
    --bg-header: #010409;
    --border-main: #30363d;
    --accent-blue: #58a6ff;
    --text-primary: #c9d1d9;
    --text-muted: #8b949e;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(139, 148, 158, 0.3);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 148, 158, 0.5);
}

body.v4 {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

.app-host {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.app-header {
    height: 50px;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-main);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    z-index: 100;
}

/* Logo styles removed */

.tab-pill {
    display: flex;
    align-items: center;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
}

#filename-label {
    outline: none;
    padding: 2px 4px;
    border-radius: 4px;
    transition: all 0.2s;
    border-bottom: 1px solid transparent;
}

#filename-label:hover {
    background: rgba(255, 255, 255, 0.1);
}

#filename-label:focus {
    background: rgba(255, 255, 255, 0.15);
    border-bottom: 1px solid var(--accent-blue);
}

.run-btn {
    background: #238636;
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.run-btn:hover {
    background: #2ea043;
}

.secondary-btn {
    background: var(--bg-editor);
    color: var(--text-primary);
    border: 1px solid var(--border-main);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.secondary-btn:hover {
    background: #30363d;
    border-color: #8b949e;
}

.h-right {
    display: flex;
    gap: 6px;
}

.editor-shell {
    flex: 1;
    overflow: hidden;
}

.main-split {
    display: flex;
    height: 100%;
    width: 100%;
    position: relative;
}

.code-editor-area {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-editor);
}

.editor-header {
    height: 38px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
    border-bottom: 1px solid var(--border-main);
    flex-shrink: 0;
    overflow: hidden;
}

.editor-toolbar-left {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* Hide scrollbar for clean look */
}

.editor-toolbar-left::-webkit-scrollbar {
    display: none;
}

.toolbar-sep {
    width: 1px;
    height: 16px;
    background: var(--border-main);
    margin: 0 6px;
    flex-shrink: 0;
}

.editor-header .title {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--text-muted);
}

.editor-header .format-btn {
    font-size: 0.65rem;
    color: #56d364;
    font-weight: 700;
    background: transparent;
    border: 1px solid rgba(86, 211, 100, 0.3);
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.editor-header .format-btn:hover {
    background: rgba(86, 211, 100, 0.1);
    border-color: #56d364;
}

.editor-header .format-btn i {
    font-size: 0.6rem;
}

.editor-header .lock-btn {
    background: transparent;
    border: none;
    color: var(--accent-blue);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 2px 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.editor-header .lock-btn:hover {
    color: var(--accent-blue);
}

.editor-header .lock-btn.is-locked {
    color: #ff7b72;
}

.code-editor-area.is-locked #monaco-container {
    opacity: 0.8;
}

#monaco-container {
    flex: 1;
    width: 100%;
    overflow: hidden;
}

/* Resizer Splitter */
.resizer {
    width: 6px;
    background: var(--bg-header);
    cursor: col-resize;
    transition: background 0.2s;
    z-index: 50;
    flex-shrink: 0;
    border-left: 1px solid var(--border-main);
    border-right: 1px solid var(--border-main);
}

.resizer:hover,
.resizer.dragging {
    background: var(--accent-blue) !important;
}

/* Live Preview Area */
.live-preview-area {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #fdfdfd;
}

.preview-header {
    height: 35px;
    background: #f6f8fa;
    border-bottom: 1px solid #d0d7de;
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 12px;
}

.device-toggles {
    display: flex;
    gap: 4px;
    margin-right: 4px;
}

.device-btn {
    background: transparent;
    border: none;
    color: #57606a;
    font-size: 0.85rem;
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.device-btn:hover {
    background: #eaeff2;
    color: #0969da;
}

.device-btn.active {
    color: #0969da;
    background: #eef2f6;
}

.url-mock {
    flex: 1;
    background: #fff;
    height: 22px;
    border-radius: 11px;
    border: 1px solid #d0d7de;
    font-size: 0.75rem;
    color: #57606a;
    display: flex;
    align-items: center;
    padding: 0 10px;
}

.pixel-badge {
    background: #eef2f6;
    color: #475569;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #cbd5e1;
    font-family: monospace;
    flex-shrink: 0;
}

.window-buttons {
    display: flex;
    gap: 6px;
    margin-left: 4px;
}

.iframe-wrap {
    flex: 1;
    position: relative;
    background: #eaeff2;
    /* 조금 더 명확한 시뮬레이션 배경 */
    overflow-y: auto;
    overflow-x: hidden;
    display: block;
}

#live-preview {
    background: #fff;
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    width: 100%;
    height: 100%;
}

.dragging-active iframe {
    pointer-events: none;
}

.dragging-active {
    cursor: col-resize;
    user-select: none;
}

.dragging-active.v-drag {
    cursor: row-resize;
}

/* Mobile Optimization */
@media (max-width: 768px) {
    .main-split {
        flex-direction: column-reverse;
    }

    .resizer {
        width: 100%;
        height: 8px;
        cursor: row-resize;
        border-top: 1px solid var(--border-main);
        border-bottom: 1px solid var(--border-main);
        border-left: none;
        border-right: none;
    }

    .iframe-wrap {
        padding: 0;
        background: #fff;
    }

    #live-preview {
        box-shadow: none;
    }

    .live-preview-area {
        height: 40%;
        flex: 0 0 auto;
    }

    .code-editor-area {
        height: 60%;
        flex: 1 1 0;
    }

    .preview-header {
        padding: 0 8px;
        gap: 4px;
    }

    .device-toggles {
        display: flex;
        gap: 2px;
    }

    .url-mock {
        display: none;
    }

    .pixel-badge {
        font-size: 0.6rem;
        padding: 2px 4px;
        margin-right: 0;
        flex-shrink: 0;
    }

    .window-buttons {
        display: none;
    }

    .h-center,
    .h-right .user-avatar {
        display: none;
    }
}