[hidden] { display: none !important; }

/* ——— Layout ————————————————————————————————————————————————————————————— */

.ps-wrap {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ——— Controls ———————————————————————————————————————————————————————————— */

.ps-controls {
    display: flex;
    align-items: center;
    padding: 0 clamp(1.5rem, 5vw, 3rem);
    height: 56px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    gap: 1.5rem;
}

.ps-controls__left  { flex-shrink: 0; }
.ps-controls__center {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex: 1;
    justify-content: center;
}
.ps-controls__right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.ps-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.4rem;
    letter-spacing: 0.05em;
    color: var(--text);
}

/* Mode toggle */
.ps-mode {
    display: flex;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 7px;
    overflow: hidden;
    flex-shrink: 0;
}

.ps-mode-btn {
    height: 28px;
    padding: 0 0.9rem;
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 0.76rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.ps-mode-btn.is-active {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}

/* Options */
.ps-opt {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: var(--muted);
    white-space: nowrap;
    cursor: default;
}

.ps-color-input {
    width: 28px;
    height: 28px;
    padding: 2px;
    border-radius: 5px;
    border: 1px solid var(--border);
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
}

.ps-range {
    width: 80px;
    accent-color: var(--accent);
    cursor: pointer;
}

.ps-range-val {
    font-size: 0.72rem;
    color: var(--text);
    min-width: 3ch;
    text-align: right;
}

.ps-select {
    height: 28px;
    padding: 0 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 0.78rem;
    font-family: inherit;
    cursor: pointer;
}

.ps-btn {
    height: 34px;
    padding: 0 1.1rem;
    border-radius: 7px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    font-family: inherit;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    white-space: nowrap;
}

.ps-btn--ghost {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}
.ps-btn--ghost:hover { border-color: var(--accent); color: var(--accent); }
.ps-btn:disabled { opacity: 0.35; pointer-events: none; }

/* ——— Stats ——————————————————————————————————————————————————————————————— */

.ps-stats {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.55rem clamp(1.5rem, 5vw, 3rem);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    font-size: 0.8rem;
}

.ps-stats__item { color: var(--muted); }
.ps-stats__item strong { color: var(--text); }
.ps-stats__sep { color: var(--muted); opacity: 0.3; }

/* ——— Main split ————————————————————————————————————————————————————————— */

.ps-main {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.ps-divider {
    width: 1px;
    background: var(--border);
    flex-shrink: 0;
}

.ps-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.ps-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    height: 40px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.ps-panel__label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
}

.ps-panel__tabs { display: flex; gap: 0.1rem; }

.ps-tab {
    height: 26px;
    padding: 0 0.75rem;
    border-radius: 5px;
    font-size: 0.72rem;
    font-family: inherit;
    border: none;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.ps-tab:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.ps-tab.is-active { background: rgba(59, 130, 246, 0.1); color: var(--accent); font-weight: 600; }

.ps-panel__body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* ——— Drop zone ——————————————————————————————————————————————————————————— */

.ps-dropzone {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    cursor: pointer;
    padding: 2rem;
    transition: background 0.15s;
    border: 2px dashed transparent;
    margin: 1rem;
    border-radius: 10px;
}

.ps-dropzone:hover,
.ps-dropzone.is-drag-over {
    background: rgba(59, 130, 246, 0.05);
    border-color: rgba(59, 130, 246, 0.25);
}

.ps-dropzone__text {
    text-align: center;
    font-size: 0.85rem;
    color: var(--muted);
    line-height: 1.8;
    margin: 0;
}

.ps-dropzone__text span {
    font-size: 0.75rem;
    opacity: 0.55;
    text-decoration: underline;
    text-decoration-style: dotted;
    cursor: pointer;
}

/* ——— Image preview ——————————————————————————————————————————————————————— */

.ps-img-wrap {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    overflow: auto;
    background: repeating-conic-gradient(
        rgba(255, 255, 255, 0.03) 0% 25%,
        transparent 0% 50%
    ) 0 0 / 24px 24px;
}

.ps-img-wrap img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

/* ——— SVG preview ————————————————————————————————————————————————————————— */

.ps-preview {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    overflow: auto;
    background: repeating-conic-gradient(
        rgba(255, 255, 255, 0.03) 0% 25%,
        transparent 0% 50%
    ) 0 0 / 24px 24px;
}

.ps-preview svg {
    max-width: 100%;
    max-height: 100%;
    display: block;
}

/* ——— Code area ——————————————————————————————————————————————————————————— */

.ps-code {
    flex: 1;
    width: 100%;
    min-height: 0;
    resize: none;
    border: none;
    outline: none;
    background: rgba(255, 255, 255, 0.02);
    color: var(--text);
    font-family: 'Courier New', 'Cascadia Code', 'Monaco', monospace;
    font-size: 0.73rem;
    line-height: 1.65;
    padding: 1rem 1.25rem;
}

/* ——— Empty state ————————————————————————————————————————————————————————— */

.ps-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    text-align: center;
    color: var(--muted);
    opacity: 0.35;
    pointer-events: none;
}

.ps-empty p {
    font-size: 0.82rem;
    line-height: 1.75;
    margin: 0;
}

/* ——— Loading ————————————————————————————————————————————————————————————— */

.ps-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(4px);
    font-size: 0.82rem;
    color: #4ade80;
    z-index: 10;
    pointer-events: none;
    animation: ps-fade-out 2.5s ease forwards;
}

@keyframes ps-fade-out {
    0%   { opacity: 0; }
    10%  { opacity: 1; }
    70%  { opacity: 1; }
    100% { opacity: 0; }
}

.ps-checkmark {
    width: 50px;
    height: 50px;
    display: block;
}

.ps-check-circle {
    stroke-dasharray: 145;
    stroke-dashoffset: 145;
    fill: none;
    animation: ps-draw 0.5s ease forwards;
}

.ps-check-tick {
    stroke-dasharray: 50;
    stroke-dashoffset: 50;
    fill: none;
    animation: ps-draw 0.35s ease 0.4s forwards;
}

@keyframes ps-draw { to { stroke-dashoffset: 0; } }

/* ——— Error ——————————————————————————————————————————————————————————————— */

.ps-error {
    font-size: 0.8rem;
    color: #f87171;
    text-align: center;
    padding: 1rem;
    opacity: 0.9;
    pointer-events: none;
}

/* ——— Responsive ————————————————————————————————————————————————————————— */

@media (max-width: 860px) {
    .ps-main { flex-direction: column; }
    .ps-divider { width: 100%; height: 1px; }
    .ps-panel { min-height: 280px; }
}

@media (max-width: 680px) {
    .ps-controls__center { display: none; }
    .ps-controls__left { flex: 1; }
}
