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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #0d1117;
    color: #c9d1d9;
    line-height: 1.6;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.container {
    max-width: 800px;
    width: 100%;
    background-color: #161b22;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    border: 1px solid #30363d;
}

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

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

.theme-selector label {
    font-weight: 600;
    color: #f0f6fc;
    margin-right: 10px;
}

.theme-selector select {
    background-color: #21262d;
    color: #c9d1d9;
    border: 1px solid #30363d;
    padding: 8px 15px;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}

.theme-selector select:hover {
    background-color: #30363d;
    border-color: #8b949e;
}

.theme-selector select:focus {
    outline: none;
    border-color: #58a6ff;
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}

.logo {
    max-width: 200px;
    height: auto;
    margin-bottom: 15px;
}

h1 {
    color: #f0f6fc;
    font-size: 1.8rem;
    margin: 0;
}

.password-display {
    background-color: #0d1117;
    padding: 40px 20px 20px 20px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 20px;
    border: 2px solid #30363d;
    overflow: visible;
}

.password-container {
    position: relative;
    display: block;
    margin-bottom: 15px;
    width: 100%;
    overflow: visible;
}

#generated-password {
    display: block;
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    font-weight: bold;
    color: #58a6ff;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
    white-space: nowrap;
    overflow-x: auto;
    cursor: pointer;
    transition: transform 0.2s, color 0.2s;
    user-select: none;
    padding: 10px 15px;
    border-radius: 6px;
    max-width: 100%;
}

/* Dark mode scrollbar styling */
#generated-password::-webkit-scrollbar {
    height: 8px;
}

#generated-password::-webkit-scrollbar-track {
    background: #21262d;
    border-radius: 4px;
}

#generated-password::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 4px;
}

#generated-password::-webkit-scrollbar-thumb:hover {
    background: #484f58;
}

#generated-password:hover {
    color: #79c0ff;
    transform: scale(1.02);
    background-color: rgba(88, 166, 255, 0.1);
}

#generated-password:active {
    transform: scale(0.98);
}

.copy-tooltip {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #238636;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
}

.copy-tooltip.show {
    opacity: 1;
    transform: translateX(-50%) translateY(-5px);
}



.password-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.primary-btn, .secondary-btn {
    padding: 10px 20px;
    font-size: 0.9rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

.primary-btn {
    background-color: #238636;
    color: white;
    min-width: 150px;
}

.primary-btn:hover {
    background-color: #2ea043;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(35, 134, 54, 0.3);
}

.secondary-btn {
    background-color: #21262d;
    color: #c9d1d9;
    border: 1px solid #30363d;
}

.secondary-btn:hover {
    background-color: #30363d;
    border-color: #8b949e;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.setting-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    position: relative;
}

.setting-group:first-child {
    padding-top: 15px;
}

.setting-group label {
    font-weight: 600;
    white-space: nowrap;
}

.setting-group input[type="range"] {
    width: 100px;
    height: 6px;
    background: #30363d;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.setting-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #58a6ff;
    border-radius: 50%;
    cursor: pointer;
}

.setting-group input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #58a6ff;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.length-value {
    font-weight: 600;
    color: #f0f6fc;
    min-width: 20px;
    display: inline-block;
    text-align: center;
}

.length-display {
    color: #8b949e;
    font-size: 0.85rem;
    display: block;
    font-weight: 600;
    position: absolute;
    top: -15px;
    left: 0;
    width: 100%;
}

.format-buttons {
    display: flex;
    gap: 5px;
}

.format-btn {
    padding: 6px 12px;
    border: 1px solid #30363d;
    background-color: #21262d;
    color: #c9d1d9;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.format-btn:hover {
    background-color: #30363d;
    border-color: #8b949e;
}

.format-btn.active {
    background-color: #58a6ff;
    color: #0d1117;
    border-color: #58a6ff;
    font-weight: 600;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.option-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background-color: #21262d;
    border: 1px solid #30363d;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.option-toggle:hover {
    background-color: #30363d;
    border-color: #8b949e;
}

.option-toggle input[type="checkbox"] {
    margin: 0;
}

.option-toggle span {
    font-weight: 500;
}

.position-controls {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 15px;
    margin-bottom: 20px;
}

.position-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.position-group label {
    font-weight: 600;
    color: #8b949e;
    font-size: 0.9rem;
}

.position-group select {
    background-color: #21262d;
    color: #c9d1d9;
    border: 1px solid #30363d;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.position-group select:hover {
    background-color: #30363d;
    border-color: #8b949e;
}

.position-group select:focus {
    outline: none;
    border-color: #58a6ff;
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}

.batch-section {
    margin-top: 20px;
}

details {
    background-color: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 12px;
}

summary {
    cursor: pointer;
    font-weight: 600;
    color: #f0f6fc;
    outline: none;
    user-select: none;
}

summary:hover {
    color: #58a6ff;
}

.batch-content {
    margin-top: 15px;
}

.batch-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.batch-btn {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #30363d;
    background-color: #21262d;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    color: #c9d1d9;
    transition: all 0.2s;
}

.batch-btn:hover {
    background-color: #30363d;
    border-color: #8b949e;
    color: #f0f6fc;
}

#batch-passwords-list {
    margin-top: 15px;
}

#batch-passwords-list h4 {
    margin-bottom: 10px;
    color: #f0f6fc;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.batch-actions {
    display: flex;
    gap: 10px;
}

#batch-passwords-list ul {
    list-style: none;
    max-height: 200px;
    overflow-y: auto;
    background-color: #161b22;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 10px;
}

#batch-passwords-list li {
    padding: 6px 10px;
    margin-bottom: 4px;
    background-color: #0d1117;
    border: 1px solid #30363d;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    color: #58a6ff;
    word-break: break-all;
    overflow-wrap: break-word;
}

.download-batch-btn, .copy-batch-btn {
    padding: 6px 12px;
    font-size: 0.85rem;
    background-color: #238636;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.download-batch-btn:hover, .copy-batch-btn:hover {
    background-color: #2ea043;
}

.copy-batch-btn {
    background-color: #21262d;
    border: 1px solid #30363d;
}

.copy-batch-btn:hover {
    background-color: #30363d;
    border-color: #8b949e;
}

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

.footer p {
    color: #8b949e;
    font-size: 0.9rem;
    margin: 0;
}

.footer a {
    color: #58a6ff;
    text-decoration: none;
    font-weight: 600;
}

.footer a:hover {
    color: #79c0ff;
    text-decoration: underline;
}

@media (max-width: 768px) {
    .container {
        max-width: 95%;
        padding: 20px;
    }
    
    #generated-password {
        font-size: clamp(1rem, 2vw, 1.4rem);
        padding: 8px 12px;
    }
    
    .password-preview {
        font-size: clamp(1rem, 2vw, 1.4rem);
        padding: 15px 10px;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 20px;
    }
    
    .logo {
        max-width: 150px;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    #generated-password {
        font-size: clamp(0.9rem, 1.8vw, 1.2rem);
        letter-spacing: 0.5px;
        padding: 8px 10px;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .options-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .primary-btn {
        width: 100%;
    }
    
    .password-preview {
        font-size: clamp(0.9rem, 1.8vw, 1.2rem);
        padding: 15px 8px;
    }
    
    .modal-content {
        padding: 20px;
        width: 95%;
    }
    
    #batch-passwords-list li {
        font-size: 0.85rem;
        padding: 5px 8px;
    }
    
    .position-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .position-group {
        width: 100%;
        justify-content: space-between;
    }
}

/* Memory Game Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: #161b22;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    border: 1px solid #30363d;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
}

.modal-content h2 {
    color: #f0f6fc;
    text-align: center;
    margin-bottom: 20px;
}

.countdown {
    font-size: 4rem;
    font-weight: bold;
    color: #58a6ff;
    text-align: center;
    margin: 20px 0;
    animation: countdownPulse 1s ease-in-out;
}

@keyframes countdownPulse {
    0% {
        transform: scale(0.9);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.password-preview {
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    font-weight: bold;
    color: #58a6ff;
    font-family: 'Courier New', monospace;
    text-align: center;
    padding: 20px 15px;
    margin: 20px 0;
    background-color: rgba(88, 166, 255, 0.1);
    border-radius: 8px;
    border: 2px dashed #58a6ff;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    white-space: nowrap;
    overflow-x: auto;
    max-width: 100%;
}

/* Dark mode scrollbar for password preview */
.password-preview::-webkit-scrollbar {
    height: 8px;
}

.password-preview::-webkit-scrollbar-track {
    background: rgba(33, 38, 45, 0.5);
    border-radius: 4px;
}

.password-preview::-webkit-scrollbar-thumb {
    background: rgba(88, 166, 255, 0.3);
    border-radius: 4px;
}

.password-preview::-webkit-scrollbar-thumb:hover {
    background: rgba(88, 166, 255, 0.5);
}


.memory-input {
    width: 100%;
    padding: 15px;
    font-size: 1.5rem;
    font-family: 'Courier New', monospace;
    background-color: #0d1117;
    color: #c9d1d9;
    border: 2px solid #238636;
    border-radius: 8px;
    margin: 20px 0 10px 0;
    text-align: center;
}

.memory-input::before {
    content: 'YOUR ANSWER';
    position: absolute;
    top: -10px;
    left: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #238636;
    background-color: #161b22;
    padding: 0 8px;
    letter-spacing: 1px;
}

.memory-input:focus {
    outline: none;
    border-color: #58a6ff;
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}

#check-answer-btn {
    margin-top: 0;
}

.test-feedback {
    text-align: center;
    font-size: 1.2rem;
    margin: 20px 0;
    min-height: 30px;
}

.test-feedback.success {
    color: #28a745;
}

.test-feedback.error {
    color: #dc3545;
}

.test-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 20px 0;
}

.hidden {
    display: none !important;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes confetti {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) rotate(720deg);
        opacity: 0;
    }
}

.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    background-color: #58a6ff;
    animation: confetti 1s ease-out forwards;
}