@media screen and (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
    }
    
    .sidebar-nav {
        grid-column: 1 / -1;
        order: 1;
    }
    
    .type-menu {
        display: none;
    }
    
    .mobile-type-select {
        display: block;
        width: 100%;
        padding: 0.75rem;
        background-color: var(--bg-secondary);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-sm);
        font-family: 'JetBrains Mono', monospace;
        font-size: 0.875rem;
        color: var(--text-primary);
    }
    
    .content-column {
        order: 2;
    }
    
    .preview-column {
        order: 3;
    }
}

@media screen and (max-width: 768px) {
    html {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        overflow-x: hidden;
    }
    
    body {
        width: 100%;
        min-width: 100%;
    }
    
    .app-container {
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    .header-content {
        padding: 0 0.75rem;
        width: 100%;
    }
    
    .install-button-text {
        display: none;
    }
    
    .install-button {
        padding: 0.5rem;
    }
    
    .sidebar-nav,
    .content-column,
    .preview-column {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .app-title {
        font-size: 1.25rem;
    }
    
    .header-brand {
        gap: 0.5rem;
    }
    
    .app-logo {
        height: 24px;
    }
    
    .main-content {
        padding: 0.75rem;
        padding-bottom: 110px;
        gap: 1rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
        grid-template-columns: 1fr;
    }
    
    .sidebar-nav {
        margin-bottom: 0.5rem;
    }
    
    .sidebar-title {
        display: none;
    }
    
    .card {
        padding: 1rem;
        border-radius: var(--radius-md);
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    
    .input-panel,
    .customization-panel,
    .preview-panel,
    .history-panel {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        position: relative;
        z-index: 1;
    }
    
    .section-title {
        font-size: 1rem;
        margin-bottom: 1rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .form-col-2,
    .form-col-3,
    .form-col-full {
        flex: 1 1 100%;
        margin-bottom: 1rem;
    }
    
    .form-input,
    .form-select,
    .form-textarea {
        padding: 0.75rem;
        font-size: 16px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.875rem;
    }
    
    .sticky-action-container {
        padding: 1rem;
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
        z-index: 999 !important;
        position: fixed !important;
    }
    
    .sticky-action-container .btn {
        width: 100%;
        max-width: 100%;
    }
    
    .main-content {
        padding-bottom: 110px;
    }
    
    .action-buttons {
        grid-template-columns: 1fr;
    }
    
    .history-panel {
        max-height: none;
    }
    
    .history-list {
        max-height: none;
    }
    
    .qr-preview {
        min-height: 250px;
        padding: 1.5rem;
        overflow: hidden;
    }
    
    .qr-code-container {
        max-width: 100%;
        overflow: hidden;
    }
    
    .qr-code-container canvas,
    .qr-code-container img {
        max-width: 100%;
        height: auto;
        display: block;
        margin: 0 auto;
    }
    
    .preview-placeholder svg {
        width: 80px;
        height: 80px;
    }
    
    .notification {
        bottom: 1rem;
        left: 50%;
        transform: translateX(-50%) translateY(100px);
        width: calc(100% - 2rem);
        max-width: calc(100vw - 2rem);
    }
    
    .notification.show {
        transform: translateX(-50%) translateY(0);
    }
}

@media screen and (max-width: 480px) {
    .app-header {
        width: 100%;
        min-width: 100%;
    }
    
    .header-content {
        padding: 0 0.5rem;
        gap: 0.5rem;
    }
    
    .app-title {
        font-size: 1rem;
        flex-shrink: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .header-brand {
        flex: 1;
        min-width: 0;
        gap: 0.375rem;
    }
    
    .app-logo {
        height: 20px;
        flex-shrink: 0;
    }
    
    .header-actions {
        gap: 0.375rem;
    }
    
    .install-button {
        padding: 0.375rem;
    }
    
    .install-button-text {
        display: none;
    }
    
    .install-button svg {
        width: 20px;
        height: 20px;
    }
    
    .theme-toggle {
        padding: 0.375rem;
        flex-shrink: 0;
    }
    
    .theme-toggle svg {
        width: 20px;
        height: 20px;
    }
    
    .main-content {
        padding: 0.5rem;
        padding-bottom: 100px;
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
    }
    
    .sidebar-nav,
    .content-column,
    .preview-column {
        width: 100%;
        max-width: calc(100vw - 1rem);
    }
    
    .card {
        padding: 0.75rem;
        border-radius: var(--radius-sm);
        box-shadow: none;
        border: 1px solid var(--border-color);
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .input-panel,
    .customization-panel,
    .preview-panel,
    .history-panel {
        margin: 0;
        width: 100%;
        max-width: calc(100vw - 1rem);
    }
    
    .section-title {
        font-size: 0.9375rem;
    }
    
    .form-label {
        font-size: 0.8125rem;
    }
    
    .form-input,
    .form-select,
    .form-textarea {
        padding: 0.625rem;
        font-size: 16px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.8125rem;
        width: 100%;
    }
    
    .btn svg {
        width: 18px;
        height: 18px;
    }
    
    .color-input-wrapper {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        max-width: 100%;
    }
    
    .form-color {
        width: 100%;
        max-width: 100%;
        height: 40px;
        box-sizing: border-box;
    }
    
    .qr-preview {
        min-height: 200px;
        padding: 1rem;
        overflow: hidden;
    }
    
    #qrcode {
        max-width: 200px;
        margin: 0 auto;
    }
    
    .preview-placeholder svg {
        width: 60px;
        height: 60px;
    }
    
    .preview-placeholder p {
        font-size: 0.8125rem;
    }
    
    .history-item {
        padding: 1rem;
        gap: 0.875rem;
    }
    
    .history-item-preview {
        width: 56px;
        height: 56px;
    }
    
    .history-item-actions {
        opacity: 1;
        position: absolute;
        right: 0.75rem;
        top: 50%;
        transform: translateY(-50%);
    }
    
    .history-item-details {
        padding-right: 80px;
    }
    
    .history-action-btn {
        padding: 0.5rem;
    }
    
    .history-action-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .history-item-type {
        font-size: 0.6875rem;
    }
    
    .history-item-content {
        font-size: 0.8125rem;
    }
    
    .history-item-date {
        font-size: 0.6875rem;
    }
    
    .notification {
        padding: 0.75rem 1rem;
    }
    
    .notification-message {
        font-size: 0.8125rem;
    }
}

@media screen and (min-width: 1600px) {
    .main-content {
        max-width: 1800px;
        grid-template-columns: 280px 1fr 1fr;
    }
    
    .sidebar-nav,
    .content-column,
    .preview-column {
        gap: 2rem;
    }
    
    .card {
        padding: 2rem;
    }
    
    .section-title {
        font-size: 1.25rem;
        margin-bottom: 1.5rem;
    }
    
    .form-group {
        margin-bottom: 1.5rem;
    }
    
    .form-input,
    .form-select,
    .form-textarea {
        padding: 1rem;
        font-size: 1rem;
    }
    
    .btn {
        padding: 1rem 2rem;
        font-size: 1rem;
    }
    
    .qr-preview {
        min-height: 400px;
    }
    
    .history-list {
        max-height: 600px;
    }
}

@media (hover: none) and (pointer: coarse) {
    .btn:active {
        transform: scale(0.98);
    }
    
    .history-item:active {
        background-color: var(--bg-hover);
        transform: scale(0.98);
    }
    
    .form-range::-webkit-slider-thumb {
        width: 24px;
        height: 24px;
    }
    
    .form-range::-moz-range-thumb {
        width: 24px;
        height: 24px;
    }
}

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

@media print {
    .app-header,
    .input-panel,
    .customization-panel,
    .action-buttons,
    .history-panel,
    .notification {
        display: none !important;
    }
    
    .main-content {
        display: block;
        padding: 0;
        padding-bottom: 100px;
    }
    
    .preview-panel {
        border: none;
        box-shadow: none;
        padding: 0;
    }
    
    .qr-preview {
        background: white;
        padding: 2cm;
    }
    
    .qr-code-container canvas,
    .qr-code-container img {
        box-shadow: none;
        border: 1px solid #000;
    }
}

@supports (backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px)) {
    .app-header {
        background-color: rgba(255, 255, 255, 0.8);
    }
    
    [data-theme="dark"] .app-header {
        background-color: rgba(28, 28, 30, 0.8);
    }
}

@media screen and (orientation: landscape) and (max-height: 600px) {
    .app-header {
        position: relative;
    }
    
    .main-content {
        grid-template-columns: 1fr 1fr;
        padding: 1rem;
    }
    
    .qr-preview {
        min-height: 200px;
    }
    
    .history-list {
        max-height: none;
    }
    
    .history-item {
        border-radius: 0;
        margin-bottom: 0;
        border-left: none;
        border-right: none;
        border-top: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .history-item:first-child {
        border-top: 1px solid var(--border-color);
    }
    
    .history-item:not(:last-child)::after {
        display: none;
    }
}