:root {
    --bg-color: #f0f2f5;
    --text-color: #333;
    --screen-bg: white;
    --header-color: #1a2a4c;
    --input-border: #ccc;
    --input-bg: white;
    --btn-primary-bg: #007bff;
    --btn-secondary-bg: #6c757d;
    --btn-secondary-hover: #5a6268;
    --btn-text: white;
    --btn-primary-hover-bg: #0056b3;
    --disabled-btn-bg: #a0c3e6;
    --code-display-bg: #e9ecef;
    --list-item-bg: #f8f9fa;
    --results-item-bg: #f1f1f1;
    --censored-word-bg: #eee;
    --error-color: #d93025;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --modal-bg: white;
    --theme-switcher-border: #ccc;
    --theme-switcher-bg: white;
    --voted-color: #28a745;
}

body.dark-mode {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --screen-bg: #1e1e1e;
    --header-color: #bb86fc;
    --input-border: #555;
    --input-bg: #333;
    --btn-primary-bg: #bb86fc;
    --btn-secondary-bg: #4f4f4f;
    --btn-secondary-hover: #666666;
    --btn-text: #121212;
    --btn-primary-hover-bg: #a16ae8;
    --disabled-btn-bg: #555;
    --code-display-bg: #333;
    --list-item-bg: #2a2a2a;
    --results-item-bg: #2c2c2c;
    --censored-word-bg: #444;
    --error-color: #cf6679;
    --shadow-color: rgba(255, 255, 255, 0.1);
    --modal-bg: #2c2c2c;
    --theme-switcher-border: #555;
    --theme-switcher-bg: #1e1e1e;
    --voted-color: #5ddc71;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    transition: background-color 0.3s, color 0.3s;
}

#theme-switcher {
    position: fixed;
    top: 15px;
    right: 15px;
    background-color: var(--theme-switcher-bg);
    color: var(--text-color);
    border: 1px solid var(--theme-switcher-border);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 1.2em;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

.screen {
    display: none;
    background-color: var(--screen-bg);
    padding: 30px 40px;
    border-radius: 12px;
    box-shadow: 0 4px 20px var(--shadow-color);
    text-align: center;
    width: 90%;
    max-width: 400px;
    transition: background-color 0.3s;
    position: relative;
}
.screen.active {
    display: block;
}

.lang-btn {
    width: 80%;
    margin: 10px auto;
}

#timer-display {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 1.5em;
    font-weight: bold;
    color: var(--header-color);
    background-color: var(--bg-color);
    padding: 5px 10px;
    border-radius: 8px;
    min-width: 2ch;
    text-align: center;
}

h1, h2, h3 {
    color: var(--header-color);
    transition: color 0.3s;
}
h1 {
    font-size: 3em;
    margin-bottom: 10px;
}
input[type="text"] {
    width: calc(100% - 20px);
    padding: 12px 10px;
    margin-bottom: 15px;
    border: 1px solid var(--input-border);
    background-color: var(--input-bg);
    color: var(--text-color);
    border-radius: 6px;
    font-size: 1em;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}
button {
    background-color: var(--btn-primary-bg);
    color: var(--btn-text);
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.2s;
    width: 100%;
    margin-top: 5px;
}
button:hover:not(:disabled) {
    background-color: var(--btn-primary-hover-bg);
}
button:disabled {
    background-color: var(--disabled-btn-bg);
    cursor: not-allowed;
}
.join-section {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 20px;
}
#game-code-display {
    background-color: var(--code-display-bg);
    font-size: 2em;
    font-weight: bold;
    letter-spacing: 4px;
    padding: 10px;
    border-radius: 6px;
    margin: 15px 0;
    font-family: 'Courier New', Courier, monospace;
    transition: background-color 0.3s;
}
#player-list, #voter-list {
    list-style: none;
    padding: 0;
    margin: 20px 0;
    text-align: left;
}
#player-list li, #voter-list li {
    background-color: var(--list-item-bg);
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 5px;
    font-weight: 500;
    transition: background-color 0.3s, color 0.3s;
}
#player-list li.host::after {
    content: '👑';
    margin-left: 8px;
}
.error {
    color: var(--error-color);
    font-size: 0.9em;
    height: 1.5em;
    margin-top: 10px;
}
#censored-word {
    font-size: 1.8em;
    font-family: 'Courier New', Courier, monospace;
    letter-spacing: 5px;
    padding: 15px;
    background: var(--censored-word-bg);
    border-radius: 5px;
    margin: 10px 0 20px 0;
    transition: background-color 0.3s;
}
#results-list {
    list-style: none;
    padding: 0;
    padding-right: 10px;
    text-align: left;
    max-height: 35vh;
    overflow-y: auto;
}
#results-list li {
    background: var(--results-item-bg);
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 5px;
    transition: background-color 0.3s;
}
#results-list li.bot-word {
    background-color: var(--censored-word-bg);
    font-style: italic;
}
#play-again-section {
    margin-top: 25px;
    border-top: 1px solid var(--input-border);
    padding-top: 20px;
}
#voter-list li.voted {
    color: var(--voted-color);
    font-weight: bold;
}
#voter-list li.voted::after {
    content: '✔️';
    margin-left: 8px;
}
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    justify-content: center;
    align-items: center;
}
.modal-content {
    background: var(--modal-bg);
    padding: 20px 30px;
    border-radius: 10px;
    text-align: center;
    width: 80%;
    max-width: 300px;
    transition: background-color 0.3s;
}
.modal-content h3 {
    margin-top: 0;
}
.difficulty-btn {
    margin-bottom: 10px;
}
.option-toggle {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--input-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9em;
}
.option-toggle input[type="checkbox"] {
    width: auto;
    height: 18px;
    width: 18px;
    margin: 0;
    cursor: pointer;
}
#cancel-difficulty {
    background-color: var(--btn-secondary-bg);
    margin-top: 20px;
}
#cancel-difficulty:hover {
    background-color: var(--btn-secondary-hover);
}
.join-section > input, .join-section > button {
    margin: 0;
}

#watermark {
    position: fixed;
    bottom: 10px;
    left: 10px;
    font-size: 0.75em;
    color: var(--text-color);
    opacity: 0.5;
    z-index: 2000;
    pointer-events: none;
}

#nonstop-controls {
    display: none;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--input-border);
}

#vote-stop-btn {
    background-color: var(--btn-secondary-bg);
}

#vote-stop-btn:hover:not(:disabled) {
    background-color: var(--btn-secondary-hover);
}

#stop-vote-status {
    font-size: 0.9em;
    margin-top: 10px;
    min-height: 1.2em;
}