/* ============================================
   QRonimo — Modern Technical Aesthetic
   Design: Swiss Minimalism + Technical Precision
   ============================================ */

/* Self-hosted fonts (GDPR: no external requests to Google) */

/* DM Sans — latin-ext */
@font-face {
    font-family: 'DM Sans';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/static/fonts/dm-sans/dm-sans-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* DM Sans — latin */
@font-face {
    font-family: 'DM Sans';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/static/fonts/dm-sans/dm-sans-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'DM Sans';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/static/fonts/dm-sans/dm-sans-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'DM Sans';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/static/fonts/dm-sans/dm-sans-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'DM Sans';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/static/fonts/dm-sans/dm-sans-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'DM Sans';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/static/fonts/dm-sans/dm-sans-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* JetBrains Mono — latin-ext */
@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/static/fonts/jetbrains-mono/jetbrains-mono-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* JetBrains Mono — latin */
@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/static/fonts/jetbrains-mono/jetbrains-mono-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/static/fonts/jetbrains-mono/jetbrains-mono-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/static/fonts/jetbrains-mono/jetbrains-mono-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    /* Color System - Monochromatic with Sharp Accents */
    --color-bg: #fafafa;
    --color-surface: #ffffff;
    --color-border: #e5e5e5;
    --color-text-primary: #0a0a0a;
    --color-text-secondary: #737373;
    --color-text-tertiary: #a3a3a3;

    /* Accent Colors */
    --color-accent: #14b8a6; /* Teal */
    --color-accent-hover: #0d9488;
    --color-danger: #ef4444;

    /* Shadows & Effects */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.08);

    /* Typography */
    --font-primary: 'DM Sans', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Spacing */
    --space-xs: 0.5rem;
    --space-sm: 0.75rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   Dark Mode
   ============================================ */

[data-theme="dark"] {
    --color-bg: #0a0a0a;
    --color-surface: #171717;
    --color-border: #262626;
    --color-text-primary: #fafafa;
    --color-text-secondary: #a3a3a3;
    --color-text-tertiary: #525252;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.2);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.3);
}

[data-theme="dark"] .bg-pattern {
    opacity: 0.15;
}

[data-theme="dark"] .canvas-inner::before {
    background: radial-gradient(circle, rgba(20, 184, 166, 0.06) 0%, transparent 70%);
}

/* ============================================
   Reset & Base Styles
   ============================================ */

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

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body {
    font-family: var(--font-primary);
    color: var(--color-text-primary);
    background: var(--color-bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    transition: background-color 0.3s, color 0.3s;
}

/* ============================================
   Geometric Background Pattern
   ============================================ */

.bg-pattern {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.4;
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 2px, var(--color-border) 2px, var(--color-border) 3px),
        repeating-linear-gradient(90deg, transparent, transparent 2px, var(--color-border) 2px, var(--color-border) 3px);
    background-size: 24px 24px;
    animation: patternSlide 60s linear infinite;
    transition: opacity 0.3s;
}

@keyframes patternSlide {
    0% { background-position: 0 0; }
    100% { background-position: 24px 24px; }
}

/* ============================================
   App Container
   ============================================ */

.app-container {
    position: relative;
    z-index: 1;
    max-width: 1600px;
    margin: 0 auto;
    padding: var(--space-lg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
}

/* ============================================
   Ad Slots
   ============================================ */

.ad-slot {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 90px;
    transition: background-color 0.3s, border-color 0.3s;
}

.ad-header { order: -1; }
.ad-footer { order: 999; }
.ad-sidebar {
    grid-area: ad;
    min-height: 600px;
}

/* ============================================
   Brand Header
   ============================================ */

.brand-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-xl) 0;
    border-bottom: 1px solid var(--color-border);
    animation: slideDown 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    transition: border-color 0.3s;
}

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

.brand-lockup {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.brand-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--color-accent);
    border-radius: var(--radius-md);
    border: 2px solid var(--color-accent);
}

/* Animated QR Logo */
.qr-logo-tiles .qr-tile {
    opacity: 0;
    animation: tileAppear 0.3s ease-out forwards, qrFadeGroup 4.3s ease-in-out infinite;
}

@keyframes tileAppear {
    from { opacity: 0; transform: scale(0); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes qrFadeGroup {
    0%, 55% { opacity: 1; }
    70% { opacity: 0; }
    85% { opacity: 0; }
    100% { opacity: 1; }
}

.brand-title {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--color-text-primary);
    margin-bottom: 0.25rem;
}

.brand-subtitle {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    letter-spacing: 0.01em;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

/* Language Switcher */
.lang-switcher {
    display: flex;
    align-items: center;
}

.lang-select {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.5rem;
    cursor: pointer;
    transition: all var(--transition-base);
}

.lang-select:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.lang-select:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.1);
}

/* Dark Mode Toggle */
.dark-mode-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: all var(--transition-base);
}

.dark-mode-toggle:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.dark-mode-toggle .icon-moon {
    display: none;
}

[data-theme="dark"] .dark-mode-toggle .icon-sun {
    display: none;
}

[data-theme="dark"] .dark-mode-toggle .icon-moon {
    display: block;
}

.privacy-indicators {
    display: flex;
    gap: var(--space-lg);
}

.indicator {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    font-family: var(--font-mono);
}

.indicator-dot {
    width: 8px;
    height: 8px;
    background: var(--color-accent);
    border-radius: 50%;
    animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ============================================
   Workspace Layout
   ============================================ */

.workspace {
    display: grid;
    grid-template-columns: 380px 1fr 300px;
    grid-template-areas: "controls canvas ad";
    gap: var(--space-xl);
    flex: 1;
    animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.2s backwards;
}

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

/* ============================================
   Control Panel
   ============================================ */

.control-panel {
    grid-area: controls;
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.panel-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    transition: all var(--transition-base);
}

.panel-section:hover {
    border-color: var(--color-text-tertiary);
    box-shadow: var(--shadow-sm);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.section-header h2 {
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--color-text-primary);
}

.section-badge {
    font-size: 0.6875rem;
    font-family: var(--font-mono);
    color: var(--color-text-tertiary);
    background: var(--color-bg);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============================================
   Form Controls
   ============================================ */

.content-input {
    width: 100%;
    padding: var(--space-md);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--color-text-primary);
    background: var(--color-bg);
    resize: vertical;
    transition: all var(--transition-base);
}

.content-input:focus {
    outline: none;
    border-color: var(--color-accent);
    background: var(--color-surface);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.1);
}

.control-row {
    margin-bottom: var(--space-md);
}

.control-row:last-child {
    margin-bottom: 0;
}

.control-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-xs);
}

.control-value {
    font-family: var(--font-mono);
    color: var(--color-accent);
    font-weight: 500;
}

.slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: var(--color-border);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--color-accent);
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.2);
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--color-accent);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.2);
}

.control-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.color-picker-wrapper {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.color-input-group {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg);
    transition: all var(--transition-base);
}

.color-input-group:focus-within {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.1);
}

.color-input {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.color-hex {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--color-text-secondary);
}

.select-input,
.text-input {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-family: var(--font-primary);
    font-size: 0.875rem;
    color: var(--color-text-primary);
    background: var(--color-bg);
    transition: all var(--transition-base);
    cursor: pointer;
}

.select-input:focus,
.text-input:focus {
    outline: none;
    border-color: var(--color-accent);
    background: var(--color-surface);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.1);
}

.text-input {
    margin-bottom: var(--space-sm);
    cursor: text;
}

.text-input:last-child {
    margin-bottom: 0;
}

/* Label Size Sliders */
.label-size-row {
    margin-top: -0.25rem;
    margin-bottom: var(--space-md);
}

/* ============================================
   File Upload
   ============================================ */

.file-upload-wrapper {
    position: relative;
}

.file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
}

.file-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    background: var(--color-bg);
    cursor: pointer;
    transition: all var(--transition-base);
}

.file-label:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
    background: rgba(20, 184, 166, 0.05);
}

/* ============================================
   Buttons
   ============================================ */

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-primary);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

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

.btn-primary:hover {
    background: var(--color-accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

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

.button-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
}

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--color-bg);
    border-color: var(--color-text-tertiary);
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ============================================
   Output Canvas
   ============================================ */

.output-canvas {
    grid-area: canvas;
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    position: sticky;
    top: var(--space-lg);
    align-self: start;
}

.canvas-inner {
    flex: 1;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 460px;
    position: relative;
    overflow: hidden;
    transition: background-color 0.3s, border-color 0.3s;
}

.canvas-inner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(20, 184, 166, 0.03) 0%, transparent 70%);
    animation: gradientRotate 15s linear infinite;
}

@keyframes gradientRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.qr-output {
    position: relative;
    z-index: 1;
}

.empty-state {
    text-align: center;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.empty-icon {
    margin-bottom: var(--space-lg);
    color: var(--color-border);
}

.empty-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: var(--space-xs);
}

.empty-subtitle {
    font-size: 0.875rem;
    color: var(--color-text-tertiary);
}

#qrWrapper {
    display: inline-block;
    padding: var(--space-xl);
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    animation: scaleIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.qr-header,
.qr-footer {
    text-align: center;
    font-weight: 600;
    color: var(--color-text-primary);
    padding: var(--space-sm) 0;
}

#qrcode {
    background: #ffffff;
    padding: var(--space-md);
    border-radius: var(--radius-md);
}

#qrcode canvas,
#qrcode img {
    display: block;
    border-radius: var(--radius-sm);
    max-width: 100%;
    height: auto;
}

/* ============================================
   Toast Notifications
   ============================================ */

.qr-toast {
    position: fixed;
    bottom: var(--space-xl);
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-md);
    font-family: var(--font-primary);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-primary);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 1000;
    pointer-events: none;
    max-width: 90vw;
    text-align: center;
}

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

.qr-toast--success {
    border-color: var(--color-accent);
}

.qr-toast--warning {
    border-color: #f59e0b;
}

/* ============================================
   Consent Banner
   ============================================ */

.consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2000;
    padding: var(--space-lg);
    opacity: 0;
    transform: translateY(100%);
    transition: opacity var(--transition-base), transform var(--transition-slow);
    pointer-events: none;
}

.consent-banner--visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.consent-banner-inner {
    max-width: 720px;
    margin: 0 auto;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.consent-banner-content {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
}

.consent-banner-icon {
    flex-shrink: 0;
    color: var(--color-accent);
    margin-top: 2px;
}

.consent-banner-text {
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--color-text-secondary);
}

.consent-banner-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.consent-banner-actions .btn {
    padding: var(--space-sm) var(--space-lg);
    font-size: 0.875rem;
    min-width: 100px;
}

.consent-banner-actions .consent-learn-more {
    margin-left: auto;
    font-size: 0.8125rem;
    color: var(--color-text-tertiary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.consent-banner-actions .consent-learn-more:hover {
    color: var(--color-accent);
}

@media (max-width: 768px) {
    .consent-banner {
        padding: var(--space-sm);
    }

    .consent-banner-icon {
        display: none;
    }

    .consent-banner-actions {
        flex-direction: column;
    }

    .consent-banner-actions .btn {
        width: 100%;
    }

    .consent-banner-actions .consent-learn-more {
        margin-left: 0;
        text-align: center;
    }
}

/* ============================================
   Footer
   ============================================ */

.app-footer {
    padding: var(--space-xl) 0;
    border-top: 1px solid var(--color-border);
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.4s backwards;
    transition: border-color 0.3s;
}

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

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

.footer-security {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
}

.footer-security svg {
    color: var(--color-accent);
}

.footer-links {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    font-size: 0.8125rem;
}

.footer-links a {
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: var(--color-accent);
}

.footer-links span {
    color: var(--color-border);
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 1400px) {
    .workspace {
        grid-template-columns: 1fr 2fr;
        grid-template-areas:
            "controls canvas"
            "ad ad";
    }

    .ad-sidebar {
        min-height: 200px;
    }
}

@media (max-width: 1024px) {
    .workspace {
        grid-template-columns: 1fr;
        grid-template-areas: none;
    }

    /* Flatten control-panel and output-canvas into the workspace grid
       so we can reorder: content → QR preview → style/options → export */
    .control-panel,
    .output-canvas {
        display: contents;
    }

    /* Content input first */
    .control-panel .panel-section:nth-child(1) { order: 1; }
    /* QR preview second */
    .canvas-inner { order: 2; }
    /* Style controls */
    .control-panel .panel-section:nth-child(2) { order: 3; }
    /* Logo upload */
    .control-panel .panel-section:nth-child(3) { order: 4; }
    /* Labels */
    .control-panel .panel-section:nth-child(4) { order: 5; }
    /* Export */
    .control-panel .panel-section:nth-child(5) { order: 6; }
    /* Ad sidebar last */
    .ad-sidebar { order: 7; min-height: 200px; }

    .canvas-inner {
        min-height: auto;
    }

    .output-canvas {
        position: static;
    }

    .privacy-indicators {
        display: none;
    }
}

@media (max-width: 768px) {
    .app-container {
        padding: var(--space-sm);
        gap: var(--space-md);
    }

    /* Compact header — single row */
    .brand-header {
        flex-direction: row;
        align-items: center;
        padding: var(--space-md) 0;
        gap: var(--space-sm);
    }

    .brand-lockup {
        gap: var(--space-sm);
    }

    .brand-icon {
        width: 40px;
        height: 40px;
        border-width: 1.5px;
    }

    .brand-icon .qr-logo {
        width: 28px;
        height: 28px;
    }

    .brand-title {
        font-size: 1.25rem;
        margin-bottom: 0;
    }

    .brand-subtitle {
        display: none;
    }

    .header-actions {
        gap: var(--space-sm);
        margin-left: auto;
    }

    /* Workspace spacing */
    .workspace {
        gap: var(--space-md);
    }

    /* Compact canvas */
    .canvas-inner {
        padding: var(--space-md);
        min-height: auto;
        border-radius: var(--radius-lg);
    }

    /* Constrain QR code to viewport */
    #qrWrapper {
        max-width: 100%;
        padding: var(--space-md);
    }

    #qrcode canvas,
    #qrcode img {
        max-width: 100%;
        height: auto !important;
    }

    /* Compact panels */
    .panel-section {
        padding: var(--space-md);
        border-radius: var(--radius-md);
    }

    /* Touch-friendly slider thumbs (44px target) */
    .slider::-webkit-slider-thumb {
        width: 28px;
        height: 28px;
    }

    .slider::-moz-range-thumb {
        width: 28px;
        height: 28px;
    }

    .slider {
        height: 8px;
    }

    /* Larger color inputs for touch */
    .color-input {
        width: 44px;
        height: 44px;
    }

    /* Keep export buttons side by side on mobile */
    .button-group {
        grid-template-columns: 1fr 1fr;
    }

    .btn {
        padding: var(--space-md);
        min-height: 48px;
    }

    /* Compact content input */
    .content-input {
        font-size: 1rem;
    }

    /* Touch-friendly select/text inputs */
    .select-input,
    .text-input {
        font-size: 1rem;
        padding: var(--space-md);
        min-height: 48px;
    }

    /* File upload touch target */
    .file-label {
        min-height: 48px;
    }

    /* Compact footer */
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: var(--space-sm);
    }

    .footer-security {
        font-size: 0.75rem;
    }

    .app-footer {
        padding: var(--space-md) 0;
    }

    /* Ad slots compact */
    .ad-slot {
        padding: var(--space-md);
        min-height: 60px;
    }

    .ad-sidebar {
        min-height: 100px;
    }

    /* Touch-friendly checkboxes */
    .toggle-label {
        min-height: 44px;
        padding: var(--space-xs) 0;
    }

    .toggle-label input[type="checkbox"] {
        width: 24px;
        height: 24px;
    }
}

@media (max-width: 480px) {
    .app-container {
        padding: var(--space-xs);
        gap: var(--space-sm);
    }

    .brand-header {
        padding: var(--space-sm) 0;
    }

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

    .canvas-inner {
        padding: var(--space-sm);
    }

    #qrWrapper {
        padding: var(--space-sm);
    }

    .panel-section {
        padding: var(--space-sm);
    }

    .pro-url-row {
        flex-direction: column;
    }

    .pro-url-row .btn-sm {
        width: 100%;
    }

    .consent-banner-inner {
        padding: var(--space-sm);
    }
}

/* ============================================
   Accessibility
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus Styles */
*:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    .bg-pattern,
    .ad-slot,
    .control-panel,
    .app-footer,
    .consent-banner {
        display: none !important;
    }

    .workspace {
        grid-template-columns: 1fr;
        grid-template-areas: "canvas";
    }
}

/* ============================================
   Toggle Labels
   ============================================ */

.toggle-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    cursor: pointer;
}

.toggle-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-accent);
    cursor: pointer;
}

/* ============================================
   Warning Banner (Contrast)
   ============================================ */

.warning-banner {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    color: #f59e0b;
    margin-bottom: var(--space-md);
}

.warning-banner svg {
    flex-shrink: 0;
}

/* ============================================
   Hint Text
   ============================================ */

.hint-text {
    font-size: 0.75rem;
    color: var(--color-text-tertiary);
    font-family: var(--font-mono);
    margin-top: var(--space-xs);
}

/* ============================================
   3-Column Button Group
   ============================================ */

.button-group-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

/* ============================================
   Batch Button
   ============================================ */

.batch-btn {
    margin-top: var(--space-sm);
    width: 100%;
}


/* ============================================
   Pro Tools
   ============================================ */

.pro-tools-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.pro-url-row {
    display: flex;
    gap: var(--space-xs);
}

.pro-url-row .text-input {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.btn-sm {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.85rem;
    min-width: auto;
}

.pro-result {
    margin-top: var(--space-sm);
    padding: var(--space-md);
    background: rgba(20, 184, 166, 0.05);
    border: 1px solid rgba(20, 184, 166, 0.15);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.pro-stats {
    margin-top: var(--space-sm);
}

.pro-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-xs) 0;
    font-size: 0.875rem;
}

.pro-stat-value {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--color-accent);
    font-size: 1.1rem;
}

/* ============================================
   Reveal Preview
   ============================================ */

.reveal-preview {
    margin-top: var(--space-md);
    border-top: 1px solid var(--color-border);
    padding-top: var(--space-md);
}

.reveal-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
}

.reveal-preview-canvas {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #0f1419;
    touch-action: none;
}

.reveal-preview-content {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-md);
    color: #8899a6;
    font-size: 0.75rem;
    line-height: 1.5;
    word-break: break-word;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.reveal-preview-content.visible {
    opacity: 1;
}

.reveal-preview-scratch {
    position: absolute;
    inset: 0;
    z-index: 10;
    cursor: grab;
}

.reveal-preview-scratch:active {
    cursor: grabbing;
}

.reveal-preview-countdown {
    position: absolute;
    inset: 0;
    z-index: 20;
    background: rgba(10, 10, 10, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
    backdrop-filter: blur(8px);
}

.reveal-preview-countdown .num {
    font-size: 3rem;
    font-weight: 700;
    color: var(--color-accent);
    font-family: var(--font-mono);
    animation: revealPulse 1s ease-in-out infinite;
}

@keyframes revealPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.8; }
}

@media (max-width: 480px) {
    .reveal-preview-canvas {
        width: 160px;
        height: 160px;
    }

    .reveal-preview-countdown .num {
        font-size: 2.5rem;
    }
}

/* ============================================
   Responsive Adjustments for New Features
   ============================================ */

@media (max-width: 1024px) {
    /* Advanced section */
    .control-panel .panel-section:nth-child(5) { order: 5; }
    /* Batch section */
    .control-panel .panel-section:nth-child(6) { order: 6; }
    /* Pro tools section */
    .control-panel .panel-section:nth-child(7) { order: 7; }
    /* Export section */
    .control-panel .panel-section:nth-child(8) { order: 8; }
    .ad-sidebar { order: 9; }
}

@media (max-width: 768px) {
    .button-group-3 {
        grid-template-columns: 1fr 1fr;
    }

    .button-group-3 .btn:last-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 480px) {
    .button-group-3 {
        grid-template-columns: 1fr;
    }
}
