/* Mini-gioco "Turno al DDM" — Area Clienti */

.ddm-game-tab,
.ddm-game-appbar-btn {
    touch-action: manipulation;
}

.portale-cliente .tabs .ddm-game-tab {
    color: #166534;
    cursor: pointer;
    white-space: nowrap;
    background: #ecfdf5;
    border: 1px solid #bbf7d0;
    border-radius: 999px;
    padding: 10px 18px;
    font-weight: 700;
}

.ddm-game-login {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px dashed #e2e8f0;
    text-align: center;
}

.ddm-game-login p {
    margin: 0 0 10px;
    color: #64748b;
    font-size: 13px;
    line-height: 1.45;
}

.ddm-game-login-btn {
    color: #fff;
    cursor: pointer;
    background: linear-gradient(135deg, #3d9c35, #2563eb);
    border: none;
    border-radius: 10px;
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    font-weight: 800;
    touch-action: manipulation;
}

.ddm-game-shortcut {
    text-align: left;
    cursor: pointer;
    background: linear-gradient(180deg, #ecfdf5, #eff6ff);
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    padding: 14px 16px;
    touch-action: manipulation;
}

.ddm-game-shortcut .shortcut-label {
    color: #166534;
    font-size: 15px;
    font-weight: 800;
    display: block;
}

.ddm-game-shortcut .shortcut-hint {
    color: #64748b;
    margin-top: 4px;
    font-size: 12px;
    display: block;
}

.ddm-game-appbar-btn {
    color: #166534;
    cursor: pointer;
    background: #ecfdf5;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 16px;
    line-height: 1;
}

.ddm-game-overlay {
    z-index: 20050;
    background: #1a3a24;
    color: #e2e8f0;
    font-family: sans-serif;
    flex-direction: column;
    display: flex;
    position: fixed;
    inset: 0;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

html.ddm-game-open,
html.ddm-game-open body {
    overflow: hidden !important;
    overscroll-behavior: none;
}

.ddm-game-overlay[hidden] {
    display: none !important;
}

.ddm-game-top {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: max(10px, env(safe-area-inset-top)) 12px 10px;
    background: #14532d;
    border-bottom: 3px solid #052e16;
}

.ddm-game-close,
.ddm-game-icon-btn {
    color: #e2e8f0;
    cursor: pointer;
    background: #166534;
    border: none;
    border-radius: 10px;
    min-width: 42px;
    min-height: 42px;
    font-size: 20px;
    font-weight: 700;
    touch-action: manipulation;
}

.ddm-game-brand {
    flex: 1;
    min-width: 0;
}

.ddm-game-brand strong {
    display: block;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.2px;
}

.ddm-game-brand span {
    color: #bbf7d0;
    font-size: 11px;
    font-weight: 600;
}

.ddm-game-hud {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ddm-game-hud[hidden] {
    display: none !important;
}

.ddm-game-score {
    background: #052e16;
    border: 1px solid #166534;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}

.ddm-game-hearts {
    letter-spacing: 1px;
    font-size: 16px;
}

.ddm-game-stage {
    flex: 1;
    min-height: 0;
    position: relative;
    display: flex;
    flex-direction: column;
}

.ddm-game-screen {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
}

.ddm-game-hero {
    text-align: center;
    max-width: 420px;
    margin: 12px auto 0;
}

.ddm-game-badge {
    display: inline-block;
    background: #14532d;
    color: #bbf7d0;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    margin-bottom: 14px;
}

.ddm-game-hero h2 {
    margin: 0 0 10px;
    font-size: 28px;
    line-height: 1.15;
    color: #fff;
}

.ddm-game-hero p {
    margin: 0 0 12px;
    color: #dcfce7;
    font-size: 15px;
    line-height: 1.5;
}

.ddm-game-rules {
    text-align: left;
    background: #052e16;
    border: 1px solid #166534;
    border-radius: 14px;
    padding: 14px 16px;
    margin: 18px 0;
    color: #dcfce7;
    font-size: 13px;
    line-height: 1.55;
}

.ddm-game-rules li {
    margin: 6px 0;
}

.ddm-game-record {
    color: #fde68a;
    font-weight: 800;
    margin: 0 0 18px;
    font-size: 14px;
}

.ddm-game-primary {
    color: #052e16;
    cursor: pointer;
    background: #4ade80;
    border: none;
    border-radius: 14px;
    width: 100%;
    padding: 16px 18px;
    font-size: 17px;
    font-weight: 900;
    touch-action: manipulation;
}

.ddm-game-secondary {
    color: #e2e8f0;
    cursor: pointer;
    background: #14532d;
    border: 1px solid #166534;
    border-radius: 14px;
    width: 100%;
    margin-top: 10px;
    padding: 14px 18px;
    font-size: 15px;
    font-weight: 700;
    touch-action: manipulation;
}

.ddm-game-mascot {
    width: 72px;
    height: 96px;
    margin: 0 auto 12px;
    position: relative;
}

.ddm-game-mascot .ddm-dude {
    position: relative;
    left: 50%;
    top: auto;
    margin: 16px 0 0 -24px;
}

.ddm-game-mascot .ddm-dude-flip {
    animation: ddm-idle 1.8s ease-in-out infinite;
}

.ddm-game-play {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.ddm-game-status {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 6px 14px 2px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #86efac;
}

.ddm-game-status.calmo { color: #86efac; }
.ddm-game-status.si-anima { color: #fde68a; }
.ddm-game-status.traffico { color: #fdba74; }
.ddm-game-status.caos { color: #fca5a5; }

.ddm-game-chaos {
    height: 4px;
    background: #052e16;
    border-radius: 999px;
    overflow: hidden;
    margin: 0 14px 6px;
}

.ddm-game-chaos > span {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #22c55e, #eab308, #ef4444);
}

.ddm-game-shop {
    flex: 1;
    min-height: 0;
    margin: 0 10px 8px;
    position: relative;
    border: 6px solid #7c4a1e;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: inset 0 0 0 3px #c4a574;
}

.ddm-game-floor {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(#8fd3ff 0 26%, transparent 26%),
        repeating-linear-gradient(90deg, #e8c48a 0 28px, #d9b278 28px 56px),
        #d9b278;
}

.ddm-game-wall {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 26%;
    background: linear-gradient(#7dd3fc, #38bdf8);
    border-bottom: 8px solid #3d9c35;
    z-index: 5;
}

.ddm-game-window {
    position: absolute;
    top: 8%;
    left: 50%;
    width: 78%;
    height: 72%;
    transform: translateX(-50%);
    background: #fff;
    border: 3px solid #fff;
    border-radius: 10px;
    box-shadow: 0 0 0 3px #166534;
    box-sizing: border-box;
    padding: 6px 8px 16px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ddm-board {
    width: 100%;
    max-height: 100%;
    overflow: hidden;
    color: #0f172a;
    text-align: left;
}

.ddm-board-empty {
    color: #64748b;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
}

.ddm-board-item {
    margin: 0 0 5px;
    line-height: 1.2;
}

.ddm-board-item:last-child {
    margin-bottom: 0;
}

.ddm-board-item strong {
    display: block;
    font-size: 12px;
    font-weight: 800;
}

.ddm-board-item span {
    display: block;
    color: #475569;
    font-size: 11px;
    margin-top: 1px;
}

.ddm-game-sign {
    position: absolute;
    top: auto;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    background: #166534;
    color: #fff;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 2px;
    padding: 2px 10px;
    border-radius: 4px;
    z-index: 2;
}

.ddm-game-door {
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 22%;
    height: 9%;
    transform: translateX(-50%);
    background: #7c4a1e;
    border-radius: 8px 8px 0 0;
    box-shadow: inset 0 8px 0 #c4a574;
}

.ddm-spot {
    position: absolute;
    width: 28%;
    transform: translate(-50%, -70%);
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    touch-action: manipulation;
    z-index: 4;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: inherit;
    -webkit-appearance: none;
    appearance: none;
}

.ddm-spot[data-spot="bancone"] { width: 42%; }
.ddm-spot[data-spot="cellulare"] { width: 24%; }

.ddm-furn {
    width: 100%;
    pointer-events: none;
}

.furn-shelves {
    height: 52px;
    background:
        linear-gradient(#8b5a2b 0 8px, #d6a56a 8px 16px, #8b5a2b 16px 24px, #d6a56a 24px 32px, #8b5a2b 32px 40px, #fde68a 40px 52px);
    border-radius: 4px;
    box-shadow: 0 6px 0 #6b3f16;
}

.furn-pc {
    height: 48px;
    background: #334155;
    border-radius: 6px 6px 2px 2px;
    position: relative;
    box-shadow: 0 6px 0 #1e293b;
}

.furn-pc::before {
    content: '';
    position: absolute;
    inset: 6px 8px 16px;
    background: #22c55e;
    border-radius: 3px;
}

.furn-pc::after {
    content: '';
    position: absolute;
    left: 20%;
    right: 20%;
    bottom: 4px;
    height: 8px;
    background: #94a3b8;
    border-radius: 2px;
}

.furn-phone {
    width: 42px;
    height: 42px;
    background: #1e293b;
    border-radius: 50%;
    box-shadow: 0 5px 0 #0f172a;
    position: relative;
}

.furn-phone::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 10px;
    background: #64748b;
    border-radius: 4px;
    left: 12px;
    top: 8px;
}

.furn-phone::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 16px;
    background: #94a3b8;
    border-radius: 3px;
    left: 16px;
    top: 18px;
}

.furn-printer {
    height: 46px;
    background: #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 6px 0 #94a3b8;
    position: relative;
}

.furn-printer::before {
    content: '';
    position: absolute;
    left: 12%;
    right: 12%;
    top: 8px;
    height: 14px;
    background: #7c3aed;
    border-radius: 3px;
}

.furn-printer::after {
    content: '';
    position: absolute;
    left: 18%;
    right: 18%;
    bottom: 8px;
    height: 10px;
    background: #fff;
    border: 2px solid #cbd5e1;
}

.furn-mobile {
    width: 36px;
    height: 52px;
    background: #0f172a;
    border-radius: 8px;
    box-shadow: 0 5px 0 #020617;
    position: relative;
}

.furn-mobile::before {
    content: '';
    position: absolute;
    inset: 6px 5px 10px;
    background: #38bdf8;
    border-radius: 3px;
}

.furn-counter {
    height: 36px;
    background: #b45309;
    border-radius: 6px;
    box-shadow: 0 8px 0 #7c2d12;
    position: relative;
}

.furn-counter::after {
    content: 'BANCONE';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: #fff7ed;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 1px;
}

.ddm-spot-label {
    margin-top: 4px;
    background: #052e16cc;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 999px;
    pointer-events: none;
}

.ddm-spot.has-task .ddm-spot-label {
    background: #dc2626;
}

.ddm-spot.busy .furn-phone,
.ddm-spot.busy .furn-mobile {
    animation: ddm-game-ring 0.35s linear infinite;
}

.ddm-bubble {
    position: absolute;
    top: -38px;
    left: 50%;
    transform: translateX(-50%);
    min-width: 54px;
    background: #fff;
    color: #0f172a;
    border-radius: 14px;
    padding: 6px 8px 8px;
    text-align: center;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
    pointer-events: none;
    z-index: 8;
    animation: ddm-game-pop 0.28s ease-out;
}

.ddm-bubble.urgent {
    box-shadow: 0 0 0 3px #ef4444, 0 6px 16px rgba(239, 68, 68, 0.35);
}

.ddm-bubble.done { animation: ddm-game-pop-out 0.2s ease-in forwards; }
.ddm-bubble.missed { animation: ddm-game-miss 0.32s ease-in forwards; }

.ddm-bubble-icon {
    font-size: 20px;
    line-height: 1;
}

.ddm-bubble-time {
    font-size: 10px;
    font-weight: 900;
    color: #166534;
}

.ddm-bubble.urgent .ddm-bubble-time { color: #dc2626; }

.ddm-ring {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 58px;
    height: 58px;
    margin: -29px 0 0 -29px;
    transform: rotate(-90deg);
    pointer-events: none;
}

.ddm-ring circle {
    fill: none;
    stroke-width: 3.5;
}

.ddm-ring-bg { stroke: #e2e8f0; }
.ddm-ring-fg { stroke: #22c55e; stroke-linecap: round; }
.ddm-bubble.warn .ddm-ring-fg { stroke: #eab308; }
.ddm-bubble.urgent .ddm-ring-fg { stroke: #ef4444; }

.ddm-customer {
    position: absolute;
    bottom: 100%;
    left: 18%;
    width: 22px;
    height: 34px;
    pointer-events: none;
}

.ddm-customer .c-head {
    width: 16px;
    height: 16px;
    margin: 0 auto;
    background: #f1c27d;
    border-radius: 50%;
}

.ddm-customer .c-body {
    width: 18px;
    height: 16px;
    margin: 1px auto 0;
    background: #2563eb;
    border-radius: 6px 6px 3px 3px;
}

.ddm-dude {
    position: absolute;
    width: 48px;
    height: 70px;
    margin-left: -24px;
    margin-top: -64px;
    z-index: 20;
    pointer-events: none;
}

.ddm-dude-flip {
    position: absolute;
    inset: 0;
}

.ddm-dude.face-left .ddm-dude-flip { transform: scaleX(-1); }
.ddm-dude.run .ddm-leg-l { animation: ddm-leg 0.28s linear infinite; }
.ddm-dude.run .ddm-leg-r { animation: ddm-leg 0.28s linear infinite reverse; }
.ddm-dude.work .ddm-dude-flip { animation: ddm-work 0.22s ease-in-out infinite; }
.ddm-dude.work.face-left .ddm-dude-flip { animation: ddm-work-left 0.22s ease-in-out infinite; }
.ddm-dude.idle .ddm-dude-flip { animation: ddm-idle 1.8s ease-in-out infinite; }
.ddm-dude.idle.face-left .ddm-dude-flip { animation: ddm-idle-left 1.8s ease-in-out infinite; }

.ddm-shadow {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 2px;
    height: 8px;
    background: #0003;
    border-radius: 50%;
}

.ddm-head {
    position: absolute;
    left: 12px;
    top: 2px;
    width: 24px;
    height: 24px;
    background: #f1c27d;
    border-radius: 50%;
    z-index: 2;
}

.ddm-head::before,
.ddm-head::after {
    content: '';
    position: absolute;
    width: 4px;
    height: 4px;
    background: #1e293b;
    border-radius: 50%;
    top: 10px;
}

.ddm-head::before { left: 6px; }
.ddm-head::after { right: 6px; }

.ddm-hair {
    position: absolute;
    left: 12px;
    top: 0;
    width: 24px;
    height: 12px;
    background: #1e293b;
    border-radius: 12px 12px 4px 4px;
    z-index: 3;
}

.ddm-body {
    position: absolute;
    left: 13px;
    top: 24px;
    width: 22px;
    height: 24px;
    background: #3d9c35;
    border-radius: 8px 8px 4px 4px;
    z-index: 1;
    box-shadow: inset 0 -6px 0 #166534;
}

.ddm-leg-l,
.ddm-leg-r {
    position: absolute;
    bottom: 6px;
    width: 7px;
    height: 16px;
    background: #1e3a8a;
    border-radius: 3px;
}

.ddm-leg-l { left: 14px; }
.ddm-leg-r { right: 14px; }

.ddm-game-caption {
    flex-shrink: 0;
    text-align: center;
    color: #dcfce7;
    font-size: 13px;
    font-weight: 700;
    min-height: 36px;
    padding: 0 12px calc(10px + env(safe-area-inset-bottom));
}

.ddm-game-flash {
    pointer-events: none;
    position: absolute;
    left: 50%;
    top: 22%;
    transform: translateX(-50%);
    background: #7f1d1d;
    color: #fecaca;
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 800;
    opacity: 0;
    z-index: 30;
}

.ddm-game-flash.ok { background: #14532d; color: #bbf7d0; }

.ddm-game-flash.show {
    animation: ddm-game-flash 1.05s ease-out;
}

.ddm-game-over h2 {
    color: #fecaca;
}

@keyframes ddm-game-pop {
    from { opacity: 0; transform: translateX(-50%) scale(0.6); }
    to { opacity: 1; transform: translateX(-50%) scale(1); }
}

@keyframes ddm-game-pop-out {
    to { opacity: 0; transform: translateX(-50%) translateY(-12px) scale(0.8); }
}

@keyframes ddm-game-miss {
    0% { transform: translateX(-50%); }
    30% { transform: translateX(calc(-50% - 6px)); background: #fee2e2; }
    100% { opacity: 0; transform: translateX(-50%) translateY(10px); }
}

@keyframes ddm-game-ring {
    0%, 100% { transform: rotate(0); }
    25% { transform: rotate(-12deg); }
    75% { transform: rotate(12deg); }
}

@keyframes ddm-leg {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes ddm-work {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

@keyframes ddm-idle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
}

@keyframes ddm-idle-left {
    0%, 100% { transform: scaleX(-1) translateY(0); }
    50% { transform: scaleX(-1) translateY(-2px); }
}

@keyframes ddm-game-flash {
    0% { opacity: 0; transform: translate(-50%, -8px); }
    15% { opacity: 1; transform: translate(-50%, 0); }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

@media (min-width: 640px) {
    .ddm-game-hero {
        max-width: 480px;
        margin-left: auto;
        margin-right: auto;
        width: 100%;
    }
    .ddm-game-shop {
        max-width: 420px;
        margin-left: auto;
        margin-right: auto;
        width: calc(100% - 20px);
    }
}
