/* Re-themed to SnapStatic dark + indigo by aliasing to styles-base --ss-* tokens. */
:root {
    --bg-primary: var(--ss-surface);
    --bg-secondary: var(--ss-bg);
    --bg-tertiary: var(--ss-surface-2);
    --text-primary: var(--ss-text);
    --text-secondary: var(--ss-text-dim);
    --text-muted: var(--ss-text-dim);
    --border-color: var(--ss-border);
    --accent: var(--ss-accent);
    --accent-hover: var(--ss-accent-hover);
    --warning: var(--ss-warn);
    --error: #ef4444;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
}

/* .container, header and footer are owned by the shared frame (styles-base.css). */

.hidden {
    display: none !important;
}

/* Header + tagline now rendered by the frame (.ss-nav + .tool-head). */

main {
    padding: 32px 16px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.type-section {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow-sm);
}

.type-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 10px 20px;
    background: transparent;
    border: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all 0.2s;
    white-space: nowrap;
}

.tab-btn:hover {
    background: var(--bg-tertiary);
}

.tab-btn.active {
    background: var(--accent);
    color: white;
}

.form-section {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.form-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-weight: 600;
    font-size: 14px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    font-size: 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--accent);
}

.form-group input.error,
.form-group textarea.error {
    border-color: var(--error);
}

.form-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-error {
    font-size: 12px;
    color: var(--error);
}

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

@media (max-width: 640px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.utm-section {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 8px;
}

.utm-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.utm-header label {
    font-weight: 600;
    font-size: 14px;
}

.utm-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.url-preview {
    margin-top: 12px;
    padding: 10px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: monospace;
    word-break: break-all;
    border: 1px solid var(--border-color);
}

.customize-section {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.customize-section h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

.customize-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

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

.customize-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.customize-item label {
    font-weight: 600;
    font-size: 14px;
}

.color-input {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-input input[type="color"] {
    width: 40px;
    height: 40px;
    padding: 0;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.color-input span {
    font-size: 14px;
    font-family: monospace;
}

.customize-item select {
    width: 100%;
    padding: 10px 12px;
    font-size: 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    outline: none;
    font-family: inherit;
    cursor: pointer;
}

.logo-upload {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.logo-upload label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}

.logo-upload-area {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-upload {
    padding: 10px 16px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    width: fit-content;
}

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

.logo-preview {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-preview img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.logo-preview button {
    padding: 4px 12px;
    background: var(--error);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
}

.upload-hint {
    font-size: 12px;
    color: var(--text-muted);
}

.preview-section {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.preview-section h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

.preview-wrapper {
    display: flex;
    justify-content: center;
    padding: 24px;
    background: white;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

#qrCanvas {
    max-width: 100%;
    height: auto;
}

.download-actions {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-primary {
    padding: 12px 24px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    padding: 12px 24px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--text-muted);
    color: white;
}

/* .footer and .toast are rendered/styled by the shared frame (styles-base.css). */

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

    .header .tagline {
        font-size: 14px;
    }

    main {
        padding: 20px 12px;
        gap: 20px;
    }

    .type-section,
    .form-section,
    .customize-section,
    .preview-section {
        padding: 16px;
        border-radius: var(--radius-md);
    }

    .type-tabs {
        gap: 2px;
    }

    .tab-btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    .customize-grid {
        grid-template-columns: 1fr;
    }

    .customize-item select {
        padding: 8px 10px;
        font-size: 14px;
    }

    .preview-wrapper {
        padding: 16px;
    }

    #qrCanvas {
        max-width: 100%;
        height: auto;
    }

    .download-actions {
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
    }
}