/* ─── Reset & Base ─── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 50%, #16213e 100%);
    color: #e4e4e7;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
}

/* ─── Header ─── */
header {
    text-align: center;
    padding: 32px 0 24px;
}

.site-logo {
    display: inline-block;
    margin-bottom: 16px;
}

.site-logo img {
    height: 32px;
    width: auto;
}

h1 {
    font-size: 2rem;
    background: linear-gradient(135deg, #06b6d4, #22d3ee);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.subtitle {
    color: #a1a1aa;
    margin-bottom: 12px;
}

.subtitle strong {
    color: #67e8f9;
}

.limitations {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    background: rgba(6, 182, 212, 0.08);
    border: 1px solid rgba(6, 182, 212, 0.18);
    color: #67e8f9;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
}

/* ─── Sections ─── */
section {
    margin-top: 28px;
}

.section-title {
    font-size: 1.1rem;
    color: #a1a1aa;
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
}

.hidden {
    display: none !important;
}

/* ─── Upload panels ─── */
.upload-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

.reuse-row {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    margin: -8px 0;
}

.upload-panel {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 20px;
    transition: opacity 0.2s;
}

.upload-panel.disabled {
    opacity: 0.35;
    pointer-events: none;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.panel-header h2 {
    font-size: 1.15rem;
    color: #e4e4e7;
}

.panel-tag {
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(6, 182, 212, 0.12);
    color: #67e8f9;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ─── Drop zone ─── */
.drop-zone {
    position: relative;
    border: 2px dashed rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 28px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.015);
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: #06b6d4;
    background: rgba(6, 182, 212, 0.06);
}

.drop-zone svg {
    color: #52525b;
    margin-bottom: 8px;
}

.drop-zone p {
    color: #71717a;
    font-size: 0.85rem;
    margin-bottom: 6px;
}

.font-name {
    display: block;
    font-size: 0.8rem;
    color: #52525b;
    transition: color 0.2s;
}

.font-name.loaded {
    color: #22d3ee;
    font-weight: 500;
}

.clear-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: #a1a1aa;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clear-btn:hover {
    background: rgba(248, 113, 113, 0.2);
    color: #f87171;
}

/* ─── Toggle ─── */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #a1a1aa;
    user-select: none;
}

.toggle-label input {
    display: none;
}

.toggle-switch {
    width: 40px;
    height: 22px;
    background: #2d2d4a;
    border-radius: 11px;
    position: relative;
    transition: background 0.2s;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: #71717a;
    border-radius: 50%;
    transition: all 0.2s;
}

.toggle-label input:checked + .toggle-switch {
    background: rgba(6, 182, 212, 0.4);
}

.toggle-label input:checked + .toggle-switch::after {
    left: 21px;
    background: #22d3ee;
}

/* ─── Disabled panel ─── */
#font1-panel.disabled {
    opacity: 0.35;
    pointer-events: none;
}

/* ─── Settings ─── */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.settings-panel {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 18px;
}

.settings-panel h3 {
    font-size: 0.9rem;
    color: #a1a1aa;
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 500;
}

.setting-row {
    display: grid;
    grid-template-columns: 110px 1fr 42px;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.setting-row label {
    font-size: 0.8rem;
    color: #a1a1aa;
}

.setting-row input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: #2d2d4a;
    border-radius: 2px;
    outline: none;
}

.setting-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #06b6d4;
    cursor: pointer;
}

.setting-row input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #06b6d4;
    border: none;
    cursor: pointer;
}

.setting-row .val {
    font-size: 0.8rem;
    color: #67e8f9;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ─── Preview ─── */
.text-preview-wrapper {
    margin-bottom: 20px;
}

.text-preview-wrapper input {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #e4e4e7;
    font-size: 0.9rem;
    outline: none;
    margin-bottom: 10px;
}

.text-preview-wrapper input:focus {
    border-color: rgba(6, 182, 212, 0.4);
}

#text-preview {
    width: 100%;
    height: 48px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.sheet-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.sheet-wrapper {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 14px;
}

.sheet-wrapper h3 {
    font-size: 0.85rem;
    color: #a1a1aa;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 500;
}

.sheet-container {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 1;
}

.sheet-container .sheet-preview {
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: pixelated;
}

.empty-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #52525b;
    font-size: 0.85rem;
}

/* ─── Generate button ─── */
.generate-row {
    text-align: center;
    margin: 28px 0;
}

.btn-generate {
    padding: 12px 36px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    background: #2d2d4a;
    color: #52525b;
    transition: all 0.2s;
}

.btn-generate:disabled {
    cursor: not-allowed;
}

.btn-generate.ready {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    color: #fff;
    box-shadow: 0 4px 20px rgba(6, 182, 212, 0.25);
}

.btn-generate.ready:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(6, 182, 212, 0.35);
}

/* ─── Download ─── */
.download-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: #a1a1aa;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-download:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-download:not(:disabled):hover {
    background: rgba(6, 182, 212, 0.1);
    border-color: rgba(6, 182, 212, 0.3);
    color: #e4e4e7;
}

.btn-download.primary {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    border-color: transparent;
    color: #fff;
    font-weight: 600;
}

.btn-download.primary:not(:disabled):hover {
    background: linear-gradient(135deg, #22d3ee, #06b6d4);
}

/* ─── Footer ─── */
footer {
    text-align: center;
    padding: 32px 0 12px;
    color: #52525b;
    font-size: 0.8rem;
}

footer a {
    color: #67e8f9;
    text-decoration: none;
}

/* ─── Toast ─── */
#toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    padding: 10px 24px;
    background: rgba(6, 182, 212, 0.9);
    color: #fff;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    pointer-events: none;
    opacity: 0;
    transition: all 0.3s;
    z-index: 100;
}

#toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .upload-grid,
    .settings-grid,
    .sheet-grid {
        grid-template-columns: 1fr;
    }

    .setting-row {
        grid-template-columns: 90px 1fr 36px;
    }

    header {
        padding: 20px 0 16px;
    }

    h1 {
        font-size: 1.6rem;
    }
}
