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

body {
    --color-gradient-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --color-text: #333;
    --color-modal-bg: #fff;
    --color-text-h2: #555;
    --color-formgroup-label: #555;
    --color-slider-bg-checked: #222;
    --color-container-bg: white;
    --color-defaultpanel-bg: #f8f9fa;

    --color-inputtext-bg: #ddd;
    --color-inputtext-border: #bbb;
    --color-inputtext: #333;
    --color-inputtext-focus-border: #667eea;

    --color-userinfo: #666;

    --color-gamecard-bg: #f8f9fa;
    --color-gamecard-border: #e0e0e0;
    --color-gamecard: #333;

    --color-confirmdialog-bg: #fff;
    --color-confirmdialog: #333;

    --color-optionslist-bg: #fff;
    --color-optionslist-border: #ccc;
    --color-optionslist: #333;

    --color-resultquestion: #333;

    --color-answercard-bg: #fff;
    --color-answercard: #333;
    --color-answercard-selected: #667eea;

    --color-finalscore-bg: #f8f9fa;
    --color-finalscore: #eee;
}

body.darkmode {
    --color-gradient-bg: linear-gradient(135deg, #232526 0%, #414345 100%);
    --color-text: #ddd;
    --color-modal-bg: #222;
    --color-text-h2: #aaa;
    --color-formgroup-label: #aaa;
    --color-slider-bg-checked: #555;
    --color-container-bg: #333;
    --color-defaultpanel-bg: #444;

    --color-inputtext-bg: #555;
    --color-inputtext-border: #888;
    --color-inputtext: #ddd;
    --color-inputtext-focus-border: #667eea;

    --color-userinfo: #aaa;

    --color-gamecard-bg: #444;
    --color-gamecard-border: #666;
    --color-gamecard: #ddd;

    --color-confirmdialog-bg: #222;
    --color-confirmdialog: #ddd;

    --color-optionslist-bg: #333;
    --color-optionslist-border: #555;
    --color-optionslist: #ddd;

    --color-resultquestion: #ddd;

    --color-answercard-bg: #555;
    --color-answercard: #ddd;
    --color-answercard-selected-bg: #232c50;

    --color-finalscore-bg: #333;
    --color-finalscore: #ddd;
}

input[type="text"], input[type="password"], input[type="number"] {
    background: var(--color-inputtext-bg);
    border-color: var(--color-inputtext-border);
    color: var(--color-inputtext);
}

input[type="text"]:focus, input[type="password"]:focus, input[type="number"]:focus {
    border-color: var(--color-inputtext-focus-border);
}


body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--color-gradient-bg);
    min-height: 100vh;
    color: var(--color-text);
}

.hidden {
    display: none !important;
}

.game-search-input {
    margin-left: 0px;
    width: 400px;
    padding: 10px 16px;
    border-radius: 8px;
    border: 1.5px solid #bbb;
    font-size: 1.1em;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.user-settings-button {
    position: fixed;
    bottom: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 18px;
    z-index: 9999;
    cursor: pointer;
    border: none;
}

.ping {
    position: fixed;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 9999;
    pointer-events: none;
}

.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
}

.screen.active {
    display: flex;
    align-items: start;
    justify-content: center;
}

.container {
    background: var(--color-container-bg);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 1200px;
    width: 100%;
    padding: 40px;
}


#login-screen .container {
    max-width: 500px;
}

h1 {
    color: #667eea;
    margin-bottom: 30px;
    text-align: center;
    font-size: 2.5em;
}

h2 {
    color: var(--color-text-h2);
    margin-bottom: 20px;
    font-size: 1.5em;
}

.waiting-message h3 {
    color: #667eea;
}

/* Username Form */
.username-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#username-input {
    padding: 15px;
    font-size: 18px;
    border: 2px solid #ddd;
    border-radius: 8px;
    transition: border-color 0.3s;
}

#username-input:focus {
    outline: none;
    border-color: #667eea;
}

/* Buttons */
button {
    padding: 12px 24px;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-danger:hover {
    background: #da190b;
}

.btn-primary:hover,
.btn-logout:hover {
    transform: translateY(-2px);
}

.btn-large {
    font-size: 20px;
    padding: 18px 36px;
    margin-top: 20px;
}


#submit-discard-btn {
    font-weight: bold;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: block;
    margin: 20px auto 0;
}

#submit-answers-btn {
    font-weight: bold;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: block;
    margin: 20px auto 0;
}

#submit-answers-btn.submit-incomplete {
    background: #95a5a6;
    color: #ecf0f1;
    cursor: not-allowed;
    opacity: 0.7;
}

#submit-answers-btn.submit-complete {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.4);
    animation: pulse 1.5s ease-in-out infinite;
}

#submit-answers-btn.submit-complete:hover {
    background: linear-gradient(135deg, #229954 0%, #1e8449 100%);
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.6);
    transform: translateY(-2px);
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(39, 174, 96, 0.4);
    }
    50% {
        box-shadow: 0 4px 25px rgba(39, 174, 96, 0.7);
    }
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 15px;
}

.user-info {
    font-size: 16px;
    color: var(--color-userinfo);
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-logout {
    background: #666;
    color: white;
    padding: 8px 16px;
    font-size: 14px;
}

.btn-logout:hover {
    background: #555;
}

/* Lobby */
.lobby-actions,
.modal-actions {
    display: flex;
    gap: 15px;
}

.current-player-indicator {
    font-size: 14px;
    font-weight: bold;
    font-style: italic;
}

.lobby-actions {
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.modal-actions {
    margin-top: 25px;
    flex-wrap: nowrap;
}

.modal-actions button {
    flex: 1;
}

.games-list {
    margin-top: 30px;
}

#public-games {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.game-card {
    background: var(--color-gamecard-bg);
    border: 2px solid var(--color-gamecard-border);
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.game-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.game-card h3 {
    color: var(--color-gamecard);
    margin-bottom: 10px;
    font-size: 1.2em;
}

.game-card .game-info {
    color: var(--color-gamecard);;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.game-card .lock-icon {
    color: #f44336;
}

.empty-message {
    text-align: center;
    color: #999;
    padding: 40px;
    font-style: italic;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--color-modal-bg);
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group-box {
    padding: 20px;
    padding-left: 20px;
    padding-left: 30px;
    border: 3px solid #636a65;
    border-radius: 10px;
    margin-bottom: 15px;
}

.form-group label,
.game-link label {
    display: block;
    margin-bottom: 8px;
    color: var(--color-formgroup-label);
    font-weight: 600;
}

.game-link label {
    font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"] {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
    border: 1px solid;
}

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

.form-group.checkbox input {
    width: auto;
    cursor: pointer;
}

.form-group.checkbox label {
    margin: 0;
    cursor: pointer;
}

/* Game Screen */
.game-content {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 30px;
}

.defaultpanel {
    background: var(--color-defaultpanel-bg);
    padding: 10px;
    border-radius: 8px;
}

.defaultpanel.settings {
    max-width: 600px;
}


#players-list {
    margin-bottom: 20px;
}

.player-item {
    background: white;
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 2px solid transparent;
}

.player-item.creator {
    border-color: #667eea;
}

.player-item.current-player {
    border: 2px solid #4caf50;
    background: #e8f5e9;
    font-weight: 600;
}

.player-item.current-player.creator {
    border-color: #667eea;
    /*background: linear-gradient(135deg, #e8f5e9 0%, #e3f2fd 100%);*/
}

.player-item.spectator-item {
    opacity: 0.85;
    border-style: dashed;
}

.player-item.spectator-item.current-player {
    border-style: dashed;
}

.player-item .crown {
    color: #ffd700;
    font-size: 18px;
}

.player-item .player-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-indicator {
    display: inline-block;
    margin-right: 6px;
    font-size: 14px;
}

.status-indicator.connected {
    color: #4caf50;
}

.status-indicator.disconnecting {
    color: #ff9800;
}

.btn-kick {
    padding: 4px 12px;
    font-size: 12px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-kick:hover {
    background: #d32f2f;
}

.btn-toggle-role {
    padding: 4px 8px;
    font-size: 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    line-height: 1;
}

.btn-toggle-role:hover {
    background: #5568d3;
    transform: scale(1.1);
}

.btn-force-role {
    padding: 4px 8px;
    font-size: 14px;
    background: #ff9800;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    line-height: 1;
}

.btn-force-role:hover {
    background: #f57c00;
    transform: scale(1.1);
}

.game-link {
    margin-top: 20px;
}

.game-link input {
    width: 100%;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 12px;
    margin-bottom: 8px;
}

.game-link button {
    width: 100%;
}


.settings-form {
    max-width: 600px;
}

.info-text {
    color: #666;
    font-style: italic;
    font-size: 14px;
    margin-top: 15px;
}

.game-actions {
    text-align: center;
    margin-top: 30px;
    margin-bottom: 30px;
}

/* Notification */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #333;
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s;
    z-index: 2000;
    max-width: 400px;
}

.notification.show {
    opacity: 1;
    transform: translateY(0);
}

.notification.error {
    background: #f44336;
}

.notification.success {
    background: #4caf50;
}

.notification.warning {
    background: #ff9800;
}

.error-message {
    color: #f44336;
    font-size: 14px;
    margin-top: 10px;
    text-align: center;
}

/* Game Play Styles */
#game-screen.playing .game-content {
    grid-template-columns: 1fr;
}

#game-screen.playing .players-panel {
    display: none;
}

.game-active {
    max-width: 1000px;
    margin: 0 auto;
}

.czar-banner {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    font-size: 18px;
    margin-bottom: 10px;
    margin-top: 10px;
    color: #333;
}

.question-card {
    background: #1a1a1a;
    color: white;
    padding: 40px;
    border-radius: 12px;
    margin-bottom: 30px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.card-label {
    position: absolute;
    top: 15px;
    left: 15px;
    font-size: 12px;
    font-weight: bold;
    color: #999;
}

.question-text {
    font-size: 24px;
    line-height: 1.4;
    text-align: center;
}

.timer-display {
    position: absolute;
    bottom: 5px;
    right: 5px;
}

.timer-circle {
    transform: rotate(-90deg);
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.timer-circle-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.2);
    stroke-width: 4;
}

.timer-circle-progress {
    fill: none;
    stroke: #4caf50;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 138;
    stroke-dashoffset: 0;
    transition: stroke 0.3s ease, stroke-dashoffset 0.3s linear;
}

.timer-circle-progress.warning {
    stroke: #ff9800;
}

.timer-circle-progress.danger {
    stroke: #f44336;
}

.timer-text {
    position: absolute;
    top: 48%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 16px;
    font-weight: bold;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

@keyframes timerPulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
    }
}

@keyframes cardFlip {
    0% { transform: rotate(0deg); }
    10% { transform: rotate(-4deg); }
    30% { transform: rotate(4deg); }
    50% { transform: rotate(-4deg); }
    70% { transform: rotate(4deg); }
    90% { transform: rotate(-4deg); }
    100% { transform: rotate(0deg); }
}

.timer-text.danger {
    animation: timerPulse 0.5s ease-in-out infinite;
    color: #f44336;
}

.win-score-label {
    text-align: center;
    font-size: 12px;
    color: #999;
    margin-bottom: 5px;
    font-weight: 500;
}

.scores-panel {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.score-item {
    background: #f8f9fa;
    padding: 10px 20px;
    border-radius: 6px;
    border: 2px solid #e0e0e0;
}

.score-item.leading {
    border-color: #4caf50;
    background: #e8f5e9;
}

.score-item .score-name {
    font-weight: 600;
    margin-right: 10px;
}

.score-item .score-value {
    /*color: #667eea;*/
    font-weight: bold;
}

.phase-title {
    text-align: center;
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 20px;
    color: #667eea;
}

.selection-info {
    text-align: center;
    font-size: 16px;
    margin-bottom: 15px;
    color: #666;
}

.card-hand {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.discard-card, .answer-card {
    background: var(--color-answercard-bg);
    color: var(--color-answercard);
    border: 3px solid #e0e0e0;
    border-radius: 10px;
    padding: 10px;
    min-height: 100px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 16px;
    position: relative;
}

.discard-card:hover, .answer-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.discard-card.selected, .answer-card.selected {
    border-color: #667eea;
    background: var(--color-answercard-selected-bg);
    transform: translateY(-5px);
}

.discard-card .selection-number,.answer-card .selection-number {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #667eea;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.waiting-message {
    text-align: center;
    padding: 20px;
}

.waiting-message p {
    color: #666;
    font-size: 18px;
}

#submission-status {
    margin-top: 25px;
    font-size: 18px;
    color: #667eea;
    font-weight: 600;
}

.answer-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.not-resetted {
    font-weight: bold;
    border-color: #f4369e !important;
    border-width: 4px !important;
}

.answer-option {
    background: var(--color-optionslist-bg);
    border: 3px solid var(--color-optionslist-border);
    color: var(--color-optionslist);
    border-radius: 10px;
    padding: 25px;
    padding-bottom: 10px;
    padding-top: 15px;
    cursor: pointer;
    transition: all 0.3s;
}

.answer-option:hover {
    border-color: #667eea;
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.answer-option.selected-winner {
    border-color: #4caf50;
    background: #e8f5e9;
}

.answer-option .answer-text {
    font-size: 18px;
    line-height: 1.6;
}

.result-banner, .game-end-banner {
    text-align: center;
    padding: 10px;
}

.result-banner h2 {
    color: #4caf50;
    font-size: 32px;
    margin-bottom: 20px;
}

.winning-combination {
    margin: 25px 0;
    padding: 20px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 12px;
}

.result-question {
    font-size: 22px;
    font-weight: bold;
    color: var(--color-resultquestion);
    margin-bottom: 15px;
    line-height: 1.5;
}

.result-question.winner-flip {
    animation: cardFlip 1.2s ease-in-out;
}

.filled-answer {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
}

.selected-czar-choice {
    border: 3px solid #ff9800 !important;
    box-shadow: 0 0 10px rgba(255, 152, 0, 0.7);
}

#end-question .filled-answer {
    color: #ffd700;
    background: rgba(255, 215, 0, 0.2);
    font-size: 1.15em;
}

.pending-game {
    border: 3px dashed #ff9800 !important;
}

.result-answers {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.result-answer-card {
    background: white;
    border: 2px solid #667eea;
    border-radius: 8px;
    padding: 15px;
    font-size: 18px;
    color: #333;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.discard-round-end, .next-round-countdown {
    font-size: 20px;
    color: var(--color-text-h2);
    margin-top: 15px;
}

.discard-round-end span, .next-round-countdown span {
    color: #667eea;
    font-weight: bold;
    font-size: 24px;
}

.game-end-banner h1 {
    color: #667eea;
    font-size: 48px;
    margin-bottom: 20px;
}

.game-end-banner h2 {
    color: #4caf50;
    font-size: 36px;
    margin-bottom: 30px;
}

#final-scores {
    padding: 30px;
    border-radius: 12px;
    max-width: 500px;
    margin: 30px auto;
}

.final-score-item {
    display: flex;
    justify-content: space-between;
    padding: 15px;
    margin-bottom: 10px;
    background: white;
    border-radius: 8px;
    font-size: 18px;
}

.final-score-item.winner {
    border: 3px solid #ffd700;
    background: #fffbea;
}

.game-title {
    padding: 0px;
    margin: 0px;
}

.game-list-header {
    display: flex;
    flex: space-between;
}


@property --progress {
  syntax: '<percentage>';
  inherits: false;
  initial-value: 0%;
}

.czarvoting-endtimer {
    padding: 10px;
  border-radius: 15px;
  /* Trick: Ein kleinerer innerer Hintergrund überdeckt das Zentrum */
  background: 
    linear-gradient(var(--color-defaultpanel-bg), var(--color-defaultpanel-bg)) padding-box, /* Inhalt-Hintergrund */
    conic-gradient(#00ffcc var(--progress), #44444400 0) border-box; /* Der "Rahmen" */
  border: 5px solid transparent;
  
  transition: --progress 1s linear;
}




/* Responsive */
@media (max-width: 768px) {
    .defaultpanel.settings {
        max-width: 768px;
    }

    .game-list-header {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    .screen {
        padding: 10px;
    }
    
    .container {
        padding: 10px;
        padding-bottom: 40px;
    }

    .game-content {
        grid-template-columns: 1fr;
    }
    
    .header {
        align-items: flex-start;
    }
    
    h1 {
        font-size: 2em;
    }
    
    .question-card {
        font-size: 16px;
        padding: 20px;
        padding-top: 35px;
        padding-bottom: 70px;
        min-height: 120px;
    }
    
    .question-text {
        font-size: 18px;
    }
    
    .card-hand {
        grid-template-columns: 1fr;
    }
    
    .discard-card, .answer-card {
        min-height: 120px;
        font-size: 14px;
        padding: 15px;
    }

    
    .game-end-banner h1 {
        font-size: 28px;
    }
    
    .game-end-banner h2 {
        font-size: 22px;
    }
    
    .czar-banner {
        font-size: 14px;
        padding: 10px;
    }
    
    .scores-panel {
        gap: 8px;
    }
    
    .score-item {
        padding: 8px 12px;
        font-size: 14px;
    }
}
