/* Modern CSS Variables for Theme */
:root {
    --primary-color: #667eea;
    --primary-dark: #5568d3;
    --primary-light: #818cf8;
    --secondary-color: #764ba2;
    --success-color: #10b981;
    --success-dark: #059669;
    --danger-color: #ef4444;
    --danger-dark: #dc2626;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    --card-bg: rgba(255, 255, 255, 0.95);
    --card-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    --card-shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.15);
    --border-radius: 16px;
    --border-radius-sm: 12px;
    --border-radius-lg: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background: var(--bg-gradient);
    background-attachment: fixed;
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius-lg);
    padding: 40px;
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: containerFadeIn 0.6s ease-out;
}

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

header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid rgba(102, 126, 234, 0.1);
}

header h1 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 3em;
    font-weight: 800;
    margin-bottom: 15px;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 10px rgba(102, 126, 234, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

header h1 .dice-emoji {
    -webkit-text-fill-color: initial;
    background: none;
    font-size: 1em;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    display: inline-block;
    animation: diceSpin 2s ease-in-out infinite;
}

@keyframes diceSpin {
    0%, 100% {
        transform: rotate(0deg) scale(1);
    }
    25% {
        transform: rotate(-10deg) scale(1.05);
    }
    75% {
        transform: rotate(10deg) scale(1.05);
    }
}

.warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    padding: 18px 24px;
    border-radius: var(--border-radius-sm);
    border-left: 4px solid var(--warning-color);
    margin-top: 15px;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15);
    font-weight: 500;
    line-height: 1.6;
}

section {
    margin-bottom: 30px;
    padding: 28px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 250, 252, 0.9) 100%);
    border-radius: var(--border-radius);
    border: 1px solid rgba(102, 126, 234, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    opacity: 0;
    transition: var(--transition);
}

section:hover::before {
    opacity: 1;
}

section:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-shadow-hover);
}

.toggle-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: 16px 28px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 600;
    width: 100%;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.toggle-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.toggle-btn:hover::before {
    width: 300px;
    height: 300px;
}

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

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

.hidden {
    display: none !important;
}

.rules-content, .settings-content {
    margin-top: 20px;
    padding: 28px;
    background: white;
    border-radius: var(--border-radius-sm);
    border: 1px solid rgba(102, 126, 234, 0.1);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    animation: slideDown 0.3s ease-out;
}

.rules-content ol {
    padding-left: 24px;
    list-style: none;
    counter-reset: rule-counter;
}

.rules-content li {
    counter-increment: rule-counter;
    margin-bottom: 16px;
    line-height: 1.8;
    padding-left: 40px;
    position: relative;
    color: var(--text-primary);
}

.rules-content li::before {
    content: counter(rule-counter);
    position: absolute;
    left: 0;
    top: 0;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9em;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.rules-content ul {
    margin-top: 8px;
    padding-left: 24px;
    list-style: none;
}

.rules-content ul li {
    padding-left: 24px;
    margin-bottom: 8px;
}

.rules-content ul li::before {
    content: '▸';
    position: absolute;
    left: 0;
    background: var(--primary-light);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    font-size: 0.7em;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95em;
    letter-spacing: 0.01em;
}

.form-group input[type="range"] {
    width: 100%;
    margin: 12px 0;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, #e5e7eb 0%, var(--primary-color) 100%);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.form-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    transition: var(--transition);
}

.form-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.6);
}

.form-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    transition: var(--transition);
}

.form-group input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.6);
}

.form-group input[type="number"],
.form-group input[type="text"] {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e5e7eb;
    border-radius: var(--border-radius-sm);
    font-size: 1em;
    transition: var(--transition);
    background: white;
    color: var(--text-primary);
}

.form-group input[type="number"]:focus,
.form-group input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.form-group input[type="checkbox"] {
    width: 22px;
    height: 22px;
    margin-right: 12px;
    cursor: pointer;
    accent-color: var(--primary-color);
    transition: var(--transition);
}

.form-group input[type="checkbox"]:hover {
    transform: scale(1.1);
}

.form-group label:has(input[type="checkbox"]) {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 12px;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

.form-group label:has(input[type="checkbox"]):hover {
    background: rgba(102, 126, 234, 0.05);
}

button {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    letter-spacing: 0.01em;
}

button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

button:active:not(:disabled) {
    transform: translateY(0);
}

button:disabled {
    background: linear-gradient(135deg, #d1d5db 0%, #9ca3af 100%);
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.6;
}

.current-settings {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.settings-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.settings-info p {
    margin: 0;
    padding: 16px;
    background: white;
    border-radius: var(--border-radius-sm);
    font-size: 1.05em;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
}

.settings-info p:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.settings-info strong {
    color: var(--primary-color);
    display: block;
    margin-bottom: 4px;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Modern Add Player Form */
.players-section h2 {
    margin-bottom: 24px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.8em;
    font-weight: 700;
}

.add-player-form {
    display: grid;
    grid-template-columns: 2fr 1.5fr auto;
    gap: 16px;
    margin-bottom: 32px;
    padding: 24px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.95) 100%);
    border-radius: var(--border-radius);
    border: 2px solid rgba(102, 126, 234, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: var(--transition);
}

.add-player-form:hover {
    border-color: rgba(102, 126, 234, 0.3);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.12);
}

.add-player-form input {
    padding: 16px 20px;
    border: 2px solid #e5e7eb;
    border-radius: var(--border-radius-sm);
    font-size: 1em;
    transition: var(--transition);
    background: white;
    color: var(--text-primary);
    font-weight: 500;
}

.add-player-form input::placeholder {
    color: var(--text-light);
    font-weight: 400;
}

.add-player-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
    background: white;
}

.add-player-form .input-wrapper {
    position: relative;
}

.add-player-form .input-wrapper::before {
    content: '';
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    z-index: 1;
    pointer-events: none;
}

.add-player-form .input-wrapper:first-child::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23667eea' stroke-width='2'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'%3E%3C/path%3E%3Ccircle cx='12' cy='7' r='4'%3E%3C/circle%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
}

.add-player-form .input-wrapper:nth-child(2)::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23667eea' stroke-width='2'%3E%3Cpath d='M12 2L2 7l10 5 10-5-10-5z'%3E%3C/path%3E%3Cpath d='M2 17l10 5 10-5'%3E%3C/path%3E%3Cpath d='M2 12l10 5 10-5'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
}

.add-player-form input#player-name {
    padding-left: 48px;
}

.add-player-form input#player-risk {
    padding-left: 48px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.add-player-form button {
    padding: 16px 32px;
    font-weight: 600;
    white-space: nowrap;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.add-player-form button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.add-player-form button:hover::before {
    width: 300px;
    height: 300px;
}

.add-player-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.add-player-form button:active {
    transform: translateY(0);
}

/* Modern Players List */
.players-list {
    margin-top: 32px;
}

.players-list h3 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 1.3em;
    font-weight: 700;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(102, 126, 234, 0.1);
}

.player-item {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.95) 100%);
    padding: 24px;
    margin-bottom: 16px;
    border-radius: var(--border-radius);
    border: 2px solid rgba(102, 126, 234, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.player-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    opacity: 0;
    transition: var(--transition);
}

.player-item:hover::before {
    opacity: 1;
}

.player-item:hover {
    transform: translateX(8px) translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
    border-color: var(--primary-color);
    background: white;
}

.player-item > div {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.player-item strong {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.2em;
    font-weight: 700;
    margin-bottom: 4px;
}

.player-item .player-info {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 0.95em;
    color: var(--text-secondary);
}

.player-item .player-info span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 20px;
    font-weight: 500;
}

.player-item .player-info .risk-badge {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.15));
    color: var(--primary-dark);
}

.player-item .player-info .win-chance-badge {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(5, 150, 105, 0.15));
    color: var(--success-dark);
}

.remove-btn {
    background: linear-gradient(135deg, var(--danger-color) 0%, var(--danger-dark) 100%);
    padding: 8px 16px;
    font-size: 0.9em;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.remove-btn:hover {
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

#pool-amount {
    margin-top: 24px;
    font-size: 1.4em;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    padding: 24px;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.15);
    border: 2px solid rgba(102, 126, 234, 0.2);
    position: relative;
    overflow: hidden;
}

#pool-amount::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.1), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

.play-section {
    text-align: center;
    padding: 40px 30px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(5, 150, 105, 0.05) 100%);
    border-radius: var(--border-radius-lg);
    border: 2px solid rgba(16, 185, 129, 0.2);
    box-shadow: 0 8px 30px rgba(16, 185, 129, 0.15);
    position: relative;
    overflow: hidden;
    margin: 40px 0;
}

.play-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.1) 0%, transparent 70%);
    animation: pulse 3s ease-in-out infinite;
}

.play-section::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(16, 185, 129, 0.05) 50%, transparent 100%);
    pointer-events: none;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

.play-section h2 {
    font-size: 1.4em;
    color: var(--text-primary);
    margin-bottom: 20px;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

#play-btn {
    font-size: 1.8em;
    padding: 22px 60px;
    background: linear-gradient(135deg, var(--success-color) 0%, var(--success-dark) 100%);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4), 0 0 40px rgba(16, 185, 129, 0.2);
    border-radius: var(--border-radius-lg);
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
    z-index: 1;
    border: 3px solid rgba(255, 255, 255, 0.3);
    transition: var(--transition);
}

#play-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

#play-btn::after {
    content: '🎯';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2em;
    opacity: 0.8;
}

#play-btn:hover:not(:disabled)::before {
    width: 500px;
    height: 500px;
}

#play-btn:hover:not(:disabled) {
    box-shadow: 0 12px 35px rgba(16, 185, 129, 0.6), 0 0 60px rgba(16, 185, 129, 0.3);
    transform: translateY(-4px) scale(1.02);
    border-color: rgba(255, 255, 255, 0.5);
}

#play-btn:active:not(:disabled) {
    transform: translateY(-2px) scale(1);
}

.play-section .play-hint {
    margin-top: 16px;
    color: var(--text-secondary);
    font-size: 0.95em;
    font-style: italic;
    position: relative;
    z-index: 1;
    opacity: 0.8;
}

#play-btn span {
    position: relative;
    z-index: 2;
}

.results-section {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
    animation: fadeIn 0.5s ease-in;
    border: 2px solid rgba(102, 126, 234, 0.2);
}

.results-section.hidden {
    display: none !important;
}

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

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 24px;
    background: white;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

table thead {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

table th {
    padding: 18px 20px;
    text-align: left;
    font-weight: 700;
    font-size: 0.95em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

table td {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: var(--transition);
}

table tbody tr {
    transition: var(--transition);
}

table tbody tr:hover {
    background: rgba(102, 126, 234, 0.05);
    transform: scale(1.01);
}

table tbody tr:last-child td {
    border-bottom: none;
}

.result-row {
    animation: slideIn 0.5s ease-out forwards;
    opacity: 0;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.winner {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(5, 150, 105, 0.1) 100%) !important;
    color: #065f46;
    border-left: 4px solid var(--success-color);
}

.loser {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(220, 38, 38, 0.1) 100%) !important;
    color: #991b1b;
    border-left: 4px solid var(--danger-color);
}

.king {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(217, 119, 6, 0.15) 100%) !important;
    color: #92400e;
    font-weight: 700;
    border-left: 4px solid var(--warning-color);
    position: relative;
}

.king::before {
    content: '👑';
    margin-right: 8px;
    font-size: 1.2em;
}

.company-revenue {
    margin-top: 24px;
    padding: 24px;
    background: linear-gradient(135deg, white 0%, rgba(248, 250, 252, 1) 100%);
    border-radius: var(--border-radius-sm);
    text-align: center;
    font-size: 1.3em;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.15);
    border: 2px solid rgba(102, 126, 234, 0.1);
}

.message {
    padding: 18px 24px;
    margin-bottom: 20px;
    border-radius: var(--border-radius-sm);
    animation: slideDown 0.3s ease-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    font-weight: 500;
    backdrop-filter: blur(10px);
}

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

.success-message {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(5, 150, 105, 0.1) 100%);
    color: #065f46;
    border-left: 4px solid var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.error-message {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(220, 38, 38, 0.1) 100%);
    color: #991b1b;
    border-left: 4px solid var(--danger-color);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 20px;
        border-radius: var(--border-radius);
    }

    header h1 {
        font-size: 2em;
    }

    section {
        padding: 20px;
        margin-bottom: 20px;
    }

    .toggle-btn {
        padding: 14px 20px;
        font-size: 1em;
    }

    .rules-content, .settings-content {
        padding: 20px;
    }

    .add-player-form {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .add-player-form input,
    .add-player-form button {
        width: 100%;
    }

    .add-player-form input#player-name,
    .add-player-form input#player-risk {
        padding-left: 48px;
    }

    .settings-info {
        grid-template-columns: 1fr;
    }

    table {
        font-size: 0.85em;
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table thead {
        display: none;
    }

    table tbody {
        display: block;
    }

    table tr {
        display: block;
        margin-bottom: 12px;
        border-radius: var(--border-radius-sm);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        padding: 12px;
        background: white;
        border: 1px solid rgba(102, 126, 234, 0.1);
    }

    table td {
        display: block;
        padding: 8px 0;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        text-align: right;
        position: relative;
        padding-left: 45%;
        padding-right: 0;
    }

    table td::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 40%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: 600;
        color: var(--text-secondary);
        font-size: 0.9em;
    }

    table td:last-child {
        border-bottom: none;
    }

    .play-section {
        padding: 30px 20px;
        margin: 30px 0;
    }

    .play-section h2 {
        font-size: 1.2em;
        margin-bottom: 16px;
    }

    #play-btn {
        font-size: 1.4em;
        padding: 18px 40px;
        width: 100%;
    }

    #play-btn::after {
        display: none;
    }

    .player-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        padding: 20px;
    }

    .player-item > div {
        width: 100%;
    }

    .player-item .player-info {
        flex-direction: column;
        gap: 8px;
    }

    .player-item .player-info span {
        width: 100%;
        justify-content: center;
    }

    .remove-btn {
        width: 100%;
        text-align: center;
        padding: 12px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.6em;
    }

    .container {
        padding: 15px;
    }

    section {
        padding: 16px;
    }

    .form-group input[type="number"],
    .form-group input[type="text"] {
        padding: 12px 16px;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }

    .container {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .toggle-btn,
    button {
        display: none;
    }
}

/* Accessibility Improvements */
button:focus,
input:focus,
.toggle-btn:focus {
    outline: 3px solid rgba(102, 126, 234, 0.5);
    outline-offset: 2px;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Loading State */
#play-btn:disabled {
    position: relative;
    color: transparent;
}

#play-btn:disabled::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
