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

:root {
    --christmas-red: #c41e3a;
    --christmas-green: #0f8558;
    --christmas-gold: #ffd700;
    --snow-white: #ffffff;
    --dark-bg: #1a1a2e;
    --light-bg: #f5f5f5;
    --extracted-color: #e74c3c;
    --covered-color: #27ae60;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, var(--christmas-red) 0%, var(--christmas-green) 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.hidden {
    display: none !important;
}

/* LANDING PAGE */
.landing {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.landing-content {
    text-align: center;
    background: white;
    padding: 60px 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.landing-content h1 {
    font-size: 3em;
    color: var(--christmas-red);
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.2em;
    color: #666;
    margin-bottom: 40px;
}

.options {
    display: flex;
    gap: 30px;
    justify-content: center;
    flex-wrap: wrap;
}

.option-card {
    background: var(--light-bg);
    padding: 30px;
    border-radius: 15px;
    min-width: 250px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
}

.option-card:hover {
    transform: translateY(-5px);
}

.option-card h2 {
    color: var(--christmas-green);
    margin-bottom: 10px;
    font-size: 1.8em;
}

.option-card p {
    color: #666;
    margin-bottom: 20px;
}

/* BUTTONS */
.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
    font-weight: bold;
}

.btn-primary {
    background: var(--christmas-red);
    color: white;
}

.btn-primary:hover {
    background: #a01729;
    transform: scale(1.05);
}

.btn-secondary {
    background: var(--christmas-green);
    color: white;
}

.btn-secondary:hover {
    background: #0c6b47;
    transform: scale(1.05);
}

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

.btn-danger:hover {
    background: #c0392b;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9em;
}

.btn-large {
    padding: 20px 50px;
    font-size: 1.3em;
}

/* LOGIN SCREEN */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-box {
    background: white;
    padding: 50px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
    min-width: 400px;
}

.login-box h1 {
    color: var(--christmas-red);
    margin-bottom: 10px;
}

.login-box p {
    color: #666;
    margin-bottom: 30px;
}

.password-hint {
    font-size: 0.85em;
    color: #888;
    font-style: italic;
    margin-top: -10px;
    margin-bottom: 20px;
}

#login-form input {
    width: 100%;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    margin-bottom: 20px;
}

#login-form input:focus {
    outline: none;
    border-color: var(--christmas-red);
}

.error-message {
    color: var(--extracted-color);
    margin-top: 10px;
    font-size: 0.9em;
}

/* PRE-GAME SCREEN */
.pregame-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.pregame-box {
    background: white;
    padding: 50px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
    min-width: 400px;
}

.pregame-box h1 {
    color: var(--christmas-red);
    margin-bottom: 10px;
}

.pregame-box p {
    color: #666;
    margin-bottom: 20px;
}

#pregame-form input {
    width: 100%;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    margin-bottom: 10px;
}

#pregame-form input:focus {
    outline: none;
    border-color: var(--christmas-green);
}

.char-counter {
    font-size: 0.85em;
    color: #888;
    margin-bottom: 20px;
    text-align: right;
}

#pregame-form button {
    width: 100%;
    margin-top: 10px;
}

/* HEADER */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 20px 30px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.header h1 {
    color: var(--christmas-red);
    font-size: 2em;
}

/* CARTELLONE - Fullscreen Layout */
.cartellone-screen {
    background: none;
    height: 100vh;
    overflow: hidden;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

.cartellone-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    height: 100vh;
    padding: 5px;
    gap: 5px;
    box-sizing: border-box;
}

.size-control {
    background: var(--light-bg);
    padding: 12px;
    border-radius: 10px;
    text-align: center;
}

.size-label {
    display: block;
    margin-bottom: 8px;
}

.size-text {
    font-size: 0.85em;
    color: #666;
    font-weight: bold;
}

.size-slider {
    width: 100%;
    height: 6px;
    border-radius: 5px;
    background: #ddd;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--christmas-red);
    cursor: pointer;
    transition: all 0.3s;
}

.size-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: var(--christmas-green);
}

.size-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--christmas-red);
    cursor: pointer;
    border: none;
    transition: all 0.3s;
}

.size-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    background: var(--christmas-green);
}

.size-value {
    margin-top: 8px;
    font-size: 0.9em;
    font-weight: bold;
    color: var(--christmas-red);
}

.duration-control {
    background: var(--light-bg);
    padding: 12px;
    border-radius: 10px;
    text-align: center;
}

.duration-label {
    display: block;
    margin-bottom: 8px;
}

.duration-text {
    font-size: 0.85em;
    color: #666;
    font-weight: bold;
}

.duration-slider {
    width: 100%;
    height: 6px;
    border-radius: 5px;
    background: #ddd;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.duration-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--christmas-green);
    cursor: pointer;
    transition: all 0.3s;
}

.duration-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: var(--christmas-red);
}

.duration-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--christmas-green);
    cursor: pointer;
    border: none;
    transition: all 0.3s;
}

.duration-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    background: var(--christmas-red);
}

.duration-value {
    margin-top: 8px;
    font-size: 0.9em;
    font-weight: bold;
    color: var(--christmas-green);
}

/* CENTER COLUMN - Board Grid (Fullscreen) */
.center-column {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 0;
    margin: 0;
}

.board-grid {
    display: grid;
    grid-template-columns: repeat(10, var(--cell-size, 1fr));
    grid-template-rows: repeat(9, var(--cell-size, 1fr));
    gap: var(--board-gap, 2px);
    background: white;
    padding: 5px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    width: fit-content;
    height: fit-content;
}

.board-number {
    width: var(--cell-size, 50px);
    height: var(--cell-size, 50px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--board-font-size, 1em);
    font-weight: bold;
    border-radius: var(--board-border-radius, 4px);
    background: var(--light-bg);
    color: #333;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.board-number.extracted {
    background: var(--extracted-color);
    color: white;
    transform: scale(1.05);
    border-color: #c0392b;
    cursor: pointer;
}

.board-number.extracted:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(231, 76, 60, 0.8);
    filter: brightness(1.1);
}

.board-number.highlight {
    background: var(--christmas-gold);
    color: var(--dark-bg);
    transform: scale(1.15);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
    animation: pulse-glow 0.3s ease-in-out;
}

@keyframes pulse-glow {
    0%, 100% { transform: scale(1.15); }
    50% { transform: scale(1.25); }
}

/* RIGHT SIDEBAR */
.right-sidebar {
    background: white;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--light-bg);
}

.sidebar-header h1 {
    color: var(--christmas-red);
    font-size: 1.4em;
    margin: 0;
}

.header-buttons {
    display: flex;
    gap: 6px;
}

.current-number-section {
    text-align: center;
}

.current-number-section .number-display {
    background: var(--christmas-gold);
    color: var(--dark-bg);
    font-size: 2.5em;
    font-weight: bold;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.current-number-section p {
    margin-top: 5px;
    color: #666;
    font-weight: bold;
    font-size: 0.8em;
}

.btn-extract-main {
    padding: 15px 20px;
    font-size: 1.3em;
    width: 100%;
}

.stats-section {
    text-align: center;
    background: var(--light-bg);
    padding: 10px;
    border-radius: 8px;
}

.stats-section p {
    font-size: 0.85em;
    color: #666;
    margin: 3px 0;
}

.stats-number {
    font-size: 1.5em !important;
    color: var(--christmas-red) !important;
    font-weight: bold !important;
}

.stats-section span {
    color: var(--christmas-red);
    font-size: 1em;
}

.last-number-section {
    text-align: center;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--light-bg);
}

.last-number-section h3 {
    color: var(--christmas-green);
    margin-bottom: 10px;
    font-size: 0.95em;
}

.last-number-display {
    background: var(--christmas-gold);
    color: var(--dark-bg);
    font-size: 2.5em;
    font-weight: bold;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.history-section h3 {
    color: var(--christmas-green);
    margin-bottom: 10px;
    font-size: 0.9em;
    text-align: center;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    align-content: start;
}

.history-number {
    background: var(--extracted-color);
    color: white;
    padding: 8px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 1.1em;
    text-align: center;
}

.qr-section {
    text-align: center;
    padding-top: 15px;
    border-top: 2px solid var(--light-bg);
}

.qr-section h3 {
    color: var(--christmas-green);
    margin-bottom: 10px;
    font-size: 0.95em;
}

.qr-code {
    background: white;
    padding: 10px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.qr-code img {
    max-width: 100%;
    height: auto;
    border-radius: 5px;
}

.qr-label {
    font-size: 0.8em;
    color: #666;
    margin: 0;
}

/* CARTELLA - Ottimizzata per smartphone orizzontale senza scroll */
.cartella-screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 10px;
    box-sizing: border-box;
}

.cartella-screen .header {
    flex-shrink: 0;
    padding: 8px 15px;
    margin-bottom: 8px;
}

.cartella-screen .header h1 {
    font-size: 1.3em;
}

.card-info {
    background: white;
    padding: 8px;
    border-radius: 10px;
    text-align: center;
    margin-bottom: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.card-info p {
    font-size: 0.9em;
    color: #666;
    margin: 0;
}

.card-info span {
    color: var(--christmas-red);
    font-weight: bold;
}

.generation-time {
    font-size: 0.8em;
    color: #888;
    margin-top: 4px;
}

.generation-time span {
    color: var(--christmas-green);
}

/* Achievement Notification */
.achievement-notification {
    background: linear-gradient(135deg, var(--christmas-gold), #ffed4e);
    color: var(--dark-bg);
    padding: 15px 30px;
    border-radius: 12px;
    text-align: center;
    font-size: 1.2em;
    font-weight: bold;
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.5);
    margin-bottom: 10px;
    animation: slideDown 0.5s ease-out, pulse 0.5s ease-in-out 0.5s 3;
    border: 3px solid var(--christmas-red);
}

.achievement-notification.hidden {
    display: none;
}

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

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

.cartella-grid {
    background: white;
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 8px;
    flex-grow: 1;
    height: 0;
}

.cartella-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.2em, 3vw, 2em);
    font-weight: bold;
    border-radius: 8px;
    background: var(--light-bg);
    color: #333;
    cursor: pointer;
    transition: all 0.3s;
    border: 3px solid transparent;
    position: relative;
}

.cartella-cell:not(.empty):hover {
    background: #e0e0e0;
    transform: scale(1.05);
}

.cartella-cell.covered {
    background: var(--covered-color);
    color: white;
    border-color: #229954;
}

.cartella-cell.covered::after {
    content: '✓';
    position: absolute;
    font-size: 0.6em;
    top: 3px;
    right: 5px;
}

.cartella-cell.empty {
    background: transparent;
    cursor: default;
}

.instructions {
    background: white;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    margin-top: 8px;
}

.instructions h3 {
    color: var(--christmas-green);
    margin-bottom: 8px;
    text-align: center;
    font-size: 1em;
}

.instructions p {
    color: #666;
    margin: 3px 0;
    font-size: 0.85em;
}

/* SETTINGS BUTTON */
.btn-settings {
    width: 100%;
    margin-top: auto;
    padding: 12px 20px;
    font-size: 1em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #6c757d;
    color: white;
}

.btn-settings:hover {
    background: #5a6268;
}

/* FLOATING BUTTONS (mobile/tablet) */
.floating-extract-btn {
    position: fixed;
    bottom: 30px;
    right: 110px;
    padding: 15px 25px;
    border-radius: 30px;
    background: var(--christmas-red);
    color: white;
    border: none;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    z-index: 9000;
    transition: all 0.3s;
    display: none;
    white-space: nowrap;
}

.floating-extract-btn:hover {
    background: #a01729;
    transform: scale(1.05);
}

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

.floating-settings-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--christmas-green);
    color: white;
    border: none;
    font-size: 1.8em;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    z-index: 9000;
    transition: all 0.3s;
    display: none;
}

.floating-settings-btn:hover {
    background: #0c6b47;
    transform: scale(1.1) rotate(45deg);
}

.floating-settings-btn:active {
    transform: scale(0.95) rotate(45deg);
}

/* SETTINGS PANEL */
.settings-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.3);
    z-index: 9998;
    transition: right 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
}

.settings-panel.show {
    right: 0;
}

.settings-content {
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 25px;
    height: 100%;
    overflow-y: auto;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--light-bg);
}

.settings-header h2 {
    color: var(--christmas-red);
    font-size: 1.8em;
    margin: 0;
}

.settings-close {
    background: var(--light-bg);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.8em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    color: #666;
}

.settings-close:hover {
    background: var(--christmas-red);
    color: white;
    transform: rotate(90deg);
}

.settings-info {
    text-align: center;
}

.qr-section-panel {
    text-align: center;
    padding: 15px;
    background: var(--light-bg);
    border-radius: 12px;
}

.qr-section-panel h3 {
    color: var(--christmas-green);
    margin-bottom: 10px;
    font-size: 1em;
}

.settings-actions,
.settings-nav {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mobile-only {
    display: none;
}

.settings-panel .size-control,
.settings-panel .duration-control {
    background: var(--light-bg);
    padding: 20px;
    border-radius: 12px;
}

.settings-panel .btn-reset {
    margin-top: auto;
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
}

/* RESPONSIVE */

/* LARGE SCREENS & TV OPTIMIZATION */
@media (min-width: 1600px) {
    .cartellone-layout {
        grid-template-columns: 1fr 320px;
        padding: 8px;
        gap: 8px;
    }

    .right-sidebar {
        padding: 15px;
        gap: 15px;
    }

    .sidebar-header h1 {
        font-size: 1.6em;
    }

    .current-number-section .number-display {
        font-size: 2.8em;
        padding: 12px;
    }

    .btn-extract-main {
        padding: 18px 25px;
        font-size: 1.4em;
    }

    .last-number-display {
        font-size: 3em;
        padding: 20px;
    }

    .tipologia-info {
        font-size: 1.1em;
        padding: 10px 20px;
    }
}

@media (min-width: 1920px) {
    .cartellone-layout {
        grid-template-columns: 1fr 360px;
        padding: 10px;
        gap: 10px;
    }

    .right-sidebar {
        padding: 18px;
        gap: 18px;
    }

    .sidebar-header h1 {
        font-size: 1.8em;
    }

    .current-number-section .number-display {
        font-size: 3.2em;
        padding: 15px;
    }

    .btn-extract-main {
        padding: 20px 30px;
        font-size: 1.5em;
    }

    .last-number-display {
        font-size: 3.5em;
        padding: 25px;
    }
}

@media (min-width: 2560px) {
    /* 4K / Ultra HD optimization */
    .cartellone-layout {
        grid-template-columns: 1fr 420px;
        padding: 15px;
        gap: 15px;
    }

    .right-sidebar {
        padding: 25px;
        gap: 25px;
    }

    .sidebar-header h1 {
        font-size: 2.2em;
    }

    .current-number-section .number-display {
        font-size: 4em;
        padding: 20px;
    }

    .btn-extract-main {
        padding: 25px 40px;
        font-size: 1.8em;
    }

    .last-number-display {
        font-size: 4em;
        padding: 30px;
    }

    .history-number {
        font-size: 1.4em;
        padding: 12px;
    }

    .tipologia-info {
        font-size: 1.3em;
        padding: 12px 25px;
    }

    .stats-number {
        font-size: 2em !important;
    }
}

@media (max-width: 1400px) {
    .cartellone-layout {
        grid-template-columns: 1fr 260px;
    }
}

@media (max-width: 1200px) {
    .cartellone-layout {
        grid-template-columns: 1fr 240px;
    }

    .sidebar-header h1 {
        font-size: 1.2em;
    }

    .current-number-section .number-display {
        font-size: 2em;
    }

    .btn-extract-main {
        font-size: 1.1em;
        padding: 12px 15px;
    }
}

@media (max-width: 1024px) {
    .cartellone-layout {
        grid-template-columns: 1fr;
    }

    .right-sidebar {
        display: none;
    }

    .floating-extract-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .floating-extract-btn.hidden {
        display: none !important;
    }

    .floating-settings-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .floating-settings-btn.hidden {
        display: none !important;
    }

    .settings-panel {
        width: 100%;
        right: -100%;
    }

    .mobile-only {
        display: flex !important;
    }

    /* Hide extract button from settings panel on mobile */
    .settings-actions.mobile-only {
        display: none !important;
    }

    .board-grid {
        grid-template-columns: repeat(10, 1fr);
    }
}

/* TABLET LANDSCAPE OPTIMIZATION */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
    .cartellone-layout {
        padding: 3px;
        gap: 3px;
    }

    .board-grid {
        grid-template-columns: repeat(10, 1fr);
        padding: 3px;
    }

    .floating-settings-btn {
        bottom: 15px;
        right: 15px;
        width: 50px;
        height: 50px;
        font-size: 1.5em;
    }
}

@media (max-width: 768px) {
    .landing-content h1 {
        font-size: 2em;
    }

    .options {
        flex-direction: column;
    }

    .board-grid {
        grid-template-columns: repeat(8, 1fr);
        padding: 3px;
        gap: 1px;
    }

    .cartellone-layout {
        padding: 2px;
        gap: 2px;
    }

    .cartella-grid {
        gap: 8px;
        padding: 20px;
    }

    .cartella-cell {
        font-size: 1.4em;
    }

    .floating-settings-btn {
        bottom: 10px;
        right: 10px;
        width: 55px;
        height: 55px;
        font-size: 1.6em;
    }
}

@media (max-width: 600px) {
    /* Mobile-specific styles for cartellone */
    .cartellone-layout {
        height: 100vh;
        overflow: hidden;
    }

    .center-column {
        overflow-y: auto;
        overflow-x: hidden;
        padding: 10px 5px;
        height: 100vh;
        display: block;
    }

    .board-grid {
        grid-template-columns: repeat(5, 1fr);
        grid-template-rows: auto;
        gap: 5px;
        width: 100%;
        max-width: 100%;
        padding: 5px;
        padding-bottom: 90px;
    }

    .board-number {
        font-size: clamp(0.9em, 4vw, 1.2em);
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1;
    }

    /* Ensure floating buttons are visible and accessible on mobile */
    .floating-extract-btn {
        bottom: 15px;
        right: 90px;
        padding: 12px 20px;
        font-size: 0.95em;
        z-index: 9001;
    }

    .floating-settings-btn {
        bottom: 15px;
        right: 15px;
        width: 55px;
        height: 55px;
        font-size: 1.6em;
        z-index: 9001;
    }

    /* Settings panel takes full width on mobile */
    .settings-panel {
        width: 100%;
        right: -100%;
    }
}

@media (max-width: 480px) {
    .login-box {
        min-width: auto;
        padding: 30px 20px;
    }

    .pregame-box {
        min-width: auto;
        padding: 30px 20px;
    }

    .board-grid {
        gap: 3px;
        padding: 3px;
        padding-bottom: 90px;
    }

    .board-number {
        font-size: clamp(0.8em, 3.5vw, 1em);
    }
}

/* CONFIRMATION MODAL */
.confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    padding: 20px;
    box-sizing: border-box;
}

.confirm-modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.confirm-modal-content h3 {
    color: var(--christmas-red);
    font-size: 1.5em;
    margin-bottom: 15px;
}

.confirm-modal-content p {
    color: #666;
    font-size: 1.1em;
    margin-bottom: 25px;
    line-height: 1.5;
}

.confirm-modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.confirm-modal-buttons .btn {
    padding: 12px 30px;
    font-size: 1em;
    min-width: 120px;
}

.btn-logout-settings {
    width: 100%;
    margin-top: 10px;
}

/* QR CODE MODAL */
.qr-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    box-sizing: border-box;
}

.qr-modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    max-width: 90vw;
    max-height: 90vh;
}

.qr-modal-credits {
    color: white;
    font-size: 1.1em;
    font-style: italic;
    text-align: center;
    margin: 0;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    letter-spacing: 0.5px;
}

.qr-modal-close {
    position: absolute;
    top: -50px;
    right: -50px;
    background: white;
    color: #333;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 2em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.qr-modal-close:hover {
    background: var(--christmas-red);
    color: white;
    transform: scale(1.1);
}

.qr-modal-image {
    width: min(600px, 70vh, 70vw);
    height: min(600px, 70vh, 70vw);
    background: white;
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.qr-modal-link {
    color: white;
    font-size: 1.2em;
    text-align: center;
    word-break: break-all;
    background: rgba(255, 255, 255, 0.1);
    padding: 15px 30px;
    border-radius: 10px;
    max-width: 80vw;
}

.qr-code {
    cursor: pointer;
    transition: transform 0.3s;
}

.qr-code:hover {
    transform: scale(1.05);
}

@media (max-width: 768px) {
    .qr-modal-close {
        top: -40px;
        right: -20px;
        width: 35px;
        height: 35px;
        font-size: 1.5em;
    }

    .qr-modal-image {
        width: min(500px, 60vh, 80vw);
        height: min(500px, 60vh, 80vw);
        padding: 15px;
    }

    .qr-modal-link {
        font-size: 1em;
        padding: 12px 20px;
    }
}

/* ==========================================
   TIPOLOGIA SELECTION SCREEN
   ========================================== */
.tipologia-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
    padding: 40px 20px;
}

.tipologia-header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
}

.tipologia-header h1 {
    color: white;
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.tipologia-header p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.2em;
}

.btn-logout {
    position: absolute;
    top: 0;
    right: -100px;
}

.tipologie-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    width: 100%;
    max-width: 1200px;
}

.tipologia-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    border: 3px solid transparent;
    display: flex;
    flex-direction: column;
    min-height: 400px;
}

.tipologia-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
    border-color: var(--christmas-gold);
}

.tipologia-card.default {
    border-color: var(--christmas-green);
}

.tipologia-card-image {
    width: 100%;
    margin-bottom: 15px;
    border-radius: 10px;
    overflow: hidden;
}

.tipologia-card-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.tipologia-card h3 {
    color: var(--christmas-red);
    font-size: 1.5em;
    margin-bottom: 10px;
}

.tipologia-card p {
    color: #666;
    margin-bottom: 15px;
}

.tipologia-card .stats {
    display: flex;
    gap: 15px;
    font-size: 0.9em;
    color: #888;
    background: none;
    padding: 0;
}

.tipologia-card .stats span {
    color: var(--christmas-green);
    font-weight: bold;
    font-size: 1em;
}

.tipologia-card button {
    display: block;
    margin-top: auto;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 0;
    width: auto;
    min-width: 150px;
}

/* ==========================================
   MOBILE WARNING OVERLAY (shown on smartphones)
   ========================================== */
.mobile-warning-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10002;
    backdrop-filter: blur(5px);
}

.mobile-warning-content {
    background: white;
    padding: 30px 25px;
    border-radius: 20px;
    max-width: 90%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: warningFadeIn 0.5s ease-out;
}

.mobile-warning-title {
    color: #e74c3c;
    font-size: 2em;
    margin-bottom: 20px;
    text-shadow: none;
}

.mobile-warning-message {
    color: #333;
    margin-bottom: 25px;
    line-height: 1.6;
}

.mobile-warning-message p {
    margin: 15px 0;
    font-size: 1em;
}

.mobile-warning-message strong {
    color: var(--christmas-red);
}

.mobile-warning-message ul {
    list-style: none;
    padding: 0;
    margin: 20px 0;
}

.mobile-warning-message ul li {
    padding: 10px;
    margin: 8px 0;
    background: var(--light-bg);
    border-radius: 10px;
    font-size: 1.1em;
}

.btn-mobile-warning {
    padding: 15px 40px;
    font-size: 1.2em;
    background: var(--christmas-green);
}

.btn-mobile-warning:hover {
    background: #0c6b47;
}

@keyframes warningFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ==========================================
   WELCOME OVERLAY (shown when board is empty)
   ========================================== */
.welcome-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    backdrop-filter: blur(5px);
}

.welcome-overlay-content {
    text-align: center;
    animation: welcomeFadeIn 0.8s ease-out;
}

.welcome-title {
    color: var(--christmas-gold);
    font-size: 5em;
    margin-bottom: 20px;
    text-shadow: 4px 4px 8px rgba(0, 0, 0, 0.8);
    animation: welcomePulse 2s ease-in-out infinite;
}

.welcome-subtitle {
    color: white;
    font-size: 3em;
    margin-bottom: 40px;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.8);
}

.welcome-qr-section {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 20px;
    margin-bottom: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.welcome-qr-text {
    color: var(--christmas-green);
    font-size: 1.3em;
    font-weight: bold;
    margin-bottom: 20px;
    text-shadow: none;
}

.welcome-qr-code {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
}

.welcome-qr-code img {
    width: 250px;
    height: 250px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.welcome-session-code {
    color: #666;
    font-size: 1.1em;
    font-family: monospace;
    font-weight: bold;
    text-shadow: none;
}

.btn-welcome-extract {
    padding: 30px 80px;
    font-size: 2.5em;
    background: linear-gradient(135deg, var(--christmas-red), #a01729);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    box-shadow: 0 10px 40px rgba(196, 30, 58, 0.6);
    transition: all 0.3s ease;
    animation: welcomeButtonGlow 2s ease-in-out infinite;
}

.btn-welcome-extract:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 50px rgba(196, 30, 58, 0.8);
}

.btn-welcome-extract:active {
    transform: translateY(-2px) scale(1.02);
}

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

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

@keyframes welcomeButtonGlow {
    0%, 100% {
        box-shadow: 0 10px 40px rgba(196, 30, 58, 0.6);
    }
    50% {
        box-shadow: 0 10px 50px rgba(196, 30, 58, 0.9);
    }
}

@media (max-width: 768px) {
    .welcome-title {
        font-size: 3em;
    }

    .welcome-subtitle {
        font-size: 2em;
        margin-bottom: 30px;
    }

    .welcome-qr-section {
        padding: 20px;
        margin-bottom: 30px;
    }

    .welcome-qr-text {
        font-size: 1.1em;
    }

    .welcome-qr-code img {
        width: 200px;
        height: 200px;
    }

    .welcome-session-code {
        font-size: 0.9em;
    }

    .btn-welcome-extract {
        padding: 20px 50px;
        font-size: 1.8em;
    }
}

@media (max-width: 480px) {
    .welcome-title {
        font-size: 2.5em;
    }

    .welcome-subtitle {
        font-size: 1.5em;
        margin-bottom: 20px;
    }

    .welcome-qr-section {
        padding: 15px;
        margin-bottom: 20px;
    }

    .welcome-qr-text {
        font-size: 0.95em;
    }

    .welcome-qr-code img {
        width: 150px;
        height: 150px;
    }

    .welcome-session-code {
        font-size: 0.8em;
    }

    .btn-welcome-extract {
        padding: 15px 40px;
        font-size: 1.5em;
    }
}

/* ==========================================
   MEDIA OVERLAY (for images/text during extraction)
   ========================================== */
.media-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.media-overlay-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-image {
    width: auto;
    height: auto;
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.media-text {
    color: white;
    font-size: 1.2em;
    text-align: left;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    padding: 0 0 0 20px;
    line-height: 1.4;
    flex: 1;
    display: flex;
    align-items: center;
}

.media-number {
    position: absolute;
    color: var(--christmas-gold);
    font-weight: bold;
    text-shadow: 4px 4px 8px rgba(0, 0, 0, 0.8),
                 -2px -2px 4px rgba(0, 0, 0, 0.8);
    animation: numberPulse 1s ease-in-out infinite;
    line-height: 1;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 20px;
    transition: all 0.5s ease-in-out;
}

/* Number starts at center (large) */
.media-number-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 15em;
    padding: 40px 60px;
}

/* Number moves to top-right (smaller) */
.media-number-top-right {
    top: 30px;
    right: 30px;
    transform: none;
    font-size: 8em;
    padding: 20px 30px;
}

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

/* Override pulse animation for centered number */
.media-number-center {
    animation: numberPulseLarge 1s ease-in-out infinite;
}

@keyframes numberPulseLarge {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.1); }
}

.media-close-btn {
    display: none; /* Hidden - replaced by Tabellone button */
}

.media-audio-container {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 900px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 10px;
    backdrop-filter: blur(10px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 20px;
}

.media-audio-container audio {
    flex: 1;
    min-width: 300px;
    height: 50px;
}

.btn-extract-overlay {
    position: absolute;
    top: 180px;
    right: 30px;
    padding: 12px 30px;
    font-size: 1.1em;
    font-weight: bold;
    background: linear-gradient(135deg, var(--christmas-green), #0c6b47);
    color: white;
    border: none;
    border-radius: 25px 25px 0 0;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-extract-overlay:hover {
    background: linear-gradient(135deg, #0c6b47, var(--christmas-green));
}

.btn-extract-overlay:active {
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.3);
}

.btn-board-overlay {
    position: absolute;
    top: 223px;
    right: 30px;
    padding: 12px 30px;
    font-size: 1.1em;
    font-weight: bold;
    background: linear-gradient(135deg, var(--christmas-red), #a01729);
    color: white;
    border: none;
    border-radius: 0 0 25px 25px;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.btn-board-overlay:hover {
    background: linear-gradient(135deg, #a01729, var(--christmas-red));
}

.btn-board-overlay:active {
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.3);
}

/* Board number with image */
.board-number-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
    opacity: 0.7;
}

.board-number-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: inherit;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8),
                 -1px -1px 2px rgba(0, 0, 0, 0.8),
                 1px -1px 2px rgba(0, 0, 0, 0.8),
                 -1px 1px 2px rgba(0, 0, 0, 0.8);
    z-index: 2;
}

.board-number.extracted {
    position: relative;
}

/* ==========================================
   TIPOLOGIA INFO BADGE (cartellone header)
   ========================================== */
.tipologia-info {
    background: linear-gradient(135deg, var(--christmas-green), #0c6b47);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.header-buttons {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    justify-content: center;
}

.last-number-text {
    color: #666;
    font-size: 0.95em;
    margin-top: 8px;
    text-align: center;
    font-style: italic;
}

.session-code {
    font-size: 0.75em;
    color: #888;
    font-family: monospace;
    margin-top: 5px;
}

/* ==========================================
   MULTI-CARTELLA STYLES
   ========================================== */
.cartella-header {
    flex-direction: column;
    gap: 10px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.tipologia-badge {
    background: linear-gradient(135deg, var(--christmas-green), #0c6b47);
    color: white;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.85em;
    font-weight: bold;
}

.global-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    padding: 10px 0;
    justify-content: center;
    align-items: center;
}

.global-badges .badge {
    padding: 6px 14px;
    border-radius: 15px;
    font-size: 0.9em;
    font-weight: bold;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.cartelle-controls {
    background: white;
    padding: 12px 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.cartelle-controls label {
    color: #666;
    font-weight: bold;
}

.cartelle-select {
    padding: 8px 15px;
    border: 2px solid var(--christmas-green);
    border-radius: 8px;
    font-size: 1em;
    background: white;
    cursor: pointer;
    min-width: 150px;
}

.cartelle-select:focus {
    outline: none;
    border-color: var(--christmas-red);
}

.cartelle-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 5px;
}

.cartella-wrapper {
    background: white;
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.cartella-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--light-bg);
}

.cartella-item-id {
    font-weight: bold;
    color: var(--christmas-red);
    font-size: 0.9em;
}

.cartella-item-time {
    font-size: 0.8em;
    color: #888;
}

.cartella-wrapper .cartella-grid {
    height: auto;
    min-height: 120px;
}

/* Achievement badges for cartelle */
.cartella-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 2px solid var(--light-bg);
}

.cartella-badges .badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: bold;
    text-transform: uppercase;
}

.badge-ambo {
    background: #3498db;
    color: white;
}

.badge-terno {
    background: #9b59b6;
    color: white;
}

.badge-quaterna {
    background: #e67e22;
    color: white;
}

.badge-quintina {
    background: var(--christmas-green);
    color: white;
}

.badge-tombola {
    background: linear-gradient(135deg, var(--christmas-gold), #ffed4e);
    color: var(--dark-bg);
    animation: tombola-glow 1s ease-in-out infinite;
}

@keyframes tombola-glow {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 215, 0, 0.5); }
    50% { box-shadow: 0 0 25px rgba(255, 215, 0, 0.8); }
}

/* ==========================================
   SELECTION SCREEN (Step 1)
   ========================================== */
.selection-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.selection-content {
    background: white;
    padding: 50px 40px;
    border-radius: 20px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 100%;
    text-align: center;
}

.selection-title {
    color: var(--christmas-red);
    font-size: 2.5em;
    margin-bottom: 10px;
}

.selection-subtitle {
    color: #666;
    font-size: 1.2em;
    margin-bottom: 40px;
}

.selection-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.selection-btn {
    padding: 20px 10px;
    background: var(--light-bg);
    border: 3px solid var(--christmas-green);
    border-radius: 15px;
    font-size: 1em;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    transition: all 0.3s;
}

.selection-btn:hover {
    background: var(--christmas-green);
    color: white;
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(15, 133, 88, 0.4);
}

.session-info {
    background: var(--light-bg);
    padding: 20px;
    border-radius: 15px;
    margin-top: 20px;
}

.session-info p {
    margin: 8px 0;
    color: #666;
    font-size: 0.95em;
}

.session-info strong {
    color: var(--christmas-red);
    font-size: 1.1em;
}

.game-screen {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Multi-cartella responsive */
@media (max-width: 768px) {
    .tipologia-header h1 {
        font-size: 1.8em;
    }

    .tipologie-grid {
        grid-template-columns: 1fr;
    }

    .btn-logout {
        position: static;
        margin-top: 15px;
    }

    .media-number {
        font-size: 5em;
    }

    .media-text {
        font-size: 1em;
        padding: 0 0 0 10px;
    }

    .media-audio-container {
        flex-direction: column;
        gap: 10px;
        max-width: 95%;
    }

    .media-audio-container audio {
        min-width: 100%;
    }

    .media-number-center {
        font-size: 8em;
        padding: 20px 30px;
    }

    .media-number-top-right {
        font-size: 5em;
        padding: 15px 20px;
        top: 20px;
        right: 20px;
    }

    .btn-extract-overlay {
        top: 120px;
        right: 20px;
        padding: 10px 25px;
        font-size: 1em;
    }

    .btn-board-overlay {
        top: 163px;
        right: 20px;
        padding: 10px 25px;
        font-size: 1em;
    }

    .cartelle-controls {
        flex-direction: column;
        gap: 10px;
    }

    .cartella-wrapper .cartella-grid {
        gap: 5px;
        padding: 10px;
    }

    /* Selection screen responsive */
    .selection-title {
        font-size: 1.8em;
    }

    .selection-subtitle {
        font-size: 1em;
    }

    .selection-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .selection-btn {
        padding: 15px 8px;
        font-size: 0.9em;
    }

    .selection-content {
        padding: 30px 20px;
    }
}

@media (max-height: 500px) {
    .cartella-wrapper .cartella-grid {
        min-height: 100px;
    }

    .cartella-badges .badge {
        padding: 3px 8px;
        font-size: 0.7em;
    }
}
