/* style.css */
:root{
    --bg:#0b0f17;
    --panel:#0f1626;
    --card:#111b2f;
    --text:#e8edf7;
    --muted:#9aa7c1;
    --line:rgba(255,255,255,.08);
    --shadow: 0 14px 50px rgba(0,0,0,.55);
    --r:16px;
    --r2:22px;
    --accent:#5ac8fa;
    --accent2:#34c759;
    --danger:#ff3b30;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }

body{
    margin:0;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Apple Color Emoji","Segoe UI Emoji";
    background:
            radial-gradient(1200px 700px at 30% 10%, rgba(90,200,250,.15), transparent 60%),
            radial-gradient(900px 600px at 80% 30%, rgba(52,199,89,.12), transparent 60%),
            var(--bg);
    color:var(--text);
}

/* Topbar */
.topbar{
    position:sticky;
    top:0;
    z-index:10;
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:14px 18px;
    border-bottom:1px solid var(--line);
    background: rgba(11,15,23,.72);
    backdrop-filter: blur(10px);
}

.brand{
    display:flex;
    gap:12px;
    align-items:center;
}
.logoDot{
    width:14px;
    height:14px;
    border-radius:999px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    box-shadow: 0 0 0 6px rgba(90,200,250,.08);
}
.brandName{
    font-weight:800;
    letter-spacing:.3px;
    line-height:1.1;
}
.brandSub{
    font-size:12px;
    color:var(--muted);
    margin-top:2px;
}

.status{
    display:flex;
    gap:10px;
    align-items:center;
    flex-wrap:wrap;
}
.pill{
    display:flex;
    gap:8px;
    align-items:center;
    padding:8px 10px;
    border:1px solid var(--line);
    border-radius:999px;
    background: rgba(255,255,255,.03);
}
.pillLabel{
    font-size:12px;
    color:var(--muted);
}
.pillValue{
    font-size:13px;
    font-weight:650;
}

/* Layout */
.layout{
    display:grid;
    grid-template-columns: 320px 1fr;
    gap:16px;
    padding:16px;
    height: calc(100vh - 64px);
    min-height: 0;
}

.panel{
    background: rgba(15,22,38,.6);
    border:1px solid var(--line);
    border-radius: var(--r2);
    padding:14px;
    overflow:auto;
    box-shadow: var(--shadow);
    min-height: 0;
}

.canvasWrap{
    position:relative;
    background: rgba(15,22,38,.35);
    border:1px solid var(--line);
    border-radius: var(--r2);
    overflow:hidden;
    box-shadow: var(--shadow);
    min-height: 0;
}

.canvasFrame{
    position:absolute;
    inset:10px;
    border-radius: 18px;
    border:1px solid rgba(255,255,255,.10);
    background: rgba(255,255,255,.02);
    overflow:hidden;
}

#c{
    position:absolute;
    left:0;
    top:0;
    image-rendering: pixelated;
    transform-origin: 0 0;
    /* црн + курсор */
    cursor: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24'>\
<line x1='12' y1='2' x2='12' y2='22' stroke='black' stroke-width='2'/>\
<line x1='2' y1='12' x2='22' y2='12' stroke='black' stroke-width='2'/>\
</svg>") 12 12, crosshair;
}

.cornerHelp{
    position:absolute;
    bottom:12px;
    right:12px;
    font-size:12px;
    color:rgba(232,237,247,.8);
    padding:8px 10px;
    border-radius:999px;
    background: rgba(0,0,0,.35);
    border:1px solid rgba(255,255,255,.10);
    pointer-events:none;
}

h2{
    margin:10px 0 10px;
    font-size:15px;
    letter-spacing:.2px;
}
.hint{
    margin:0 0 12px;
    color: var(--muted);
    line-height:1.35;
}
.hint.small{
    font-size:12px;
    margin-top:10px;
}

.card{
    margin-top:12px;
    padding:12px;
    border-radius: var(--r);
    border:1px solid var(--line);
    background: rgba(17,27,47,.55);
}
.cardHead{
    display:flex;
    align-items:center;
    justify-content:space-between;
}
.badge{
    font-size:11px;
    padding:4px 8px;
    border-radius:999px;
    background: rgba(52,199,89,.14);
    border:1px solid rgba(52,199,89,.22);
    color: rgba(232,237,247,.92);
}

.controls{
    display:flex;
    gap:10px;
    flex-wrap:wrap;
}

/* Buttons */
.btn{
    appearance:none;
    border:none;
    border-radius: 12px;
    padding:10px 12px;
    background: rgba(255,255,255,.06);
    color: var(--text);
    border:1px solid rgba(255,255,255,.10);
    cursor:pointer;
    font-weight:650;
    transition: transform .06s ease, background .2s ease, border-color .2s ease, opacity .2s ease;
}
.btn:hover{ background: rgba(255,255,255,.09); }
.btn:active{ transform: translateY(1px); }
.btn.primary{
    background: linear-gradient(135deg, rgba(90,200,250,.95), rgba(52,199,89,.95));
    color:#071019;
    border: 1px solid rgba(255,255,255,.18);
}
.btn:disabled{
    opacity:.55;
    cursor:not-allowed;
}

.iconBtn{
    width:36px;
    height:36px;
    border-radius: 12px;
    border:1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.06);
    color: var(--text);
    cursor:pointer;
}

/* Palette */
.palette{
    display:grid;
    grid-template-columns: repeat(8, 1fr);
    gap:8px;
    margin-bottom: 8px;
}
.swatch{
    width:100%;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    border: 2px solid rgba(255,255,255,.10);
    cursor:pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,.22);
}
.swatch.active{
    border: 3px solid white;
    outline: 2px solid black;
    transform: scale(1.08);
}

/* Toast */
.overlay{
    position:absolute;
    top:16px;
    left:50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,.55);
    border:1px solid rgba(255,255,255,.14);
    color: var(--text);
    padding:10px 12px;
    border-radius: 999px;
    opacity:0;
    pointer-events:none;
    transition: opacity .18s ease, transform .18s ease;
    backdrop-filter: blur(10px);
}
.overlay.show{
    opacity:1;
    transform: translateX(-50%) translateY(2px);
}

/* Mini auth meta */
.mini{
    margin-top:10px;
    padding-top:10px;
    border-top:1px dashed rgba(255,255,255,.10);
}
.authMeta{
    font-size:12px;
    color: var(--muted);
}

/* Modal */
.modal{
    position:fixed;
    inset:0;
    display:none;
    align-items:center;
    justify-content:center;
    z-index:50;
}
.modal.show{ display:flex; }
.modalBackdrop{
    position:absolute;
    inset:0;
    background: rgba(0,0,0,.55);
}
.modalCard{
    position:relative;
    width:min(520px, 92vw);
    border-radius: 22px;
    border:1px solid rgba(255,255,255,.12);
    background: rgba(15,22,38,.92);
    box-shadow: var(--shadow);
    padding:14px;
    backdrop-filter: blur(12px);
}
.modalTop{
    display:flex;
    justify-content:space-between;
    align-items:flex-start;
    gap:12px;
    padding:6px 4px 10px;
}
.modalTitle{ font-weight:850; font-size:16px; }
.modalSub{ color: var(--muted); font-size:12px; margin-top:4px; }

.tabs{
    display:flex;
    gap:8px;
    padding:8px 4px 10px;
}
.tab{
    flex:1;
    padding:10px 12px;
    border-radius: 14px;
    border:1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.05);
    color: var(--text);
    cursor:pointer;
    font-weight:750;
}
.tab.active{
    background: rgba(90,200,250,.12);
    border-color: rgba(90,200,250,.22);
}

.form{
    padding: 4px;
    display:flex;
    flex-direction:column;
    gap:10px;
}
.field{
    display:flex;
    flex-direction:column;
    gap:6px;
}
.field span{
    font-size:12px;
    color: var(--muted);
}
.field input{
    padding:12px 12px;
    border-radius: 14px;
    border:1px solid rgba(255,255,255,.12);
    background: rgba(0,0,0,.25);
    color: var(--text);
    outline:none;
}
.field input:focus{
    border-color: rgba(90,200,250,.55);
    box-shadow: 0 0 0 4px rgba(90,200,250,.12);
}

.row{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
}

.errorBox{
    border-radius: 14px;
    padding:10px 12px;
    border:1px solid rgba(255,59,48,.25);
    background: rgba(255,59,48,.10);
    color: rgba(255,220,220,.95);
    font-size:12px;
    line-height:1.35;
}

.modalActions{
    display:flex;
    gap:10px;
    justify-content:flex-end;
    padding-top:6px;
}

.fineprint{
    color: var(--muted);
    font-size:11px;
    line-height:1.35;
    padding: 8px 2px 2px;
}

/* Responsive */
@media (max-width: 940px){
    .layout{
        grid-template-columns: 1fr;
        height:auto;
    }
    .canvasWrap{
        min-height: 420px;
    }
}
