* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

:root {
    --primary: #4d8eff;
    --secondary: #8a3ffc;
    --background: #121212;
    --surface: #1e1e1e;
    --text: #f0f0f0;
    --text-secondary: #aaaaaa;
    --border: #444444;
    --shadow: rgba(0, 0, 0, 0.3);
    --success: #66bb6a;
    --warning: #ffb74d;
    --danger: #f48fb1;
}

.light-mode {
    --primary: #2575fc;
    --secondary: #6a11cb;
    --background: #f8f9ff;
    --surface: #ffffff;
    --text: #333333;
    --text-secondary: #666666;
    --border: #e1e1e1;
    --shadow: rgba(0, 0, 0, 0.1);
    --success: #4CAF50;
    --warning: #ff9800;
    --danger: #e91e63;
}

.colorful-mode {
    --primary: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    --secondary: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
    --background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --surface: rgba(255, 255, 255, 0.95);
    --text: #333333;
    --text-secondary: #666666;
    --border: rgba(37, 117, 252, 0.2);
    --shadow: rgba(0, 0, 0, 0.1);
    --success: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
    --warning: linear-gradient(135deg, #ff9800 0%, #ef6c00 100%);
    --danger: linear-gradient(135deg, #e91e63 0%, #ad1457 100%);
}

body {
    background: var(--background);
    color: var(--text);
    min-height: 100vh;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    -webkit-tap-highlight-color: transparent;
}

.container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
}

.header-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    width: 100%;
    flex-wrap: wrap;
    gap: 15px;
}

.language-selector {
    display: flex;
    gap: 10px;
    align-items: center;
}

.lang-btn {
    padding: 10px 15px;
    border-radius: 50px;
    border: 2px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 70px;
    justify-content: center;
}

.lang-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.flag-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px;
    background: var(--surface);
    border-radius: 20px;
    box-shadow: 0 10px 30px var(--shadow);
    width: 100%;
}

h1 {
    color: var(--primary);
    font-size: 2.2rem;
    margin-bottom: 10px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.5;
}

.app-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-bottom: 30px;
}

.input-section, .output-section {
    background: var(--surface);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px var(--shadow);
}

.form-group {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text);
    font-size: 1rem;
}

input, select, textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    background: var(--surface);
    color: var(--text);
    transition: all 0.3s;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(77, 142, 255, 0.2);
}

.type-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 25px;
}

.type-option {
    padding: 20px 10px;
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 110px;
}

.type-option:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
}

.type-option.active {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
}

.type-option i {
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.type-option span {
    font-size: 0.95rem;
    font-weight: 600;
}

.type-form {
    display: none;
    animation: fadeIn 0.5s;
}

.type-form.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.country-dropdown {
    position: relative;
    width: 100%;
    margin-bottom: 20px;
}

.country-select {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    background: var(--surface);
    color: var(--text);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23888' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 12px;
    padding-right: 40px;
}

.phone-input-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
}

.country-code-display {
    flex-shrink: 0;
    padding: 15px;
    background: rgba(77, 142, 255, 0.1);
    border-radius: 10px;
    font-weight: bold;
    min-width: 80px;
    text-align: center;
    border: 2px solid var(--border);
    font-size: 1.1rem;
}

.phone-number-input {
    flex: 1;
    font-size: 1.1rem;
    letter-spacing: 1px;
}

.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 15px;
}

.preset-btn {
    padding: 12px 18px;
    background: rgba(77, 142, 255, 0.1);
    border: 1px solid rgba(77, 142, 255, 0.3);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    color: var(--text);
    border: none;
    font-weight: 500;
}

.preset-btn:hover {
    background: rgba(77, 142, 255, 0.2);
    transform: translateY(-2px);
}

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

.style-section {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px solid var(--border);
}

.style-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 15px;
}

.style-option {
    padding: 15px;
    border: 2px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s;
    background: var(--surface);
}

.style-option:hover {
    border-color: var(--primary);
}

.style-option.active {
    border-color: var(--primary);
    background: rgba(77, 142, 255, 0.1);
}

.color-options {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
    justify-content: center;
}

.color-option {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.3s;
    border: 3px solid transparent;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.active {
    border-color: var(--text);
    transform: scale(1.1);
}

/* Исправляем основной контейнер QR-кода - убираем overflow: hidden */
.qr-container {
    width: 100%;
    max-width: 300px;
    height: 300px;
    margin: 25px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 15px;
    padding: 15px; /* Уменьшаем padding чтобы было больше места для QR-кода */
    box-shadow: 0 5px 15px var(--shadow);
    /* Убираем overflow: hidden !!! */
}

/* Обеспечиваем адаптивность для мобильных */
@media (max-width: 768px) {
    .qr-container {
        max-width: 250px;
        height: 250px;
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .qr-container {
        max-width: 220px;
        height: 220px;
        padding: 10px;
    }
}

/* Для очень маленьких экранов */
@media (max-width: 360px) {
    .qr-container {
        max-width: 200px;
        height: 200px;
        padding: 8px;
    }
}

/* Усиливаем ограничения для изображения QR-кода */
#qrcode {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible; /* Разрешаем изображению выходить за пределы контейнера */
}

#qrcode canvas,
#qrcode img {
    max-width: 100% !important;
    max-height: 100% !important;
    width: 100% !important; /* Заставляем занимать всю доступную ширину */
    height: auto !important;
    object-fit: contain; /* Сохраняет пропорции, заполняя контейнер */
    display: block;
}

/* Альтернативный вариант - если предыдущий не работает */
/* Этот вариант создаст "внутренний" контейнер для изображения */
.qr-inner {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-inner img,
.qr-inner canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Обновляем стили для блока с информацией */
.output-section {
    display: flex;
    flex-direction: column;
}

.output-section h3 {
    order: 1;
}

.qr-preview {
    order: 2;
    margin-top: 10px;
    margin-bottom: 15px;
    text-align: center;
    padding: 12px 15px;
    background: rgba(77, 142, 255, 0.1);
    border-radius: 12px;
    border-left: 4px solid var(--primary);
    width: 100%;
    font-size: 0.95rem;
}

.qr-container {
    order: 3;
    margin-bottom: 20px;
}

/* Обновляем стили для мобильных */
@media (max-width: 768px) {
    .qr-preview {
        padding: 10px 12px;
        font-size: 0.9rem;
        margin-top: 5px;
        margin-bottom: 15px;
    }
}

/* Если проблема сохраняется, попробуйте этот вариант */
/* Принудительно уменьшаем QR-код если он генерируется слишком большим */
.force-qr-fit img,
.force-qr-fit canvas {
    transform: scale(0.95); /* Немного уменьшаем */
    transform-origin: center;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 30px;
    width: 100%;
}

.action-btn {
    padding: 18px 25px;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
}

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

.generate-btn:hover {
    opacity: 0.9;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(77, 142, 255, 0.3);
}

.download-btn {
    background: var(--success);
    color: white;
}

.download-btn:hover {
    opacity: 0.9;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(102, 187, 106, 0.3);
}

.download-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.instructions {
    background: var(--surface);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 30px var(--shadow);
    margin-top: 30px;
    margin-bottom: 20px;
}

.instructions h3 {
    color: var(--primary);
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.instructions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.instruction-card {
    padding: 20px;
    background: rgba(77, 142, 255, 0.05);
    border-radius: 12px;
    border-top: 4px solid var(--primary);
}

.instruction-card i {
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 12px;
}

.instruction-card h4 {
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.instruction-card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.theme-panel {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
    margin-bottom: 20px;
    padding: 15px;
    width: 100%;
    flex-wrap: wrap;
}

.theme-btn {
    padding: 12px 20px;
    border-radius: 10px;
    border: 2px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: 1rem;
    transition: all 0.3s;
}

.theme-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.theme-btn:hover {
    transform: translateY(-2px);
}

.page-footer {
    text-align: center;
    margin-top: 20px;
    color: var(--text);
    padding: 20px;
    width: 100%;
    font-size: 0.95rem;
    border-top: 1px solid var(--border);
}

.developer-info {
    margin-top: 10px;
    line-height: 1.5;
}

.developer-info a {
    color: var(--primary);
    text-decoration: none;
    display: inline-block;
    margin-top: 5px;
}

.developer-info a:hover {
    text-decoration: underline;
}

.error-message {
    color: var(--danger);
    font-size: 0.9rem;
    margin-top: 5px;
    display: none;
}

.error-message.show {
    display: block;
}

.install-prompt {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--surface);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    z-index: 1000;
    display: none;
    max-width: 300px;
    border-left: 5px solid var(--primary);
}

.install-prompt.show {
    display: block;
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.install-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    margin-top: 10px;
    display: inline-block;
}

.close-install {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
}

.text-center {
    text-align: center;
}

@media (max-width: 768px) {
    .container {
        padding: 0 10px;
    }
    
    header {
        padding: 20px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .type-selector {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .type-option {
        min-height: 100px;
        padding: 15px 8px;
    }
    
    .type-option i {
        font-size: 1.5rem;
    }
    
    .qr-container {
        width: 250px;
        height: 250px;
    }
    
    .instructions-grid {
        grid-template-columns: 1fr;
    }
    
    .header-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .language-selector {
        justify-content: center;
    }
    
    .install-prompt {
        left: 20px;
        right: 20px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .type-selector {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .qr-container {
        width: 220px;
        height: 220px;
    }
    
    .preset-buttons {
        flex-direction: column;
    }
    
    .preset-btn {
        justify-content: center;
    }
    
    .theme-panel {
        flex-direction: column;
        align-items: center;
    }
    
    .theme-btn {
        width: 100%;
        max-width: 200px;
        justify-content: center;
    }
}

@media (max-width: 360px) {
    .type-selector {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .type-option span {
        font-size: 0.85rem;
    }
}
/* Добавьте в конец файла */
.time-info {
    margin: 10px 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.time-info i {
    color: var(--primary);
}

#time-zone {
    font-size: 0.8rem;
    opacity: 0.8;
}

.theme-auto-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 5px;
    text-align: center;
    opacity: 0.7;
}