:root {
    color-scheme: dark;
    --ff-bg: #020b16;
    --ff-panel: rgba(3, 23, 42, 0.92);
    --ff-panel-soft: rgba(8, 47, 73, 0.72);
    --ff-border: rgba(125, 211, 252, 0.22);
    --ff-text: #f8fafc;
    --ff-muted: #9fb6ca;
    --ff-cyan: #38bdf8;
    --ff-blue: #2563eb;
    --ff-green: #34d399;
    --ff-danger: #fb7185;
    --ff-warning: #fbbf24;
    --ff-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    min-height: 100%;
    margin: 0;
}

body {
    overflow-x: hidden;
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    color: var(--ff-text);
    background:
        radial-gradient(circle at 15% 8%, rgba(14, 165, 233, 0.16), transparent 30%),
        radial-gradient(circle at 86% 18%, rgba(37, 99, 235, 0.16), transparent 28%),
        linear-gradient(180deg, #020b16, #041426 55%, #020811);
}

button,
a {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

.ff-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.ff-topbar {
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding:
        max(0.8rem, env(safe-area-inset-top))
        clamp(1rem, 3vw, 2.2rem)
        0.8rem;
    border-bottom: 1px solid rgba(125, 211, 252, 0.12);
    background: rgba(2, 11, 22, 0.74);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.ff-brand {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    color: inherit;
    text-decoration: none;
}

.ff-brand img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    filter: drop-shadow(0 8px 18px rgba(56, 189, 248, 0.18));
}

.ff-brand span {
    min-width: 0;
    display: grid;
    gap: 0.08rem;
}

.ff-brand strong {
    font-size: 0.98rem;
    letter-spacing: 0.01em;
}

.ff-brand small {
    color: var(--ff-muted);
    font-size: 0.72rem;
}

.ff-top-actions {
    display: flex;
    gap: 0.55rem;
}

.ff-icon-button {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 1px solid var(--ff-border);
    border-radius: 13px;
    color: var(--ff-text);
    background: rgba(8, 47, 73, 0.58);
    cursor: pointer;
    transition:
        transform 140ms ease,
        border-color 140ms ease,
        background 140ms ease;
}

.ff-icon-button:hover,
.ff-icon-button:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(56, 189, 248, 0.52);
    background: rgba(14, 116, 144, 0.52);
    outline: none;
}

.ff-main {
    width: 100%;
    flex: 1;
    display: grid;
    place-items: center;
    padding: clamp(0.8rem, 2.5vw, 2rem);
}

.ff-game-card {
    width: min(1180px, 100%);
    overflow: hidden;
    border: 1px solid var(--ff-border);
    border-radius: clamp(18px, 2vw, 28px);
    background:
        linear-gradient(180deg, rgba(8, 47, 73, 0.82), rgba(3, 23, 42, 0.92));
    box-shadow: var(--ff-shadow);
}

.ff-hud {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    background: rgba(125, 211, 252, 0.12);
}

.ff-hud-box {
    min-width: 0;
    min-height: 72px;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 0.18rem;
    padding: 0.7rem;
    text-align: center;
    background: rgba(3, 23, 42, 0.94);
}

.ff-hud-box span {
    color: var(--ff-muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.ff-hud-box strong {
    max-width: 100%;
    overflow: hidden;
    font-size: clamp(1rem, 2vw, 1.45rem);
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ff-hud-target strong {
    font-size: clamp(0.85rem, 1.6vw, 1.1rem);
}

#ffTargetDot {
    width: 9px;
    height: 9px;
    display: block;
    border-radius: 999px;
    background: #38bdf8;
    box-shadow: 0 0 14px currentColor;
}

.ff-timer-track {
    height: 5px;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.9);
}

.ff-timer-fill {
    width: 100%;
    height: 100%;
    transform-origin: left center;
    background:
        linear-gradient(90deg, #34d399, #38bdf8 55%, #2563eb);
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.55);
}

.ff-canvas-wrap {
    position: relative;
    width: 100%;
    min-height: min(68vh, 660px);
    height: min(68vh, 660px);
    overflow: hidden;
    isolation: isolate;
    touch-action: none;
    cursor: crosshair;
    background:
        radial-gradient(circle at 50% -10%, rgba(125, 211, 252, 0.28), transparent 42%),
        linear-gradient(180deg, #0d4168 0%, #07516e 28%, #06445f 56%, #052d43 100%);
}

#ffCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    z-index: 2;
}

.ff-water-glow {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
        linear-gradient(
            115deg,
            transparent 10%,
            rgba(186, 230, 253, 0.09) 28%,
            transparent 44%
        ),
        linear-gradient(
            65deg,
            transparent 50%,
            rgba(186, 230, 253, 0.06) 67%,
            transparent 78%
        );
    animation: ffLightSweep 8s ease-in-out infinite alternate;
}

.ff-scanline {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    opacity: 0.2;
    background:
        repeating-linear-gradient(
            180deg,
            transparent 0,
            transparent 3px,
            rgba(255, 255, 255, 0.018) 4px
        );
}

.ff-target-flash {
    position: absolute;
    top: 22px;
    left: 50%;
    z-index: 9;
    min-width: min(360px, calc(100% - 32px));
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.7rem;
    padding: 0.8rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 999px;
    color: #f8fafc;
    background:
        linear-gradient(
            135deg,
            rgba(3, 23, 42, 0.96),
            rgba(8, 47, 73, 0.96)
        );
    box-shadow:
        0 16px 38px rgba(0, 0, 0, 0.42),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    opacity: 0;
    pointer-events: none;
    transform:
        translate(-50%, -18px)
        scale(0.86);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.ff-target-flash span {
    color: #bae6fd;
    font-size: 0.66rem;
    font-weight: 900;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.ff-target-flash strong {
    overflow: hidden;
    font-size: clamp(1rem, 3vw, 1.35rem);
    line-height: 1;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ff-target-flash i {
    width: 18px;
    height: 18px;
    display: block;
    border: 3px solid rgba(255, 255, 255, 0.78);
    border-radius: 999px;
    background: #38bdf8;
    box-shadow:
        0 0 0 5px rgba(255, 255, 255, 0.08),
        0 0 22px currentColor;
}

.ff-target-flash.ff-target-flash-show {
    animation: ffTargetFlash 1.3s ease-out forwards;
}

.ff-screen {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: none;
    place-items: center;
    padding: 1rem;
    background:
        radial-gradient(circle at center, rgba(8, 47, 73, 0.48), rgba(2, 11, 22, 0.78));
    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
}

.ff-screen-active {
    display: grid;
}

.ff-screen-card {
    width: min(430px, 100%);
    display: grid;
    justify-items: center;
    gap: 1rem;
    padding: clamp(1.25rem, 4vw, 2.4rem);
    text-align: center;
    border: 1px solid rgba(125, 211, 252, 0.26);
    border-radius: 24px;
    background:
        linear-gradient(180deg, rgba(8, 47, 73, 0.96), rgba(3, 23, 42, 0.97));
    box-shadow:
        0 24px 70px rgba(0, 0, 0, 0.48),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.ff-screen-card h1,
.ff-screen-card h2,
.ff-screen-card p {
    margin: 0;
}

.ff-screen-card h1 {
    font-size: clamp(2.1rem, 8vw, 4rem);
    line-height: 0.96;
    letter-spacing: -0.055em;
    background: linear-gradient(135deg, #f8fafc, #7dd3fc 58%, #60a5fa);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.ff-screen-card h2 {
    font-size: clamp(1.65rem, 6vw, 2.6rem);
    letter-spacing: -0.04em;
}

.ff-screen-card p {
    max-width: 36ch;
    color: #c6d6e4;
    line-height: 1.55;
}

.ff-screen-card small {
    color: var(--ff-muted);
    font-size: 0.72rem;
}

.ff-kicker {
    color: #7dd3fc;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.ff-best {
    color: var(--ff-muted);
    font-size: 0.9rem;
}

.ff-best strong {
    color: var(--ff-text);
}

.ff-primary-button {
    min-width: min(220px, 100%);
    min-height: 52px;
    padding: 0.8rem 1.4rem;
    border: 1px solid rgba(125, 211, 252, 0.45);
    border-radius: 15px;
    color: #f8fafc;
    font-weight: 800;
    cursor: pointer;
    background:
        linear-gradient(135deg, #0284c7, #2563eb);
    box-shadow:
        0 14px 30px rgba(37, 99, 235, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.22);
    transition:
        transform 150ms ease,
        filter 150ms ease;
}

.ff-primary-button:hover,
.ff-primary-button:focus-visible {
    transform: translateY(-2px);
    filter: brightness(1.08);
    outline: none;
}

.ff-final-score {
    display: grid;
    gap: 0.25rem;
}

.ff-final-score span,
.ff-results-grid span {
    color: var(--ff-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.ff-final-score strong {
    font-size: clamp(2.5rem, 10vw, 4.6rem);
    line-height: 1;
    color: #7dd3fc;
}

.ff-results-grid {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.7rem;
}

.ff-results-grid > div {
    display: grid;
    gap: 0.35rem;
    padding: 0.9rem;
    border: 1px solid rgba(125, 211, 252, 0.14);
    border-radius: 14px;
    background: rgba(2, 11, 22, 0.34);
}

.ff-results-grid strong {
    font-size: 1.15rem;
}

.ff-floating-message {
    position: absolute;
    z-index: 8;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
    color: white;
    font-size: clamp(1.15rem, 4vw, 1.7rem);
    font-weight: 900;
    text-shadow: 0 5px 18px rgba(0, 0, 0, 0.7);
}

.ff-floating-message.ff-show {
    animation: ffScorePop 650ms ease-out forwards;
}

.ff-floating-message.ff-miss {
    color: #fda4af;
}

.ff-game-footer {
    min-height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    color: var(--ff-muted);
    font-size: 0.77rem;
    background: rgba(3, 23, 42, 0.96);
}

.ff-game-footer b {
    color: #dbeafe;
}

.ff-staging-badge {
    flex: 0 0 auto;
    padding: 0.28rem 0.55rem;
    border: 1px solid rgba(251, 191, 36, 0.28);
    border-radius: 999px;
    color: #fde68a;
    background: rgba(146, 64, 14, 0.18);
}

@keyframes ffTargetFlash {
    0% {
        opacity: 0;
        transform:
            translate(-50%, -18px)
            scale(0.86);
    }

    14% {
        opacity: 1;
        transform:
            translate(-50%, 0)
            scale(1.05);
    }

    28% {
        transform:
            translate(-50%, 0)
            scale(1);
    }

    76% {
        opacity: 1;
        transform:
            translate(-50%, 0)
            scale(1);
    }

    100% {
        opacity: 0;
        transform:
            translate(-50%, -10px)
            scale(0.96);
    }
}

@keyframes ffLightSweep {
    from {
        transform: translateX(-3%);
        opacity: 0.65;
    }

    to {
        transform: translateX(4%);
        opacity: 1;
    }
}

@keyframes ffScorePop {
    0% {
        opacity: 0;
        transform: translate(-50%, -45%) scale(0.75);
    }

    20% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -125%) scale(1.08);
    }
}

@media (max-width: 720px) {
    .ff-target-flash {
        top: 14px;
        min-width: min(320px, calc(100% - 20px));
        gap: 0.55rem;
        padding: 0.72rem 0.85rem;
    }

    .ff-target-flash span {
        font-size: 0.58rem;
    }

    .ff-target-flash i {
        width: 16px;
        height: 16px;
    }

    .ff-topbar {
        min-height: 62px;
        padding-inline: 0.8rem;
    }

    .ff-brand img {
        width: 36px;
        height: 36px;
    }

    .ff-brand small {
        display: none;
    }

    .ff-icon-button {
        width: 38px;
        height: 38px;
    }

    .ff-main {
        display: block;
        padding: 0;
    }

    .ff-game-card {
        min-height: calc(100vh - 62px);
        min-height: calc(100dvh - 62px);
        border: 0;
        border-radius: 0;
    }

    .ff-hud-box {
        min-height: 64px;
        padding: 0.5rem 0.35rem;
    }

    .ff-canvas-wrap {
        height: calc(100vh - 185px);
        height: calc(100dvh - 185px);
        min-height: 420px;
    }

    .ff-game-footer {
        display: none;
    }
}

@media (max-width: 430px) {
    .ff-hud-box strong {
        font-size: 0.96rem;
    }

    .ff-hud-target strong {
        max-width: 72px;
        font-size: 0.72rem;
    }

    .ff-screen-card {
        border-radius: 19px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}
.tc-game-back {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 40px;
    padding: 0.58rem 0.8rem;
    margin-left: auto;
    border: 1px solid rgba(125, 211, 252, 0.24);
    border-radius: 12px;
    color: #dff7ff;
    font-size: 0.78rem;
    font-weight: 800;
    text-decoration: none;
    background: rgba(8, 47, 73, 0.5);
    transition:
        transform 140ms ease,
        border-color 140ms ease,
        background 140ms ease;
}

.tc-game-back:hover,
.tc-game-back:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(56, 189, 248, 0.55);
    color: #ffffff;
    background: rgba(14, 116, 144, 0.5);
    outline: none;
}

@media (max-width: 720px) {
    .tc-game-back {
        padding: 0.52rem 0.65rem;
        font-size: 0.72rem;
    }

    .tc-game-back span:last-child {
        display: none;
    }
}

/* ==========================================================================
   TanksConnected arcade standalone viewport owner
   ========================================================================== */

@media (display-mode: standalone) and (max-width: 720px) {
    html,
    body {
        width: 100%;
        height: 100%;
        min-height: 0;
        overflow: hidden;
        overscroll-behavior: none;
    }

    .ff-shell {
        width: 100%;
        height: 100svh;
        min-height: 0;
        max-height: 100svh;
        overflow: hidden;
    }

    .ff-topbar {
        flex: 0 0 auto;
        padding-top: max(
            0.8rem,
            env(safe-area-inset-top, 0px)
        );
    }

    .ff-main {
        flex: 1 1 auto;
        min-height: 0;
        display: block;
        overflow: hidden;
        padding: 0;
    }

    .ff-game-card {
        width: 100%;
        height: 100%;
        min-height: 0;
        max-height: 100%;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        border: 0;
        border-radius: 0;
    }

    .ff-hud {
        flex: 0 0 auto;
    }

    .ff-canvas-wrap {
        flex: 1 1 0;
        width: 100%;
        height: 0;
        min-height: 0;
        max-height: none;
        overflow: hidden;
    }

    .ff-game-footer {
        display: none;
    }
}
