:root {
    --bomb-w: 506;
    --bomb-h: 900;
    --tg-bg: var(--tg-theme-bg-color, #0d0d18);
    --tg-fg: var(--tg-theme-text-color, #eaeaea);
    --tg-accent: var(--tg-theme-button-color, #2481cc);
    --tg-accent-fg: var(--tg-theme-button-text-color, #fff);
}

* { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0;
    background: var(--tg-bg);
    color: var(--tg-fg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

body {
    display: grid;
    place-items: center;
}

#app {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    display: grid;
    place-items: center;
}

/* ---------- LOADER ---------- */
.loader {
    color: var(--tg-fg);
    opacity: 0.6;
    font-size: 14px;
}

/* ---------- BOMB SCENE ---------- */
.bomb {
    position: relative;
    aspect-ratio: var(--bomb-w) / var(--bomb-h);
    width: min(100vw, calc(100dvh * var(--bomb-w) / var(--bomb-h)));
    height: auto;
    max-height: 100vh;
    max-height: 100dvh;
    container-type: size;
}

.bomb-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
    -webkit-user-drag: none;
}

/* Coordinates are percentages of the 506x900 background image */

.bomb-lcd {
    position: absolute;
    left: 35.4%;
    top: 43.3%;
    width: 39.6%;
    height: 8.7%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: ui-monospace, "SFMono-Regular", "Menlo", "Consolas", "Courier New", monospace;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #ff2c2c;
    text-shadow:
        0 0 0.6cqh #ff5050,
        0 0 1.8cqh #ff0000,
        0 0 3cqh rgba(255, 0, 0, 0.4);
    font-size: 3.4cqh;
    white-space: nowrap;
    overflow: hidden;
    line-height: 1;
}

.bomb-lcd.tiny    { font-size: 2.6cqh; }
.bomb-lcd.large   { font-size: 4.2cqh; }

.bomb-btn {
    position: absolute;
    left: 11.5%;
    top: 39.7%;
    width: 17.5%;
    height: 12.3%;
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0;
    cursor: pointer;
    border-radius: 4%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    -webkit-tap-highlight-color: transparent;
    transition: filter 0.1s ease, transform 0.05s ease;
}
.bomb-btn:active {
    transform: scale(0.97);
    filter: brightness(1.4);
}
.bomb-btn-label {
    font-family: ui-monospace, "SFMono-Regular", "Menlo", "Consolas", "Courier New", monospace;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: #ff2c2c;
    text-shadow:
        0 0 0.4cqh #ff5050,
        0 0 1.2cqh #ff0000;
    font-size: 2.4cqh;
    text-transform: uppercase;
}

/* Flicker animation on the LCD when non-admin taps */
@keyframes lcd-flicker {
    0%   { opacity: 1; }
    8%   { opacity: 0.1; }
    14%  { opacity: 0.9; }
    22%  { opacity: 0.15; }
    34%  { opacity: 1; }
    48%  { opacity: 0.2; }
    62%  { opacity: 0.95; }
    78%  { opacity: 0.3; }
    100% { opacity: 1; }
}
.flicker {
    animation: lcd-flicker 0.55s steps(1, end);
}

/* ---------- FULLSCREEN OVERLAY SCREENS ---------- */
.overlay {
    position: fixed;
    inset: 0;
    background: var(--tg-bg);
    color: var(--tg-fg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 24px;
    text-align: center;
    z-index: 10;
}
.overlay h1 {
    margin: 0;
    font-size: clamp(20px, 5vw, 28px);
}
.overlay p {
    margin: 0;
    color: var(--tg-fg);
    opacity: 0.75;
    max-width: 360px;
    line-height: 1.45;
}
.overlay .muted {
    opacity: 0.55;
    font-size: 13px;
    max-width: 360px;
}
.overlay img.hero {
    max-width: min(80vw, 320px);
    height: auto;
    border-radius: 12px;
}

.btn {
    appearance: none;
    border: 0;
    border-radius: 12px;
    padding: 14px 26px;
    font-size: 16px;
    font-weight: 700;
    background: var(--tg-accent);
    color: var(--tg-accent-fg);
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 200px;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-danger { background: #e53935; color: #fff; }
