/* =========================================================
   HANGMAN RESCUE - PREMIUM TURN FEEDBACK
   ========================================================= */

.hr-turn-feedback {
    position: relative;

    display: none;

    width: calc(100% - 18px);
    box-sizing: border-box;

    margin: 7px auto 9px;
    padding: 9px 13px;

    overflow: hidden;

    border: 2px solid rgba(173, 113, 25, 0.96);
    border-radius: 14px;

    background:
        linear-gradient(
            180deg,
            rgba(32, 49, 70, 0.98),
            rgba(8, 23, 40, 0.99)
        );

    box-shadow:
        inset 0 0 0 1px rgba(255, 217, 116, 0.14),
        0 4px 10px rgba(0, 0, 0, 0.34);

    color: #ffffff;

    isolation: isolate;
}

.hr-turn-feedback.hr-visible {
    display: block;
}

.hr-turn-feedback::before {
    content: "";

    position: absolute;
    inset: 0;

    pointer-events: none;

    opacity: 0.34;

    background:
        radial-gradient(
            circle at 12% 50%,
            rgba(255, 214, 93, 0.26),
            transparent 31%
        ),
        radial-gradient(
            circle at 88% 50%,
            rgba(39, 163, 255, 0.18),
            transparent 32%
        );

    z-index: -1;
}

.hr-turn-feedback__main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.hr-turn-feedback__identity {
    min-width: 0;
}

.hr-turn-feedback__eyebrow {
    display: block;

    margin-bottom: 2px;

    color: #eac673;

    font-size: 10px;
    font-weight: 900;
    line-height: 1;

    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.hr-turn-feedback__title {
    display: block;

    overflow: hidden;

    color: #ffffff;

    font-family: Georgia, "Times New Roman", serif;
    font-size: 20px;
    font-weight: 900;
    line-height: 1.05;

    letter-spacing: 0.025em;

    text-overflow: ellipsis;
    white-space: nowrap;

    text-shadow:
        0 2px 3px rgba(0, 0, 0, 0.82);
}

.hr-turn-feedback__status {
    display: block;

    margin-top: 3px;

    overflow: hidden;

    color: #cfe4f9;

    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.hr-turn-feedback__clock {
    flex: 0 0 auto;

    min-width: 69px;

    padding: 7px 10px;

    border: 2px solid rgba(79, 205, 117, 0.78);
    border-radius: 11px;

    background:
        linear-gradient(
            180deg,
            rgba(18, 98, 51, 0.88),
            rgba(7, 52, 28, 0.94)
        );

    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        0 0 10px rgba(54, 218, 101, 0.20);

    color: #ddffe7;

    font-size: 15px;
    font-weight: 900;
    line-height: 1;
    text-align: center;
}

.hr-turn-feedback__track {
    position: relative;

    width: 100%;
    height: 7px;

    margin-top: 7px;

    overflow: hidden;

    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;

    background:
        rgba(0, 0, 0, 0.50);

    box-shadow:
        inset 0 1px 3px rgba(0, 0, 0, 0.70);
}

.hr-turn-feedback__fill {
    position: absolute;

    top: 0;
    bottom: 0;
    left: 0;

    width: 0%;

    border-radius: inherit;

    background:
        linear-gradient(
            90deg,
            #139346,
            #45e37b
        );

    box-shadow:
        0 0 8px rgba(66, 229, 119, 0.72);

    transition:
        width 180ms linear,
        background 180ms ease,
        box-shadow 180ms ease;
}

/* ---------------------------------------------------------
   YOUR TURN
   --------------------------------------------------------- */

.hr-turn-feedback.hr-my-turn {
    border-color:
        rgba(67, 220, 119, 0.98);

    box-shadow:
        inset 0 0 0 1px rgba(143, 255, 179, 0.20),
        0 4px 12px rgba(0, 0, 0, 0.38),
        0 0 18px rgba(50, 220, 112, 0.28);

    animation:
        hrYourTurnPanelPulse 1150ms ease-in-out infinite;
}

.hr-turn-feedback.hr-my-turn
.hr-turn-feedback__eyebrow {
    color: #8fffb2;
}

.hr-turn-feedback.hr-my-turn
.hr-turn-feedback__title {
    color: #effff3;

    text-shadow:
        0 2px 3px rgba(0, 0, 0, 0.84),
        0 0 11px rgba(79, 245, 134, 0.40);
}

/* ---------------------------------------------------------
   WARNING TIMER STATES
   --------------------------------------------------------- */

.hr-turn-feedback.hr-warning
.hr-turn-feedback__fill {
    background:
        linear-gradient(
            90deg,
            #c98a0b,
            #ffd248
        );

    box-shadow:
        0 0 9px rgba(255, 203, 61, 0.84);
}

.hr-turn-feedback.hr-warning
.hr-turn-feedback__clock {
    border-color:
        rgba(255, 203, 61, 0.92);

    background:
        linear-gradient(
            180deg,
            rgba(132, 88, 6, 0.92),
            rgba(72, 45, 3, 0.96)
        );

    color: #ffec9a;

    box-shadow:
        0 0 12px rgba(255, 197, 39, 0.26);
}

.hr-turn-feedback.hr-danger {
    border-color:
        rgba(255, 80, 80, 0.98);

    box-shadow:
        inset 0 0 0 1px rgba(255, 153, 153, 0.18),
        0 4px 12px rgba(0, 0, 0, 0.40),
        0 0 18px rgba(255, 45, 45, 0.30);

    animation:
        hrDangerPanelPulse 560ms ease-in-out infinite;
}

.hr-turn-feedback.hr-danger
.hr-turn-feedback__fill {
    background:
        linear-gradient(
            90deg,
            #ad1717,
            #ff4e4e
        );

    box-shadow:
        0 0 11px rgba(255, 61, 61, 0.92);

    animation:
        hrTimerDangerFill 560ms ease-in-out infinite;
}

.hr-turn-feedback.hr-danger
.hr-turn-feedback__clock {
    border-color:
        rgba(255, 81, 81, 0.96);

    background:
        linear-gradient(
            180deg,
            rgba(136, 21, 21, 0.94),
            rgba(68, 7, 7, 0.98)
        );

    color: #ffb0b0;

    animation:
        hrTimerDangerText 560ms ease-in-out infinite;
}

/* ---------------------------------------------------------
   CREW LIST CURRENT-TURN HIGHLIGHT
   --------------------------------------------------------- */

#players .player-row.turn,
#players .player-row.hr-current-player {
    position: relative;

    border-color:
        rgba(255, 207, 75, 0.95) !important;

    background:
        linear-gradient(
            90deg,
            rgba(116, 69, 12, 0.88),
            rgba(45, 55, 72, 0.92)
        ) !important;

    box-shadow:
        inset 0 0 0 1px rgba(255, 227, 132, 0.20),
        0 0 14px rgba(255, 192, 48, 0.30) !important;

    animation:
        hrCurrentPlayerGlow 1250ms ease-in-out infinite;
}

#players .player-row.turn::after,
#players .player-row.hr-current-player::after {
    content: "TURN";

    position: absolute;

    top: 50%;
    right: 8px;

    padding: 3px 7px;

    border: 1px solid rgba(255, 222, 116, 0.76);
    border-radius: 999px;

    background:
        rgba(87, 48, 4, 0.90);

    color: #ffe595;

    font-size: 8px;
    font-weight: 900;
    line-height: 1;

    letter-spacing: 0.08em;

    transform:
        translateY(-50%);
}

/* ---------------------------------------------------------
   DISABLED / WAITING KEYBOARD
   --------------------------------------------------------- */

#keyboard.hr-waiting-turn,
.keyboard.hr-waiting-turn {
    position: relative;

    opacity: 0.53;

    filter:
        grayscale(0.38)
        saturate(0.66);

    transition:
        opacity 180ms ease,
        filter 180ms ease;
}

#keyboard.hr-waiting-turn .key,
.keyboard.hr-waiting-turn .key {
    cursor: not-allowed !important;
}

#keyboard.hr-my-turn,
.keyboard.hr-my-turn {
    opacity: 1;

    filter: none;
}

#keyboard.hr-my-turn .key:not(:disabled),
.keyboard.hr-my-turn .key:not(:disabled) {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.20),
        0 3px 7px rgba(0, 0, 0, 0.33),
        0 0 7px rgba(59, 211, 108, 0.11);
}

/*
  Existing desktop side-panel timer inherits warning colors.
*/
.turn-card.hr-timer-warning .timer i {
    background:
        linear-gradient(
            90deg,
            #cf8e0e,
            #ffd33d
        ) !important;

    box-shadow:
        0 0 8px rgba(255, 199, 43, 0.78) !important;
}

.turn-card.hr-timer-warning #timerText {
    color: #ffe483 !important;
}

.turn-card.hr-timer-danger .timer i {
    background:
        linear-gradient(
            90deg,
            #ae1717,
            #ff4545
        ) !important;

    box-shadow:
        0 0 10px rgba(255, 55, 55, 0.90) !important;

    animation:
        hrTimerDangerFill 560ms ease-in-out infinite;
}

.turn-card.hr-timer-danger #timerText {
    color: #ff8c8c !important;

    animation:
        hrTimerDangerText 560ms ease-in-out infinite;
}

/*
  Existing mobile timer also receives matching state classes.
*/
.hr-mobile-turn-timer.hr-my-turn {
    border-color:
        rgba(67, 220, 119, 0.98) !important;

    box-shadow:
        inset 0 0 0 1px rgba(145, 255, 181, 0.17),
        0 3px 9px rgba(0, 0, 0, 0.40),
        0 0 15px rgba(52, 220, 112, 0.24) !important;
}

/* ---------------------------------------------------------
   MOBILE
   --------------------------------------------------------- */

@media (max-width: 560px) {
    .hr-turn-feedback {
        width:
            calc(100% - 10px);

        margin:
            5px auto 6px;

        padding:
            7px 9px;

        border-radius:
            11px;
    }

    .hr-turn-feedback__main {
        gap: 7px;
    }

    .hr-turn-feedback__eyebrow {
        font-size: 8px;
    }

    .hr-turn-feedback__title {
        font-size: 15px;
    }

    .hr-turn-feedback__status {
        margin-top: 2px;

        font-size: 9px;
    }

    .hr-turn-feedback__clock {
        min-width: 57px;

        padding:
            6px 7px;

        border-radius:
            9px;

        font-size: 12px;
    }

    .hr-turn-feedback__track {
        height: 6px;

        margin-top: 5px;
    }

    /*
      Avoid displaying both full timer bars when the dedicated mobile
      keyboard timer is already installed. Keep this banner focused on
      turn ownership while its compact seconds badge stays visible.
    */
    body:has(.hr-mobile-turn-timer)
    .hr-turn-feedback__track {
        display: none;
    }
}

@media (max-width: 430px) {
    .hr-turn-feedback {
        width:
            calc(100% - 6px);

        padding:
            6px 7px;
    }

    .hr-turn-feedback__title {
        font-size: 14px;
    }

    .hr-turn-feedback__clock {
        min-width: 53px;

        font-size: 11px;
    }
}

/* ---------------------------------------------------------
   ANIMATIONS
   --------------------------------------------------------- */

@keyframes hrYourTurnPanelPulse {
    0%,
    100% {
        filter:
            brightness(1);
    }

    50% {
        filter:
            brightness(1.07);
    }
}

@keyframes hrDangerPanelPulse {
    0%,
    100% {
        filter:
            brightness(0.94);
    }

    50% {
        filter:
            brightness(1.12);
    }
}

@keyframes hrTimerDangerFill {
    0%,
    100% {
        opacity: 0.72;
    }

    50% {
        opacity: 1;
    }
}

@keyframes hrTimerDangerText {
    0%,
    100% {
        transform:
            scale(1);
    }

    50% {
        transform:
            scale(1.08);
    }
}

@keyframes hrCurrentPlayerGlow {
    0%,
    100% {
        filter:
            brightness(0.98);
    }

    50% {
        filter:
            brightness(1.10);
    }
}

@media (prefers-reduced-motion: reduce) {
    .hr-turn-feedback,
    .hr-turn-feedback *,
    #players .player-row.turn,
    #players .player-row.hr-current-player,
    .turn-card *,
    .hr-mobile-turn-timer * {
        animation: none !important;
        transition-duration: 1ms !important;
    }
}
