:root {
    --roll-duration: 0.5s;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 100%);
    color: #ffffff;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(120, 160, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 120, 160, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(120, 255, 160, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.container {
    width: 100%;
    max-width: 1000px;
    padding: 10px;
    position: relative;
    z-index: 1;
}

@media (min-width: 768px) {
    .container {
        padding: 20px;
    }
}

header {
    text-align: center;
    margin-bottom: 20px;
    animation: fadeInDown 0.8s ease-out;
}

@media (min-width: 768px) {
    header {
        margin-bottom: 30px;
    }
}

h1 {
    font-size: 2.5em;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 255, 255, 0.1);
    background: linear-gradient(135deg, #fff 0%, #78a0ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h1 i {
    -webkit-text-fill-color: #78a0ff;
    margin-right: 8px;
}

@media (min-width: 768px) {
    h1 {
        font-size: 3.5em;
        margin-bottom: 20px;
    }
    
    h1 i {
        margin-right: 10px;
    }
}

.btn {
    padding: 0;
    border: none;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 2px;
    position: relative;
    overflow: hidden;
    font-weight: 500;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn i {
    margin-right: 0;
}

@media (min-width: 768px) {
    .btn {
        width: 44px;
        height: 44px;
        font-size: 18px;
        margin: 0 4px;
    }
    
    .btn i {
        margin-right: 0;
    }
}

.btn-primary {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-secondary {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.4);
}

.btn-large {
    font-size: 16px;
    padding: 12px 24px;
    animation: pulse 2s infinite;
    min-width: 120px;
    height: 48px;
    border-radius: 24px;
}

.btn-large:disabled {
    animation: none;
    opacity: 0.6;
    cursor: not-allowed;
}

@media (min-width: 768px) {
    .btn-large {
        font-size: 18px;
        padding: 14px 30px;
        min-width: 140px;
        height: 52px;
        border-radius: 26px;
    }
}

.game-setup {
    background: rgba(26, 31, 58, 0.9);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 15px;
    max-width: 500px;
    margin: 0 auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    animation: fadeIn 0.6s ease-out;
}

@media (min-width: 768px) {
    .game-setup {
        padding: 40px;
        border-radius: 20px;
    }
}

.game-setup h2 {
    margin-bottom: 20px;
    text-align: center;
}

.player-selection {
    margin-bottom: 20px;
}

.player-selection label {
    display: block;
    margin-bottom: 10px;
}

.player-selection select {
    width: 100%;
    padding: 12px 15px;
    font-size: 16px;
    border-radius: 10px;
    border: 2px solid transparent;
    background: linear-gradient(#2a2f4a, #2a2f4a) padding-box,
                linear-gradient(135deg, #78a0ff 0%, #ff78a0 100%) border-box;
    color: white;
    transition: all 0.3s ease;
    cursor: pointer;
}

.player-selection select:focus {
    outline: none;
    box-shadow: 0 0 20px rgba(120, 160, 255, 0.3);
}

.player-names {
    margin-bottom: 20px;
}

.game-setup {
    text-align: center;
}

#startGameBtn {
    width: auto;
    height: auto;
    border-radius: 25px;
    padding: 12px 24px;
    font-size: 16px;
    min-width: 140px;
    margin-top: 10px;
}

#startGameBtn i {
    margin-right: 8px;
}

/* Modal footer buttons should be rectangular with text */
.modal-footer .btn {
    width: auto;
    height: auto;
    border-radius: 25px;
    padding: 10px 20px;
    font-size: 14px;
    min-width: 120px;
}

.modal-footer .btn i {
    margin-right: 6px;
}

@media (min-width: 768px) {
    .modal-footer .btn {
        padding: 12px 24px;
        font-size: 16px;
        min-width: 140px;
    }
    
    .modal-footer .btn i {
        margin-right: 8px;
    }
}

.player-names input {
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 10px;
    font-size: 16px;
    border-radius: 10px;
    border: 2px solid transparent;
    background: linear-gradient(#2a2f4a, #2a2f4a) padding-box,
                linear-gradient(135deg, #78a0ff 0%, #ff78a0 100%) border-box;
    color: white;
    transition: all 0.3s ease;
}

.player-names input:focus {
    outline: none;
    box-shadow: 0 0 20px rgba(120, 160, 255, 0.3);
}

.player-names input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.game-area {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

@media (min-width: 768px) {
    .game-area {
        gap: 30px;
    }
}

.dice-section {
    background: rgba(26, 31, 58, 0.9);
    backdrop-filter: blur(10px);
    padding: 15px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    animation: slideInLeft 0.8s ease-out;
    max-width: 600px;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .dice-section {
        padding: 25px;
        border-radius: 20px;
    }
}

.current-player h2 {
    margin-bottom: 10px;
    font-size: 20px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

@media (min-width: 768px) {
    .current-player h2 {
        font-size: 28px;
    }
}

.roll-info {
    margin-bottom: 20px;
    font-size: 18px;
    color: #78a0ff;
    font-weight: 500;
}

.roll-info i {
    animation: spin 2s linear infinite;
}

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

.dice-container {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 15px 0;
    flex-wrap: wrap;
}

@media (min-width: 768px) {
    .dice-container {
        gap: 15px;
        margin: 25px 0;
        flex-wrap: nowrap;
    }
}

.die {
    width: 45px;
    height: 45px;
    background: linear-gradient(145deg, #ffffff 0%, #f0f0f0 100%);
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3), inset 0 1px 2px rgba(255, 255, 255, 0.9);
}

@media (min-width: 768px) {
    .die {
        width: 70px;
        height: 70px;
        border-radius: 12px;
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3), inset 0 1px 2px rgba(255, 255, 255, 0.9);
    }
}

.die:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.die.held {
    background: linear-gradient(145deg, #FFD700 0%, #FFA500 100%);
    transform: translateY(-10px) scale(1.1);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.5), 0 0 30px rgba(255, 215, 0, 0.3);
}

.die.rolling {
    animation: roll var(--roll-duration) ease-in-out;
}

@keyframes roll {
    0% { transform: rotateX(0) rotateY(0); }
    50% { transform: rotateX(720deg) rotateY(720deg); }
    100% { transform: rotateX(0) rotateY(0); }
}

.die-face {
    width: 100%;
    height: 100%;
    display: flex;
    position: relative;
    padding: 8px;
}

@media (min-width: 768px) {
    .die-face {
        padding: 12px;
    }
}

.die-dot {
    position: absolute;
    width: 8px;
    height: 8px;
    background: radial-gradient(circle at 30% 30%, #333, #000);
    border-radius: 50%;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5), 0 1px 1px rgba(255, 255, 255, 0.1);
}

@media (min-width: 768px) {
    .die-dot {
        width: 16px;
        height: 16px;
    }
}

/* Die 1 */
.die[data-value="1"] .die-dot:nth-child(1) {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Die 2 */
.die[data-value="2"] .die-dot:nth-child(1) {
    top: 20%;
    left: 20%;
}

.die[data-value="2"] .die-dot:nth-child(2) {
    bottom: 20%;
    right: 20%;
}

/* Die 3 */
.die[data-value="3"] .die-dot:nth-child(1) {
    top: 20%;
    left: 20%;
}

.die[data-value="3"] .die-dot:nth-child(2) {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.die[data-value="3"] .die-dot:nth-child(3) {
    bottom: 20%;
    right: 20%;
}

/* Die 4 */
.die[data-value="4"] .die-dot:nth-child(1) {
    top: 20%;
    left: 20%;
}

.die[data-value="4"] .die-dot:nth-child(2) {
    top: 20%;
    right: 20%;
}

.die[data-value="4"] .die-dot:nth-child(3) {
    bottom: 20%;
    left: 20%;
}

.die[data-value="4"] .die-dot:nth-child(4) {
    bottom: 20%;
    right: 20%;
}

/* Die 5 */
.die[data-value="5"] .die-dot:nth-child(1) {
    top: 20%;
    left: 20%;
}

.die[data-value="5"] .die-dot:nth-child(2) {
    top: 20%;
    right: 20%;
}

.die[data-value="5"] .die-dot:nth-child(3) {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.die[data-value="5"] .die-dot:nth-child(4) {
    bottom: 20%;
    left: 20%;
}

.die[data-value="5"] .die-dot:nth-child(5) {
    bottom: 20%;
    right: 20%;
}

/* Die 6 */
.die[data-value="6"] .die-dot:nth-child(1) {
    top: 20%;
    left: 20%;
}

.die[data-value="6"] .die-dot:nth-child(2) {
    top: 20%;
    right: 20%;
}

.die[data-value="6"] .die-dot:nth-child(3) {
    top: 50%;
    left: 20%;
    transform: translateY(-50%);
}

.die[data-value="6"] .die-dot:nth-child(4) {
    top: 50%;
    right: 20%;
    transform: translateY(-50%);
}

.die[data-value="6"] .die-dot:nth-child(5) {
    bottom: 20%;
    left: 20%;
}

.die[data-value="6"] .die-dot:nth-child(6) {
    bottom: 20%;
    right: 20%;
}

.scoresheets-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    max-width: 600px;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .scoresheets-container {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 15px;
    }
}

.scoresheet {
    background: rgba(26, 31, 58, 0.9);
    backdrop-filter: blur(10px);
    padding: 12px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    animation: slideInRight 0.8s ease-out;
    min-height: 420px;
}

@media (min-width: 768px) {
    .scoresheet {
        padding: 16px;
        border-radius: 20px;
        min-height: 480px;
    }
}

.scoresheet h3 {
    text-align: center;
    margin-bottom: 15px;
    font-size: 20px;
}

@media (min-width: 768px) {
    .scoresheet h3 {
        margin-bottom: 20px;
        font-size: 24px;
    }
}

.score-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border-radius: 10px;
}

.score-table th,
.score-table td {
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 13px;
}

@media (min-width: 768px) {
    .score-table th,
    .score-table td {
        padding: 8px 12px;
        font-size: 14px;
    }
}

.score-table th {
    background: linear-gradient(135deg, #2a2f4a 0%, #3a4f6a 100%);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 14px;
}

.score-table tr:hover td:first-child {
    padding-left: 20px;
    transition: padding-left 0.3s ease;
}

.score-table tr[data-category]:hover {
    background-color: rgba(120, 160, 255, 0.05);
}

.section-header {
    background: linear-gradient(135deg, #2a2f4a 0%, #3a4f6a 100%);
    font-weight: bold;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 14px;
}

.score-cell {
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 5px;
    position: relative;
}

.score-cell:hover {
    background-color: rgba(120, 160, 255, 0.1);
    transform: scale(1.05);
}

.score-cell.filled {
    cursor: default;
    color: #4CAF50;
    font-weight: bold;
    background: rgba(76, 175, 80, 0.1);
    animation: scoreAdded 0.5s ease-out;
}

@keyframes scoreAdded {
    0% {
        transform: scale(1.3);
        background: rgba(76, 175, 80, 0.3);
    }
    100% {
        transform: scale(1);
        background: rgba(76, 175, 80, 0.1);
    }
}

.score-cell.preview {
    color: #FFD700;
    font-style: italic;
    animation: glow 1.5s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% {
        text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
    }
    50% {
        text-shadow: 0 0 15px rgba(255, 215, 0, 0.8), 0 0 5px rgba(255, 215, 0, 0.5);
    }
}

.subtotal,
.bonus,
.upper-total,
.lower-total,
.grand-total {
    font-weight: bold;
}

.grand-total {
    background: linear-gradient(135deg, #2a2f4a 0%, #3a4f6a 100%);
    font-size: 20px;
    color: #FFD700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.game-over {
    background: rgba(26, 31, 58, 0.9);
    backdrop-filter: blur(10px);
    padding: 50px;
    border-radius: 20px;
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    animation: zoomIn 0.6s ease-out;
}

.game-over h2 {
    font-size: 2.5em;
    margin-bottom: 20px;
}

.winner-display {
    margin-bottom: 30px;
}

.winner-display h3 {
    font-size: 2.5em;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
    animation: winnerPulse 1.5s ease-in-out infinite;
}

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

#finalScores {
    font-size: 1.4em;
    line-height: 2;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    margin-top: 20px;
}

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

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

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

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

/* Notification */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 1000;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.notification.show {
    transform: translateX(0);
}

.notification i {
    font-size: 20px;
}

/* Mobile-first responsive design */
@media (max-width: 480px) {
    .game-controls {
        display: flex;
        flex-direction: row;
        gap: 8px;
        align-items: center;
        justify-content: center;
    }
    
    .btn {
        width: 48px;
        height: 48px;
        font-size: 18px;
    }
    
    .dice-container {
        gap: 6px;
    }
    
    .die {
        width: 45px;
        height: 45px;
        min-height: 44px; /* Touch-friendly minimum size */
    }
    
    .die-dot {
        width: 6px;
        height: 6px;
    }
    
    .scoresheet {
        padding: 10px;
        min-height: 450px;
    }
    
    .score-table th,
    .score-table td {
        padding: 8px 6px;
        font-size: 12px;
        min-height: 40px; /* Touch-friendly row height */
    }
    
    .score-cell {
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .scoresheet h3 {
        font-size: 18px;
        margin-bottom: 10px;
    }
    
    /* Improve touch targets */
    .toggle-switch {
        width: 70px;
        height: 40px;
    }
    
    .slider:before {
        height: 32px;
        width: 32px;
        left: 4px;
        bottom: 4px;
    }
    
    input:checked + .slider:before {
        transform: translateX(30px);
    }
}

/* Tablet responsive */
@media (max-width: 900px) and (min-width: 481px) {
    .notification {
        right: 10px;
        left: 10px;
        transform: translateY(-100px);
    }
    
    .notification.show {
        transform: translateY(0);
    }
}

/* Settings Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.show {
    display: flex !important;
    opacity: 1;
    visibility: visible;
}

.modal.show .modal-content {
    transform: scale(1);
}

.modal:not(.show) {
    display: none !important;
}

.modal-content {
    background: rgba(26, 31, 58, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 0;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal.show .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h2 {
    margin: 0;
    color: #fff;
    font-size: 24px;
}

.close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 30px;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(90deg);
}

.modal-body {
    padding: 30px;
}

.setting-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding: 15px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.setting-group:last-child {
    border-bottom: none;
}

.setting-group label {
    color: #fff;
    font-size: 16px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-switch {
    position: relative;
    width: 60px;
    height: 30px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #333, #555);
    border-radius: 30px;
    transition: 0.3s;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.3);
}

.slider:before {
    position: absolute;
    content: "";
    height: 24px;
    width: 24px;
    left: 3px;
    bottom: 3px;
    background: linear-gradient(145deg, #fff, #f0f0f0);
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

input:checked + .slider {
    background: linear-gradient(135deg, #4CAF50, #45a049);
}

input:checked + .slider:before {
    transform: translateX(30px);
}

.setting-group select {
    padding: 8px 15px;
    border-radius: 10px;
    border: 2px solid transparent;
    background: linear-gradient(#2a2f4a, #2a2f4a) padding-box,
                linear-gradient(135deg, #78a0ff 0%, #ff78a0 100%) border-box;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.setting-group select:focus {
    outline: none;
    box-shadow: 0 0 15px rgba(120, 160, 255, 0.3);
}

.range-slider {
    display: flex;
    align-items: center;
    gap: 15px;
}

.range-slider input[type="range"] {
    width: 120px;
    height: 5px;
    border-radius: 5px;
    background: linear-gradient(135deg, #333, #555);
    outline: none;
    cursor: pointer;
}

.range-slider input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(145deg, #4CAF50, #45a049);
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.range-slider input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(145deg, #4CAF50, #45a049);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.range-slider span {
    color: #78a0ff;
    font-weight: 500;
    min-width: 40px;
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    padding: 20px 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

@media (max-width: 600px) {
    .modal-content {
        width: 95%;
        margin: 10px;
        max-height: 90vh;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-header {
        padding: 20px;
    }
    
    .modal-footer {
        flex-direction: column;
        gap: 10px;
        padding: 15px 20px;
    }
    
    .setting-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 10px 0;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 10px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-info h3 {
        font-size: 20px;
    }
    
    .modal-large {
        max-width: 95%;
    }
}

/* No animations mode */
.no-animations * {
    animation: none !important;
    transition: none !important;
}

/* Hints */
.show-hints .score-cell.preview::after {
    content: " (tap to score)";
    font-size: 12px;
    color: rgba(255, 215, 0, 0.7);
    font-style: normal;
}

.light-theme.show-hints .score-cell.preview::after {
    color: rgba(37, 99, 235, 0.8);
}

/* Removed confusing button hover hints */

.show-hints .die:hover::after {
    content: "Click to hold";
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 10;
}

.show-hints .die.held:hover::after {
    content: "Click to release";
}

/* Rules Modal */
.modal-large {
    max-width: 800px;
    max-height: 90vh;
}

.rules-section {
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    border-left: 4px solid #78a0ff;
}

.rules-section h3 {
    margin-bottom: 15px;
    color: #78a0ff;
    font-size: 18px;
}

.rules-section p {
    line-height: 1.6;
    margin-bottom: 10px;
}

.rules-section ol {
    padding-left: 20px;
}

.rules-section ol li {
    margin-bottom: 10px;
    line-height: 1.5;
}

.rules-section ul {
    padding-left: 20px;
}

.rules-section ul li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.scoring-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.score-item {
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
    font-size: 14px;
    line-height: 1.4;
}

.bonus-info {
    background: rgba(255, 215, 0, 0.1);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    color: #FFD700;
    font-size: 16px;
    text-align: center;
}

/* Stats Modal */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

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

.stat-icon {
    font-size: 30px;
    margin-bottom: 10px;
}

.stat-icon i {
    background: linear-gradient(135deg, #78a0ff, #ff78a0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-info h3 {
    font-size: 28px;
    margin-bottom: 5px;
    color: #fff;
}

.stat-info p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.achievement-section {
    margin-top: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
}

.achievement-section h3 {
    margin-bottom: 15px;
    color: #FFD700;
    font-size: 18px;
}

.achievements-list {
    max-height: 200px;
    overflow-y: auto;
}

.achievement-item {
    display: flex;
    align-items: center;
    padding: 10px;
    margin-bottom: 8px;
    background: rgba(255, 215, 0, 0.1);
    border-radius: 8px;
    border-left: 4px solid #FFD700;
}

.achievement-item i {
    color: #FFD700;
    margin-right: 10px;
    font-size: 18px;
}

.achievement-item .achievement-text {
    flex: 1;
}

.achievement-item .achievement-date {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
}

.no-achievements {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
    padding: 20px;
}

@media (max-width: 800px) {
    .modal-large {
        max-width: 95%;
        margin: 20px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .scoring-grid {
        grid-template-columns: 1fr;
    }
}

/* Light Theme */
.light-theme {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #333;
}

.light-theme::before {
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(120, 160, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 120, 160, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(120, 255, 160, 0.1) 0%, transparent 50%);
}

.light-theme h1 {
    background: linear-gradient(135deg, #333 0%, #78a0ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

.light-theme h1 i {
    -webkit-text-fill-color: #78a0ff;
}

.light-theme .game-setup,
.light-theme .dice-section,
.light-theme .scoresheet,
.light-theme .game-over {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
}

.light-theme .modal-content {
    background: rgba(255, 255, 255, 0.95);
    color: #333;
}

.light-theme .modal-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.light-theme .modal-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.light-theme .setting-group {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.light-theme .rules-section {
    background: rgba(0, 0, 0, 0.03);
    border-left: 4px solid #78a0ff;
}

.light-theme .score-item {
    background: rgba(0, 0, 0, 0.05);
}

.light-theme .stat-card {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.light-theme .achievement-section {
    background: rgba(0, 0, 0, 0.03);
}

.light-theme .achievement-item {
    background: rgba(255, 215, 0, 0.15);
    border-left: 4px solid #b8860b;
}

.light-theme .achievement-item i {
    color: #b8860b;
}

.light-theme .score-table th {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e0 100%);
    color: #333;
}

.light-theme .section-header {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e0 100%);
    color: #333;
}

.light-theme .grand-total {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e0 100%);
    color: #b8860b;
    font-weight: bold;
}

.light-theme .score-table tr[data-category]:hover {
    background-color: rgba(120, 160, 255, 0.1);
}

.light-theme .score-cell:hover {
    background-color: rgba(120, 160, 255, 0.1);
}

.light-theme .close-btn {
    color: #333;
}

.light-theme .close-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

.light-theme .player-selection select,
.light-theme .player-names input,
.light-theme .setting-group select {
    background: linear-gradient(#f7fafc, #f7fafc) padding-box,
                linear-gradient(135deg, #78a0ff 0%, #ff78a0 100%) border-box;
    color: #333;
}

.light-theme .die {
    background: linear-gradient(145deg, #ffffff 0%, #f0f0f0 100%);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2), inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.light-theme .die.held {
    background: linear-gradient(145deg, #4CAF50 0%, #45a049 100%);
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.4), 0 0 30px rgba(76, 175, 80, 0.2);
}

.light-theme .die-dot {
    background: radial-gradient(circle at 30% 30%, #333, #000);
}

/* Light theme specific overrides for better contrast */
.light-theme .score-cell.preview {
    color: #2563eb;
    font-weight: bold;
}

.light-theme .score-cell.preview::after {
    color: #2563eb;
}

.light-theme .score-cell.preview {
    animation: glowBlue 1.5s ease-in-out infinite;
}

@keyframes glowBlue {
    0%, 100% {
        text-shadow: 0 0 5px rgba(37, 99, 235, 0.5);
    }
    50% {
        text-shadow: 0 0 15px rgba(37, 99, 235, 0.8), 0 0 5px rgba(37, 99, 235, 0.5);
    }
}

.light-theme .winner-display h3 {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
}

.light-theme .bonus-info {
    background: rgba(37, 99, 235, 0.1);
    border: 1px solid rgba(37, 99, 235, 0.3);
    color: #1d4ed8;
}

.light-theme .rules-section h3 {
    color: #2563eb;
}

.light-theme .achievement-section h3 {
    color: #b8860b;
}

.light-theme .roll-info {
    color: #2563eb;
}

.light-theme .current-player h2 {
    color: #333;
}

.light-theme .stat-info h3 {
    color: #333;
}

.light-theme .notification {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
}

.light-theme .modal-header h2 {
    color: #333;
}

.light-theme .setting-group label {
    color: #333;
}

.light-theme .range-slider span {
    color: #2563eb;
}

.light-theme .rules-section {
    background: rgba(0, 0, 0, 0.03);
    border-left: 4px solid #2563eb;
    color: #333;
}

.light-theme .rules-section h3 {
    color: #2563eb;
}

.light-theme .rules-section p,
.light-theme .rules-section li {
    color: #333;
}

.light-theme .stat-info p {
    color: #666;
}

.light-theme .no-achievements {
    color: #666;
}

.light-theme .achievement-item .achievement-text {
    color: #333;
}

.light-theme .achievement-item .achievement-date {
    color: #666;
}

/* Auto theme listener */
@media (prefers-color-scheme: dark) {
    [data-theme="auto"] {
        background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 100%);
        color: #ffffff;
    }
}

@media (prefers-color-scheme: light) {
    [data-theme="auto"] {
        background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
        color: #333;
    }
}