/* -------------------------------------------------------------------------- */
/*                               CASINO RÍTMIC                                */
/*                              Design System                                 */
/* -------------------------------------------------------------------------- */

:root {
    /* Colors */
    --gold: #ffd700;
    --gold-dark: #b8860b;
    --felt-green: #2d5a27;
    --felt-dark: #1a3c1a;
    --wood-border: #5d4037;
    --dark: #0a0a12;
    --text-white: #f5f5dc;
    --text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    
    /* Effects */
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --gold-glow: 0 0 20px rgba(255, 215, 0, 0.6);
    
    /* Dimensions */
    --table-width: 95vw;
    --table-height: 90vh;
}

/* -------------------------------------------------------------------------- */
/*                               Global Styles                                */
/* -------------------------------------------------------------------------- */

body {
    margin: 0;
    padding: 0;
    background-color: #111;
    font-family: 'Playfair Display', serif;
    /* A l'aula, un portàtil de 1366x768 deixa ~620 px útils. Amb 100vh i
       overflow:hidden, tot el que no cabia es retallava EN SILENCI: l'alumne
       veia el tapet i prou, i havia de fer Ctrl+- per jugar. Ara la pàgina
       fa scroll si cal, que és lleig però jugable. */
    overflow: auto;
    height: auto;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    color: white;
    user-select: none;
}

/* Table Background and Texture Overlay */
.casino-table {
    width: var(--table-width);
    height: auto;
    min-height: var(--table-height);
    margin: 2vh 0;
    background: radial-gradient(circle at center, var(--felt-green), var(--felt-dark));
    border: 20px solid var(--wood-border);
    border-radius: 50px;
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.8), 0 0 20px rgba(0, 0, 0, 0.5);
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
    overflow: visible;
}

.casino-table::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
    pointer-events: none;
    border-radius: 30px;
    z-index: 1;
}

/* -------------------------------------------------------------------------- */
/*                                 UI Bar                                     */
/* -------------------------------------------------------------------------- */

#casino-ui-bar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    z-index: 100;
    box-sizing: border-box;
    gap: 10px;
    flex-shrink: 0;
}
#casino-ui-bar h1 {
    font-size: clamp(1.1rem, 3.5vw, 2rem);
    text-align: center;
    line-height: 1.1;
}
/* En pantalles estretes (mòbil vertical) la barra reflueix perquè el control
   de volum no quedi tallat pel títol. */
@media (max-width: 560px) {
    #casino-ui-bar { flex-wrap: wrap; row-gap: 6px; padding: 8px 12px; }
    #casino-ui-bar h1 { order: 3; flex-basis: 100%; }
}

.btn-menu {
    text-decoration: none;
    color: var(--gold);
    font-size: 1.5rem;
    font-weight: bold;
    background: rgba(0, 0, 0, 0.5);
    padding: 5px 15px;
    border: 1px solid var(--gold);
    border-radius: 20px;
    transition: all 0.2s;
}

.btn-menu:hover {
    background: rgba(255, 215, 0, 0.2);
    transform: scale(1.05);
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.5);
    padding: 5px 15px;
    border: 1px solid var(--gold);
    border-radius: 20px;
}

.volume-control input[type="range"] {
    width: 100px;
    accent-color: var(--gold);
    cursor: pointer;
}

/* -------------------------------------------------------------------------- */
/*                                  Modals                                    */
/* -------------------------------------------------------------------------- */

.casino-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: #1a0505;
    padding: 40px;
    border: 5px double var(--gold);
    border-radius: 20px;
    text-align: center;
    max-width: 600px;
    width: 90%;
    color: white;
    box-shadow: var(--gold-glow);
    position: relative;
    animation: modalPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.modal-btn {
    background: linear-gradient(to bottom, var(--gold), var(--gold-dark));
    border: 2px solid white;
    color: #1a0505;
    padding: 12px 40px;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    transition: all 0.2s;
    margin-top: 20px;
    font-family: inherit;
}

.modal-btn:hover {
    filter: brightness(1.2);
    transform: translateY(-2px);
}

/* -------------------------------------------------------------------------- */
/*                                 Animations                                 */
/* -------------------------------------------------------------------------- */

@keyframes shake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-1deg); }
    20% { transform: translate(-3px, 0px) rotate(1deg); }
    30% { transform: translate(3px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(1deg); }
    50% { transform: translate(-1px, 2px) rotate(-1deg); }
    60% { transform: translate(-3px, 1px) rotate(0deg); }
    70% { transform: translate(3px, 1px) rotate(-1deg); }
    80% { transform: translate(-1px, -1px) rotate(1deg); }
    90% { transform: translate(1px, 2px) rotate(0deg); }
    100% { transform: translate(1px, -2px) rotate(-1deg); }
}

.shake { animation: shake 0.5s; }

.hidden { display: none !important; }
