/* ==========================================================
   nilshiddedijkstra.nl  -  Roblox style
   Zwarte baseplate + 1 grote rode knop + Roblox Explosion
   ========================================================== */

:root {
    /* Roblox kleuren */
    --rbx-red:        #e2231a;
    --rbx-red-light:  #ff4b42;
    --rbx-red-dark:   #a5120b;
    --rbx-red-edge:   #6e0b06;
    --rbx-yellow:     #ffc800;
    --rbx-yellow-dark:#a37a00;

    --rbx-topbar:     rgba(20, 21, 23, .88);
    --rbx-border:     rgba(255, 255, 255, .10);
    --rbx-text-dim:   #9aa0a6;

    /* Roblox EasingStyle benaderingen (TweenService) */
    --rbx-back:   cubic-bezier(.34, 1.56, .64, 1);   /* EasingStyle.Back  */
    --rbx-quad:   cubic-bezier(.25, .46, .45, .94);  /* EasingStyle.Quad  */
    --rbx-linear: cubic-bezier(.4, 0, 1, 1);         /* EasingStyle.Linear*/
}

* { box-sizing: border-box; }

html,
body { height: 100%; }

body {
    margin: 0;
    background: #000;
    color: #fff;
    font-family: "Montserrat", "Segoe UI", system-ui, -apple-system, Tahoma, Verdana, sans-serif;
    font-weight: 700;

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: hidden;
    overscroll-behavior: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
}

/* Roblox baseplate: subtiele studs op de zwarte achtergrond */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background-image: radial-gradient(rgba(255, 255, 255, .065) 1.3px, transparent 1.4px);
    background-size: 26px 26px;
    background-position: center;
}

/* ----------------------------------------------------------
   Canvas + flits
   ---------------------------------------------------------- */
#fx {
    position: fixed;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    opacity: 1;
    transition: opacity .3s var(--rbx-linear);
    will-change: transform, opacity;
}

#flash {
    position: fixed;
    inset: 0;
    background: #fff8e6;
    opacity: 0;
    pointer-events: none;
    z-index: 6;
}

/* ----------------------------------------------------------
   Roblox topbar
   ---------------------------------------------------------- */
.rbx-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 7;

    display: flex;
    align-items: center;
    gap: 10px;
    height: 56px;
    padding: 0 12px;

    background: var(--rbx-topbar);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--rbx-border);

    transition: opacity .3s var(--rbx-linear);
    animation: rbxSlideDown .5s var(--rbx-back) both;
}

@keyframes rbxSlideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}

.rbx-avatar {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 19px;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .45);
    background: linear-gradient(140deg, #3b82f6, #8b5cf6 55%, #ec4899);
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, .38), 0 3px 10px rgba(0, 0, 0, .55);
}

.rbx-topbar-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    min-width: 0;
}

.rbx-name {
    font-size: 15px;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rbx-place {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--rbx-text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Roblox-achtige icoon-knopjes */
.rbx-icon-btn {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    font-size: 17px;
    line-height: 1;
    color: #c9ced4;
    background: rgba(255, 255, 255, .06);
    border: 1px solid var(--rbx-border);
    border-radius: 10px;
    cursor: pointer;
    transition: transform .16s var(--rbx-back), background .16s var(--rbx-linear), color .16s var(--rbx-linear);
}

.rbx-icon-btn:hover  { transform: scale(1.12); background: rgba(255, 255, 255, .13); color: #fff; }
.rbx-icon-btn:active { transform: scale(.92); }

.rbx-mute { margin-left: auto; }

/* ----------------------------------------------------------
   Het spel-scherm
   ---------------------------------------------------------- */
.stage {
    position: relative;
    z-index: 4;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 76px 20px 24px;
    opacity: 1;
    transition: opacity .18s var(--rbx-quad);
    will-change: transform, opacity;
}

.rbx-stack {
    width: 100%;
    max-width: min(92vw, 900px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    will-change: transform;
}

/* Roblox badge */
.rbx-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 900;
    letter-spacing: .12em;
    color: #2a1c00;
    background: linear-gradient(180deg, #ffd83d, var(--rbx-yellow));
    box-shadow: 0 3px 0 var(--rbx-yellow-dark), 0 8px 22px rgba(255, 200, 0, .30);
    animation: rbxPop .5s var(--rbx-back) .20s both;
}

/* ----------------------------------------------------------
   De grote rode Roblox-knop
   ---------------------------------------------------------- */
.rbx-btn-wrap {
    position: relative;
    width: 100%;
    /* Roblox EasingStyle.Back pop-in */
    animation: rbxPop .6s var(--rbx-back) .28s both;
}

/* gloed-puls (Roblox highlight) */
.rbx-btn-wrap::after {
    content: "";
    position: absolute;
    inset: 8px;
    border-radius: 20px;
    box-shadow: 0 0 48px 10px rgba(255, 60, 50, .8);
    opacity: .22;
    z-index: -1;
    pointer-events: none;
    animation: rbxGlowPulse 1.9s var(--rbx-quad) .9s infinite;
}

@keyframes rbxGlowPulse {
    0%, 100% { opacity: .20; }
    50%      { opacity: .68; }
}

.rbx-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    min-height: clamp(120px, 26vh, 250px);
    padding: clamp(20px, 3.6vw, 40px) clamp(18px, 5vw, 56px);

    overflow: hidden;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;

    font-family: inherit;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .05em;
    line-height: 1.18;
    text-align: center;
    font-size: clamp(1.05rem, 4vw, 2.5rem);

    color: #fff;
    text-shadow: 0 2px 0 rgba(0, 0, 0, .35);

    background: linear-gradient(180deg, var(--rbx-red-light) 0%, var(--rbx-red) 46%, var(--rbx-red-dark) 100%);
    border: 2px solid rgba(255, 255, 255, .22);
    border-radius: 16px;

    box-shadow:
        0 10px 0 var(--rbx-red-edge),
        0 18px 34px rgba(226, 35, 26, .42),
        inset 0 3px 0 rgba(255, 255, 255, .42),
        inset 0 -8px 16px rgba(0, 0, 0, .28);

    transition:
        transform .18s var(--rbx-back),
        box-shadow .18s var(--rbx-quad),
        filter .18s var(--rbx-linear);
}

/* Roblox-achtige glans die over de knop veegt */
.rbx-btn::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -60%;
    width: 45%;
    pointer-events: none;
    transform: skewX(-18deg);
    background: linear-gradient(100deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .38), rgba(255, 255, 255, 0));
    transition: left .45s var(--rbx-quad);
}

.rbx-btn:hover::before { left: 120%; }

.rbx-btn:hover {
    transform: translateY(-3px) scale(1.035);
    filter: brightness(1.10);
    box-shadow:
        0 13px 0 var(--rbx-red-edge),
        0 24px 48px rgba(226, 35, 26, .60),
        inset 0 3px 0 rgba(255, 255, 255, .48),
        inset 0 -8px 16px rgba(0, 0, 0, .28);
}

.rbx-btn:active {
    transform: translateY(8px) scale(.985);
    filter: brightness(.98);
    box-shadow:
        0 3px 0 var(--rbx-red-edge),
        0 8px 18px rgba(226, 35, 26, .40),
        inset 0 3px 0 rgba(255, 255, 255, .34),
        inset 0 -6px 14px rgba(0, 0, 0, .32);
}

.rbx-btn:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 6px;
}

.rbx-hint {
    margin: 0;
    font-size: clamp(11px, 1.7vw, 13px);
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--rbx-text-dim);
    animation: rbxPop .5s var(--rbx-back) .40s both;
}

@keyframes rbxPop {
    0%   { opacity: 0; transform: scale(.55); }
    70%  { opacity: 1; transform: scale(1.07); }
    100% { opacity: 1; transform: scale(1); }
}

/* ----------------------------------------------------------
   Nils' wens: de knop is ROND, als een echte "nuke knop"
   - bolle rode drukknop met glans
   - geel/zwarte gevarenring eromheen
   - ronde gloed-puls
   ---------------------------------------------------------- */
.rbx-nuke-wrap {
    --nuke-size: clamp(180px, min(48vh, 76vw), 340px);

    width: auto;
    display: grid;
    place-items: center;
}

/* geel/zwarte gevarenring onder de knop */
.rbx-nuke-wrap::before {
    content: "";
    position: absolute;
    width: calc(var(--nuke-size) + 26px);
    height: calc(var(--nuke-size) + 26px);
    border-radius: 50%;
    z-index: -2;
    pointer-events: none;
    background: repeating-conic-gradient(#141416 0deg 12deg, var(--rbx-yellow) 12deg 24deg);
    box-shadow:
        0 14px 26px rgba(0, 0, 0, .65),
        inset 0 0 0 7px rgba(0, 0, 0, .62),
        inset 0 0 22px rgba(0, 0, 0, .80);
}

/* ronde rode gloed-puls (i.p.v. de rechthoekige) */
.rbx-nuke-wrap::after {
    inset: auto;
    width: calc(var(--nuke-size) + 70px);
    height: calc(var(--nuke-size) + 70px);
    border-radius: 50%;
    z-index: -3;
    box-shadow: 0 0 60px 16px rgba(255, 60, 50, .85);
}

/* de knop zelf: bol, rond en rood */
.rbx-nuke {
    display: grid;
    place-items: center;

    width: var(--nuke-size);
    height: var(--nuke-size);
    min-height: 0;
    padding: 17%;

    border: 0;
    border-radius: 50%;

    background:
        radial-gradient(circle at 34% 26%,
            #ffb0aa 0%,
            var(--rbx-red-light) 15%,
            var(--rbx-red) 48%,
            var(--rbx-red-dark) 80%,
            var(--rbx-red-edge) 100%);

    box-shadow:
        0 14px 0 var(--rbx-red-edge),
        0 26px 46px rgba(226, 35, 26, .52),
        inset 0 8px 0 rgba(255, 255, 255, .30),
        inset 0 -18px 30px rgba(0, 0, 0, .46);
}

/* glans bovenop de bolle knop (i.p.v. de rechthoekige veeg) */
.rbx-nuke::before {
    top: 7%;
    bottom: auto;
    left: 50%;
    width: 66%;
    height: 34%;
    transform: translateX(-50%);
    border-radius: 50%;
    opacity: .95;
    background: radial-gradient(ellipse at 50% 32%, rgba(255, 255, 255, .62), rgba(255, 255, 255, 0) 72%);
    transition: opacity .25s var(--rbx-linear);
}

.rbx-nuke:hover::before { left: 50%; opacity: 1; }

/* dunne binnenring, net als een echte drukknop */
.rbx-nuke::after {
    content: "";
    position: absolute;
    inset: 7%;
    border-radius: 50%;
    pointer-events: none;
    border: 2px solid rgba(255, 255, 255, .26);
    box-shadow:
        inset 0 0 24px rgba(0, 0, 0, .38),
        0 0 16px rgba(255, 255, 255, .10);
}

.rbx-nuke-label {
    position: relative;
    z-index: 2;
    display: block;
    max-width: 100%;
    font-size: clamp(.6rem, min(2.1vw, 2.6vh), 1.05rem);
    line-height: 1.34;
    letter-spacing: .08em;
    text-wrap: balance;
}

.rbx-nuke:hover {
    transform: translateY(-4px) scale(1.04);
    box-shadow:
        0 18px 0 var(--rbx-red-edge),
        0 34px 62px rgba(226, 35, 26, .62),
        inset 0 8px 0 rgba(255, 255, 255, .36),
        inset 0 -18px 30px rgba(0, 0, 0, .46);
}

.rbx-nuke:active {
    transform: translateY(10px) scale(.99);
    box-shadow:
        0 4px 0 var(--rbx-red-edge),
        0 10px 22px rgba(226, 35, 26, .45),
        inset 0 8px 0 rgba(255, 255, 255, .28),
        inset 0 -14px 26px rgba(0, 0, 0, .52);
}

/* ----------------------------------------------------------
   Moment van de klap
   ---------------------------------------------------------- */
body.detonated .stage { opacity: 0; }

.rbx-btn.detonating {
    transform: scale(1.18);
    filter: brightness(2.2) saturate(1.3);
    transition: transform .16s var(--rbx-back), filter .16s var(--rbx-linear);
}

/* Roblox-achtige screen shake */
body.shake .rbx-stack,
body.shake #fx,
body.shake .rbx-topbar {
    animation: rbxShake .6s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes rbxShake {
    10%, 90%      { transform: translate3d(-4px,  2px, 0) rotate(-.4deg); }
    20%, 80%      { transform: translate3d( 7px, -3px, 0) rotate( .5deg); }
    30%, 50%, 70% { transform: translate3d(-11px, 4px, 0) rotate(-.7deg); }
    40%, 60%      { transform: translate3d( 11px, -4px, 0) rotate( .7deg); }
}

/* ----------------------------------------------------------
   Na de explosie: alles volledig zwart
   ---------------------------------------------------------- */
body.blacked #fx,
body.blacked #flash,
body.blacked .stage,
body.blacked .rbx-topbar,
body.blacked .rbx-mute {
    opacity: 0 !important;
    visibility: hidden;
}

/* ----------------------------------------------------------
   Na de explosie: donker toneel met het Roblox-poppetje
   (canvas: poppetje + zaklampbundel)
   ---------------------------------------------------------- */
#darkScene {
    position: fixed;
    inset: 0;
    z-index: 8;
    background: #000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .5s var(--rbx-quad), visibility .5s linear;
}

body.dark #darkScene { opacity: 1; visibility: visible; }

#darkCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* ----------------------------------------------------------
   De RESTART-knop: alleen zichtbaar waar de zaklamp schijnt
   ---------------------------------------------------------- */
.rbx-restart {
    position: fixed;
    left: 64%;
    top: 73%;
    z-index: 9;

    width: auto;
    min-width: clamp(150px, 20vw, 250px);
    min-height: 0;
    padding: 15px 26px;

    font-size: clamp(.95rem, 2.4vw, 1.45rem);
    letter-spacing: .12em;
    border-radius: 14px;

    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    cursor: default;
    transform: translate(-50%, -50%) scale(1);

    /* door de zaklamp "uitgesneden" uit het donker */
    --lit: 0px;
    --lx: 50%;
    --ly: 50%;

    -webkit-mask-image: radial-gradient(circle var(--lit) at var(--lx) var(--ly), #000 0%, #000 65%, transparent 100%);
            mask-image: radial-gradient(circle var(--lit) at var(--lx) var(--ly), #000 0%, #000 65%, transparent 100%);
    -webkit-mask-repeat: no-repeat;
            mask-repeat: no-repeat;

    box-shadow:
        0 8px 0 var(--rbx-red-edge),
        0 16px 30px rgba(226, 35, 26, .45),
        inset 0 3px 0 rgba(255, 255, 255, .42),
        inset 0 -7px 14px rgba(0, 0, 0, .28);

    transition: filter .16s var(--rbx-linear);
    animation: none;
}

body.dark .rbx-restart { visibility: visible; }

.rbx-restart.lit { pointer-events: auto; cursor: pointer; }

/* hover/klik mogen de knop niet verschuiven (hij staat gecentreerd) */
.rbx-restart:hover,
.rbx-restart:active {
    transform: translate(-50%, -50%) scale(1);
}

.rbx-restart.pressed {
    transform: translate(-50%, -50%) scale(.90) translateY(6px);
    filter: brightness(1.35);
    box-shadow:
        0 3px 0 var(--rbx-red-edge),
        0 6px 14px rgba(226, 35, 26, .40),
        inset 0 3px 0 rgba(255, 255, 255, .34),
        inset 0 -5px 12px rgba(0, 0, 0, .32);
}

/* witte flits bij het opnieuw beginnen (moet boven het donkere toneel) */
body.restarting #flash {
    z-index: 10;
    visibility: visible;
}

/* ----------------------------------------------------------
   No-script / toegankelijkheid
   ---------------------------------------------------------- */
.noscript {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9;
    color: #888;
    font-size: 14px;
}

@media (prefers-reduced-motion: reduce) {
    .rbx-topbar,
    .rbx-badge,
    .rbx-btn-wrap,
    .rbx-hint { animation: none !important; }

    .rbx-btn-wrap::after { animation: none !important; }

    body.shake .rbx-stack,
    body.shake #fx,
    body.shake .rbx-topbar { animation: none !important; }
}
