/* ── Canvas ──────────────────────────────────────────────────── */
.dl-canvas {
    position: relative;
    box-sizing: border-box;
    background: #fafafa;
    border: 2px dashed #c0c0c0;
    border-radius: 6px;
    overflow: hidden;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ── Login notice ────────────────────────────────────────────── */
.dl-login-notice {
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 6px;
    padding: 14px 20px;
    font-size: 14px;
    margin: 20px 0;
}

/* ── Toolbar ─────────────────────────────────────────────────── */
.dl-toolbar {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.95);
    border: 1px solid #ddd;
    border-radius: 30px;
    padding: 6px 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.12);
    white-space: nowrap;
}

.dl-btn {
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 6px 13px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}
.dl-btn:hover       { background: #135e96; }
.dl-btn--success    { background: #1e8a44; }
.dl-btn--success:hover { background: #166534; }
.dl-btn--danger     { background: #c0392b; }
.dl-btn--danger:hover  { background: #96281b; }
.dl-btn:disabled    { background: #999; cursor: not-allowed; opacity: 0.7; }

.dl-project-badge {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    background: #f0f0f0;
    border-radius: 20px;
    padding: 4px 12px;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Stage ───────────────────────────────────────────────────── */
.dl-stage {
    position: absolute;
    inset: 0;
}

/* ── Lines ───────────────────────────────────────────────────── */
.dl-line {
    position: absolute;
    cursor: grab;
    z-index: 10;
    box-sizing: border-box;
}
.dl-line:active { cursor: grabbing; }

.dl-line--horizontal {
    left: 10%; top: 50%;
    width: 80%; height: 6px;
    background: #2271b1;
    border-radius: 3px;
}
.dl-line--vertical {
    top: 10%; left: 50%;
    width: 6px; height: 80%;
    background: #e74c3c;
    border-radius: 3px;
}

.dl-line .ui-resizable-handle {
    background: #fff;
    border: 2px solid #555;
    border-radius: 50%;
    width: 12px !important;
    height: 12px !important;
    z-index: 20;
}
.dl-line--horizontal .ui-resizable-e { right:-6px; top:50%; transform:translateY(-50%); cursor:ew-resize; }
.dl-line--horizontal .ui-resizable-w { left:-6px;  top:50%; transform:translateY(-50%); cursor:ew-resize; }
.dl-line--vertical   .ui-resizable-s { bottom:-6px; left:50%; transform:translateX(-50%); cursor:ns-resize; }
.dl-line--vertical   .ui-resizable-n { top:-6px;    left:50%; transform:translateX(-50%); cursor:ns-resize; }

.dl-line-delete {
    position: absolute;
    top: -10px; right: -10px;
    width: 18px; height: 18px;
    background: #c0392b; color: #fff;
    border: none; border-radius: 50%;
    font-size: 11px; line-height: 18px;
    text-align: center; cursor: pointer;
    display: none; z-index: 30; padding: 0;
}
.dl-line:hover .dl-line-delete,
.dl-line.dl-line--selected .dl-line-delete { display: block; }

.dl-line-controls {
    position: absolute;
    bottom: -34px; left: 50%;
    transform: translateX(-50%);
    display: none;
    gap: 6px; align-items: center;
    background: rgba(255,255,255,0.97);
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 4px 10px;
    z-index: 30;
    white-space: nowrap;
    font-size: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.dl-line.dl-line--selected .dl-line-controls { display: flex; }
.dl-line-controls label { margin: 0 2px; color: #333; }
.dl-line-controls input[type=color]  { width:24px; height:24px; border:none; padding:0; cursor:pointer; border-radius:50%; overflow:hidden; }
.dl-line-controls input[type=range]  { width:70px; cursor:pointer; }

/* ── Modal overlay ───────────────────────────────────────────── */
.dl-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dl-modal {
    background: #fff;
    border-radius: 10px;
    padding: 28px 30px 22px;
    width: 420px;
    max-width: 90%;
    max-height: 80%;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.22);
    overflow: hidden;
}

.dl-modal__title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
}

.dl-modal__label {
    margin: 0;
    font-size: 12px;
    color: #888;
    text-align: center;
}

.dl-modal__section { display: flex; gap: 8px; align-items: center; }
.dl-modal__row     { display: flex; gap: 8px; margin-top: 8px; }
.dl-modal__footer  { display: flex; justify-content: flex-end; margin-top: 4px; }

.dl-modal-btn {
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}
.dl-modal-btn:hover           { background: #135e96; }
.dl-modal-btn--primary        { background: #1e8a44; }
.dl-modal-btn--primary:hover  { background: #166534; }
.dl-modal-btn--danger         { background: #c0392b; }
.dl-modal-btn--danger:hover   { background: #96281b; }

.dl-input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
.dl-input:focus { border-color: #2271b1; }

/* ── Project list ────────────────────────────────────────────── */
.dl-project-list-wrap { overflow: hidden; display: flex; flex-direction: column; gap: 6px; }

.dl-project-list {
    overflow-y: auto;
    max-height: 220px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-right: 4px;
}

.dl-project-list__empty {
    margin: 0;
    color: #999;
    font-size: 13px;
    text-align: center;
    padding: 20px 0;
}

.dl-project-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    background: #fafafa;
    transition: background 0.15s;
}
.dl-project-item:hover { background: #f0f6ff; border-color: #2271b1; }
.dl-project-item--active { background: #e8f4fd; border-color: #2271b1; }

.dl-project-item__info { flex: 1; min-width: 0; }
.dl-project-item__name {
    font-weight: 600;
    font-size: 14px;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dl-project-item__meta {
    font-size: 11px;
    color: #888;
    margin-top: 2px;
}

.dl-project-item__load {
    background: #2271b1; color: #fff;
    border: none; border-radius: 6px;
    padding: 5px 12px; font-size: 12px;
    cursor: pointer; white-space: nowrap;
    transition: background 0.2s;
    flex-shrink: 0;
}
.dl-project-item__load:hover { background: #135e96; }

.dl-project-item__delete {
    background: transparent; color: #c0392b;
    border: 1px solid #c0392b; border-radius: 6px;
    padding: 5px 8px; font-size: 12px;
    cursor: pointer; white-space: nowrap;
    transition: all 0.2s;
    flex-shrink: 0;
}
.dl-project-item__delete:hover { background: #c0392b; color: #fff; }

/* ── Toast notice ────────────────────────────────────────────── */
.dl-notice {
    position: absolute;
    bottom: 14px; left: 50%;
    transform: translateX(-50%);
    background: rgba(30,138,68,0.93);
    color: #fff;
    padding: 7px 18px;
    border-radius: 20px;
    font-size: 13px;
    z-index: 300;
    pointer-events: none;
    transition: opacity 0.5s ease;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.dl-notice--error { background: rgba(192,57,43,0.93); }
.dl-notice--hide  { opacity: 0; }
