.qr-app {
    max-width: 520px;
    margin: 0 auto;
    padding: 0 0 88px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.qr-head {
    text-align: center;
    margin-bottom: 20px;
}

.qr-title {
    margin: 0 0 8px;
    font-size: clamp(1.35rem, 4vw, 1.65rem);
    letter-spacing: -0.02em;
    color: #2c3e50;
}

.qr-lead {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: #6e6e73;
}

/* Type tabs — horizontal scroll on mobile */
.qr-types {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 4px 2px 12px;
    margin-bottom: 16px;
}

.qr-types::-webkit-scrollbar {
    display: none;
}

.qr-type {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 10px 16px;
    border: 1px solid #e5e5ea;
    border-radius: 999px;
    background: #fff;
    color: #333;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.qr-type.is-active {
    background: #4e73df;
    border-color: #4e73df;
    color: #fff;
}

.qr-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.qr-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.qr-field span {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.qr-field input,
.qr-field textarea,
.qr-field select {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid #d2d2d7;
    border-radius: 12px;
    font-size: 16px;
    line-height: 1.4;
    background: #fff;
    color: #111;
    -webkit-appearance: none;
    appearance: none;
}

.qr-field textarea {
    min-height: 96px;
    resize: vertical;
}

.qr-field input:focus,
.qr-field textarea:focus,
.qr-field select:focus {
    outline: none;
    border-color: #4e73df;
    box-shadow: 0 0 0 3px rgba(78, 115, 223, 0.15);
}

.qr-check {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    font-size: 15px;
    color: #333;
    cursor: pointer;
}

.qr-check input {
    width: 20px;
    height: 20px;
    accent-color: #4e73df;
}

/* Design accordion */
.qr-design {
    margin-bottom: 20px;
    border: 1px solid #e5e5ea;
    border-radius: 14px;
    background: #fafafa;
    overflow: hidden;
}

.qr-design summary {
    padding: 14px 16px;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    list-style: none;
}

.qr-design summary::-webkit-details-marker {
    display: none;
}

.qr-design-body {
    padding: 0 16px 16px;
    border-top: 1px solid #ececf0;
}

.qr-design-label {
    margin: 12px 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.qr-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.qr-chip {
    min-height: 40px;
    padding: 8px 14px;
    border: 1px solid #d2d2d7;
    border-radius: 10px;
    background: #fff;
    font-size: 14px;
    cursor: pointer;
}

.qr-chip.is-active {
    border-color: #4e73df;
    background: #eef2ff;
    color: #4e73df;
    font-weight: 600;
}

.qr-colors {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 14px 0;
}

.qr-color {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.qr-color input[type="color"] {
    width: 100%;
    height: 44px;
    padding: 4px;
    border: 1px solid #d2d2d7;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
}

/* Preview */
.qr-preview-wrap {
    text-align: center;
}

.qr-preview-card {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    padding: 20px;
    background: #fff;
    border: 1px solid #e5e5ea;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.qr-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
}

.qr-preview img,
.qr-preview canvas {
    max-width: min(100%, 280px);
    height: auto !important;
    width: auto !important;
    border-radius: 8px;
}

.qr-preview-empty {
    position: absolute;
    margin: 0;
    padding: 0 16px;
    font-size: 14px;
    color: #9ca3af;
}

.qr-preview-hint {
    margin: 12px 0 0;
    font-size: 13px;
    color: #6e6e73;
    line-height: 1.45;
}

.qr-error {
    margin: 10px 0 0;
    font-size: 14px;
    color: #c0392b;
}

/* Sticky download on mobile */
.qr-actions {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    border-top: 1px solid #e5e5ea;
}

.qr-btn {
    display: block;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    min-height: 52px;
    padding: 14px 20px;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.15s;
}

.qr-btn-primary {
    background: #4e73df;
    color: #fff;
}

.qr-btn-primary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.qr-btn-primary:not(:disabled):active {
    transform: scale(0.98);
}

@media (min-width: 640px) {
    .qr-app {
        padding-bottom: 24px;
    }

    .qr-actions {
        position: static;
        padding: 20px 0 0;
        background: transparent;
        backdrop-filter: none;
        border-top: none;
    }

    .qr-preview img,
    .qr-preview canvas {
        max-width: min(100%, 320px);
    }
}

@media (min-width: 768px) {
    .qr-types {
        flex-wrap: wrap;
        overflow: visible;
        justify-content: center;
    }
}
