/* Fundo geral: azul-escuro (substitui preto) */
:root {
    --app-page-bg: #0c1a2e;
    --app-overlay-loading: rgba(10, 22, 48, 0.85);
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--app-page-bg);
    font-family: Arial, sans-serif;
}

body {
    position: fixed;
    inset: 0;
}

#game-container {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--app-page-bg);
}

#game-canvas {
    position: relative;
    display: block;
    touch-action: none;
    background: #fff;
    flex-shrink: 0;
    /* largura/altura em px definidas no JS = bitmap interno (sem esticar) */
}

.hidden {
    display: none !important;
}

#loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    background: var(--app-overlay-loading);
}

/* Menu inicial: fundo bem transparente + cartao colado na base (mostra o Odontinho) */
#menu-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: max(52px, 12vmin) 14px max(44px, env(safe-area-inset-bottom) + 30px);
    box-sizing: border-box;
    background: linear-gradient(
        to bottom,
        rgba(18, 40, 72, 0.14) 0%,
        rgba(14, 32, 58, 0.24) 45%,
        rgba(10, 22, 45, 0.45) 100%
    );
    pointer-events: none;
}

.loading-card {
    width: min(92vw, 430px);
    border-radius: 22px;
    padding: 22px;
    box-sizing: border-box;
    text-align: center;
    color: #fff;
    background: rgba(10, 22, 35, 0.82);
    backdrop-filter: blur(6px);
    border: 2px solid rgba(255,255,255,0.18);
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}

.menu-card {
    width: min(96vw, 440px);
    border-radius: 22px 22px 16px 16px;
    padding: 18px 20px 20px;
    box-sizing: border-box;
    text-align: center;
    color: #fff;
    background: rgba(10, 22, 35, 0.38);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow: 0 -4px 28px rgba(0, 0, 0, 0.2);
    pointer-events: auto;
}

.menu-card h1 {
    margin: 0 0 10px;
    font-size: clamp(28px, 7vw, 44px);
    line-height: 1.05;
}

.menu-card p {
    margin: 8px 0;
    font-size: clamp(16px, 4.2vw, 22px);
    line-height: 1.35;
}

.progress {
    width: 100%;
    height: 14px;
    background: rgba(255,255,255,0.16);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 16px;
}

#loading-progress {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #3bc6a7, #7de6cf);
    transition: width 0.2s ease;
}

.start-button,
#save-certificate-btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    border: none;
    border-radius: 18px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #42a883, #63b38d);
    box-shadow: 0 8px 18px rgba(0,0,0,0.28);
}

.start-button {
    margin-top: 18px;
    padding: 16px 34px;
    font-size: clamp(28px, 6vw, 48px);
    min-width: 220px;
}

#cert-name-bar {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    z-index: 35;
    width: min(92vw, 400px);
    padding: 12px 14px 12px;
    box-sizing: border-box;
    bottom: max(175px, env(safe-area-inset-bottom) + 158px);
    background: rgba(10, 22, 35, 0.94);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.cert-name-label {
    display: block;
    color: #e8f4ff;
    font-size: clamp(14px, 3.8vw, 18px);
    font-weight: 700;
    margin-bottom: 6px;
    font-family: Arial, sans-serif;
}

.cert-label-city {
    margin-top: 10px;
}

.cert-field-input {
    display: block;
    width: 100%;
    padding: 14px 12px;
    font-size: clamp(16px, 4vw, 20px);
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    background: #fff;
    color: #152030;
    font-family: Arial, sans-serif;
    box-sizing: border-box;
}

.cert-field-input::placeholder {
    color: #8899aa;
}

.cert-ok-full {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 14px 20px;
    font-size: clamp(16px, 4vw, 20px);
    font-weight: 700;
    color: #fff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    background: linear-gradient(135deg, #42a883, #63b38d);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    font-family: Arial, sans-serif;
}

#save-certificate-btn {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    width: min(72vw, 330px);
    padding: 18px 22px;
    font-size: clamp(18px, 4.5vw, 28px);
    bottom: max(22px, env(safe-area-inset-bottom) + 10px);
}