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

:root {
    --bg: #0a0a0f;
    --surface: #13131a;
    --surface2: #1c1c27;
    --border: #2a2a3a;
    --accent: #7c5cfc;
    --accent2: #fc5c7d;
    --text: #f0f0ff;
    --muted: #6b6b8a;
    --radius: 12px;
}

body {
    font-family: 'Syne', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 16px 48px;
    background-image: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(124,92,252,0.18), transparent);
}

header {
    text-align: center;
    margin-bottom: 32px;
    animation: fadeDown 0.6s ease both;
}

header h1 {
    font-size: clamp(1.8rem, 5vw, 2.8rem);
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #c9b8ff 0%, #fc5c7d 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header p {
    color: var(--muted);
    font-family: 'Space Mono', monospace;
    font-size: 0.78rem;
    margin-top: 6px;
    letter-spacing: 1px;
}

.app {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    width: 100%;
    max-width: 900px;
    animation: fadeUp 0.7s ease 0.1s both;
}

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

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
}

.tabs {
    display: flex;
    gap: 4px;
    background: var(--surface2);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 20px;
}

.tab {
    flex: 1;
    padding: 8px 4px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-family: 'Syne', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.5px;
}

.tab.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 12px rgba(124,92,252,0.4);
}

label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 6px;
    margin-top: 16px;
}

label:first-child { margin-top: 0; }

input[type="text"],
input[type="url"],
input[type="email"],
input[type="tel"],
textarea {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text);
    font-family: 'Space Mono', monospace;
    font-size: 0.82rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    resize: vertical;
}

input:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(124,92,252,0.15);
}

textarea { min-height: 80px; }

.color-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.color-group { flex: 1; min-width: 100px; }
.color-group label { margin-top: 0; }

.color-input-wrap {
    position: relative;
    height: 40px;
    border-radius: 8px;
    border: 1px solid var(--border);
    overflow: hidden;
    cursor: pointer;
}

.color-input-wrap input[type="color"] {
    position: absolute;
    inset: -8px;
    width: calc(100% + 16px);
    height: calc(100% + 16px);
    border: none;
    cursor: pointer;
    padding: 0;
}

.presets {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.preset-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
    flex-shrink: 0;
}

.preset-btn:hover { transform: scale(1.15); }
.preset-btn.selected { border-color: white; transform: scale(1.15); }

.upload-area {
    border: 1.5px dashed var(--border);
    border-radius: 8px;
    padding: 14px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
    overflow: hidden;
}

.upload-area:hover {
    border-color: var(--accent);
    background: rgba(124,92,252,0.05);
}

.upload-area input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.upload-area p {
    font-size: 0.78rem;
    color: var(--muted);
    font-family: 'Space Mono', monospace;
}

.upload-area .icon { font-size: 1.5rem; margin-bottom: 4px; }

.logo-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 8px 12px;
    background: var(--surface2);
    border-radius: 8px;
}

.logo-preview img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 4px;
}

.logo-preview span {
    font-size: 0.75rem;
    color: var(--muted);
    font-family: 'Space Mono', monospace;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.remove-btn {
    background: none;
    border: none;
    color: var(--accent2);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 2px;
}

.generate-btn {
    width: 100%;
    margin-top: 20px;
    padding: 13px;
    background: linear-gradient(135deg, var(--accent), #9b7cfc);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-family: 'Syne', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 4px 20px rgba(124,92,252,0.35);
}

.generate-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(124,92,252,0.5);
}

.generate-btn:active { transform: translateY(0); }

.qr-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.qr-stage {
    width: 220px;
    height: 220px;
    background: #fff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 8px 40px rgba(0,0,0,0.4);
    overflow: hidden;
    flex-shrink: 0;
}

.empty-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: var(--muted);
}

.empty-stage .grid-icon {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 3px;
    opacity: 0.25;
}

.empty-stage .grid-icon span {
    width: 10px;
    height: 10px;
    background: var(--muted);
    border-radius: 2px;
}

.empty-stage p {
    font-family: 'Space Mono', monospace;
    font-size: 0.72rem;
    text-align: center;
    line-height: 1.6;
}

.qr-info { text-align: center; width: 100%; }

.qr-type-badge {
    display: inline-block;
    padding: 3px 10px;
    background: rgba(124,92,252,0.15);
    border: 1px solid rgba(124,92,252,0.3);
    border-radius: 20px;
    font-size: 0.68rem;
    font-family: 'Space Mono', monospace;
    color: #a98cff;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.qr-content-preview {
    font-family: 'Space Mono', monospace;
    font-size: 0.72rem;
    color: var(--muted);
    word-break: break-all;
    max-height: 48px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.action-btns {
    display: flex;
    gap: 10px;
    width: 100%;
}

.action-btn {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text);
    font-family: 'Syne', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
}

.action-btn:hover {
    border-color: var(--accent);
    color: #c9b8ff;
    background: rgba(124,92,252,0.08);
}

.action-btn.download {
    background: linear-gradient(135deg, rgba(124,92,252,0.2), rgba(252,92,125,0.2));
    border-color: rgba(124,92,252,0.4);
}

.size-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.size-btn {
    padding: 5px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--muted);
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.15s;
}

.size-btn.active {
    border-color: var(--accent);
    color: #c9b8ff;
    background: rgba(124,92,252,0.1);
}

.section-title {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.divider { height: 1px; background: var(--border); margin: 20px 0; }

.error-box {
    background: rgba(252,92,125,0.1);
    border: 1px solid rgba(252,92,125,0.3);
    border-radius: 8px;
    padding: 10px 14px;
    margin-top: 14px;
    font-size: 0.78rem;
    color: #fc9ab3;
    font-family: 'Space Mono', monospace;
}

@keyframes fadeDown {
    from { opacity: 0; transform: translateY(-16px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes pop {
    0%   { transform: scale(0.85); opacity: 0; }
    60%  { transform: scale(1.04); }
    100% { transform: scale(1);    opacity: 1; }
}

.qr-animate { animation: pop 0.35s cubic-bezier(0.34,1.56,0.64,1) both; }
