body {
    margin: 0;
    padding: 0;
    background: #111;
    font-family: 'Orbitron', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Bloqueio de scroll via JS */
body.block-scroll {
    overflow: hidden !important;
    touch-action: none !important;
}

/* Bloqueio de scroll via JS */
body.block-scroll {
  overflow: hidden !important;
  position: fixed !important;
  width: 100% !important;
  height: 100% !important;
  touch-action: none !important;
}

/* Wrapper: ocupa toda a largura do ecrã em mobile, centraliza em desktop */
.arcade-wrapper {
    position: relative;
    width: 100vw;
    max-width: 430px;
    aspect-ratio: 9/16;
    margin: 0 auto;
    background: transparent;
    overflow: visible;
}

/* Imagem da arcade */
.arcade-bg {
    position: absolute;
    left: -8px;
    top: -8px;
    width: calc(100% + 12px);
    height: calc(100% + 12px);
    z-index: 0;
    pointer-events: none;
    user-select: none;
    display: block;
    object-fit: contain;
    object-position: top center;
    aspect-ratio: 9/16;
}

/* Canvas: encaixa no ecrã da arcade (AJUSTA estes valores!) */
#game-canvas {
    position: absolute;
    left: 14%;
    top: 22%;
    width: 70%;
    height: 36%;
    min-width: 140px;
    min-height: 140px;
    max-width: 100%;
    max-height: 100%;
    z-index: 1;
    background: transparent;
    border-radius: 12px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.3);
    display: block;
}

/* Mobile: ocupa 100vw, sem margens laterais, scroll vertical permitido */
@media (max-width: 600px) {
    .arcade-wrapper {
        width: 100vw;
        max-width: 100vw;
        aspect-ratio: 9/16;
        margin: 0;
    }
    #game-canvas {
        min-width: 120px;
        min-height: 120px;
    }
}

/* SCORE E NÍVEL */
#score-display, #level-display {
    position: absolute;
    color: #e3ffde;
    font-size: 1.1em;
    font-family: 'Orbitron', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: bold;
    text-shadow: 0 2px 8px #111, 0 0px 2px #fff;
    z-index: 2;
    user-select: none;
    pointer-events: none;
    background: rgba(17,17,17,0.3);
    padding: 0.2em 0.6em;
    border-radius: 8px;
    letter-spacing: 1px;
}
#score-display { left: 8%; top: 14%; }
#level-display { right: 10%; top: 14%; text-align: right; }

/* INTRO VIDEO */
#intro-overlay {
    position: absolute;
    left: 14%;
    top: 22%;
    width: 71%;
    height: 36%;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(17,17,17,0.75);
}
#intro-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.3);
    display: block;
}
#skip-intro {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 11;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.5em 1em;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.2s;
}

/* RESTART BUTTON */
#restart-btn {
    position: absolute;
    left: 64%;
    top: 64%;
    transform: translate(-50%, -50%);
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: none;
    background: rgba(227,255,222,0);
    box-shadow: 0 0 0 0 transparent;
    cursor: pointer;
    z-index: 10;
    outline: none;
    transition: background 0.2s;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}
#restart-btn::after {
    content: '';
    display: block;
    width: 26px;
    height: 26px;
    mask: url('data:image/svg+xml;utf8,') center/contain no-repeat;
    background: white;
    opacity: 0.7;
    pointer-events: none;
}
#restart-btn.pulsing {
    animation: btnPulse 1.2s infinite;
    pointer-events: auto;
}
@keyframes btnPulse {
    0% { background: rgba(227,255,222,0.05);}
    50% { background: rgba(227,255,222,0.4);}
    100% { background: rgba(227,255,222,0.05);}
}

/* PAUSE BUTTON */
#pause-btn {
    position: absolute;
    left: 78%;
    top: 64%;
    transform: translate(-50%, -50%);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: none;
    background: rgba(227,255,222,0);
    box-shadow: 0 0 0 0 transparent;
    cursor: pointer;
    z-index: 10;
    outline: none;
    transition: background 0.2s;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Orbitron', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 1.5em;
    color: #fff;
    font-weight: bold;
    letter-spacing: 0.1em;
    user-select: none;
}
#pause-btn.pulsing {
    animation: btnPulse 1.2s infinite;
    pointer-events: auto;
}
#pause-btn::after {
    content: "P";
    display: block;
    color: #fff;
    opacity: 0.8;
    pointer-events: none;
}

/* TOP 10 */
#top10-container {
    width: 100%;
    max-width: 430px;
    margin: 40px auto 60px auto;
    background: rgba(17, 17, 17, 0.95);
    border-radius: 14px;
    box-shadow: 0 4px 32px rgba(0,0,0,0.25);
    padding: 1.5em 1em 2em 1em;
    text-align: center;
}
#top10-container h2 {
    color: #e3ffde;
    font-family: 'Orbitron', sans-serif;
    margin-bottom: 1em;
    font-size: 1.3em;
    letter-spacing: 1px;
}
#top10 {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Orbitron', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
#top10 th, #top10 td {
    padding: 0.6em 0.3em;
    border-bottom: 1px solid #222;
    color: #e3ffde;
    font-size: 1em;
}
#top10 th {
    background: #222;
    font-weight: bold;
}
#top10 tr:nth-child(even) {
    background: rgba(34, 34, 34, 0.6);
}

/* MODALS */
.modal-bg {
    position: fixed;
    z-index: 9999;
    left: 0; top: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-content {
    background: #222;
    color: #fff;
    border-radius: 8px;
    padding: 24px 32px;
    text-align: center;
    box-shadow: 0 4px 32px #000a;
    min-width: 240px;
    font-family: 'Orbitron', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.modal-content input[type="text"] {
    font-size: 1.5em;
    width: 80px;
    text-align: center;
    margin-bottom: 10px;
    text-transform: uppercase;
    font-family: 'Orbitron', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    border: 1px solid #4caf50;
    border-radius: 4px;
    padding: 4px 8px;
    background: #111;
    color: #e3ffde;
    outline: none;
}
.modal-content button {
    margin: 6px 10px 0 10px;
    padding: 6px 16px;
    font-size: 1em;
    border: none;
    border-radius: 4px;
    background: #4caf50;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
    font-family: 'Orbitron', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.modal-content button:hover {
    background: #388e3c;
}