/* LeetCode Inspired Dark Theme */
:root {
    --bg-dark: #1a1a1a;
    --bg-medium: #282828;
    --bg-light: #3a3a3a;
    --text-light: #f0f0f0;
    --text-medium: #cccccc;
    --text-dark: #1a1a1a;
    --border-color: #444444;
    --accent-color-start: #ffac41;
    --accent-color-end: #ffa116;
    --correct-color: #2ebd59;
    --wrong-color: #f73737;
}

body.dark-theme {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    margin: 0;
    padding: 20px;
    background-color: var(--bg-dark);
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

header {
    width: 100%;
    max-width: 900px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 15px 20px;
    background-color: var(--bg-medium);
    border-bottom: 1px solid var(--border-color);
    box-sizing: border-box;
    border-radius: 12px;
}

.logo {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--text-light);
}

.speed-control {
    display: flex;
    align-items: center;
    color: var(--text-medium);
}

.speed-control span {
    margin: 0 8px;
}

main {
    width: 100%;
    max-width: 700px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.card {
    background-color: var(--bg-medium);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 25px;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.semaphore-display {
    text-align: center;
    min-height: 280px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#semaphore-image {
    max-width: 320px;
    height: auto;
    margin-bottom: 10px;
    background-color: var(--bg-light);
    padding: 10px;
    border-radius: 4px;
}

.controls {
    margin-bottom: 25px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

button {
    padding: 10px 20px;
    cursor: pointer;
    font-size: 1em;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    transition: background-color 0.2s ease, opacity 0.2s ease;
    font-weight: 500;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.control-button {
    background-color: var(--bg-light);
    color: var(--text-light);
}

.control-button:hover:not(:disabled) {
    background-color: #454545;
}

.action-button {
    background-color: var(--bg-light);
    color: var(--text-light);
}

.action-button:hover:not(:disabled) {
    background-color: #454545;
}

.accent-button {
    background-image: linear-gradient(to bottom, var(--accent-color-start), var(--accent-color-end));
    color: var(--text-dark);
    border: 1px solid var(--accent-color-end);
    font-weight: 600;
}

.accent-button:hover:not(:disabled) {
    background-image: linear-gradient(to bottom, #ffb451, #ffa92b);
}

.answer-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 450px;
}

#answer-input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    box-sizing: border-box;
    font-size: 1em;
    text-align: center;
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    color: var(--text-light);
}

#answer-input::placeholder {
    color: var(--text-medium);
}

#feedback-message {
    margin-top: 10px;
    font-weight: bold;
    min-height: 1.2em;
    text-align: center;
}

.correct {
    color: var(--correct-color);
}

.wrong {
    color: var(--wrong-color);
}

footer {
    margin-top: auto;
    padding: 10px 20px;
    text-align: center;
    background-color: var(--bg-medium);
    color: var(--text-light);
    border-top: 1px solid var(--border-color);
    width: 100%;
    box-sizing: border-box;
    font-size: 0.9em;
}

/* Responsive Design */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .speed-control {
        justify-content: center;
        width: 100%;
    }

    main {
        padding: 0 15px;
    }

    .controls {
        flex-direction: column;
        gap: 10px;
    }

    #semaphore-image {
        max-width: 150px;
    }

    .answer-area {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    header {
        padding: 10px;
    }

    .logo {
        font-size: 1.2em;
    }

    button {
        font-size: 0.9em;
        padding: 8px 15px;
    }

    #semaphore-image {
        max-width: 120px;
    }

    .answer-area {
        padding: 0 10px;
    }

    #answer-input {
        font-size: 0.9em;
        padding: 10px;
    }
}