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

:root {
    --bg-color: #f8f8f8;
    --container-bg: white;
    --text-color: black;
    --input-bg: #f8f8f8;
    --button-bg: #f0f0f0;
    --button-hover: #e0e0e0;
    --shadow-color: rgba(0,0,0,0.1);
    --footer-text-color: #666666;
}

[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --container-bg: #2d2d2d;
    --text-color: #ffffff;
    --input-bg: #3d3d3d;
    --button-bg: #404040;
    --button-hover: #505050;
    --shadow-color: rgba(0,0,0,0.3);
    --footer-text-color: #C2C2C2;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: var(--bg-color);
    color: var(--text-color);
}

.container {
    width: 100%;
    max-width: 800px;
    background-color: var(--container-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--bg-color);
}

.donate-button {
    background-color: #FF5F5F;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.2s;
}

.donate-button:hover {
    background-color: #FF4545;
}

main {
    flex: 1;
    padding: 2rem;
    width: 100%;
    display: flex;
    flex-direction: column;
}

.controls {
    flex-shrink: 0;
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    align-items: center;
    justify-content: space-between;
}

.controls-left {
    display: flex;
    gap: 0.5rem;
}

.controls-right {
    display: flex;
    gap: 0.25rem;
}

.controls button {
    padding: 0.5rem 1rem;
    border: none;
    background-color: var(--button-bg);
    color: var(--text-color);
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.controls button:hover {
    background-color: var(--button-hover);
}

.strength-bar {
    flex-shrink: 0;
    height: 8px;
    background-color: #f0f0f0;
    border-radius: 4px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.strength-fill {
    height: 100%;
    width: 0;
    background-color: #ff0000;
    transition: all 0.3s;
}

.password-container {
    position: relative;
    width: 100%;
    flex: 1;
    display: flex;
    background-color: var(--input-bg);
    border-radius: 4px;
    min-height: 150px;
    overflow: hidden;
}

#passwordInput {
    width: 100%;
    height: 100%;
    padding: 1rem;
    border: none;
    outline: none;
    resize: none;
    font-family: monospace;
    font-size: 48px;
    background-color: transparent;
    border-radius: 4px;
    color: transparent;
    caret-color: var(--text-color);
    line-height: 1.2;
    z-index: 1;
    -webkit-text-fill-color: transparent;
    user-select: none;
    letter-spacing: 0.1em;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    cursor: not-allowed;
}

#passwordInput::placeholder {
    color: #999;
    font-size: 24px;
    opacity: 1;
    -webkit-text-fill-color: #999;
    -webkit-text-security: none;
    user-select: none;
    content: "Paste your password here";
}

#passwordInput:focus {
    cursor: text;
}

.masked-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 1rem;
    font-family: monospace;
    font-size: 48px;
    line-height: 1.2;
    pointer-events: none;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    z-index: 2;
    user-select: none;
    letter-spacing: 0.1em;
}

footer {
    flex-shrink: 0;
    padding: 1rem;
    text-align: center;
    background-color: var(--container-bg);
    border-top: 2px solid var(--bg-color)
}

footer p {
    font-size: 0.85rem;
    color: var(--footer-text-color);
}


.header-buttons {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    header {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    main {
        padding: 1rem;
    }

    .header-buttons {
        width: 100%;
        justify-content: center;
    }
}

.private-warning {
    background-color: var(--container-bg);
    border-bottom: 2px solid #ff9800;
    padding: 1rem;
    position: relative;
}

.warning-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.warning-content i {
    color: #ff9800;
}

.private-button {
    background-color: var(--container-bg);
    color: var(--text-color);
    border: 1px solid #ff9800;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s;
}

.private-button:hover {
    background-color: var(--bg-color);
    color: var(--text-color);
}

.close-warning {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 0.5rem;
    margin-left: auto;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: var(--container-bg);
    padding: 2rem;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
}

.modal-content h3 {
    margin-bottom: 1rem;
}

.modal-content p {
    margin-bottom: 1rem;
}

.modal-content ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.modal-content li {
    margin-bottom: 0.5rem;
}

.modal-content code {
    background-color: var(--input-bg);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: monospace;
}

.modal-content button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 1rem;
}

.copy-url {
    background-color: var(--button-bg);
    color: var(--text-color);
}

.close-modal {
    background-color: #ff9800;
    color: white;
}

.copy-url:hover {
    background-color: var(--button-hover);
}

.close-modal:hover {
    background-color: #f57c00;
}

.password-legend {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.9rem;
    color: var(--text-color);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

#clearPassword {
    color: #ff4444;
}

#clearPassword:hover {
    background-color: #ffeeee;
}

.timer-button {
    background-color: var(--button-bg) !important;
    color: var(--text-color) !important;
    width: 3.5rem !important;
    padding: 0.5rem !important;
    font-variant-numeric: tabular-nums !important;
    cursor: default !important;
    font-family: monospace;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.timer-button:hover {
    background-color: var(--button-bg) !important;
}

.controls > :nth-child(-n+3) {
    margin-right: 0;
}

.controls > :nth-child(n+4) {
    margin-left: auto;
}

.timer-button, #clearPassword {
    margin-left: 0.25rem !important;
}

.switch-password {
    position: relative;
    width: 3rem;
    height: 1.5rem;
    display: none;
}

.switch-password input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--button-bg);
    transition: .4s;
    border-radius: 1.5rem;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 1.2rem;
    width: 1.2rem;
    left: 0.15rem;
    bottom: 0.15rem;
    background-color: var(--text-color);
    transition: .4s;
    border-radius: 50%;
}

input:checked + .switch-slider {
    background-color: var(--button-hover);
}

input:checked + .switch-slider:before {
    transform: translateX(1.5rem);
}

@media (hover: none) and (pointer: coarse) {
    #showPassword {
        display: none;
    }
    
    .switch-password {
        display: block;
    }
}

#speakPassword {
    position: relative;
}

#speakPassword:active {
    background-color: var(--button-hover);
}

#speakPassword.speaking i {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@supports not (speech-synthesis: speak) {
    #speakPassword {
        display: none;
    }
}