@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Mono:wght@400;500&display=swap');

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

:root {
    --bg: #0d0d0d;
    --surface: #161616;
    --surface1: #161616;
    --surface2: #1f1f1f;
    --border: #2a2a2a;
    --accent: #e8ff47;
    --accent2: #ff6b35;
    --text: #f0f0f0;
    --muted: #666;
    --radius: 8px;
}

body {
    font-family: 'Syne', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* HEADER */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 28px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.logo span { color: var(--accent); }

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.badge {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 4px 10px;
    border-radius: 20px;
}

.btn {
    font-family: 'Syne', sans-serif;
    font-weight: 600;
    font-size: 13px;
    padding: 9px 20px;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 7px;
}

.btn-primary {
    background: var(--accent);
    color: #000;
}

.btn-primary:hover { background: #d4eb00; transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-ghost:hover { border-color: #444; background: var(--surface2); }

/* UPLOAD ZONE */
#upload-zone {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 24px;
}

.upload-card {
    width: 100%;
    max-width: 520px;
    background: var(--surface);
    border: 2px dashed var(--border);
    border-radius: 16px;
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.upload-card:hover, .upload-card.dragover {
    border-color: var(--accent);
    background: #161f00;
}

.upload-icon {
    width: 64px;
    height: 64px;
    background: var(--surface2);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 28px;
    transition: transform 0.2s;
}

.upload-card:hover .upload-icon { transform: scale(1.1); }

.upload-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.upload-sub {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.upload-sub strong {
    color: var(--accent);
    font-weight: 600;
}

#file-input { display: none; }

/* EDITOR */
#editor-zone {
    display: none;
    flex: 1;
    flex-direction: column;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 10px;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-name {
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    color: var(--accent);
    background: #1a2100;
    border: 1px solid #3a4d00;
    padding: 4px 12px;
    border-radius: 20px;
}

.hint-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.hint {
    font-size: 11px;
    color: var(--muted);
    background: var(--surface2);
    border: 1px solid var(--border);
    padding: 3px 10px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.hint-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.hint-dot.text { background: #6ee7b7; }
.hint-dot.img { background: #fbbf24; }
.hint-dot.link { background: #60a5fa; }

/* PREVIEW FRAME */
.preview-container {
    flex: 1;
    background: #0a0a0a;
    overflow: auto;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

#preview-frame-wrapper {
    width: 100%;
    overflow: hidden;
    position: relative;
    min-height: 400px;
}

#preview-frame {
    width: 100%;
    border: none;
    display: block;
    min-height: 400px;
}

/* IMAGE OVERLAY MODAL */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
}

.modal-overlay.open { display: flex; }

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 28px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.5);
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-title {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 6px;
}

.modal-sub {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 20px;
}

.input-group {
    display: flex;
    gap: 8px;
}

.url-input {
    flex: 1;
    font-family: 'DM Mono', monospace;
    font-size: 13px;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 14px;
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.15s;
}

.url-input:focus { border-color: var(--accent); }
.url-input::placeholder { color: var(--muted); }

.modal-preview {
    margin-top: 16px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.modal-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.modal-preview-placeholder {
    color: var(--muted);
    font-size: 12px;
}

.modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 20px;
    justify-content: flex-end;
}

/* SETTINGS MODAL */
.settings-modal {
    width: 620px;
    max-width: 94vw;
    max-height: 80vh;
    overflow-y: auto;
}

.settings-section { margin-bottom: 20px; }

.settings-label {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    font-weight: 500;
    color: var(--muted);
    margin-bottom: 6px;
    letter-spacing: 0.4px;
}

.code-wrap {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    height: 180px;
    background: #282c34;
    transition: border-color 0.15s;
}

.code-wrap:focus-within { border-color: var(--accent); }

.code-wrap pre,
.code-wrap textarea {
    position: absolute;
    inset: 0;
    margin: 0;
    padding: 12px 14px;
    font-family: 'DM Mono', monospace;
    font-size: 12.5px;
    line-height: 1.65;
    tab-size: 2;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow: auto;
}

.code-wrap pre {
    pointer-events: none;
    background: transparent !important;
}

.code-wrap pre code {
    background: transparent !important;
    padding: 0 !important;
    font-size: inherit !important;
    font-family: inherit !important;
    line-height: inherit !important;
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
}

.code-wrap textarea {
    z-index: 1;
    background: transparent;
    color: transparent;
    caret-color: #e8ff47;
    border: none;
    resize: none;
    outline: none;
    spellcheck: false;
}

.code-wrap textarea::selection { background: rgba(232,255,71,0.2); }

/* NOTIFICATION TOAST */
#toast {
    position: fixed;
    bottom: 28px;
    right: 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 8px;
    transform: translateY(80px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#toast.show {
    transform: translateY(0);
    opacity: 1;
}

#toast.success { border-left: 3px solid var(--accent); }
#toast.info { border-left: 3px solid #60a5fa; }

.btn-icon {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    padding: 6px 10px;
    font-size: 14px;
    line-height: 1;
}

.btn-icon:hover:not(:disabled) { border-color: #444; background: var(--surface2); }
.btn-icon:disabled { opacity: 0.3; cursor: not-allowed; }

/* LAYER PANEL */
#layer-panel {
    position: fixed;
    top: 120px;
    right: 20px;
    width: 230px;
    min-width: 280px;
    max-width: 520px;
    max-height: 80vh;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    z-index: 500;
    display: none;
    flex-direction: column;
    overflow: hidden;
    user-select: none;
}

#layer-panel.visible { display: flex; }

#layer-resize-handle {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    cursor: ew-resize;
    z-index: 10;
    border-radius: 12px 0 0 12px;
    transition: background 0.15s;
}

#layer-resize-handle:hover { background: rgba(232,255,71,0.25); }

#layer-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 14px;
    background: var(--surface2);
    border-bottom: 1px solid var(--border);
    cursor: move;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--muted);
    flex-shrink: 0;
}

#layer-panel-header span { color: var(--text); }

#layer-panel-close {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 15px;
    padding: 0;
    line-height: 1;
}

#layer-panel-close:hover { color: var(--text); }

#layer-list {
    padding: 8px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.layer-section-wrap { border-radius: 6px; overflow: hidden; }
.layer-section-wrap + .layer-section-wrap { margin-top: 3px; }

.layer-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 10px;
    cursor: grab;
    border: 1px solid transparent;
    border-radius: 6px;
    transition: background 0.12s, border-color 0.12s;
    font-size: 12px;
    color: var(--text);
    background: var(--surface2);
}

.layer-item:hover { border-color: var(--border); }
.layer-item.layer-active { background: #1c2600 !important; border-color: var(--accent) !important; }
.layer-item.layer-dragging { opacity: 0.35; }

.layer-drop-placeholder {
    height: 35px;
    background: rgba(232,255,71,0.1);
    border: 2px dashed var(--accent);
    border-radius: 6px;
    margin: 2px 4px;
    flex-shrink: 0;
}

.layer-toggle {
    font-size: 9px;
    color: var(--muted);
    cursor: pointer;
    flex-shrink: 0;
    width: 12px;
    text-align: center;
    transition: transform 0.15s;
    line-height: 1;
    padding: 2px;
}

.layer-toggle.open { color: var(--accent); }

.layer-grip {
    color: var(--muted);
    font-size: 13px;
    flex-shrink: 0;
    cursor: grab;
}

.layer-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.layer-idx {
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    color: var(--muted);
    flex-shrink: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 5px;
}

/* CHILDREN TREE */
.layer-children {
    background: #0f0f0f;
    border-top: 1px solid var(--border);
}

.layer-child-row {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    font-size: 11px;
    border-left: 2px solid transparent;
    transition: background 0.1s;
    cursor: grab;
}

.layer-child-row:hover { background: var(--surface2); border-left-color: var(--border); }
.layer-child-row.layer-row-active { background: #1c2600 !important; border-left-color: var(--accent) !important; }
.layer-child-row.child-dragging { opacity: 0.35; cursor: grabbing; }

.layer-child-grip {
    font-size: 11px;
    color: #333;
    flex-shrink: 0;
    cursor: grab;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.1s;
}

.layer-child-row:hover .layer-child-grip { opacity: 1; }

.layer-child-arrow {
    font-size: 8px;
    color: var(--muted);
    cursor: pointer;
    flex-shrink: 0;
    width: 10px;
    text-align: center;
    line-height: 1;
}

.layer-child-arrow.has-children { color: #555; }
.layer-child-arrow.has-children:hover { color: var(--text); }

.layer-child-tag {
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    color: #7dd3a8;
    flex-shrink: 0;
    background: rgba(110,231,183,0.07);
    padding: 1px 5px;
    border-radius: 3px;
}

.layer-child-tag.tag-img { color: #fbbf24; background: rgba(251,191,36,0.07); }
.layer-child-tag.tag-a   { color: #60a5fa; background: rgba(96,165,250,0.07); }
.layer-child-tag.tag-h   { color: #c084fc; background: rgba(192,132,252,0.07); }
.layer-child-tag.tag-btn { color: #fb923c; background: rgba(251,146,60,0.07); }

.layer-child-text {
    flex: 1;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
}

.layer-class-name {
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70px;
    flex-shrink: 0;
}

.layer-empty {
    padding: 16px 10px;
    text-align: center;
    color: var(--muted);
    font-size: 12px;
}

.layer-dup-btn {
    flex-shrink: 0;
    background: none;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1;
    padding: 2px 5px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.1s, color 0.1s, border-color 0.1s;
}

.layer-item:hover .layer-dup-btn,
.layer-child-row:hover .layer-dup-btn { opacity: 1; }

.layer-dup-btn:hover { color: var(--accent); border-color: var(--accent); }

.layer-del-btn {
    flex-shrink: 0;
    background: none;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1;
    padding: 2px 5px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.1s, color 0.1s, border-color 0.1s;
}

.layer-item:hover .layer-del-btn,
.layer-child-row:hover .layer-del-btn { opacity: 1; }

.layer-del-btn:hover { color: #f87171; border-color: #f87171; }

.layer-edit-btn {
    flex-shrink: 0;
    background: none;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--muted);
    font-size: 10px;
    font-family: 'DM Mono', monospace;
    line-height: 1;
    padding: 2px 5px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.1s, color 0.1s, border-color 0.1s;
}

.layer-item:hover .layer-edit-btn,
.layer-child-row:hover .layer-edit-btn { opacity: 1; }

.layer-edit-btn:hover { color: #60a5fa; border-color: #60a5fa; }

#html-edit-wrap { height: clamp(200px, 55vh, 600px); }

/* LAYER CONTEXT MENU */
#layer-ctx-menu {
    position: fixed;
    z-index: 9999;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.55);
    padding: 4px;
    display: none;
    flex-direction: column;
    min-width: 155px;
    user-select: none;
}
#layer-ctx-menu.visible { display: flex; }
.ctx-item {
    background: none;
    border: none;
    color: var(--text);
    font: inherit;
    font-size: 13px;
    text-align: left;
    padding: 6px 12px;
    border-radius: 5px;
    cursor: pointer;
    white-space: nowrap;
}
.ctx-item:hover { background: var(--surface2); }
.ctx-item:disabled { color: var(--muted); cursor: default; }
.ctx-item:disabled:hover { background: none; }
.ctx-del:hover { color: #f87171; }
.ctx-sep { height: 1px; background: var(--border); margin: 3px 4px; }

/* ── STYLE SETTINGS PANEL ─────────────────────────────────────── */
#style-panel {
    position: fixed; top: 70px; right: 270px;
    width: 260px; max-height: calc(100vh - 90px);
    background: var(--surface1); border: 1px solid var(--border);
    border-radius: 10px; box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    display: none; flex-direction: column; z-index: 600; overflow: hidden;
}
#style-panel.visible { display: flex; }
#style-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 9px 12px; background: var(--surface2);
    border-bottom: 1px solid var(--border);
    cursor: move; font-size: 12px; font-weight: 700;
    color: var(--fg); user-select: none; flex-shrink: 0;
}
#style-panel-close { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 0; line-height: 1; }
#style-panel-close:hover { color: var(--fg); }
#style-panel-body { overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 12px; }
.sp-section { display: flex; flex-direction: column; gap: 7px; }
.sp-section-title {
    font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--muted);
    padding-bottom: 4px; border-bottom: 1px solid var(--border);
}
/* Unit selector row */
.sp-unit-row { display: flex; align-items: center; gap: 3px; }
.sp-unit-row-label { font-size: 9px; color: var(--muted); margin-right: 2px; }
.sp-unit-btn {
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 3px; color: var(--muted); cursor: pointer;
    font-size: 9px; padding: 2px 6px; transition: all 0.1s; line-height: 1.4;
}
.sp-unit-btn.sp-unit-active { background: var(--accent); color: #000; border-color: var(--accent); }
.sp-unit-btn:not(.sp-unit-active):hover { color: var(--fg); border-color: var(--accent); }
/* Box model */
.sp-box-model {
    display: grid; grid-template-columns: 1fr 48px 1fr;
    grid-template-rows: auto auto auto;
    gap: 4px; align-items: center; justify-items: center;
}
.sp-bm-top    { grid-column: 2; grid-row: 1; }
.sp-bm-left   { grid-column: 1; grid-row: 2; }
.sp-bm-center {
    grid-column: 2; grid-row: 2; width: 48px;
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 4px; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    font-size: 10px; color: var(--muted); font-weight: 700;
    gap: 3px; padding: 4px 0;
}
.sp-link-btn {
    background: none; border: 1px solid var(--border);
    border-radius: 3px; color: var(--muted); cursor: pointer;
    font-size: 9px; line-height: 1; padding: 2px 4px;
    transition: all 0.1s;
}
.sp-link-btn.sp-link-active { color: var(--accent); border-color: var(--accent); }
.sp-link-btn:not(.sp-link-active):hover { color: var(--text); border-color: #555; }
.sp-bm-right  { grid-column: 3; grid-row: 2; }
.sp-bm-bot    { grid-column: 2; grid-row: 3; }
/* Numeric input with up/down arrows */
.sp-num-wrap { position: relative; display: inline-flex; align-items: stretch; }
.sp-bm-inp {
    width: 44px; background: var(--surface2);
    border: 1px solid var(--border); border-radius: 4px;
    color: var(--fg); font-size: 11px;
    padding: 3px 14px 3px 5px; text-align: left; outline: none;
}
.sp-bm-inp:focus { border-color: var(--accent); }
.sp-bm-inp::placeholder { color: var(--muted); }
.sp-num-arrows {
    position: absolute; right: 1px; top: 1px; bottom: 1px;
    width: 13px; display: flex; flex-direction: column;
}
.sp-num-up, .sp-num-dn {
    flex: 1; background: none; border: none; padding: 0;
    color: var(--muted); cursor: pointer; font-size: 5px;
    display: flex; align-items: center; justify-content: center;
    border-left: 1px solid var(--border); line-height: 1;
}
.sp-num-up { border-bottom: 1px solid var(--border); border-radius: 0 3px 0 0; }
.sp-num-dn { border-radius: 0 0 3px 0; }
.sp-num-up:hover, .sp-num-dn:hover { background: rgba(255,255,255,0.1); color: var(--fg); }
/* Field rows */
.sp-field { display: flex; align-items: center; gap: 6px; }
.sp-field label { width: 88px; flex-shrink: 0; color: var(--muted); font-size: 11px; }
.sp-field input, .sp-field select {
    flex: 1; min-width: 0; background: var(--surface2);
    border: 1px solid var(--border); border-radius: 4px;
    color: var(--fg); font-size: 11px; padding: 3px 6px; outline: none;
}
.sp-field input:focus, .sp-field select:focus { border-color: var(--accent); }
.sp-field input::placeholder { color: var(--muted); }
.sp-field select { cursor: pointer; }
/* Background color row */
.sp-color-row { display: flex; gap: 5px; flex: 1; min-width: 0; align-items: center; }
.sp-color-picker {
    width: 28px; height: 24px; padding: 2px; flex-shrink: 0;
    border: 1px solid var(--border); border-radius: 4px;
    background: var(--surface2); cursor: pointer;
}
/* Alignment buttons */
.sp-align-btns { display: flex; gap: 4px; }
.sp-align-btn {
    flex: 1; background: var(--surface2); border: 1px solid var(--border);
    border-radius: 5px; color: var(--muted); cursor: pointer;
    font-size: 14px; padding: 5px 4px; transition: all 0.12s; line-height: 1;
}
.sp-align-btn:hover { border-color: var(--accent); color: var(--fg); }
.sp-align-btn.sp-active { background: var(--accent); color: #000; border-color: var(--accent); }
/* Style button in layer rows */
.layer-style-btn {
    flex-shrink: 0; background: none; border: 1px solid transparent;
    border-radius: 4px; color: var(--muted); font-size: 12px; line-height: 1;
    padding: 2px 5px; cursor: pointer; opacity: 0;
    transition: opacity 0.1s, color 0.1s, border-color 0.1s;
}
.layer-item:hover .layer-style-btn,
.layer-child-row:hover .layer-style-btn { opacity: 1; }
.layer-style-btn:hover { color: var(--accent); border-color: var(--accent); }


/* ── DOWNLOAD PROMO MODAL ──────────────────────────────────────── */
.download-modal {
    max-width: 560px;
    width: 94vw;
    position: relative;
    padding: 32px;
}

.dl-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    padding: 5px;
    border-radius: 5px;
    transition: color 0.15s, background 0.15s;
}
.dl-close:hover { color: var(--text); background: var(--surface2); }

.dl-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 12px;
    font-family: 'Syne', sans-serif;
    font-weight: 600;
    padding: 0;
    margin-bottom: 16px;
    transition: color 0.15s;
}
.dl-back:hover { color: var(--text); }

.dl-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    background: rgba(232,255,71,0.1);
    border: 1px solid rgba(232,255,71,0.25);
    border-radius: 20px;
    padding: 4px 12px;
    margin-bottom: 14px;
    letter-spacing: 0.3px;
}

.dl-headline {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 8px;
    line-height: 1.3;
}

.dl-sub {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 22px;
    line-height: 1.65;
}

.dl-platforms {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.dl-platform {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    transition: border-color 0.15s;
}
.dl-platform:hover { border-color: #3a3a3a; }

.dl-platform-icon { font-size: 20px; margin-bottom: 7px; }

.dl-platform-name {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 10px;
}

.dl-features {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.dl-features li {
    font-size: 12px;
    color: var(--muted);
    display: flex;
    align-items: flex-start;
    gap: 6px;
    line-height: 1.4;
}
.dl-features li::before {
    content: '✓';
    color: var(--accent);
    font-size: 11px;
    flex-shrink: 0;
    margin-top: 1px;
}

.dl-countdown-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}
.dl-countdown-label { font-size: 13px; color: var(--muted); }
.dl-countdown-num {
    font-family: 'DM Mono', monospace;
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
    min-width: 26px;
    text-align: center;
}

.dl-progress {
    height: 3px;
    background: var(--surface2);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 22px;
}
.dl-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    width: 100%;
    transition: width 1s linear;
}

.dl-actions {
    display: flex;
    gap: 10px;
}
.dl-actions .btn { flex: 1; justify-content: center; }

/* Contact form */
.dl-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.dl-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}
.dl-form-group label {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.dl-form-group input,
.dl-form-group select,
.dl-form-group textarea {
    font-family: 'Syne', sans-serif;
    font-size: 13px;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 14px;
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.15s;
    width: 100%;
}
.dl-form-group input:focus,
.dl-form-group select:focus,
.dl-form-group textarea:focus { border-color: var(--accent); }
.dl-form-group input::placeholder,
.dl-form-group textarea::placeholder { color: var(--muted); }
.dl-form-group textarea { resize: vertical; min-height: 100px; }
.dl-form-group select { cursor: pointer; }

.dl-form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 4px;
}

/* Success state */
.dl-success {
    text-align: center;
    padding: 40px 20px;
}
.dl-success-icon {
    width: 58px;
    height: 58px;
    background: rgba(232,255,71,0.12);
    border: 2px solid var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--accent);
    margin: 0 auto 18px;
}
.dl-success h3 { font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.dl-success p { font-size: 14px; color: var(--muted); margin-bottom: 24px; line-height: 1.6; }

pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{color:#abb2bf;background:#282c34}.hljs-comment,.hljs-quote{color:#5c6370;font-style:italic}.hljs-doctag,.hljs-formula,.hljs-keyword{color:#c678dd}.hljs-deletion,.hljs-name,.hljs-section,.hljs-selector-tag,.hljs-subst{color:#e06c75}.hljs-literal{color:#56b6c2}.hljs-addition,.hljs-attribute,.hljs-meta .hljs-string,.hljs-regexp,.hljs-string{color:#98c379}.hljs-attr,.hljs-number,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-pseudo,.hljs-template-variable,.hljs-type,.hljs-variable{color:#d19a66}.hljs-bullet,.hljs-link,.hljs-meta,.hljs-selector-id,.hljs-symbol,.hljs-title{color:#61aeee}.hljs-built_in,.hljs-class .hljs-title,.hljs-title.class_{color:#e6c07b}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700}.hljs-link{text-decoration:underline}