@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap');

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #87CEEB 0%, #F5F7FA 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 10px 0;
    color: #0052A2;
    font-size: 16px;
    overflow-y: hidden;
}

.container {
    background: white;
    padding: 12px;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(135, 206, 235, 0.2);
    max-width: 600px;
    width: 90%;
    text-align: center;
    border: 2px solid transparent;
    background-image: linear-gradient(white, white), linear-gradient(135deg, #87CEEB, #F5F7FA);
    background-origin: border-box;
    background-clip: padding-box, border-box;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

h1 {
    color: #0052A2;
    font-weight: 600;
    margin: 0;
    font-size: 24px;
    flex: 1;
}

.language-toggle {
    background: none;
    border: 2px solid #87CEEB;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
    padding: 0;
    overflow: hidden;
}

.language-toggle img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.language-toggle:hover {
    background: #87CEEB;
    transform: scale(1.1);
    border-color: #4682B4;
}

.input-section, .solve-fields, .result {
    margin: 8px 0;
}

label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    color: #0052A2;
    font-size: 1.1em;
}

select, input {
    padding: 8px;
    margin: 3px 0;
    border: 1px solid #87CEEB;
    border-radius: 6px;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    background: #FFFFFF;
    transition: border-color 0.3s ease, transform 0.2s ease;
}

input:disabled {
    background: #E6ECEF;
    border-color: #B0C4DE;
    cursor: not-allowed;
    opacity: 0.7;
}

select {
    width: 100%;
    background: #F5F7FA;
}

select:focus, input:focus {
    outline: none;
    border-color: #4682B4;
    transform: scale(1.02);
}

.time-limit-section {
    background: #F5F7FA;
    padding: 6px;
    border-radius: 8px;
    margin-top: 6px;
}

.time-limit-input {
    display: flex;
    gap: 4px;
    justify-content: center;
    align-items: center;
}

.time-limit-input input {
    width: 70px;
}

.time-limit-input .separator {
    font-size: 16px;
    color: #0052A2;
    font-weight: 500;
}

.solve-input {
    display: flex;
    gap: 4px;
    margin-bottom: 4px;
    justify-content: center;
    align-items: center;
    position: relative;
}

.solve-input label {
    width: 80px;
    font-size: 1.1em;
}

.solve-input input {
    width: 70px;
}

.solve-input .centiseconds {
    width: 70px;
}

.solve-input .separator {
    font-size: 16px;
    color: #0052A2;
    font-weight: 500;
}

.result p {
    font-size: 1.2em;
    color: #0052A2;
    margin: 6px 0;
}

.result span {
    font-weight: 500;
    color: #87CEEB;
}

.result .negative {
    color: #F56565;
}

.button-group {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 8px;
}

.reset-button {
    padding: 8px 16px;
    background: #FF4C4C;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
}

.reset-button:hover {
    background: #CC0000;
    transform: scale(1.05);
}

.help-button {
    padding: 8px 16px;
    background: #FFFFFF;
    color: #0052A2;
    border: 2px solid #87CEEB;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: background 0.3s ease, color 0.3s ease, transform 0.2s ease;
}

.help-button:hover {
    background: #87CEEB;
    color: white;
    transform: scale(1.05);
}

.popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 82, 162, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    overflow: hidden;
}

.popup[aria-hidden="false"] {
    display: flex;
}

.popup-content {
    background: white;
    padding: 15px;
    border-radius: 8px;
    max-width: 90%;
    width: 90%;
    text-align: center;
    box-shadow: 0 8px 20px rgba(135, 206, 235, 0.2);
    position: relative;
    max-height: 70vh;
    overflow-y: auto;
}

.popup-content h2 {
    color: #0052A2;
    font-size: 20px;
    margin-bottom: 10px;
}

.popup-content p {
    color: #0052A2;
    font-size: 14px;
    margin-bottom: 10px;
}

.popup-content a {
    color: #87CEEB;
    text-decoration: none;
    font-weight: 500;
}

.popup-content a:hover {
    text-decoration: underline;
}

.close-button {
    padding: 8px 16px;
    background: #87CEEB;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
}

.close-button:hover {
    background: #4682B4;
    transform: scale(1.05);
}

.tooltip {
    display: none;
    background: #4682B4;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    position: absolute;
    top: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%) translateX(50px);
    z-index: 10;
    white-space: nowrap;
}

.tooltip::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid #4682B4;
}

@media (max-width: 600px) or (max-height: 600px) {
    body {
        margin: 5px 0;
    }

    .container {
        padding: 10px;
    }

    .header {
        margin-bottom: 6px;
    }

    h1 {
        font-size: 20px;
        margin: 0;
    }

    .language-toggle {
        width: 35px;
        height: 35px;
        margin-left: 8px;
    }

    .input-section, .solve-fields, .result {
        margin: 6px 0;
    }

    label {
        margin-bottom: 3px;
        font-size: 1em;
    }

    select, input {
        padding: 6px;
        margin: 2px 0;
        font-size: 12px;
    }

    .time-limit-input input {
        width: 60px;
    }

    .time-limit-input .separator {
        font-size: 14px;
    }

    .solve-input label {
        width: 70px;
        font-size: 1em;
    }

    .solve-input input {
        width: 60px;
    }

    .solve-input .centiseconds {
        width: 60px;
    }

    .solve-input .separator {
        font-size: 14px;
    }

    .result p {
        font-size: 1.1em;
        margin: 4px 0;
    }

    .button-group {
        gap: 6px;
        margin-top: 6px;
    }

    .reset-button, .help-button {
        padding: 6px 12px;
        font-size: 12px;
    }

    .popup-content {
        padding: 10px;
        max-height: 60vh;
    }

    .popup-content h2 {
        font-size: 18px;
        margin-bottom: 8px;
    }

    .popup-content p {
        font-size: 12px;
        margin-bottom: 8px;
    }

    .close-button {
        padding: 6px 12px;
        font-size: 12px;
    }

    .tooltip {
        font-size: 10px;
        padding: 3px 6px;
        transform: translateX(-50%) translateX(40px);
    }

    .tooltip::before {
        border-left: 5px solid transparent;
        border-right: 5px solid transparent;
        border-bottom: 5px solid #4682B4;
        top: -5px;
        transform: translateX(-50%);
    }

    input:disabled {
        background: #E6ECEF;
        border-color: #B0C4DE;
        opacity: 0.7;
    }

    .dns-warning {
        font-size: 0.8em;
        right: -120px;
        padding: 3px 6px;
    }
}


.solve-input.dns-disabled {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    padding: 4px;
    margin: 2px 0;
}

.solve-input.dns-disabled input,
.solve-input.disabled-no-limit input {
    background: #e9ecef;
    border-color: #adb5bd;
    color: #6c757d;
}

.solve-input.dns-disabled label,
.solve-input.disabled-no-limit label {
    color: #6c757d;
}

.solve-input.dns-disabled .separator,
.solve-input.disabled-no-limit .separator {
    color: #6c757d;
}

.solve-input.dns-disabled::after {
    content: "DNS";
    position: absolute;
    top: 4px;
    right: 4px;
    background: #6c757d;
    color: white;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.65em;
    font-weight: 600;
    text-transform: uppercase;
}

.solve-input.dnf-warning {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 6px;
    padding: 4px;
    margin: 2px 0;
    animation: warning-pulse 2s infinite;
}

.solve-input.dnf-warning::after {
    content: "⚠️ DNF";
    position: absolute;
    top: 4px;
    right: 4px;
    background: #dc3545;
    color: white;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.65em;
    font-weight: 600;
    text-transform: uppercase;
}

@keyframes warning-pulse {
    0% { border-color: #ffc107; }
    50% { border-color: #dc3545; }
    100% { border-color: #ffc107; }
}
