@import "../../style.css";

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
}

.app {
    max-width: 1140px;
    margin: 48px auto;
    padding: 0 var(--space-3) var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.header {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.header h1 {
    margin: 0;
    font-size: 32px;
    letter-spacing: 0.02em;
}

.header .lede {
    margin: 0;
    color: var(--muted);
}

.steps {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.step-pill {
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--muted);
    font-size: 13px;
}

.card {
    background: linear-gradient(140deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: var(--space-4);
}

.layout {
    display: grid;
    grid-template-columns: 0.9fr 1.1fr;
    gap: var(--space-4);
    align-items: stretch;
}

.section-heading {
    margin-bottom: var(--space-2);
}

.section-label {
    display: inline-block;
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.hint {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.drop-zone {
    position: relative;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.02);
    padding: var(--space-3);
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
    cursor: pointer;
}

.drop-zone:hover {
    border-color: rgba(56, 189, 248, 0.6);
    background: rgba(56, 189, 248, 0.05);
}

.drop-zone.is-dragover {
    border-color: rgba(34, 211, 238, 0.9);
    background: rgba(34, 211, 238, 0.12);
    transform: translateY(-2px);
}

.drop-inner {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    text-align: center;
}

.primary {
    margin: 0;
    font-weight: 700;
}

.secondary {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.file-name {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.control-stack {
    margin-top: var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--panel);
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.control {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-weight: 600;
}

.label-row .muted {
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
}

input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
    cursor: pointer;
}

select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--panel-strong);
    color: var(--text);
    font-size: 15px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

select:focus-visible {
    border-color: rgba(56, 189, 248, 0.7);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
}

.control-helper {
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
}

.control-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 13px;
    color: var(--muted);
}

.range-value {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(56, 189, 248, 0.12);
    color: #e0f2fe;
    font-weight: 700;
}

.range-hint {
    color: var(--muted);
}

.color-readout {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chip {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.readout-value {
    font-family: var(--font-mono);
    font-size: 14px;
}

.status-box {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--muted);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--muted);
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.08);
    flex-shrink: 0;
}

.preview-panel {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    height: 100%;
    min-height: 0;
}

.canvas-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.button-row {
    display: flex;
    gap: var(--space-2);
    align-items: center;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
}

.zoom-display {
    min-width: 54px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
}

.icon-button {
    width: 34px;
    height: 34px;
    padding: 0;
    line-height: 1;
}

.pill-button:disabled,
.ghost-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.canvas-frame {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #0d1525;
    overflow: hidden;
    min-height: 260px;
    flex: 1;
}

.checkerboard {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(45deg, rgba(255, 255, 255, 0.05) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(255, 255, 255, 0.05) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.05) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.05) 75%);
    background-size: 32px 32px;
    background-position: 0 0, 0 16px, 16px -16px, -16px 0px;
    opacity: 0.5;
}

canvas {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    max-width: none;
    height: auto;
    width: auto;
    z-index: 1;
    cursor: crosshair;
    image-rendering: pixelated;
    transform-origin: top left;
    transition: transform 0.08s ease-out;
}

canvas.is-panning {
    cursor: grabbing;
}

@media (max-width: 960px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .app {
        margin: 32px auto;
    }
}

@media (max-width: 640px) {
    .header h1 {
        font-size: 26px;
    }

    .canvas-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .button-row {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}
