* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    padding: 24px;
    max-width: 900px;
    width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 600px;
    margin: 0 auto;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.header-top {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    margin-bottom: 10px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    grid-column: 2;
}

.logo-icon {
    font-size: 2em;
    animation: pulse 2s infinite;
}

.logo-text {
    font-size: 2em;
    font-weight: 700;
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tagline {
    color: #6b7280;
    font-size: 0.95em;
}

/* Switch Page Button */
.btn-switch-page {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9em;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    justify-self: end;
    grid-column: 3;
}

.btn-switch-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.btn-switch-page:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-switch-page:hover::before {
    left: 100%;
}

.btn-switch-page:active {
    transform: translateY(0);
}

.btn-switch-page span {
    font-size: 1.2em;
}

/* Main Content */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
    max-width: 100%;
}

/* Input Section */
.input-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    max-width: 100%;
    flex-shrink: 0;
    overflow: hidden;
}

.input-section label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 10px;
}

.label-icon {
    font-size: 1.2em;
}

.textarea-wrapper {
    position: relative;
    display: flex;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s;
    min-height: 120px;
}

.textarea-wrapper:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.line-numbers {
    background: #f3f4f6;
    color: #9ca3af;
    padding: 12px 8px;
    text-align: right;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
    font-size: 14px;
    line-height: 1.428571;
    user-select: none;
    min-width: 35px;
    overflow-y: hidden;
    white-space: pre-line;
    letter-spacing: 0.3px;
    min-height: 120px;
    position: relative;
}

/* Line number items */
.line-numbers .line-num {
    padding: 0 4px;
    border-radius: 3px;
    transition: all 0.2s;
    line-height: 1.428571;
    cursor: pointer;
}

.line-numbers .line-num:hover {
    background: #e5e7eb;
    color: #374151;
    font-weight: 600;
}

/* Highlight active line */
.line-numbers .line-num.active {
    background: #667eea;
    color: white;
    font-weight: 600;
}

textarea {
    flex: 1;
    padding: 12px;
    border: none;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
    font-size: 14px;
    resize: none;
    min-height: 120px;
    line-height: 1.428571;
    background: transparent;
    letter-spacing: 0.3px;
    overflow-y: hidden;
}

textarea:focus {
    outline: none;
}

/* Buttons */
.action-buttons {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.btn-generate, .btn-clear, .btn-copy-all {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    min-height: 44px;
}

.btn-generate {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    flex: 1;
    min-width: 120px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.btn-generate:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-clear {
    background: #fef2f2;
    color: #dc2626;
    width: 90px;
    box-shadow: 0 1px 3px rgba(220, 38, 38, 0.1);
}

.btn-clear:hover {
    background: #fee2e2;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.2);
}

.btn-copy-all {
    background: #f3f4f6;
    color: #374151;
    width: 130px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-copy-all:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Codes Display */
.codes-display {
    background: #fafafa;
    border-radius: 12px;
    padding: 16px;
    border: 1px solid #e5e7eb;
    overflow: visible;
    display: flex;
    flex-direction: column;
    flex: 1;
    container-type: inline-size;
}

.codes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    position: relative;
}

.codes-header h3 {
    color: #1f2937;
    font-size: 1.05em;
    font-weight: 700;
}

.timer {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #6b7280;
    font-size: 0.9em;
}

.timer-icon {
    animation: rotate 30s linear infinite;
}

/* Codes List */
.codes-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    padding: 2px;
}

/* Custom scrollbar */
.codes-list::-webkit-scrollbar {
    width: 6px;
}

.codes-list::-webkit-scrollbar-track {
    background: transparent;
}

.codes-list::-webkit-scrollbar-thumb {
    background: #e5e7eb;
    border-radius: 3px;
}

.codes-list::-webkit-scrollbar-thumb:hover {
    background: #cbd5e1;
}

.code-item {
    background: white;
    padding: 12px 16px;
    padding-left: 48px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 0;
    transition: all 0.3s;
    position: relative;
    min-height: 56px;
    overflow: visible;
    max-width: 100%;
    animation: slideIn 0.3s ease-out;
}

.code-item:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

/* Highlight code item when line number is clicked */
.code-item.highlight {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
    background: #f5f3ff;
}

.line-number {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    color: #6b7280;
    font-weight: 600;
    padding: 3px 6px;
    border-radius: 6px;
    font-size: 0.75em;
    min-width: 26px;
    text-align: center;
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.code-info {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    justify-content: space-between;
}

.code-secret {
    font-family: 'Courier New', monospace;
    font-size: 0.8em;
    color: #9ca3af;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1 1 auto;
    min-width: 120px;
    max-width: 300px;
}

.code-value {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: 'Courier New', monospace;
    font-size: 1.4em;
    font-weight: 800;
    letter-spacing: 2px;
    text-shadow: 0 2px 4px rgba(102, 126, 234, 0.1);
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    white-space: nowrap;
    min-width: 90px;
}

/* When secret is shown, push code to right */
.code-secret + .code-value {
    margin-left: auto;
}

/* When secret is hidden, code value takes more space */
.code-info:not(:has(.code-secret)) .code-value {
    margin-left: 0;
    flex: 0 0 auto;
}

.copy-single {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 0.85em;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 32px;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 12px;
}

.copy-single:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* Copied state animation */
.copy-single.copied {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-color: transparent;
    animation: copySuccess 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

@keyframes copySuccess {
    0% {
        transform: scale(1);
    }
    30% {
        transform: scale(1.15);
    }
    50% {
        transform: scale(0.95);
    }
    70% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Empty Message */
.empty-message {
    text-align: center;
    padding: 80px 40px;
    color: #9ca3af;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
}

.empty-message p {
    max-width: 400px;
    line-height: 1.6;
    font-size: 1.05em;
    color: #6b7280;
}

.empty-icon {
    font-size: 4em;
    display: block;
    margin-bottom: 20px;
    opacity: 0.7;
}

/* Settings Section */
.settings-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.toggle-group {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.toggle-slider {
    width: 44px;
    height: 24px;
    background: #e5e7eb;
    border-radius: 24px;
    position: relative;
    transition: background 0.3s;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform 0.3s;
}

input[type="checkbox"]:checked + .toggle-slider {
    background: #667eea;
}

input[type="checkbox"]:checked + .toggle-slider::after {
    transform: translateX(20px);
}

input[type="checkbox"] {
    display: none;
}

.toggle-text {
    color: #6b7280;
    font-size: 0.85em;
    font-weight: 500;
}

/* Animations */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes slideIn {
    from { 
        transform: translateY(-20px);
        opacity: 0;
    }
    to { 
        transform: translateY(0);
        opacity: 1;
    }
}

.pulse {
    animation: pulse 0.5s ease-in-out;
}

/* Horizontal Layout */
body.horizontal-layout .container {
    max-width: 1200px;
}

body.horizontal-layout .main-content {
    display: grid;
    grid-template-columns: minmax(340px, 380px) 1fr;
    gap: 20px;
    align-items: start;
}

/* Default grid for horizontal layout */
body.horizontal-layout .codes-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 12px;
    align-content: start;
}

/* Use grid for 10+ items - responsive rows */
body.horizontal-layout .codes-list.many-columns {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(5, auto);
    grid-auto-columns: minmax(340px, 1fr);
    gap: 8px 16px;
    overflow-x: auto;
    overflow-y: visible;
    padding: 4px;
    align-items: start;
    justify-content: start;
}

/* Smart responsive - show all items without scroll */
@media (max-width: 1400px) {
    body.horizontal-layout .codes-list.many-columns {
        grid-auto-flow: row;
        grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
        grid-template-rows: none;
        grid-auto-columns: unset;
        overflow: visible;
    }
}

/* When half screen or smaller - single column NO SCROLL */
@media (max-width: 1000px) {
    body.horizontal-layout .codes-list.many-columns {
        display: flex;
        flex-direction: column;
        gap: 8px;
        overflow: visible;
    }
}

/* Mobile - normal flex column */
@media (max-width: 768px) {
    body.horizontal-layout .codes-list.many-columns {
        display: flex;
        flex-direction: column;
        gap: 8px;
        overflow: visible;
    }
}

body.horizontal-layout .codes-list.many-columns .code-item {
    width: 100%;
    margin: 0;
}

/* Container queries for smarter responsive */
@container (max-width: 900px) {
    body.horizontal-layout .codes-list.many-columns {
        grid-auto-flow: row;
        grid-template-columns: 1fr;
        grid-template-rows: none;
        overflow: visible;
    }
}

@container (max-width: 600px) {
    body.horizontal-layout .codes-list.many-columns {
        display: flex;
        flex-direction: column;
        overflow: visible;
    }
}

/* Custom scrollbar for many-columns */
body.horizontal-layout .codes-list.many-columns::-webkit-scrollbar {
    height: 8px;
}

body.horizontal-layout .codes-list.many-columns::-webkit-scrollbar-thumb {
    background: #e5e7eb;
    border-radius: 4px;
}

body.horizontal-layout .codes-list.many-columns::-webkit-scrollbar-thumb:hover {
    background: #cbd5e1;
}

/* Keep action buttons horizontal in horizontal layout */
body.horizontal-layout .action-buttons {
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 6px !important;
}

body.horizontal-layout .action-buttons button {
    width: auto !important;
    padding: 10px 16px !important;
    font-size: 0.9em !important;
}

body.horizontal-layout .btn-generate {
    flex: 1 !important;
    max-width: none !important;
    min-width: 100px !important;
}

body.horizontal-layout .btn-clear {
    width: auto !important;
    min-width: 70px !important;
    flex-shrink: 0 !important;
}

body.horizontal-layout .btn-copy-all {
    width: auto !important;
    min-width: 100px !important;
    flex-shrink: 0 !important;
}

/* Code items remain the same in horizontal layout */

body.horizontal-layout .code-info {
    flex-wrap: nowrap;
}

body.horizontal-layout .code-secret {
    font-size: 0.75em;
    min-width: 120px;
    max-width: 180px;
}

body.horizontal-layout .code-value {
    white-space: nowrap;
    overflow: visible;
    min-width: 85px;
    text-align: center;
}

/* Empty state in horizontal layout */
body.horizontal-layout .empty-message {
    grid-column: 1 / -1;
    min-height: 400px;
}

/* Optimize for many items (>6 but <10) */
body.horizontal-layout .codes-list.many-items:not(.many-columns) {
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 10px;
}

body.horizontal-layout .codes-list.many-items .code-secret {
    font-size: 0.7em;
    min-width: 140px;
}

body.horizontal-layout .codes-list.many-items .code-value {
    font-size: 1.3em;
}

/* Better spacing for horizontal layout on medium screens */
@media (min-width: 1024px) and (max-width: 1280px) {
    body.horizontal-layout .main-content {
        grid-template-columns: 340px 1fr;
    }
    
    body.horizontal-layout .codes-list {
        grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    }
}

/* Optimize for very large screens */
@media (min-width: 1280px) {
    body.horizontal-layout .codes-list:not(.many-columns) {
        grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    }
    
    body.horizontal-layout .codes-list.many-items:not(.many-columns) {
        grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    }
    
    body.horizontal-layout .codes-list.many-columns {
        grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    }
}

/* Dark Mode */
body.dark-mode {
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
}

body.dark-mode .container {
    background: rgba(30, 41, 59, 0.95);
    border-color: rgba(71, 85, 105, 0.3);
}

body.dark-mode header {
    border-bottom-color: rgba(71, 85, 105, 0.3);
}

body.dark-mode .input-section,
body.dark-mode .codes-display {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.8) 100%);
    border-color: rgba(71, 85, 105, 0.3);
}

body.dark-mode .code-item {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(71, 85, 105, 0.3);
}

body.dark-mode .code-item:hover {
    border-color: rgba(102, 126, 234, 0.5);
}

body.dark-mode .code-item.highlight {
    border-color: #818cf8;
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.3);
    background: rgba(67, 56, 202, 0.3);
}

body.dark-mode .line-number {
    background: rgba(71, 85, 105, 0.3);
    color: #94a3b8;
}

body.dark-mode .code-secret,
body.dark-mode .toggle-text,
body.dark-mode .tagline {
    color: #94a3b8;
}

body.dark-mode .empty-message {
    color: #64748b;
}

body.dark-mode .empty-message p {
    color: #94a3b8;
}

body.dark-mode textarea {
    background: rgba(30, 41, 59, 0.5);
    color: #e2e8f0;
}

body.dark-mode .line-numbers {
    background: rgba(71, 85, 105, 0.3);
    color: #64748b;
}

body.dark-mode label {
    color: #cbd5e1;
}

body.dark-mode h3 {
    color: #e2e8f0;
}

body.dark-mode .copy-single {
    background: linear-gradient(135deg, rgba(71, 85, 105, 0.5) 0%, rgba(51, 65, 85, 0.5) 100%);
    border-color: rgba(71, 85, 105, 0.5);
    color: #cbd5e1;
}

body.dark-mode .copy-single.copied {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.5);
}

body.dark-mode .btn-switch-page {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

body.dark-mode .btn-switch-page:hover {
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

body.dark-mode .btn-copy-all {
    background: rgba(71, 85, 105, 0.5);
    color: #cbd5e1;
}

body.dark-mode .btn-copy-all:hover {
    background: rgba(71, 85, 105, 0.7);
}

body.dark-mode .btn-clear {
    background: rgba(220, 38, 38, 0.1);
    color: #f87171;
}

body.dark-mode .btn-clear:hover {
    background: rgba(220, 38, 38, 0.2);
}

body.dark-mode .settings-section {
    border-top-color: rgba(71, 85, 105, 0.3);
}

/* Dark mode scrollbar */
body.dark-mode .codes-list::-webkit-scrollbar-thumb {
    background: rgba(71, 85, 105, 0.5);
}

body.dark-mode .codes-list::-webkit-scrollbar-thumb:hover {
    background: rgba(71, 85, 105, 0.7);
}

/* Dark mode scrollbar for many-columns */
body.dark-mode.horizontal-layout .codes-list.many-columns::-webkit-scrollbar-thumb {
    background: rgba(71, 85, 105, 0.5);
}

body.dark-mode.horizontal-layout .codes-list.many-columns::-webkit-scrollbar-thumb:hover {
    background: rgba(71, 85, 105, 0.7);
}

/* Toast Notification */
.toast-notification {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: rgba(16, 185, 129, 0.95);
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 0.9em;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.toast-notification.show {
    opacity: 1;
    transform: translateY(0);
}

body.dark-mode .toast-notification {
    background: rgba(16, 185, 129, 0.9);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }
    
    .header-top {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .logo {
        grid-column: 1;
    }
    
    .btn-switch-page {
        grid-column: 1;
        justify-self: center;
        font-size: 0.85em;
        padding: 8px 16px;
    }
    
    .logo-text {
        font-size: 1.5em;
    }
    
    .action-buttons {
        flex-direction: row;
        gap: 6px;
    }
    
    .btn-generate {
        flex: 1;
        min-width: 0;
    }
    
    .btn-clear {
        width: 70px;
    }
    
    .btn-copy-all {
        width: 90px;
    }
    
    .code-item {
        padding: 10px 14px;
        padding-left: 42px;
        min-height: 52px;
    }
    
    .code-secret {
        font-size: 0.7em;
        min-width: 100px;
        max-width: 200px;
    }
    
    .code-value {
        font-size: 1.25em;
    }
    
    .copy-single {
        padding: 5px 10px;
        height: 28px;
        font-size: 0.8em;
    }
    
    body.horizontal-layout .main-content {
        grid-template-columns: 1fr;
    }
    
    body.horizontal-layout .codes-list {
        grid-template-columns: 1fr;
    }
    
    body.horizontal-layout .codes-list.many-columns {
        display: flex;
        flex-direction: column;
        flex-wrap: nowrap;
        overflow: visible;
    }
    
    body.horizontal-layout .codes-list.many-columns .code-item {
        width: 100%;
        max-width: 100%;
    }
    
    body.horizontal-layout .code-item {
        padding: 10px 12px;
        padding-left: 40px;
    }
    
    /* Override action buttons for horizontal layout on tablet/mobile */
    body.horizontal-layout .action-buttons {
        flex-direction: row !important;
    }
    
    body.horizontal-layout .action-buttons button {
        width: auto !important;
    }
    
    body.horizontal-layout .btn-generate {
        flex: 1 !important;
        max-width: none !important;
    }
    
    body.horizontal-layout .btn-clear {
        width: 70px !important;
    }
    
    body.horizontal-layout .btn-copy-all {
        width: 100px !important;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 16px;
    }
    
    .empty-message {
        padding: 40px 20px;
        min-height: 250px;
    }
    
    .empty-icon {
        font-size: 3em;
    }
    
    .empty-message p {
        font-size: 0.95em;
    }
    
    .code-item {
        padding: 8px 10px;
        padding-left: 38px;
        min-height: 48px;
    }
    
    .code-info {
        gap: 8px;
    }
    
    .code-secret {
        font-size: 0.65em;
        min-width: 0;
        max-width: 150px;
    }
    
    .code-value {
        font-size: 1.15em;
        letter-spacing: 1px;
    }
    
    .copy-single {
        padding: 4px 8px;
        font-size: 0.75em;
        height: 26px;
        gap: 3px;
        margin-left: 6px;
    }
    
    .line-numbers {
        padding: 12px 4px;
        min-width: 25px;
        font-size: 12px;
    }
    
    .line-number {
        padding: 2px 4px;
        font-size: 0.65em;
        min-width: 22px;
    }
    
    textarea {
        font-size: 12px;
        padding: 12px 8px;
        min-height: 100px;
    }
    
    .textarea-wrapper {
        min-height: 100px;
    }
    
    .action-buttons {
        gap: 5px;
    }
    
    .btn-generate, .btn-clear, .btn-copy-all {
        padding: 8px 12px;
        font-size: 0.85em;
        min-height: 38px;
    }
    
    .btn-generate {
        flex: 1;
        min-width: 0;
    }
    
    .btn-clear {
        width: 60px;
    }
    
    .btn-copy-all {
        width: 80px;
    }
    
    body.horizontal-layout .code-item {
        padding: 8px 10px;
        padding-left: 36px;
    }
    
    /* Override action buttons for horizontal layout on small mobile */
    body.horizontal-layout .action-buttons {
        gap: 4px;
        flex-wrap: nowrap !important;
    }
    
    body.horizontal-layout .btn-generate,
    body.horizontal-layout .btn-clear,
    body.horizontal-layout .btn-copy-all {
        padding: 6px 10px;
        font-size: 0.75em;
        min-height: 34px;
    }
    
    body.horizontal-layout .btn-generate {
        flex: 1 !important;
        min-width: 0 !important;
    }
    
    body.horizontal-layout .btn-clear {
        width: 50px !important;
        flex-shrink: 0 !important;
    }
    
    body.horizontal-layout .btn-copy-all {
        width: 70px !important; 
        flex-shrink: 0 !important;
    }
}