* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: #000; color: #fff; font-family: 'Inter', sans-serif; overflow: hidden; height: 100vh; display: flex; flex-direction: column; }

/* Header & Dock */
.app-header { height: 65px; background: #000; border-bottom: 1px solid #1a1a1a; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; z-index: 1000; }
.logo-text { font-weight: 900; font-size: 18px; }
.logo-text span { color: #3b82f6; }
.asset-dock { display: flex; gap: 10px; background: #0a0a0a; padding: 6px 14px; border-radius: 40px; border: 1px solid #222; align-items: center; }
.dock-pill { cursor: pointer; font-size: 11px; display: flex; align-items: center; gap: 6px; color: #888; font-weight: 600; padding: 4px 8px; border-radius: 6px; }

.utility-pill { background: #1a1a1a; color: #ccc; font-weight: 800; font-size: 11px; padding: 6px 14px; border-radius: 20px; border: 1px solid #333; cursor: pointer; margin-left: 5px; }
.utility-pill.gold { background: linear-gradient(to right, #eab308, #ca8a04); color: #000; border: none; }
.utility-pill.blue { background: #3b82f6; color: #fff; border: none; }
.utility-pill.clean-ws {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-left: 0;
    background: linear-gradient(135deg, #e11d48 0%, #be123c 50%, #9f1239 100%);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.18) inset,
        0 6px 20px rgba(190, 18, 60, 0.35);
}
.utility-pill.clean-ws:hover {
    filter: brightness(1.12);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.22) inset,
        0 8px 24px rgba(190, 18, 60, 0.45);
}
.utility-pill.clean-ws:active {
    filter: brightness(0.95);
    transform: translateY(1px);
}
.utility-pill.clean-ws i { font-size: 12px; opacity: 0.95; }

.header-right-tools {
    display: flex;
    align-items: center;
    gap: 10px;
}
.success-state { background: #22c55e !important; color: #000 !important; }

/* STRICT LOCKED HORIZONTAL TOOLBAR */
.editor-toolbar { height: 55px; background: #0a0a0a; border-bottom: 1px solid #1a1a1a; display: none; align-items: center; padding: 0 24px; z-index: 100; }
.editor-toolbar.active { display: flex; }
.toolbar-container { display: flex; flex-direction: row; align-items: center; width: 100%; }
.locked-horizontal-row { display: flex; flex-direction: row; align-items: center; gap: 12px; white-space: nowrap; overflow: hidden; }

.t-btn { height: 34px; width: 34px; border: none; background: transparent; color: #aaa; cursor: pointer; display: flex; align-items: center; justify-content: center; border-radius: 6px; flex-shrink: 0; }
.t-btn:hover { background: #1a1a1a; color: #fff; }
.t-select { background: #111; color: #ccc; border: 1px solid #333; font-size: 11px; padding: 4px; border-radius: 4px; flex-shrink: 0; }
.t-divider { width: 1px; height: 20px; background: #222; margin: 0 8px; flex-shrink: 0; }

.t-color-item { position: relative; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; border-radius: 6px; cursor: pointer; flex-shrink: 0; }
.t-color-item input { position: absolute; opacity: 0; width: 100%; height: 100%; cursor: pointer; z-index: 2; }
.t-color-item i { color: #888; font-size: 14px; }

.t-btn-delete {
    height: 34px;
    min-width: 38px;
    padding: 0 10px;
    border: none;
    border-radius: 6px;
    background: rgba(220, 38, 38, 0.2);
    color: #f87171;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.t-btn-delete:hover { background: rgba(220, 38, 38, 0.35); color: #fff; }

/* Workspace & Silver Border */
.editor-viewport { flex: 1; background: #000; overflow: auto; display: flex; justify-content: center; padding: 40px 0; }

.workspace-shell {
    width: 1100px;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}
.workspace-tabs {
    display: flex;
    flex-shrink: 0;
    gap: 0;
    border-bottom: 1px solid #64748b;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    border-radius: 12px 12px 0 0;
    overflow: hidden;
    box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.06) inset;
}
.workspace-tab {
    padding: 12px 24px;
    border: none;
    background: transparent;
    color: #94a3b8;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.02em;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    border-right: 1px solid rgba(100, 116, 139, 0.35);
    transition: background 0.15s, color 0.15s;
}
.workspace-tab:hover {
    background: rgba(59, 130, 246, 0.12);
    color: #e2e8f0;
}
.workspace-tab--active {
    background: #3b82f6;
    color: #fff;
}
.workspace-tab--active:hover {
    background: #2563eb;
    color: #fff;
}
.workspace-pane {
    display: none;
}
.workspace-pane--active {
    display: block;
}

/* Formatted article: normal flow (no absolute blocks) */
.formatted-canvas {
    width: 1100px;
    max-width: 100%;
    background: #fff;
    position: relative;
    min-height: 500px;
    padding: 55px;
    border: 1px solid #cbd5e1;
    border-top: none;
    border-radius: 0 0 4px 4px;
    background-image: linear-gradient(135deg, #f8fafc 0%, #cbd5e1 45%, #94a3b8 55%, #f1f5f9 100%);
}
.formatted-article-body {
    min-height: 12em;
    background: rgba(255, 255, 255, 0.92);
    padding: 24px 28px;
    border-radius: 10px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 8px 24px rgba(15, 23, 42, 0.06);
}
.formatted-article-body:focus {
    outline: none;
    box-shadow: 0 0 0 2px #22c55e, 0 8px 24px rgba(15, 23, 42, 0.06);
}
.canvas--preview.formatted-preview-root {
    width: 1100px;
    min-height: 320px;
}

#infiniteCanvas { 
    width: 1100px; background: #fff; position: relative; min-height: 500px;
    padding: 55px;
    border: 1px solid #cbd5e1;
    background-image: linear-gradient(135deg, #f8fafc 0%, #cbd5e1 45%, #94a3b8 55%, #f1f5f9 100%);
}
.canvas--preview {
    width: 1100px;
    background: #fff;
    position: relative;
    min-height: 500px;
    padding: 55px;
    border: none;
    background-image: linear-gradient(135deg, #f8fafc 0%, #cbd5e1 45%, #94a3b8 55%, #f1f5f9 100%);
}
.canvas--preview .draggable-item { position: absolute; }
.canvas--preview .edit-gateway { color: #1e293b; }
.edit-gateway {
    width: 100%;
    min-height: 1.5em;
    outline: none;
    color: #1e293b;
    font-size: 18px;
    line-height: 1.75;
    overflow-wrap: anywhere;
    word-break: break-word;
    letter-spacing: 0.01em;
}
.canvas--preview .edit-gateway {
    max-width: none;
    margin-left: 0;
    margin-right: 0;
}
.edit-gateway img,
.content-node img {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
}
.edit-gateway table,
.content-node table {
    max-width: 100%;
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}
.editing-active { box-shadow: inset 0 0 0 2px #22c55e; }

/* Blocks */
.draggable-item {
    position: absolute;
    display: flex;
    flex-direction: column;
}
.draggable-item > .content-node {
    position: relative;
    z-index: 1;
    flex: 1 1 auto;
    min-height: 0;
}
.section-body {
    width: 100%;
    height: 100%;
}
.card-3d {
    border-radius: 12px;
    border: 1px solid rgba(226, 232, 240, 0.95);
    padding: 15px;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.75) inset,
        0 -1px 0 rgba(15, 23, 42, 0.04) inset,
        3px 4px 0 rgba(148, 163, 184, 0.35),
        6px 12px 24px rgba(15, 23, 42, 0.12);
    background: linear-gradient(165deg, #ffffff 0%, #f8fafc 55%, #f1f5f9 100%);
}
.is-selected .card-3d {
    border: 2px solid #3b82f6;
    box-shadow:
        0 0 0 1px rgba(59, 130, 246, 0.35),
        4px 8px 24px rgba(59, 130, 246, 0.2);
}
.t-block { border-left: 5px solid #3b82f6; }
.tbl-block { border-left: 5px solid #22c55e; }

/* 3D framed image blocks */
.i-block.image-3d-card {
    border-left: 5px solid #7c3aed;
    padding: 12px;
    overflow: hidden;
    background: linear-gradient(155deg, #e2e8f0 0%, #f8fafc 35%, #cbd5e1 55%, #f1f5f9 100%);
    box-shadow:
        0 2px 0 rgba(255, 255, 255, 0.9) inset,
        0 -2px 8px rgba(15, 23, 42, 0.06) inset,
        4px 5px 0 rgba(100, 116, 139, 0.25),
        6px 14px 28px rgba(15, 23, 42, 0.18),
        0 0 0 1px rgba(255, 255, 255, 0.5);
}
.image-3d-card img,
.i-block img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
    display: block;
    /* Keep selection off, but allow drag-to-body feature */
    user-select: none;
    box-shadow:
        0 2px 6px rgba(0, 0, 0, 0.12),
        0 8px 16px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.35);
    border: 1px solid rgba(15, 23, 42, 0.12);
}
.i-block .img-placeholder {
    min-height: 140px;
    border-radius: 10px;
    border: 2px dashed rgba(100, 116, 139, 0.45);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.65), rgba(241, 245, 249, 0.95));
    box-shadow: inset 0 2px 6px rgba(255, 255, 255, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
}

.a-block { border-left: 5px solid #db2777; }
.audio-player-ui {
    display: flex; align-items: center; gap: 10px; cursor: pointer;
    padding: 12px 14px; background: #fdf2f8; color: #831843; border-radius: 8px;
    font-weight: 600; font-size: 14px;
}
.audio-player-ui i { font-size: 18px; }

.is-table-block { width: 100%; border-collapse: collapse; border-radius: 8px; overflow: hidden; }
.is-table-block td {
    border: 1px solid #e2e8f0;
    padding: 10px 12px;
    min-width: 40px;
    text-align: center;
    background: rgba(255, 255, 255, 0.92);
}
.is-table-block tr:nth-child(even) td { background: rgba(248, 250, 252, 0.95); }

.resizer-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 16px;
    height: 16px;
    cursor: nwse-resize;
    background: #3b82f6;
    z-index: 50;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    border-radius: 2px 0 8px 0;
    pointer-events: auto;
}
.draggable-item .block-drag-grip { z-index: 45; }

.block-drag-grip {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.08);
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: grab;
    z-index: 5;
    user-select: none;
    -webkit-user-select: none;
}
.block-drag-grip:active { cursor: grabbing; }
.draggable-item.is-selected .block-drag-grip {
    background: rgba(59, 130, 246, 0.18);
    color: #1d4ed8;
}

.text-3d-card {
    display: flex;
    flex-direction: column;
    padding-top: 36px;
    padding-bottom: 1.1rem;
    padding-left: 1.35rem;
    padding-right: 1.35rem;
    color: #1e293b;
    line-height: 1.7;
    letter-spacing: 0.015em;
    background: linear-gradient(180deg, #ffffff 0%, #fafbfc 45%, #f4f6f8 100%);
    border: 1px solid #e2e8f0;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 1) inset,
        3px 3px 0 #bfdbfe,
        8px 10px 28px rgba(30, 58, 138, 0.08);
    cursor: default;
}
.text-3d-card-inner {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    outline: none;
    cursor: text;
    color: inherit;
    line-height: inherit;
    letter-spacing: inherit;
    -webkit-user-drag: none;
    user-select: text;
}
.canvas--preview .text-3d-card {
    padding-top: 1.35rem;
}

.table-3d-card {
    padding-top: 36px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 1) inset,
        3px 3px 0 rgba(34, 197, 94, 0.25),
        8px 10px 26px rgba(20, 83, 45, 0.07);
}
.canvas--preview .table-3d-card {
    padding-top: 1rem;
}
.block-drag-grip--table {
    width: 28px;
    height: 22px;
    font-size: 10px;
    opacity: 0.85;
}
.i-block .block-drag-grip { top: 10px; left: 10px; }
.a-block { padding-top: 36px; }
.a-block .audio-player-ui { margin-top: 0; }
.canvas--preview .a-block { padding-top: 1rem; }
.overlap-reservation { width: 100%; pointer-events: none; }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.9); z-index: 2000; display: none; align-items: center; justify-content: center; }
.modal-box { position: relative; background: #111; padding: 30px; border-radius: 12px; width: 80%; border: 1px solid #333; }
.modal-box textarea { width: 100%; height: 400px; background: #000; color: #3b82f6; font-family: monospace; padding: 20px; }
.modal-header { position: relative; margin-bottom: 12px; }
.modal-header h3 { margin: 0; }
.modal-footer {
    margin-top: 14px;
    display: flex;
    justify-content: flex-start;
}
.copy-btn {
    min-width: 132px;
    height: 40px;
    padding: 0 18px;
    border: 1px solid rgba(59, 130, 246, 0.55);
    border-radius: 10px;
    background: linear-gradient(135deg, #111827 0%, #0f172a 40%, #1d4ed8 100%);
    color: #e5edff;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow:
        0 0 0 1px rgba(30, 64, 175, 0.2) inset,
        0 8px 20px rgba(29, 78, 216, 0.25);
    transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.copy-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(96, 165, 250, 0.9);
    box-shadow:
        0 0 0 1px rgba(96, 165, 250, 0.28) inset,
        0 10px 24px rgba(59, 130, 246, 0.35);
}
.copy-btn:active {
    transform: translateY(0);
    box-shadow:
        0 0 0 1px rgba(30, 64, 175, 0.2) inset,
        0 6px 12px rgba(29, 78, 216, 0.2);
}
.modal-close-btn {
    position: absolute;
    top: 0;
    right: 0;
    width: 32px;
    height: 32px;
    border: 1px solid #444;
    border-radius: 6px;
    background: #0b0b0b;
    color: #ddd;
    cursor: pointer;
    line-height: 1;
    font-size: 20px;
}
.modal-close-btn:hover { background: #1a1a1a; color: #fff; }

.preview-overlay { position: fixed; inset: 0; background: #000; z-index: 3000; display: none; flex-direction: column; }
.preview-nav { height: 60px; background: #111; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid #222; }
.preview-body {
    flex: 1;
    overflow: auto;
    padding: 32px 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background: radial-gradient(ellipse 120% 80% at 50% 0%, #1e293b 0%, #0f172a 45%, #020617 100%);
}
#previewViewport {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 42%, #94a3b8 52%, #f1f5f9 100%);
    width: 1100px;
    min-height: calc(100vh - 120px);
    margin: auto;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
}
#previewContent {
    width: 100%;
    display: flex;
    justify-content: center;
}
.preview-scaler {
    transform-origin: top center;
    will-change: transform;
}
#previewContent .canvas--preview {
    box-shadow: none;
    border-radius: 0;
}
.view-tab { background: none; border: none; color: #888; cursor: pointer; padding: 10px; font-weight: bold; }
.view-tab.active { color: #3b82f6; }

/* Table properties modal */
.table-props-box {
    width: 100%;
    max-width: 420px;
    padding: 0;
    overflow: hidden;
    border: 1px solid #3f3f46;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.55);
}
.table-props-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px 14px;
    border-bottom: 1px solid #333;
    background: linear-gradient(180deg, #18181b 0%, #111 100%);
}
.table-props-header h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    color: #fafafa;
    letter-spacing: -0.02em;
}
.table-props-back {
    width: 40px;
    height: 40px;
    border: 1px solid #444;
    border-radius: 10px;
    background: #0c0c0c;
    color: #e4e4e7;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.table-props-back:hover {
    background: #1f1f23;
    border-color: #52525b;
    color: #fff;
}
.table-props-body {
    padding: 8px 20px 20px;
    max-height: min(70vh, 520px);
    overflow-y: auto;
}
.table-props-section {
    margin-top: 18px;
}
.table-props-section-title {
    margin: 0 0 12px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #71717a;
}
.table-props-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 520px) {
    .table-props-columns {
        grid-template-columns: 1fr;
    }
}
.tp-floating-field {
    position: relative;
    margin-bottom: 16px;
}
.tp-floating-field.tp-floating-grow {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
}
.tp-floating-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 16px;
}
.tp-floating-field input[type='text'],
.tp-floating-field select {
    width: 100%;
    padding: 16px 12px 10px;
    background: #0a0a0a;
    border: 1px solid #3f3f46;
    border-radius: 6px;
    color: #e4e4e7;
    font-size: 14px;
    font-family: 'Inter', system-ui, sans-serif;
}
.tp-floating-field select {
    cursor: pointer;
}
.tp-floating-field label {
    position: absolute;
    left: 10px;
    top: -8px;
    padding: 0 5px;
    font-size: 11px;
    font-weight: 600;
    color: #a1a1aa;
    background: #111;
    pointer-events: none;
}
.tp-floating-field:focus-within label {
    color: #60a5fa;
}
.tp-floating-field:focus-within input,
.tp-floating-field:focus-within select {
    border-color: #3b82f6;
    outline: none;
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.35);
}
.tp-color-swatch {
    width: 48px;
    height: 48px;
    padding: 2px;
    border: 1px solid #3f3f46;
    border-radius: 10px;
    background: #0a0a0a;
    cursor: pointer;
    flex-shrink: 0;
}
.table-props-footer {
    padding: 16px 20px 20px;
    border-top: 1px solid #333;
    background: #0f0f0f;
}
.table-props-apply {
    width: 100%;
    height: 44px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff;
    font-weight: 800;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.35);
}
.table-props-apply:hover {
    filter: brightness(1.08);
}
.table-props-apply:active {
    transform: translateY(1px);
}