* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg-near-black: #0B0B0C;
    --bg-alt: #0E0E10;
    --surface-primary: #F5F5F3;
    --surface-secondary: #2A2A2E;
    --text-primary: #FFFFFF;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --accent-loser: #D13B3B;
    --ease-settle: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-anticipation: cubic-bezier(0.7, 0, 0.3, 1);
}

body {
    font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-near-black);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Casino Typography System */
h1, h2, h3, .casino-heading {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.casino-subheading {
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    font-style: italic;
    letter-spacing: 0.02em;
}

.casino-paragraph, p, .player-name {
    font-family: 'Lato', sans-serif;
    font-weight: 300;
    letter-spacing: 0.01em;
    line-height: 1.6;
}

/* ============================================
   BACKGROUND LAYER SYSTEM
   Stack order (bottom to top):
   1. Gradient Void (base)
   2. Noise Texture
   3. Shadow Horizon
   4. Ambient Light Sweep (idle only)
   5. Blur Shapes
   6. Typography Background
   7. Vignette
   8. Dice (always above)
   ============================================ */

/* 1. Gradient Void - Base Layer */
.bg-gradient-void {
    position: fixed;
    top: -10%;
    left: -10%;
    right: -10%;
    bottom: -10%;
    background: radial-gradient(
        ellipse 120% 100% at 45% 55%,
        #151517 0%,
        #0B0B0C 60%,
        #0B0B0C 100%
    );
    z-index: 0;
    animation: voidDrift 90s ease-in-out infinite;
    will-change: transform;
}

@keyframes voidDrift {
    0%, 100% {
        transform: translate(0, 0);
    }
    33% {
        transform: translate(2%, -2%);
    }
    66% {
        transform: translate(-2%, 2%);
    }
}

#game-screen.rolling .bg-gradient-void {
    animation-play-state: paused;
}

#game-screen.end-state .bg-gradient-void {
    animation-play-state: paused;
    background: radial-gradient(
        ellipse 100% 100% at 50% 50%,
        #0E0E10 0%,
        #0B0B0C 100%
    );
    transform: translate(0, 0);
}

/* 2. Noise Texture */
.bg-noise {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.04;
    mix-blend-mode: overlay;
    z-index: 1;
    pointer-events: none;
}

/* 3. Shadow Horizon */
.bg-horizon {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.15) 0%,
        rgba(0, 0, 0, 0.05) 30%,
        transparent 100%
    );
    z-index: 2;
    pointer-events: none;
    transition: opacity 0.6s var(--ease-settle), background 0.6s var(--ease-settle);
}

#game-screen.rolling .bg-horizon {
    opacity: 0.3;
    transition: opacity 0.4s var(--ease-anticipation);
}

#game-screen.rolling .bg-horizon {
    opacity: 0;
}

#game-screen.end-state .bg-horizon {
    opacity: 0.1;
}

/* 4. Procedurally Generated Casino Pattern Background - REMOVED */

/* 5. Floating Blur Shapes */
.bg-blur-shape {
    position: fixed;
    border-radius: 50%;
    filter: blur(250px);
    z-index: 4;
    pointer-events: none;
    opacity: 0.15;
    transition: opacity 0.6s var(--ease-settle);
}

.bg-blur-shape-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.4) 0%, transparent 70%);
    top: 20%;
    left: 10%;
    animation: floatShape1 35s ease-in-out infinite;
}

.bg-blur-shape-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    bottom: 15%;
    right: 15%;
    animation: floatShape2 50s ease-in-out infinite;
}

.bg-blur-shape-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.25) 0%, transparent 70%);
    top: 60%;
    left: 50%;
    animation: floatShape3 42s ease-in-out infinite;
}

@keyframes floatShape1 {
    0%, 100% {
        transform: translate(0, 0);
    }
    50% {
        transform: translate(30px, -40px);
    }
}

@keyframes floatShape2 {
    0%, 100% {
        transform: translate(0, 0);
    }
    50% {
        transform: translate(-25px, 35px);
    }
}

@keyframes floatShape3 {
    0%, 100% {
        transform: translate(0, 0);
    }
    50% {
        transform: translate(20px, 30px);
    }
}

#game-screen.rolling .bg-blur-shape,
#game-screen.end-state .bg-blur-shape {
    opacity: 0;
}

/* 6. Typography Background */
.bg-typography {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cinzel', serif;
    font-size: clamp(4rem, 15vw, 12rem);
    font-weight: 700;
    color: rgba(255, 255, 255, 0.025);
    letter-spacing: 0.1em;
    overflow: hidden;
    white-space: nowrap;
    transition: opacity 0.4s var(--ease-settle), font-size 0.3s ease;
    text-transform: uppercase;
    padding: 2rem;
    text-align: center;
    word-break: break-word;
    max-width: 100vw;
}

/* Responsive typography for different viewport sizes */
@media (max-width: 480px) {
    .bg-typography {
        font-size: clamp(3rem, 12vw, 8rem);
    }
}

@media (min-width: 768px) {
    .bg-typography {
        font-size: clamp(6rem, 18vw, 15rem);
    }
}

#game-screen.rolling .bg-typography {
    opacity: 0;
    transition: opacity 0.3s var(--ease-anticipation);
}

/* 7. Reactive Vignette */
.bg-vignette {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(
        ellipse at center,
        transparent 0%,
        transparent 40%,
        rgba(0, 0, 0, 0.3) 100%
    );
    z-index: 6;
    pointer-events: none;
    opacity: 0.2;
    transition: opacity 0.6s var(--ease-settle);
}

#game-screen.rolling .bg-vignette {
    opacity: 0.5;
    transition: opacity 0.4s var(--ease-anticipation);
}

#game-screen.end-state .bg-vignette {
    opacity: 0.6;
}

#results-screen .bg-vignette {
    opacity: 0.4;
    animation: vignettePulse 3s ease-in-out infinite;
}

@keyframes vignettePulse {
    0%, 100% {
        opacity: 0.4;
    }
    50% {
        opacity: 0.5;
    }
}

.screen {
    display: none;
    min-height: 100vh;
    padding: 2rem 1rem;
    position: relative;
}

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

.container {
    width: 100%;
    max-width: 500px;
    text-align: center;
    position: relative;
}

/* Rules Screen */
#rules-screen h1 {
    font-family: 'Cinzel', serif;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 3rem;
    color: var(--text-primary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.rules-content {
    margin: 3rem 0;
    padding: 2rem;
    background: var(--surface-secondary);
    border-radius: 16px;
}

.rule-text {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    font-weight: 400;
    font-style: italic;
    margin: 1.2rem 0;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

/* Player Input Screen */
.player-input {
    width: 100%;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    background: var(--surface-secondary);
    border: none;
    border-radius: 12px;
    color: var(--text-primary);
    text-align: center;
    transition: all 0.3s var(--ease-settle);
}

.player-input::placeholder {
    color: var(--text-secondary);
}

.player-input:focus {
    outline: none;
    background: var(--surface-primary);
    color: var(--bg-near-black);
}

/* Buttons */
.btn-primary, .btn-secondary {
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s var(--ease-settle);
    margin: 0.5rem;
    -webkit-user-select: none;
    user-select: none;
}

.btn-primary {
    background: var(--surface-primary);
    color: var(--bg-near-black);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: var(--surface-secondary);
    color: var(--text-primary);
}

.btn-secondary:active {
    transform: scale(0.98);
}

/* Game Screen - iPhone-first layout */
#game-screen {
    justify-content: space-between;
    padding-bottom: 4rem;
    position: relative;
    overflow: hidden;
}

#game-screen .container {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Leaderboard Section */
#leaderboard-section {
    position: fixed;
    bottom: 6rem;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 2rem);
    max-width: 400px;
    opacity: 1;
    transition: opacity 0.4s var(--ease-settle),
                transform 0.4s var(--ease-settle),
                filter 0.4s var(--ease-settle);
    z-index: 200;
    pointer-events: auto;
}

.leaderboard-header {
    margin-bottom: 0.75rem;
    text-align: center;
}

.leaderboard-title {
    font-family: 'Cinzel', serif;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    opacity: 0.6;
}

.leaderboard-subtitle {
    font-family: 'Playfair Display', serif;
    font-size: 0.9rem;
    font-weight: 400;
    font-style: italic;
    color: var(--text-primary);
    margin: 0;
}

#players-list {
    padding: 1rem 1.25rem;
    background: var(--surface-secondary);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

#game-screen.rolling #leaderboard-section {
    opacity: 0;
    transform: translateX(-50%) scale(0.96);
    filter: blur(8px);
    pointer-events: none;
}

#game-screen.rolling #roll-btn {
    opacity: 0;
    transform: translateX(-50%) scale(0.96);
    filter: blur(8px);
    pointer-events: none;
}

.player-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.player-item:last-child {
    border-bottom: none;
}

.player-item.completed {
    opacity: 0.5;
}

.player-item.completed .player-name {
    text-decoration: line-through;
    text-decoration-color: rgba(255, 255, 255, 0.2);
}

.player-name {
    font-family: 'Lato', sans-serif;
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-secondary);
    letter-spacing: 0.03em;
}

.player-item:not(.completed) .player-name {
    color: var(--text-primary);
    font-weight: 500;
}

.player-sum {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.05em;
    min-width: 2rem;
    text-align: right;
}

.player-item.completed .player-sum {
    opacity: 0.6;
}

#current-player-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 1;
}

#roll-btn {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 2rem);
    max-width: 400px;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    transition: opacity 0.4s var(--ease-settle),
                transform 0.4s var(--ease-settle),
                filter 0.4s var(--ease-settle);
    z-index: 200;
    pointer-events: auto;
}

/* Dice Container - The Sacred Object (Three.js Canvas) */
.dice-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    pointer-events: none;
    opacity: 1 !important; /* Never dim the dice */
}

/* Ensure dice stay visible during rolling */
#game-screen.rolling .dice-container,
#game-screen.rolling #dice-canvas {
    opacity: 1 !important;
    filter: none !important;
    transform: none !important;
}

#dice-canvas {
    width: 100%;
    height: 100%;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 1 !important; /* Never dim the dice */
}

/* Settings Button */
.settings-btn {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 44px;
    height: 44px;
    background: var(--surface-secondary);
    border: none;
    border-radius: 50%;
    color: var(--text-primary);
    cursor: pointer;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s var(--ease-settle);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.settings-btn:hover {
    background: var(--surface-primary);
    color: var(--bg-near-black);
    transform: scale(1.1);
}

.settings-btn:active {
    transform: scale(0.95);
}

/* Settings Modal */
.settings-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 400;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}

.settings-modal.active,
.settings-modal[style*="flex"] {
    display: flex !important;
}

.settings-content {
    background: var(--surface-secondary);
    border-radius: 16px;
    padding: 2rem;
    max-width: 400px;
    width: calc(100% - 2rem);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.settings-header h3 {
    font-family: 'Cinzel', serif;
    font-size: 1.5rem;
    margin: 0;
}

.settings-close {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.settings-close:hover {
    transform: scale(1.2);
}

.settings-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.settings-body label {
    font-family: 'Lato', sans-serif;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.dice-count-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin: 1rem 0;
}

.dice-count-btn {
    background: var(--bg-near-black);
    border: 2px solid var(--surface-primary);
    border-radius: 8px;
    padding: 1rem;
    color: var(--text-primary);
    font-size: 1.5rem;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s var(--ease-settle);
    min-height: 60px;
}

.dice-count-btn:hover {
    background: var(--surface-primary);
    color: var(--bg-near-black);
    transform: scale(1.05);
}

.dice-count-btn.active {
    background: var(--surface-primary);
    color: var(--bg-near-black);
    border-color: var(--text-primary);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

.dice-count-btn:active {
    transform: scale(0.95);
}

.settings-hint {
    font-family: 'Lato', sans-serif;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: -0.5rem;
}

/* Round History */
.round-history {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.round-history h3 {
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.round-item {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--surface-secondary);
    border-radius: 8px;
}

.round-item h4 {
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.round-player {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    font-family: 'Lato', sans-serif;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.round-player:last-child {
    border-bottom: none;
}

.totals-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid rgba(255, 255, 255, 0.2);
}

.totals-section h3 {
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.total-item {
    display: flex;
    justify-content: space-between;
    padding: 0.6rem 0;
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.total-item:last-child {
    border-bottom: none;
}

.dice-wrapper {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    flex-wrap: wrap;
    align-items: center;
    transform-style: preserve-3d;
}

.dice {
    width: 100px;
    height: 100px;
    position: relative;
    transform-style: preserve-3d;
    transform: scale(1) rotateX(0deg) rotateY(0deg) rotateZ(0deg);
    transition: transform 0.1s linear;
    will-change: transform;
    filter: blur(0px); /* Will be animated for motion blur */
    /* Ensure 3D rendering */
    -webkit-transform-style: preserve-3d;
    -moz-transform-style: preserve-3d;
    /* Always visible */
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
}

/* Simple Black and White Dice with Gloss */
.dice-face {
    position: absolute;
    width: 100px;
    height: 100px;
    background: #FFFFFF; /* Pure white */
    border-radius: 0; /* Straight edges */
    /* Gloss effect */
    box-shadow: 
        0 40px 80px rgba(0, 0, 0, 0.35),
        0 12px 20px rgba(0, 0, 0, 0.5),
        inset 0 0 20px rgba(255, 255, 255, 0.8),
        inset 0 -10px 30px rgba(0, 0, 0, 0.1);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    padding: 10px;
    gap: 5px;
    align-items: center;
    justify-items: center;
    backface-visibility: visible; /* Show back faces for 3D effect */
    box-sizing: border-box;
    /* Ensure 3D rendering */
    -webkit-backface-visibility: visible;
    -moz-backface-visibility: visible;
}

/* Gloss overlay */
.dice-face::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.6) 0%,
        rgba(255, 255, 255, 0.2) 30%,
        transparent 50%,
        rgba(0, 0, 0, 0.05) 100%
    );
    pointer-events: none;
}

/* Position each face of the cube in 3D space */
.dice-front {
    transform: translateZ(50px) rotateY(0deg);
}

.dice-back {
    transform: translateZ(-50px) rotateY(180deg);
}

.dice-top {
    transform: translateY(-50px) rotateX(90deg);
}

.dice-bottom {
    transform: translateY(50px) rotateX(-90deg);
}

.dice-left {
    transform: translateX(-50px) rotateY(-90deg);
}

.dice-right {
    transform: translateX(50px) rotateY(90deg);
}

/* Dice dots - pure black */
.dot {
    width: 18px;
    height: 18px;
    background: #000000; /* Pure black */
    border-radius: 50%;
    opacity: 0 !important;
    transition: opacity 0.1s ease;
}

/* Dice face patterns - use !important to override inline styles */
/* Face 1: center dot */
.dice-face.face-1 .dot:nth-child(5) { 
    opacity: 1 !important; 
    visibility: visible !important;
}

/* Face 2: top-left and bottom-right */
.dice-face.face-2 .dot:nth-child(1),
.dice-face.face-2 .dot:nth-child(9) { 
    opacity: 1 !important; 
    visibility: visible !important;
}

/* Face 3: diagonal from top-left to bottom-right */
.dice-face.face-3 .dot:nth-child(1),
.dice-face.face-3 .dot:nth-child(5),
.dice-face.face-3 .dot:nth-child(9) { 
    opacity: 1 !important; 
    visibility: visible !important;
}

/* Face 4: four corners */
.dice-face.face-4 .dot:nth-child(1),
.dice-face.face-4 .dot:nth-child(3),
.dice-face.face-4 .dot:nth-child(7),
.dice-face.face-4 .dot:nth-child(9) { 
    opacity: 1 !important; 
    visibility: visible !important;
}

/* Face 5: four corners + center */
.dice-face.face-5 .dot:nth-child(1),
.dice-face.face-5 .dot:nth-child(3),
.dice-face.face-5 .dot:nth-child(5),
.dice-face.face-5 .dot:nth-child(7),
.dice-face.face-5 .dot:nth-child(9) { 
    opacity: 1 !important; 
    visibility: visible !important;
}

/* Face 6: two columns of three */
.dice-face.face-6 .dot:nth-child(1),
.dice-face.face-6 .dot:nth-child(3),
.dice-face.face-6 .dot:nth-child(4),
.dice-face.face-6 .dot:nth-child(6),
.dice-face.face-6 .dot:nth-child(7),
.dice-face.face-6 .dot:nth-child(9) { 
    opacity: 1 !important; 
    visibility: visible !important;
}

/* Background dim during roll */
#game-screen.rolling::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    transition: opacity 0.5s var(--ease-anticipation);
    z-index: 50;
    pointer-events: none;
}

/* Results Screen */
#results-screen h2 {
    font-family: 'Cinzel', serif;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--text-primary);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

#results-list {
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--surface-secondary);
    border-radius: 12px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.result-item:last-child {
    border-bottom: none;
}

.announcement {
    margin: 2rem 0;
    padding: 2rem;
    background: var(--surface-secondary);
    border-radius: 12px;
}

.winner-announcement,
.loser-announcement {
    margin: 1.5rem 0;
}

.label {
    font-family: 'Cinzel', serif;
    font-size: 0.7rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

.winner-name {
    font-family: 'Cinzel', serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.loser-name {
    font-family: 'Cinzel', serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent-loser);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(4px);
    animation: loserReveal 0.8s var(--ease-settle) forwards;
}

@keyframes loserReveal {
    to {
        opacity: 1;
        transform: translateY(0);
        letter-spacing: -0.01em;
    }
}

/* Mobile optimizations */
@media (max-width: 480px) {
    .dice {
        width: 90px;
        height: 90px;
    }
    
    .dice-wrapper {
        gap: 1rem;
    }
    
    #leaderboard-section {
        bottom: 5.5rem;
        max-width: calc(100% - 1rem);
    }
    
    #roll-btn {
        bottom: 1rem;
        max-width: calc(100% - 1rem);
    }
}

/* Book of Questions Styles */
.btn-book {
    background: var(--surface-secondary);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 2rem;
    font-size: 0.95rem;
    font-family: 'Cinzel', serif;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s var(--ease-settle);
    margin: 0.5rem;
    -webkit-user-select: none;
    user-select: none;
}

.btn-book:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-book:active {
    transform: scale(0.98);
}

.book-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(11, 11, 12, 0.95);
    backdrop-filter: blur(20px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow-y: auto;
}

.book-container {
    background: var(--surface-secondary);
    border-radius: 16px;
    padding: 2rem;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    position: relative;
}

.book-header {
    margin-bottom: 2rem;
    text-align: center;
    position: relative;
}

.book-header h2 {
    font-family: 'Cinzel', serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
}

.book-warning {
    font-family: 'Lato', sans-serif;
    font-size: 0.85rem;
    color: var(--accent-loser);
    opacity: 0.8;
    margin-top: 0.5rem;
}

.book-close {
    position: absolute;
    top: 0;
    right: 0;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
    transition: color 0.2s ease;
}

.book-close:hover {
    color: var(--text-primary);
}

.book-categories {
    display: grid;
    gap: 1rem;
}

.book-category-btn {
    background: var(--bg-near-black);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.25rem 1.5rem;
    font-size: 1rem;
    font-family: 'Playfair Display', serif;
    font-weight: 500;
    letter-spacing: 0.02em;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s var(--ease-settle);
    text-align: left;
}

.book-category-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateX(4px);
}

.book-category-btn:active {
    transform: translateX(2px);
}

.book-questions {
    animation: fadeIn 0.3s ease;
}

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

.book-back-btn {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 0.5rem 0;
    font-size: 0.9rem;
    font-family: 'Lato', sans-serif;
    cursor: pointer;
    margin-bottom: 1.5rem;
    transition: color 0.2s ease;
    text-align: left;
}

.book-back-btn:hover {
    color: var(--text-primary);
}

.book-category-title {
    font-family: 'Cinzel', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    letter-spacing: 0.05em;
    text-align: center;
}

.book-questions-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.book-question-btn {
    background: var(--bg-near-black);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.25rem 1.5rem;
    font-size: 0.95rem;
    font-family: 'Lato', sans-serif;
    font-weight: 400;
    line-height: 1.6;
    letter-spacing: 0.01em;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s var(--ease-settle);
    text-align: left;
}

.book-question-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateX(4px);
}

.book-question-btn:active {
    transform: translateX(2px);
}

/* Confirmation Modal Styles */
.confirmation-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(11, 11, 12, 0.95);
    backdrop-filter: blur(20px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.confirmation-container {
    background: var(--surface-secondary);
    border-radius: 16px;
    padding: 2.5rem;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    text-align: center;
    animation: fadeIn 0.3s ease;
}

.confirmation-container h3 {
    font-family: 'Cinzel', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    letter-spacing: 0.05em;
}

.confirmation-container p {
    font-family: 'Lato', sans-serif;
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 2rem;
    white-space: pre-line;
}

.confirmation-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn-confirm-cancel,
.btn-confirm-ok {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s var(--ease-settle);
    font-family: 'Cinzel', serif;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    -webkit-user-select: none;
    user-select: none;
}

.btn-confirm-cancel {
    background: var(--surface-secondary);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-confirm-cancel:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-confirm-ok {
    background: var(--surface-primary);
    color: var(--bg-near-black);
}

.btn-confirm-ok:hover {
    background: rgba(245, 245, 243, 0.9);
}

.btn-confirm-cancel:active,
.btn-confirm-ok:active {
    transform: scale(0.98);
}

/* Mobile optimizations for book */
@media (max-width: 480px) {
    .book-container {
        padding: 1.5rem;
        max-height: 95vh;
    }
    
    .book-header h2 {
        font-size: 1.5rem;
    }
    
    .book-category-btn,
    .book-question-btn {
        padding: 1rem;
        font-size: 0.9rem;
    }
    
    .confirmation-container {
        padding: 2rem 1.5rem;
    }
    
    .confirmation-container h3 {
        font-size: 1.25rem;
    }
    
    .confirmation-container p {
        font-size: 0.9rem;
    }
    
    .confirmation-buttons {
        flex-direction: column;
    }
    
    .btn-confirm-cancel,
    .btn-confirm-ok {
        width: 100%;
    }
}

/* Prevent text selection */
button, input {
    -webkit-user-select: none;
    user-select: none;
}
