* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    background: linear-gradient(135deg, #408CAF 0%, #408CAF 100%);
    padding: 10px;
    padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
}

.container {
    width: 100%;
    max-width: 600px;
    min-height: 600px;
    background-color: #fff;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    padding: 20px;
}

.header {
    text-align: center;
    margin-bottom: 20px;
}

h1 {
    font-size: 28px;
    color: #333;
    margin-bottom: 15px;
    font-weight: 700;
}

.header-image {
    max-width: 40%;
    height: auto;
    border-radius: 10px;
}

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.tab-button {
    flex: 1;
    min-height: 44px;
    padding: 12px 16px;
    background-color: transparent;
    color: #666;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.tab-button.active {
    color: #408CAF;
    border-bottom-color: #408CAF;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

h4 {
    color: #555;
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: 600;
}

.checkbox-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
    margin-bottom: 15px;
    max-height: 200px;
    overflow-y: auto;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
}

.checkbox-container label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.checkbox-container label:has(input:checked) {
    background-color: #e3eff5;
}

.checkbox-container input[type="checkbox"] {
    flex-shrink: 0;
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: #408CAF;
}

textarea {
    width: 100%;
    min-height: 80px;
    margin-bottom: 15px;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 15px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    resize: vertical;
    transition: border-color 0.3s ease;
    line-height: 1.5;
}

textarea:focus {
    outline: none;
    border-color: #408CAF;
}

.generate-button {
    position: sticky;
    bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 1;
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #408CAF 0%, #2d6580 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 6px rgba(64, 140, 175, 0.3);
}

.generate-button:active {
    transform: scale(0.98);
}

@media (hover: hover) {
    .tab-button:hover {
        color: #408CAF;
    }

    .generate-button:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 12px rgba(64, 140, 175, 0.4);
    }

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

.animation-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
}

.animation {
    max-width: 30%;
    height: auto;
}

.hidden {
    display: none;
}

.pairs-output {
    margin-top: 20px;
    scroll-margin-top: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 10px;
    min-height: 50px;
}

.pairs-output p {
    padding: 10px;
    margin: 8px 0;
    background-color: white;
    border-left: 4px solid #408CAF;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 500;
    color: #333;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
    text-align: center;
}

footer p {
    font-size: 12px;
    color: #999;
    margin: 0;
}

/* Mobile responsiveness */
@media (max-width: 600px) {
    body {
        padding: 5px;
    }

    .container {
        border-radius: 15px;
        padding: 15px;
    }

    h1 {
        font-size: 24px;
    }

    .header-image {
        max-width: 36%;
    }

    .tab-button {
        font-size: 13px;
        padding: 10px 6px;
    }

    .checkbox-container {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 4px;
        max-height: none;
        overflow-y: visible;
        padding: 6px;
    }

    .checkbox-container label {
        min-height: 44px;
        padding: 4px 8px;
        font-size: 15px;
    }

    .checkbox-container input[type="checkbox"] {
        width: 22px;
        height: 22px;
    }

    textarea {
        min-height: 60px;
        font-size: 16px;
    }

    .generate-button {
        min-height: 52px;
        font-size: 17px;
        padding: 12px;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    }

    .pairs-output p {
        font-size: 14px;
    }

    footer {
        margin-top: 20px;
        padding-top: 15px;
    }

    footer p {
        font-size: 11px;
    }
}