:root {
    --tpw-bg: #080808;
    --tpw-card: #121212;
    --tpw-card-2: #1a1a1a;
    --tpw-text: #f5f5f5;
    --tpw-muted: #b4b4b8;
    --tpw-border: rgba(255, 255, 255, 0.12);
    --tpw-shadow: 0 18px 44px rgba(2, 5, 18, 0.62);
}

body.tpw-body {
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    color: var(--tpw-text);
    background:
        radial-gradient(circle at 18% -10%, rgba(192, 38, 211, 0.14), transparent 36%),
        radial-gradient(circle at 92% -15%, rgba(220, 38, 38, 0.16), transparent 34%),
        linear-gradient(180deg, #0b0b0f 0%, #050507 100%);
}

.tpw-home-section {
    max-width: 1320px;
}

.tpw-hero-heading {
    font-family: "Oxanium", sans-serif;
    letter-spacing: 0.01em;
}

.tpw-hero-card,
.tpw-panel,
.tpw-auth-modal,
.tpw-game-stage,
.tpw-game-card,
.tpw-chat-shell {
    background: linear-gradient(165deg, rgba(18, 18, 18, 0.96), rgba(9, 9, 11, 0.97));
    border: 1px solid var(--tpw-border);
    box-shadow: var(--tpw-shadow);
}

.tpw-floating-icon {
    font-size: clamp(2.4rem, 3vw, 4rem);
    opacity: 0.25;
    filter: blur(0.1px);
    animation-duration: 22s;
}

.tpw-floating-icon-1 { top: 2%; left: 4%; }
.tpw-floating-icon-2 { top: 18%; right: 4%; }
.tpw-floating-icon-3 { bottom: 2%; left: 20%; }
.tpw-floating-icon-4 { top: 4%; right: 38%; }
.tpw-floating-icon-5 { bottom: 14%; right: 12%; }

@keyframes tpw-float {
    0% { transform: translateY(30px) rotate(0deg) scale(0.92); opacity: 0; }
    12% { opacity: 0.22; }
    48% { transform: translateY(-26px) rotate(8deg) scale(1); opacity: 0.35; }
    74% { transform: translateY(-8px) rotate(-6deg) scale(1.03); opacity: 0.26; }
    100% { transform: translateY(30px) rotate(0deg) scale(0.92); opacity: 0; }
}

.tpw-game-card {
    position: relative;
    overflow: hidden;
    min-height: 226px;
}

.tpw-game-card-netflix {
    min-width: 260px;
    max-width: 280px;
    flex: 0 0 auto;
    transform-origin: center center;
}

.tpw-game-card-netflix:hover {
    transform: scale(1.03) translateY(-2px);
    z-index: 4;
}

.tpw-game-bg-icon {
    position: absolute;
    right: -8px;
    bottom: -12px;
    font-size: 5rem;
    opacity: 0.08;
    pointer-events: none;
}

.tpw-game-card:hover .tpw-game-bg-icon {
    transform: translate(-3px, -3px) scale(1.04);
    opacity: 0.14;
}

.tpw-game-card .tpw-game-desc,
.tpw-game-card .tpw-game-meta,
.tpw-panel .text-muted,
.tpw-footer .text-muted,
.tpw-hero-muted,
.tpw-section-subheading,
.tpw-hero-text {
    color: var(--tpw-muted) !important;
}

.tpw-game-title,
.tpw-panel-title,
.tpw-game-top-name,
.tpw-game-description,
.tpw-section-heading,
.tpw-chat-meta a,
.tpw-user-link {
    color: var(--tpw-text);
}

.tpw-user-link {
    text-decoration: none;
}

.tpw-user-link:hover,
.tpw-chat-meta a:hover {
    text-decoration: underline;
}

.tpw-card-theme-lime { --card-accent: #22c55e; }
.tpw-card-theme-violet { --card-accent: #a855f7; }
.tpw-card-theme-indigo { --card-accent: #6366f1; }
.tpw-card-theme-cyan { --card-accent: #06b6d4; }
.tpw-card-theme-orange { --card-accent: #f97316; }
.tpw-card-theme-pink { --card-accent: #ec4899; }
.tpw-card-theme-rose { --card-accent: #f43f5e; }
.tpw-card-theme-amber { --card-accent: #f59e0b; }
.tpw-card-theme-magenta { --card-accent: #d946ef; }
.tpw-card-theme-slate { --card-accent: #94a3b8; }
.tpw-card-theme-teal { --card-accent: #14b8a6; }
.tpw-card-theme-red { --card-accent: #ef4444; }
.tpw-card-theme-blue { --card-accent: #3b82f6; }
.tpw-card-theme-green { --card-accent: #22c55e; }
.tpw-card-theme-yellow { --card-accent: #eab308; }
.tpw-card-theme-purple { --card-accent: #8b5cf6; }

.tpw-game-card {
    border-color: color-mix(in srgb, var(--card-accent) 35%, rgba(255, 255, 255, 0.05));
}

.tpw-game-card .tpw-game-icon-wrap {
    background: linear-gradient(135deg, color-mix(in srgb, var(--card-accent) 55%, #ef4444), #4b5563);
}

.tpw-game-card:hover {
    box-shadow: 0 18px 44px color-mix(in srgb, var(--card-accent) 35%, rgba(4, 8, 27, 0.6));
}

.tpw-community {
    margin-bottom: 3rem;
}

.tpw-category-row {
    margin-bottom: 1.6rem;
}

.tpw-category-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.7rem;
}

.tpw-category-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
}

.tpw-category-desc {
    color: var(--tpw-muted);
    font-size: 0.88rem;
}

.tpw-carousel-shell {
    position: relative;
}

.tpw-carousel-track {
    display: flex;
    gap: 0.85rem;
    overflow-x: auto;
    padding: 0.3rem 0.2rem 0.8rem;
    scroll-snap-type: x mandatory;
}

.tpw-carousel-track > .tpw-game-card {
    scroll-snap-align: start;
}

.tpw-carousel-track::-webkit-scrollbar {
    height: 8px;
}

.tpw-carousel-track::-webkit-scrollbar-thumb {
    background: rgba(212, 212, 216, 0.3);
    border-radius: 999px;
}

.tpw-live-features .tpw-panel {
    min-height: 146px;
}

#tpw-daily-challenges li {
    border-bottom: 1px dashed rgba(174, 191, 255, 0.16);
    padding-bottom: 0.35rem;
}

#tpw-daily-challenges li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.tpw-community-head {
    margin-bottom: 0.8rem;
}

.tpw-chat-shell {
    border-radius: 18px;
    padding: 1rem;
}

.tpw-chat-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.75rem;
}

#tpw-chat-channel {
    width: min(280px, 100%);
    background: #0b1330;
    color: #e9eeff;
    border-color: rgba(174, 191, 255, 0.5);
}

.tpw-chat-list {
    list-style: none;
    margin: 0;
    padding: 0.5rem;
    min-height: 180px;
    max-height: 320px;
    overflow: auto;
    border-radius: 12px;
    border: 1px solid rgba(174, 191, 255, 0.25);
    background: rgba(5, 10, 24, 0.86);
}

.tpw-chat-item {
    padding: 0.5rem 0.35rem;
    border-bottom: 1px dashed rgba(174, 191, 255, 0.2);
}

.tpw-chat-item:last-child {
    border-bottom: none;
}

.tpw-chat-item p {
    margin: 0.25rem 0 0;
    color: #ebefff;
    line-height: 1.35;
}

.tpw-chat-meta {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.82rem;
    color: var(--tpw-muted);
}

.tpw-chat-meta time {
    opacity: 0.85;
}

.tpw-chat-badge {
    background: rgba(156, 163, 175, 0.3);
    border-radius: 999px;
    padding: 0.08rem 0.45rem;
    font-size: 0.68rem;
}

.tpw-chat-form {
    margin-top: 0.75rem;
    display: flex;
    gap: 0.6rem;
}

.tpw-chat-form input {
    background: #091029;
    border-color: rgba(174, 191, 255, 0.45);
    color: #f5f8ff;
}

.tpw-chat-empty {
    color: var(--tpw-muted);
    font-size: 0.88rem;
    padding: 0.65rem 0.35rem;
}

.tpw-profile-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.tpw-profile-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #f97316, #a855ff);
}

.tpw-profile-avatar i {
    color: #fff;
}

.tpw-profile-name {
    font-weight: 700;
    font-size: 1.1rem;
}

.tpw-profile-meta {
    color: var(--tpw-muted);
    font-size: 0.88rem;
}

.tpw-profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem;
}

.tpw-profile-stat {
    border: 1px solid rgba(174, 191, 255, 0.25);
    border-radius: 12px;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.tpw-profile-stat span {
    color: var(--tpw-muted);
    font-size: 0.75rem;
}

.tpw-profile-stat strong {
    font-size: 1rem;
}

.tpw-profile-section-title {
    margin-top: 0.85rem;
    font-weight: 600;
}

.tpw-profile-achievements {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.tpw-profile-progress-meta {
    font-size: 0.82rem;
    color: var(--tpw-muted);
    margin-bottom: 0.3rem;
}

.tpw-profile-progress-bar {
    height: 8px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.25);
    overflow: hidden;
}

.tpw-profile-progress-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #f97316, #a855f7);
}

.tpw-achievement-pill {
    border-radius: 999px;
    border: 1px solid rgba(174, 191, 255, 0.35);
    background: rgba(31, 41, 73, 0.7);
    padding: 0.22rem 0.55rem;
    font-size: 0.74rem;
}

.tpw-profile-scores {
    max-height: 280px;
    overflow: auto;
    border: 1px solid rgba(174, 191, 255, 0.22);
    border-radius: 12px;
    padding: 0.45rem;
}

.tpw-profile-score-row {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.3rem 0.2rem;
    border-bottom: 1px dashed rgba(174, 191, 255, 0.18);
}

.tpw-profile-score-row:last-child {
    border-bottom: none;
}

.tpw-footer {
    background: rgba(8, 8, 8, 0.98);
}

.tpw-footer-icon,
.tpw-footer .text-muted {
    color: #c7d0f3 !important;
}

.tpw-game-stage:fullscreen {
    padding: 1rem;
    background: linear-gradient(180deg, #07070b, #030306);
}

.tpw-game-stage:fullscreen canvas {
    max-height: calc(100vh - 5rem);
    width: auto;
}

.tpw-game-section:fullscreen {
    width: 100vw;
    height: 100vh;
    max-width: none;
    overflow: auto;
    background: #060608;
    padding: 0.85rem;
}

.tpw-game-section:fullscreen .col-lg-4 {
    display: none;
}

.tpw-game-section:fullscreen .col-lg-8 {
    width: 100%;
}

.tpw-game-section:fullscreen .tpw-game-stage {
    min-height: calc(100vh - 120px);
    height: calc(100vh - 120px);
}

.tpw-game-section:fullscreen .tpw-game-top {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(8, 8, 10, 0.92);
    backdrop-filter: blur(4px);
    padding: 0.4rem 0.2rem;
}

.tpw-game-section:fullscreen .tpw-game-stage > * {
    height: 100%;
}

.tpw-game-section:fullscreen canvas {
    width: 100% !important;
    height: 100% !important;
    max-height: none !important;
}

.tpw-game-stage {
    touch-action: none;
}

.tpw-mobile-gamepad {
    position: fixed;
    left: 0;
    right: 0;
    bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 90;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 0 12px;
    pointer-events: none;
}

.tpw-mobile-gamepad > * {
    pointer-events: auto;
}

.tpw-pad-left,
.tpw-pad-right {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.tpw-pad-row {
    display: flex;
    gap: 0.45rem;
}

.tpw-mobile-gamepad button {
    width: 46px;
    height: 46px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    background: rgba(20, 20, 24, 0.82);
    color: #f4f4f5;
    display: grid;
    place-items: center;
    backdrop-filter: blur(3px);
}

.tpw-mobile-gamepad .tpw-pad-action {
    width: 54px;
    height: 54px;
    border-radius: 999px;
    font-weight: 700;
}

@media (max-width: 992px) {
    .tpw-sidebar {
        width: 60px;
    }

    .tpw-main {
        padding: 1rem;
    }

    .tpw-chat-form {
        flex-direction: column;
    }

    .tpw-profile-stats-grid {
        grid-template-columns: 1fr;
    }

    .tpw-game-card-netflix {
        min-width: 220px;
    }
}
