/* Canvas Area */
#editor-canvas { flex: 1; background: var(--bg-canvas); display: flex; flex-direction: column; position: relative; min-width: 0; }
#welcome-screen { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 10; background: var(--bg-dark); }
#welcome-screen.hidden { display: none; }

/* Start Mode — hide chrome around the canvas */
.start-mode #file-explorer { display: none; }
.start-mode #properties-sidebar { display: none; }
.start-mode #iframe-wrapper { display: none; }
.start-mode .top-bar-center { display: none; }
.start-mode .top-bar-right > *:not(#auth-container):not(#btn-theme-toggle) { display: none; }

/* Start Screen */
.start-screen { display: flex; flex-direction: column; align-items: center; gap: 40px; padding: 40px; max-width: 1460px; width: 100%; }
.start-logo { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.start-logo-icon { font-size: 40px; line-height: 1; }
.start-logo-name { font-size: 26px; font-weight: 700; color: var(--text-main); letter-spacing: -0.5px; }
.start-logo-sub { font-size: 13px; color: var(--text-muted); }
.start-cards { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.start-card { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 8px; padding: 28px 24px; width: 220px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; transition: border-color 0.15s; }
.start-card:hover { border-color: var(--accent); }
.start-card-icon { color: var(--accent); margin-bottom: 4px; }
.start-card h3 { font-size: 14px; font-weight: 600; color: var(--text-main); }
.start-card p { font-size: 12px; color: var(--text-muted); line-height: 1.5; flex: 1; }
.start-card .btn { width: 100%; margin-top: 8px; }
.start-card-ai { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.start-card-ai:hover { border-color: var(--accent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent); }
.start-card-ai .start-card-icon { color: var(--accent); }

#iframe-wrapper { flex: 1; display: flex; flex-direction: column; height: 100%; overflow: hidden; position: relative; }
#iframe-wrapper.hidden { display: none; }

#iframe-wrapper:fullscreen,
#iframe-wrapper:-webkit-full-screen {
    width: 100%;
    height: 100%;
    background: var(--bg-canvas);
}

#iframe-wrapper:fullscreen #iframe-container-outer,
#iframe-wrapper:-webkit-full-screen #iframe-container-outer {
    padding: 0;
    background-image: none;
}

#iframe-wrapper:fullscreen #resizable-iframe-container,
#iframe-wrapper:-webkit-full-screen #resizable-iframe-container {
    width: 100% !important;
    max-width: none;
    height: 100%;
    box-shadow: none;
}

#iframe-wrapper:fullscreen .resize-handle,
#iframe-wrapper:-webkit-full-screen .resize-handle {
    display: none;
}

.canvas-toolbar { height: 36px; background: var(--bg-panel); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 10px; justify-content: flex-end; color: var(--text-muted); font-size: 12px; flex-shrink: 0; }
.btn-icon { background: none; border: none; cursor: pointer; font-size: 14px; opacity: 0.7; }
.btn-icon:hover { opacity: 1; }
.btn-icon.active { opacity: 1; color: var(--accent); }
.btn-icon.active svg { fill: var(--accent); }
.separator { margin: 0 8px; opacity: 0.3; }

#iframe-container-outer {
    flex: 1; display: flex; justify-content: center; align-items: center;
    padding: 0px 10px; background-image: radial-gradient(var(--sidebar-header-bg) 1px, transparent 1px);
    background-size: 20px 20px; overflow: hidden;
}

#resizable-iframe-container {
    width: 100%; height: 100%; position: relative; background: white;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3); max-width: 100%; box-sizing: border-box;
}

#preview-iframe { width: 100%; height: 100%; border: none; background: white; display: block; }

.resize-handle {
    position: absolute; top: 0; bottom: 0; width: 14px; height: 100%;
    background: transparent; border-left: 1px solid transparent; border-right: 1px solid transparent;
    cursor: col-resize; display: flex; align-items: center; justify-content: center; z-index: 50;
    transition: background 0.2s, border-color 0.2s;
}

.resize-handle:hover { background: rgba(0, 122, 204, 0.1); border-color: rgba(0, 122, 204, 0.3); }
.resize-handle::after {
    content: '||'; color: #888; font-size: 10px; letter-spacing: 1px; font-weight: bold;
    background: var(--bg-panel); padding: 4px 2px; border-radius: 2px; border: 1px solid var(--border);
}
.resize-handle:hover::after { color: white; background: var(--accent); border-color: var(--accent); }
.handle-left { left: -14px; }
.handle-right { right: -14px; }

#iframe-drag-overlay { position: absolute; inset: 0; z-index: 40; display: none; cursor: copy; }
#resizable-iframe-container.is-resizing #iframe-drag-overlay { display: block; cursor: col-resize; }
#iframe-drag-overlay.block-drag-active { display: block; }

/* Element move handle */
#element-move-handle {
    position: absolute;
    width: 22px;
    height: 22px;
    background: var(--accent);
    color: white;
    border-radius: 3px;
    cursor: grab;
    z-index: 45;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: opacity 0.15s;
}
#element-move-handle:hover { opacity: 0.85; }
#element-move-handle:active { cursor: grabbing; }
#element-move-handle.visible { display: flex; }
