/* Reset und Grundstile */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
}

.container {
    width: 90%;
    max-width: 800px;
    margin: 0 auto;
}

/* Bildschirm-Management */
.screen {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Karten-Layouts */
.welcome-card,
.setup-card,
.pause-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
    margin: 20px 0;
}

.welcome-card h1 {
    font-size: 3em;
    margin-bottom: 30px;
    color: #667eea;
}

.game-description {
    text-align: left;
    margin: 30px 0;
    background: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
    border-left: 5px solid #667eea;
}

.game-description h2 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.game-description h3 {
    color: #764ba2;
    margin: 20px 0 10px 0;
    font-size: 1.2em;
}

.game-description ul {
    list-style: none;
    padding-left: 0;
}

.game-description li {
    margin: 10px 0;
    padding: 10px;
    background: white;
    border-radius: 8px;
    border-left: 3px solid #667eea;
}

.why-timer {
    background: #e3f2fd;
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
}

.why-timer h3 {
    color: #1976d2;
}

/* Buttons */
.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 50px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

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

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
}

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

/* Setup-Konfiguration */
.setup-card h1 {
    font-size: 2.5em;
    margin-bottom: 30px;
    color: #667eea;
}

.config-section {
    margin: 25px 0;
    text-align: left;
}

.config-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.config-section select,
.config-section input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1em;
    transition: border-color 0.3s ease;
}

.config-section select:focus,
.config-section input:focus {
    outline: none;
    border-color: #667eea;
}

#name-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.name-input {
    display: flex;
    flex-direction: column;
}

.name-input label {
    font-size: 0.9em;
    color: #667eea;
    margin-bottom: 5px;
}

/* Spielbildschirm */
#game-screen {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.game-header {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.game-header h1 {
    font-size: 1.8em;
    margin: 0;
}

.game-controls {
    display: flex;
    gap: 10px;
}

.game-controls .btn {
    padding: 10px 20px;
    font-size: 0.9em;
    margin: 0;
}

.game-main {
    padding: 40px;
}

.current-player {
    text-align: center;
    margin-bottom: 30px;
}

.current-player h2 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.player-display {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    padding: 20px;
    border-radius: 15px;
    font-size: 1.8em;
    font-weight: 600;
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
    margin: 0 auto;
    max-width: 300px;
}

/* Timer-Anzeige */
.timer-display {
    text-align: center;
    margin: 40px 0;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.timer-display:hover {
    transform: scale(1.05);
}

.time-circle {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: linear-gradient(45deg, #667eea, #764ba2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    box-shadow: 0 15px 30px rgba(102, 126, 234, 0.4);
    position: relative;
    overflow: hidden;
}

.time-circle::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    border-radius: 50%;
    background: white;
    z-index: 1;
}

.time-text {
    font-size: 3em;
    font-weight: 700;
    color: #667eea;
    z-index: 2;
    position: relative;
}

.time-label {
    font-size: 1em;
    color: #764ba2;
    z-index: 2;
    position: relative;
    margin-top: -10px;
}

/* Timer-Animationen */
.time-circle.warning {
    animation: pulse 1s infinite;
}

.time-circle.critical {
    animation: shake 0.5s infinite;
    background: linear-gradient(45deg, #ff6b6b, #feca57);
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Spielanweisungen */
.game-instructions {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 15px;
    margin: 30px 0;
    text-align: center;
}

.game-instructions p {
    margin: 10px 0;
    font-size: 1.1em;
}

/* Spielerliste */
.player-list {
    margin-top: 30px;
}

.player-list h3 {
    color: #667eea;
    margin-bottom: 20px;
    text-align: center;
}

#all-players {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.player-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.player-item.active {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border-color: #667eea;
    transform: scale(1.05);
}

.player-item .player-name {
    font-weight: 600;
    font-size: 1.1em;
}

.player-item .player-status {
    font-size: 0.9em;
    opacity: 0.8;
    margin-top: 5px;
}

/* Pause-Bildschirm */
.pause-card h1 {
    font-size: 2.5em;
    margin-bottom: 20px;
    color: #feca57;
}

.pause-card p {
    font-size: 1.2em;
    margin-bottom: 30px;
    color: #666;
}

/* Responsive Design */
.container {
    width: 90%;
    max-width: 800px;
    margin: 20px auto;
}

/* Large screens */
@media (min-width: 1200px) {
    .container {
        max-width: 900px;
    }
    
    .welcome-card h1 {
        font-size: 3.5em;
    }
    
    .time-circle {
        width: 250px;
        height: 250px;
    }
    
    .time-text {
        font-size: 3.5em;
    }
}

/* Medium screens - tablets */
@media (max-width: 768px) {
    .container {
        width: 95%;
        padding: 0 15px;
        margin: 15px auto;
    }
    
    .welcome-card,
    .setup-card,
    .pause-card {
        padding: 25px;
    }
    
    .welcome-card h1,
    .setup-card h1 {
        font-size: 2.2em;
    }
    
    .game-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 20px;
    }
    
    .game-header h1 {
        font-size: 1.8em;
    }
    
    .game-main {
        padding: 25px;
    }
    
    .time-circle {
        width: 180px;
        height: 180px;
    }
    
    .time-text {
        font-size: 2.8em;
    }
    
    .button-group {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 300px;
        margin: 5px 0;
    }
    
    .game-description {
        padding: 20px;
    }
    
    #name-inputs {
        grid-template-columns: 1fr;
    }
    
    #all-players {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
}

/* Small screens - mobile */
@media (max-width: 480px) {
    .container {
        width: 95%;
        margin: 10px auto;
    }
    
    .welcome-card,
    .setup-card,
    .pause-card {
        padding: 20px;
    }
    
    .welcome-card h1,
    .setup-card h1 {
        font-size: 1.8em;
        margin-bottom: 20px;
    }
    
    .game-header {
        padding: 15px;
    }
    
    .game-header h1 {
        font-size: 1.5em;
    }
    
    .game-main {
        padding: 20px;
    }
    
    .time-circle {
        width: 150px;
        height: 150px;
    }
    
    .time-text {
        font-size: 2.2em;
    }
    
    .time-label {
        font-size: 0.9em;
    }
    
    .current-player h2 {
        font-size: 1.3em;
    }
    
    .player-display {
        font-size: 1.5em;
        padding: 15px;
    }
    
    .game-description h2 {
        font-size: 1.3em;
    }
    
    .game-description h3 {
        font-size: 1.1em;
    }
    
    .game-instructions p {
        font-size: 1em;
    }
    
    .btn {
        font-size: 1em;
        padding: 12px 25px;
    }
    
    .config-section input,
    .config-section select {
        font-size: 1em;
        padding: 10px;
    }
    
    #all-players {
        grid-template-columns: 1fr;
    }
    
    .player-item {
        padding: 12px;
    }
}

/* Extra small screens */
@media (max-width: 320px) {
    .container {
        width: 98%;
        margin: 5px auto;
    }
    
    .welcome-card,
    .setup-card,
    .pause-card {
        padding: 15px;
    }
    
    .welcome-card h1,
    .setup-card h1 {
        font-size: 1.5em;
    }
    
    .time-circle {
        width: 120px;
        height: 120px;
    }
    
    .time-text {
        font-size: 1.8em;
    }
    
    .btn {
        font-size: 0.9em;
        padding: 10px 20px;
    }
    
    .game-description {
        padding: 15px;
    }
    
    .game-main {
        padding: 15px;
    }
}

/* Landscape orientation fixes */
@media (orientation: landscape) and (max-height: 600px) {
    .container {
        margin: 5px auto;
        max-height: 95vh;
        overflow-y: auto;
    }
    
    .welcome-card,
    .setup-card,
    .pause-card {
        padding: 20px;
    }
    
    .welcome-card h1,
    .setup-card h1 {
        font-size: 1.8em;
        margin-bottom: 15px;
    }
    
    .time-circle {
        width: 120px;
        height: 120px;
    }
    
    .time-text {
        font-size: 2em;
    }
    
    .game-description {
        padding: 15px;
    }
    
    .game-main {
        padding: 15px;
    }
    
    .game-header {
        padding: 10px 15px;
    }
}

/* Touch-friendly optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .timer-display {
        padding: 10px;
    }
    
    .time-circle {
        margin: 10px auto;
    }
}

/* Print styles */
@media print {
    body {
        background: white;
    }
    
    .btn {
        display: none;
    }
    
    .game-controls {
        display: none;
    }
}

/* Accessibility improvements */
.btn:focus,
.config-section select:focus,
.config-section input:focus {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .welcome-card,
    .setup-card,
    .pause-card {
        border: 2px solid #000;
    }
    
    .btn {
        border: 2px solid #000;
    }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Header */
header {
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: #4a5568;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

header p {
    color: #718096;
    font-size: 1.1rem;
    margin-bottom: 20px;
}

/* Welcome Screen */
.welcome-card {
    animation: fadeIn 0.5s ease-in;
}

.welcome-card h2 {
    color: #2d3748;
    margin-bottom: 20px;
    font-size: 2rem;
}

.game-explanation {
    text-align: left;
    margin-bottom: 30px;
    background: #f7fafc;
    padding: 25px;
    border-radius: 15px;
    border-left: 4px solid #667eea;
}

.game-explanation h3 {
    color: #2d3748;
    margin-bottom: 15px;
    font-size: 1.8rem;
}

.game-explanation p {
    line-height: 1.6;
    margin-bottom: 15px;
    color: #4a5568;
    font-size: 1.1rem;
}

.game-features {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.feature {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: white;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.feature-icon {
    font-size: 2rem;
    min-width: 40px;
}

.feature div {
    flex: 1;
}

.feature strong {
    color: #2d3748;
    display: block;
    margin-bottom: 5px;
}

.feature p {
    color: #718096;
    font-size: 0.9rem;
    margin: 0;
}

.timer-explanation {
    margin-top: 25px;
    padding: 20px;
    background: #e6fffa;
    border-radius: 10px;
    border-left: 4px solid #38b2ac;
}

.timer-explanation h3 {
    color: #2c5282;
    margin-bottom: 10px;
}

.timer-explanation p {
    color: #2d3748;
    margin: 0;
}

/* Setup Screen */
.setup-card {
    animation: fadeIn 0.5s ease-in;
}

.setup-card h2 {
    color: #2d3748;
    margin-bottom: 30px;
    font-size: 2rem;
}

.player-count-section {
    margin-bottom: 30px;
    text-align: left;
}

.player-count-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #2d3748;
    font-size: 1.1rem;
}

.player-count-section select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.player-count-section select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.players-section {
    margin-bottom: 30px;
    text-align: left;
}

.players-section h3 {
    color: #2d3748;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

#player-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.player-input {
    display: flex;
    flex-direction: column;
}

.player-input label {
    margin-bottom: 5px;
    font-weight: 600;
    color: #4a5568;
    font-size: 0.9rem;
}

.player-input input {
    padding: 10px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.player-input input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.time-settings {
    margin-bottom: 30px;
    text-align: left;
    background: #f7fafc;
    padding: 20px;
    border-radius: 15px;
}

.time-settings h3 {
    color: #2d3748;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.time-option {
    margin-bottom: 10px;
}

.time-option label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #2d3748;
    font-size: 1rem;
}

.time-option input {
    width: 100%;
    padding: 10px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.time-option input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.time-hint {
    color: #718096;
    font-size: 0.9rem;
    font-style: italic;
}

.setup-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

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

.game-header h2 {
    color: #2d3748;
    font-size: 1.8rem;
}

.current-player {
    margin-bottom: 30px;
}

.current-player h3 {
    color: #4a5568;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.player-name {
    font-size: 2rem;
    font-weight: bold;
    color: #667eea;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.timer-display {
    margin: 30px 0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.timer-display:hover {
    transform: scale(1.02);
}

.time-text {
    font-size: 5rem;
    font-weight: bold;
    color: #667eea;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    user-select: none;
    font-family: 'Courier New', monospace;
}

.timer-hint {
    color: #718096;
    font-size: 1rem;
    margin-top: 10px;
    font-style: italic;
}

.players-overview {
    margin-top: 30px;
}

.players-overview h3 {
    color: #2d3748;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

#players-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.player-card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.player-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.player-card.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    transform: scale(1.05);
}

.player-card h4 {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.player-card .remaining-time {
    font-size: 1.5rem;
    font-weight: bold;
    font-family: 'Courier New', monospace;
}

/* Pause Screen */
.pause-card {
    animation: fadeIn 0.5s ease-in;
}

.pause-card h2 {
    color: #d69e2e;
    margin-bottom: 20px;
    font-size: 2rem;
}

.pause-card p {
    color: #4a5568;
    font-size: 1.1rem;
    margin-bottom: 30px;
}

.pause-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Game Over Screen */
.game-over-card {
    animation: fadeIn 0.5s ease-in;
}

.game-over-card h2 {
    color: #38a169;
    margin-bottom: 20px;
    font-size: 2rem;
}

.game-over-card p {
    color: #4a5568;
    font-size: 1.1rem;
    margin-bottom: 30px;
}

#final-results {
    background: #f7fafc;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 30px;
    text-align: left;
}

/* Buttons */
.btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.btn-secondary {
    background: linear-gradient(135deg, #718096 0%, #4a5568 100%);
}

.btn-success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}

.btn-danger {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
}

/* Screen Management */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* Animationen */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Timer Animations */
.timer-warning {
    animation: pulse 1s infinite;
    color: #f6ad55 !important;
}

.timer-critical {
    animation: pulse 0.5s infinite;
    color: #f56565 !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        width: 95%;
        padding: 20px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .time-text {
        font-size: 4rem;
    }
    
    .game-features {
        gap: 10px;
    }
    
    .feature {
        flex-direction: column;
        text-align: center;
    }
    
    .game-header {
        flex-direction: column;
        text-align: center;
    }
    
    #player-inputs {
        grid-template-columns: 1fr;
    }
    
    #players-list {
        grid-template-columns: 1fr;
    }
    
    .setup-actions,
    .pause-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 300px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .time-text {
        font-size: 3rem;
    }
    
    .welcome-card h2,
    .setup-card h2,
    .pause-card h2,
    .game-over-card h2 {
        font-size: 1.5rem;
    }
    
    .game-explanation {
        padding: 15px;
    }
    
    .feature {
        padding: 10px;
    }
    
    .time-settings {
        padding: 15px;
    }
}