/* =====================================================================
   ESAForum — Arcade2 Mini-Games Styles (Hangman + Russian Roulette)
   Created by ESAGAMES HOSTING SHIELD SRL
   Extends arcade.css — dark theme, purple accent var(--primary)
   ===================================================================== */

/* ======================================================================
   HANGMAN 🪢
   ====================================================================== */

.hangman-stage {
    padding: 28px 24px;
    background: linear-gradient(160deg, #100d28, #0d1020);
    border: 1px solid rgba(var(--primary-rgb),.3);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    min-height: 420px;
}

/* Gallows SVG container */
.hangman-gallows-wrap {
    width: 200px;
    height: 220px;
    flex-shrink: 0;
}

.hangman-svg {
    width: 100%;
    height: 100%;
}

/* Gallows structural elements */
.hg-structure {
    stroke: rgba(var(--primary-rgb),.6);
    stroke-linecap: round;
    fill: none;
}

/* Body parts — hidden by default, revealed as wrong guesses accumulate */
.hg-part {
    stroke: #c0a0ff;
    stroke-linecap: round;
    fill: none;
    opacity: 0;
    transition: opacity .35s ease;
    filter: drop-shadow(0 0 4px rgba(192,160,255,.6));
}
.hg-part.visible { opacity: 1; }

/* Head is a circle, needs fill for face */
.hg-head {
    stroke: #c0a0ff;
    fill: rgba(192,160,255,.12);
    opacity: 0;
    transition: opacity .35s ease;
    filter: drop-shadow(0 0 6px rgba(192,160,255,.5));
}
.hg-head.visible { opacity: 1; }

/* Win state — green glow */
.hangman-gallows-wrap.won .hg-part,
.hangman-gallows-wrap.won .hg-head {
    stroke: var(--green, #2ee6a6);
    filter: drop-shadow(0 0 8px rgba(46,230,166,.7));
}

/* Lose state — red shake */
.hangman-gallows-wrap.lost .hg-part,
.hangman-gallows-wrap.lost .hg-head {
    stroke: var(--red, #ff4d6d);
    filter: drop-shadow(0 0 8px rgba(255,77,109,.7));
    animation: hangShake .5s ease;
}

@keyframes hangShake {
    0%,100% { transform: rotate(0deg); transform-origin: 50% 30%; }
    20%     { transform: rotate(-6deg); transform-origin: 50% 30%; }
    40%     { transform: rotate(6deg); transform-origin: 50% 30%; }
    60%     { transform: rotate(-4deg); transform-origin: 50% 30%; }
    80%     { transform: rotate(4deg); transform-origin: 50% 30%; }
}

/* Hanged man body sway on loss */
.hangman-gallows-wrap.lost .hg-body-group {
    animation: bodySway 1.2s ease-in-out infinite alternate;
    transform-origin: 100px 68px; /* top of head */
}

@keyframes bodySway {
    from { transform: rotate(-4deg); }
    to   { transform: rotate(4deg); }
}

/* Wrong-guess flash */
@keyframes wrongFlash {
    0%   { background: rgba(255,77,109,.3); }
    100% { background: transparent; }
}
.hangman-stage.wrong-flash {
    animation: wrongFlash .4s ease;
}

/* Word display */
.hangman-word {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 4px;
}

.hangman-letter-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.hangman-letter-char {
    font-size: 22px;
    font-weight: 900;
    color: #fff;
    min-width: 22px;
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
    min-height: 28px;
    letter-spacing: .05em;
    transition: color .25s, text-shadow .25s;
}

.hangman-letter-char.revealed {
    color: var(--green, #2ee6a6);
    text-shadow: 0 0 10px rgba(46,230,166,.6);
    animation: letterPop .3s ease;
}

.hangman-letter-char.blank { color: transparent; }

@keyframes letterPop {
    0%   { transform: scale(1.5); }
    100% { transform: scale(1); }
}

.hangman-letter-line {
    width: 22px;
    height: 2px;
    background: rgba(var(--primary-rgb),.5);
    border-radius: 2px;
}

/* Wrong counter */
.hangman-wrong-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-mute);
    font-weight: 600;
}

.hangman-wrong-pips {
    display: flex;
    gap: 4px;
}

.hangman-pip {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1.5px solid rgba(255,77,109,.4);
    background: transparent;
    transition: background .25s, border-color .25s, box-shadow .25s;
}

.hangman-pip.used {
    background: var(--red, #ff4d6d);
    border-color: var(--red, #ff4d6d);
    box-shadow: 0 0 6px rgba(255,77,109,.5);
}

/* Keyboard */
.hangman-keyboard {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    max-width: 400px;
}

.hk-btn {
    width: 34px;
    height: 34px;
    border-radius: 7px;
    border: 1.5px solid rgba(var(--primary-rgb),.4);
    background: rgba(var(--primary-rgb),.1);
    color: #ddd;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, border-color .15s, transform .1s, opacity .2s;
    user-select: none;
    font-family: 'JetBrains Mono', monospace;
}

.hk-btn:hover:not(:disabled) {
    background: rgba(var(--primary-rgb),.3);
    border-color: var(--primary);
    transform: scale(1.1);
    color: #fff;
}

.hk-btn:disabled { opacity: .35; cursor: not-allowed; transform: none; }

.hk-btn.correct {
    background: rgba(46,230,166,.2);
    border-color: var(--green, #2ee6a6);
    color: var(--green, #2ee6a6);
    opacity: 1;
    cursor: default;
}

.hk-btn.wrong {
    background: rgba(255,77,109,.15);
    border-color: var(--red, #ff4d6d);
    color: var(--red, #ff4d6d);
    opacity: .6;
    cursor: default;
}

/* Difficulty selector */
.hangman-diff-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-bottom: 14px;
}

.hangman-diff-btn {
    padding: 10px 6px;
    border-radius: 8px;
    border: 2px solid var(--border);
    background: var(--surface-2);
    color: var(--text-mute);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: border-color .18s, background .18s, color .18s;
}

.hangman-diff-btn:hover { border-color: rgba(var(--primary-rgb),.5); color: var(--text); }
.hangman-diff-btn.active {
    border-color: var(--primary);
    background: rgba(var(--primary-rgb),.18);
    color: #fff;
}
.hangman-diff-btn.d-easy.active   { border-color: #2ee6a6; background: rgba(46,230,166,.12); color: #2ee6a6; }
.hangman-diff-btn.d-medium.active { border-color: #f5b301; background: rgba(245,179,1,.1);   color: #f5b301; }
.hangman-diff-btn.d-hard.active   { border-color: #ff4d6d; background: rgba(255,77,109,.12); color: #ff4d6d; }

/* Multiplier display */
.hangman-mult-display {
    text-align: center;
    font-size: 13px;
    color: var(--text-mute);
    margin-bottom: 4px;
}

.hangman-mult-display b {
    color: var(--amber, #f5b301);
    font-size: 18px;
}

/* Win celebration overlay on stage */
.hangman-win-glow {
    animation: winGlow .8s ease;
}

@keyframes winGlow {
    0%,100% { box-shadow: none; }
    40%     { box-shadow: 0 0 60px rgba(46,230,166,.5); }
}

/* ======================================================================
   RUSSIAN ROULETTE 🔫
   ====================================================================== */

.rr-stage {
    padding: 28px 20px;
    background: linear-gradient(160deg, #120a08, #1a0d0a);
    border: 1px solid rgba(255,100,60,.25);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    min-height: 420px;
    position: relative;
    overflow: hidden;
}

/* Red vignette that pulses on each pull */
.rr-stage::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(ellipse at 50% 100%, rgba(255,60,30,.08) 0%, transparent 70%);
    pointer-events: none;
}

.rr-stage.bang-flash {
    animation: bangFlash .6s ease;
}

@keyframes bangFlash {
    0%   { box-shadow: inset 0 0 0 rgba(255,60,30,0); }
    25%  { box-shadow: inset 0 0 80px rgba(255,60,30,.7); }
    100% { box-shadow: inset 0 0 0 rgba(255,60,30,0); }
}

/* Screen shake on bang */
.rr-stage.screen-shake {
    animation: screenShake .5s ease;
}

@keyframes screenShake {
    0%,100% { transform: translateX(0); }
    15%     { transform: translateX(-8px) rotate(-1deg); }
    30%     { transform: translateX(8px) rotate(1deg); }
    45%     { transform: translateX(-6px) rotate(-.5deg); }
    60%     { transform: translateX(6px) rotate(.5deg); }
    75%     { transform: translateX(-3px); }
}

/* Revolver SVG */
.rr-gun-wrap {
    width: 240px;
    height: 160px;
    position: relative;
}

.rr-gun-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 4px 18px rgba(255,100,60,.2));
    transition: filter .3s;
}

.rr-gun-svg.fire-anim {
    animation: gunKick .3s ease;
    filter: drop-shadow(0 0 20px rgba(255,140,0,.8));
}

@keyframes gunKick {
    0%   { transform: rotate(0deg) translate(0,0); }
    30%  { transform: rotate(-10deg) translate(-4px,-6px); }
    70%  { transform: rotate(4deg) translate(2px,2px); }
    100% { transform: rotate(0deg) translate(0,0); }
}

/* Cylinder chambers ring */
.rr-cylinder {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    width: 140px;
    height: 140px;
}

.rr-cylinder-ring {
    position: relative;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: 3px solid rgba(200,140,80,.4);
    background: radial-gradient(circle, rgba(60,40,20,.8) 0%, rgba(30,18,10,.95) 100%);
    box-shadow:
        0 0 20px rgba(0,0,0,.6),
        inset 0 0 20px rgba(0,0,0,.5);
}

.rr-cylinder-ring.spin-anim {
    animation: cylinderSpin .4s ease;
}

@keyframes cylinderSpin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(60deg); } /* overridden per chamber count via JS */
}

.rr-chamber-slot {
    position: absolute;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(180,120,50,.6);
    background: radial-gradient(circle, #1a1008 0%, #0d0804 100%);
    transform-origin: 70px 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: background .3s, border-color .3s, box-shadow .3s;
}

/* Center hub */
.rr-cylinder-hub {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: radial-gradient(circle, #4a3018 0%, #2a1808 100%);
    border: 2px solid rgba(180,120,50,.5);
    box-shadow: 0 0 8px rgba(0,0,0,.6);
    z-index: 2;
}

/* Fired chamber styling */
.rr-chamber-slot.fired {
    background: radial-gradient(circle, #3a1a08 0%, #1a0804 100%);
    border-color: rgba(255,80,30,.5);
    box-shadow: inset 0 0 8px rgba(255,60,30,.4);
}

/* Bullet glow in chamber (not revealed to user, purely decorative) */
.rr-chamber-slot.has-bullet {
    background: radial-gradient(circle, #2a2010 0%, #1a1208 100%);
}

/* Multiplier counter */
.rr-mult-display {
    text-align: center;
}

.rr-mult-value {
    font-size: 56px;
    font-weight: 900;
    font-family: 'JetBrains Mono', monospace;
    color: #fff;
    text-shadow: 0 0 30px rgba(255,140,60,.4);
    line-height: 1;
    transition: color .3s, text-shadow .3s;
}

.rr-mult-value.high {
    color: #f5b301;
    text-shadow: 0 0 30px rgba(245,179,1,.7);
}

.rr-mult-value.danger {
    color: #ff4d6d;
    text-shadow: 0 0 30px rgba(255,77,109,.8);
    animation: dangerPulse 1s ease infinite;
}

@keyframes dangerPulse {
    0%,100% { text-shadow: 0 0 30px rgba(255,77,109,.8); }
    50%     { text-shadow: 0 0 50px rgba(255,77,109,1); }
}

.rr-mult-label {
    font-size: 12px;
    color: rgba(255,255,255,.4);
    text-transform: uppercase;
    letter-spacing: .1em;
    margin-top: 2px;
}

/* Chambers left indicator */
.rr-chambers-left {
    font-size: 14px;
    color: var(--text-mute);
    font-weight: 600;
    text-align: center;
}

.rr-chambers-left span {
    color: #fff;
    font-size: 18px;
}

/* Pull history track */
.rr-pull-track {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
    min-height: 28px;
}

.rr-pull-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    border: 2px solid rgba(46,230,166,.5);
    background: rgba(46,230,166,.15);
    color: #2ee6a6;
    animation: dotPop .25s ease;
}

.rr-pull-dot.bang {
    border-color: rgba(255,77,109,.6);
    background: rgba(255,77,109,.2);
    color: #ff4d6d;
    font-size: 12px;
}

@keyframes dotPop {
    0%   { transform: scale(0); }
    60%  { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* Tension meter */
.rr-tension-bar {
    width: 100%;
    max-width: 280px;
    height: 8px;
    border-radius: 4px;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.1);
    overflow: hidden;
}

.rr-tension-fill {
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, #2ee6a6, #f5b301, #ff4d6d);
    transition: width .4s ease;
    width: 0%;
}

/* Buttons */
.rr-action-btns {
    display: flex;
    gap: 10px;
    width: 100%;
    max-width: 320px;
}

.rr-pull-btn {
    flex: 1.6;
    padding: 14px 10px;
    font-size: 15px;
    font-weight: 700;
    border-radius: var(--radius);
    cursor: pointer;
    border: none;
    background: linear-gradient(135deg, #c0392b, #8e2417);
    color: #fff;
    transition: opacity .18s, transform .15s, box-shadow .18s;
    box-shadow: 0 4px 20px rgba(192,57,43,.4);
    position: relative;
    overflow: hidden;
}

.rr-pull-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.1), transparent);
    transform: translateX(-100%);
    animation: arcShimmer 2s infinite;
}

.rr-pull-btn:hover:not(:disabled) {
    opacity: .9;
    transform: translateY(-1px);
    box-shadow: 0 6px 28px rgba(192,57,43,.6);
}

.rr-pull-btn:disabled { opacity: .5; cursor: not-allowed; }
.rr-pull-btn:disabled::after { display: none; }

.rr-cashout-btn {
    flex: 1;
    padding: 14px 10px;
    font-size: 14px;
    font-weight: 700;
    border-radius: var(--radius);
    cursor: pointer;
    border: 2px solid #2ee6a6;
    background: rgba(46,230,166,.12);
    color: #2ee6a6;
    transition: background .18s, box-shadow .18s, transform .15s;
}

.rr-cashout-btn:hover:not(:disabled) {
    background: rgba(46,230,166,.22);
    box-shadow: 0 0 18px rgba(46,230,166,.35);
    transform: translateY(-1px);
}

.rr-cashout-btn:disabled { opacity: .4; cursor: not-allowed; }

/* Chambers selector */
.rr-chambers-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 14px;
}

.rr-chambers-btn {
    padding: 10px 8px;
    border-radius: 8px;
    border: 2px solid var(--border);
    background: var(--surface-2);
    color: var(--text-mute);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    transition: border-color .18s, background .18s, color .18s;
}

.rr-chambers-btn:hover { border-color: rgba(255,100,60,.5); color: var(--text); }
.rr-chambers-btn.active {
    border-color: rgba(255,100,60,.8);
    background: rgba(255,100,60,.14);
    color: #ff6e45;
}

/* Game state tip */
.rr-tip {
    font-size: 13px;
    color: var(--text-mute);
    text-align: center;
    font-style: italic;
    line-height: 1.5;
}

/* Bang overlay text */
.rr-bang-text {
    font-size: 36px;
    font-weight: 900;
    color: #ff4d6d;
    text-shadow: 0 0 40px rgba(255,77,109,.9);
    text-align: center;
    opacity: 0;
    transition: opacity .3s;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    pointer-events: none;
    z-index: 10;
    white-space: nowrap;
}

.rr-bang-text.visible { opacity: 1; animation: bangText .4s ease; }

@keyframes bangText {
    0%   { transform: translate(-50%,-50%) scale(.6); }
    50%  { transform: translate(-50%,-50%) scale(1.2); }
    100% { transform: translate(-50%,-50%) scale(1); }
}

/* Responsive */
@media (max-width: 600px) {
    .hangman-keyboard { max-width: 300px; }
    .hk-btn { width: 28px; height: 28px; font-size: 11px; }
    .rr-mult-value { font-size: 42px; }
    .rr-cylinder-ring { width: 110px; height: 110px; }
    .rr-cylinder { width: 110px; height: 110px; }
    .rr-chamber-slot { width: 22px; height: 22px; transform-origin: 55px 55px; }
}

/* ======================================================================
   MOBILE RESPONSIVENESS — arcade2.css (Hangman + Russian Roulette)
   Appended for ESAForum arcade mobile audit.
   ====================================================================== */

/* ── Tablet (≤768px) ── */
@media (max-width: 768px) {

    /* Hangman stage: reduce padding, allow content to breathe */
    .hangman-stage {
        padding: 20px 14px;
        gap: 14px;
        min-height: unset;
    }

    /* Gallows SVG: make it fluid so it never overflows */
    .hangman-gallows-wrap {
        width: 100%;
        max-width: 200px;
        height: auto;
        aspect-ratio: 200 / 220;
    }

    /* Keyboard: wider wrap, buttons stay fixed at 34px (enough room on tablets) */
    .hangman-keyboard {
        max-width: 100%;
    }

    /* Word letters: slightly smaller gap */
    .hangman-word {
        gap: 6px;
    }

    /* Russian Roulette stage */
    .rr-stage {
        padding: 20px 14px;
        gap: 14px;
        min-height: unset;
    }

    /* Gun SVG: scale to container */
    .rr-gun-wrap {
        width: 100%;
        max-width: 240px;
        height: auto;
        aspect-ratio: 240 / 160;
    }

    /* Action buttons: allow them to wrap on narrow tablets */
    .rr-action-btns {
        max-width: 100%;
    }

    /* Tension bar */
    .rr-tension-bar {
        max-width: 100%;
    }
}

/* ── Phone (≤480px) ── */
@media (max-width: 480px) {

    /* Hangman */
    .hangman-stage {
        padding: 14px 10px;
        gap: 10px;
    }

    /* Gallows: shrink proportionally on very narrow phones */
    .hangman-gallows-wrap {
        max-width: 160px;
    }

    /* Keyboard buttons: shrink to 28×28 to fit A–Z in fewer rows */
    .hangman-keyboard {
        max-width: 100%;
        gap: 4px;
    }
    .hk-btn {
        width: 26px;
        height: 26px;
        font-size: 10px;
        border-radius: 5px;
    }

    /* Word display */
    .hangman-letter-char {
        font-size: 18px;
        min-width: 18px;
    }
    .hangman-letter-line {
        width: 18px;
    }

    /* Difficulty grid: stack to 1 column */
    .hangman-diff-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }

    /* ── Russian Roulette ── */
    .rr-stage {
        padding: 12px 10px;
        gap: 10px;
    }

    /* Gun: slightly smaller */
    .rr-gun-wrap {
        max-width: 200px;
    }

    /* Cylinder: keep at 110px (already handled at 600px), ensure transform-origin correct */
    .rr-cylinder,
    .rr-cylinder-ring {
        width: 110px;
        height: 110px;
    }
    .rr-chamber-slot {
        width: 22px;
        height: 22px;
        transform-origin: 55px 55px;
    }

    /* Multiplier value */
    .rr-mult-value {
        font-size: 36px;
    }

    /* Action buttons: stack vertically on very narrow screens */
    .rr-action-btns {
        flex-direction: column;
        gap: 8px;
        max-width: 100%;
    }
    .rr-pull-btn,
    .rr-cashout-btn {
        flex: none;
        width: 100%;
        padding: 12px 10px;
    }

    /* Chambers grid */
    .rr-chambers-grid {
        grid-template-columns: 1fr 1fr;
    }

    /* Bang text: scale for small screens */
    .rr-bang-text {
        font-size: 26px;
    }
}
