@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;600;700;800;900&family=Rajdhani:wght@400;500;600;700&display=swap');

:root {
    --red: #ab0000;
    --bright-red: #e50000;
    --black: #080808;
    --white: #f5f5f5;
    --muted: #888;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--black);
    color: var(--white);
    font-family: 'Rajdhani', sans-serif;
    overscroll-behavior: none;
}

body {
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

button {
    font: inherit;
}

#game {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 50% 55%, #300000 0%, transparent 55%),
        #080808;
}

/* LOADING SCREEN */

#loading-screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #080808;
    z-index: 10;
}

.loading-logo {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(30px, 8vw, 65px);
    font-weight: 900;
    letter-spacing: 5px;
    color: white;
    text-shadow: 0 0 25px #ab0000;
    animation: logoPulse 2s ease-in-out infinite;
}

.loading-subtitle {
    margin-top: 8px;
    font-family: 'Orbitron', sans-serif;
    font-size: 12px;
    letter-spacing: 8px;
    color: var(--bright-red);
}

.loading-bar {
    width: min(260px, 65vw);
    height: 3px;
    margin-top: 45px;
    background: #333;
    overflow: hidden;
}

.loading-progress {
    width: 40%;
    height: 100%;
    background: var(--bright-red);
    box-shadow: 0 0 15px var(--bright-red);
    animation: loadingMove 1.5s ease-in-out infinite;
}

#loading-screen p {
    margin-top: 18px;
    color: #777;
    font-family: 'Orbitron', sans-serif;
    font-size: 9px;
    letter-spacing: 3px;
    text-align: center;
}

/* MAIN GAME SCREEN */

#game-screen {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

#game-screen:not([hidden]) {
    display: block;
}

#game-background {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(#ffffff08 1px, transparent 1px),
        linear-gradient(90deg, #ffffff08 1px, transparent 1px);
    background-size: 45px 45px;
    mask-image: linear-gradient(to bottom, black, transparent);
    pointer-events: none;
}

#game-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 25px;
    padding-top: max(35px, env(safe-area-inset-top));
    padding-bottom: max(35px, env(safe-area-inset-bottom));
    text-align: center;
}

.game-version {
    margin-bottom: 25px;
    color: var(--bright-red);
    font-family: 'Orbitron', sans-serif;
    font-size: 10px;
    letter-spacing: 4px;
}

#game-content h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(30px, 7vw, 75px);
    font-weight: 900;
    line-height: 1.2;
    text-shadow: 0 0 30px #ab000044;
}

#game-content h1 span {
    display: block;
    color: var(--bright-red);
}

#game-message {
    margin-top: 25px;
    color: var(--muted);
    font-size: 19px;
}

#start-button {
    margin-top: 45px;
    min-height: 58px;
    padding: 0 35px;
    border: 1px solid var(--red);
    background: var(--red);
    color: white;
    font-family: 'Orbitron', sans-serif;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 2px;
    cursor: pointer;
    box-shadow: 0 0 25px #ab000044;
    transition: 0.2s;
}

#start-button:hover {
    background: var(--bright-red);
    box-shadow: 0 0 35px #e5000088;
    transform: translateY(-3px);
}

#start-button:active {
    transform: scale(0.96);
}

/* FOOTER */

#game-screen footer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    gap: 15px;
    color: #666;
    font-family: 'Orbitron', sans-serif;
    font-size: 9px;
    letter-spacing: 2px;
}

/* ANIMATIONS */

@keyframes logoPulse {
    0%, 100% {
        opacity: 1;
        text-shadow: 0 0 25px #ab0000;
    }

    50% {
        opacity: 0.75;
        text-shadow: 0 0 45px #e50000;
    }
}

@keyframes loadingMove {
    0% {
        transform: translateX(-110%);
    }

    100% {
        transform: translateX(260%);
    }
}

/* SMALL SCREENS */

@media (max-width: 600px) {
    #game-content {
        padding: 18px;
    }

    .game-version {
        font-size: 8px;
        letter-spacing: 2px;
    }

    #game-message {
        font-size: 16px;
    }

    #start-button {
        min-height: 54px;
        padding: 0 22px;
        font-size: 10px;
    }

    #game-screen footer {
        padding: 15px;
        font-size: 7px;
    }
}

/* ==========================================
   MOBILE SCREEN FIT
========================================== */

#game-screen,
#loading-screen {
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
}

#game-content {
    overflow: hidden;
}

#game-content h1 {
    max-width: 100%;
    overflow-wrap: anywhere;
}

#game-screen footer {
    box-sizing: border-box;
    padding-bottom: max(15px, env(safe-area-inset-bottom));
    padding-left: max(15px, env(safe-area-inset-left));
    padding-right: max(15px, env(safe-area-inset-right));
}

@media (max-height: 500px) {
    #game-content {
        justify-content: center;
        padding-top: 10px;
        padding-bottom: 45px;
    }

    .game-version {
        margin-bottom: 10px;
    }

    #game-message {
        margin-top: 10px;
    }

    #start-button {
        margin-top: 18px;
        min-height: 44px;
    }
}

/* VIEWPORT AND LANDSCAPE FIX */

#game-screen,
#loading-screen {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}

#game-content {
    padding-top: max(25px, env(safe-area-inset-top));
    padding-bottom: max(45px, env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
}

@media (orientation: landscape) {
    #game-content {
        padding-top: max(10px, env(safe-area-inset-top));
        padding-bottom: max(45px, env(safe-area-inset-bottom));
    }

    #game-content h1 {
        font-size: clamp(24px, 5vw, 48px);
    }

    .game-version {
        margin-bottom: 10px;
    }

    #game-message {
        margin-top: 10px;
    }

    #start-button {
        margin-top: 18px;
    }
}

/* ==========================================
   LANDSCAPE ORIENTATION
========================================== */

#rotate-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
    background: #080808;
    color: white;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    padding: 25px;
}

.rotate-icon {
    font-size: 65px;
    color: var(--bright-red);
    margin-bottom: 20px;
}

#rotate-overlay h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 22px;
}

#rotate-overlay p {
    margin-top: 15px;
    color: var(--muted);
    letter-spacing: 2px;
}

@media (orientation: portrait) and (pointer: coarse) {
    #rotate-overlay {
        display: flex;
    }
}

#rotateStartButton {
    margin-top: 30px;
    padding: 16px 28px;
    background: var(--red);
    color: white;
    border: 1px solid var(--bright-red);
    font-family: 'Orbitron', sans-serif;
    font-weight: 800;
    letter-spacing: 2px;
}


/* ==========================================
   TAMOBOT: CHAOS ARENA
   MAIN LOBBY
========================================== */

#lobby {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background: #080808;
    color: #fff;
    font-family: 'Rajdhani', sans-serif;
}

/* BACKGROUND */

.lobby-background {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 50% 60%, #480000 0%, transparent 55%),
        linear-gradient(180deg, #100000 0%, #080808 75%);
}

.lobby-background::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(#ffffff08 1px, transparent 1px),
        linear-gradient(90deg, #ffffff08 1px, transparent 1px);
    background-size: 45px 45px;
    mask-image: linear-gradient(to bottom, black, transparent);
}

.lobby-vignette {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, #080808bb, transparent 35%, transparent 65%, #080808bb),
        linear-gradient(0deg, #080808cc, transparent 35%);
    pointer-events: none;
}

/* TOP BAR */

.lobby-topbar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 75px;
    padding: 0 4%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #ffffff18;
    background: #080808aa;
    backdrop-filter: blur(12px);
    z-index: 5;
}

.lobby-brand {
    font-family: 'Orbitron', sans-serif;
    font-size: 19px;
    font-weight: 900;
    letter-spacing: 3px;
}

.lobby-brand span {
    display: block;
    margin-top: 4px;
    color: var(--bright-red);
    font-size: 9px;
    letter-spacing: 4px;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.player-avatar {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: 1px solid var(--red);
    background: #240000;
    font-family: 'Orbitron', sans-serif;
    font-size: 20px;
}

.player-name {
    font-family: 'Orbitron', sans-serif;
    font-size: 11px;
    font-weight: 800;
}

.player-level {
    margin-top: 4px;
    color: #999;
    font-size: 12px;
}

/* MAIN LAYOUT */

.lobby-layout {
    position: absolute;
    top: 75px;
    bottom: 65px;
    left: 0;
    right: 0;

    display: grid;
    grid-template-columns: 190px minmax(0, 1fr) 245px;
    align-items: center;
    gap: 15px;
    padding: 15px 4%;

    min-height: 0;
}

/* LEFT NAVIGATION */

.lobby-navigation {
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 2;
}

.nav-heading,
.panel-heading {
    margin-bottom: 12px;
    color: var(--bright-red);
    font-family: 'Orbitron', sans-serif;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 3px;
}

.lobby-nav-button {
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid #ffffff18;
    background: #111111cc;
    color: #aaa;
    text-align: left;
    font-family: 'Orbitron', sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    transition: 0.2s;
}

.lobby-nav-button span {
    color: var(--bright-red);
    font-size: 17px;
}

.lobby-nav-button:hover,
.lobby-nav-button.active {
    border-color: var(--red);
    background: #360000bb;
    color: white;
    box-shadow: inset 3px 0 var(--bright-red);
}

/* TAMOBOT STAGE */

.lobby-stage {
    position: relative;
    height: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    isolation: isolate;
}

.lobby-stage-glow {
    position: absolute;
    width: min(70%, 400px);
    aspect-ratio: 1;
    border-radius: 50%;
    background: #ab0000;
    filter: blur(100px);
    opacity: 0.22;
    z-index: -1;
    animation: lobbyGlow 4s ease-in-out infinite;
}

#lobbyTamoBot {
    position: relative;
    z-index: 1;
    width: min(70%, 330px);
    max-height: 65%;
    object-fit: contain;
    filter: drop-shadow(0 0 25px #ab000066);
    animation: lobbyIdle 4s ease-in-out infinite;
    cursor: pointer;
}

.lobby-dialogue {
    position: relative;
    z-index: 3;
    max-width: 90%;
    padding: 12px 20px;
    border: 1px solid #ab0000aa;
    border-radius: 10px;
    background: #151515ee;
    color: white;
    font-size: 15px;
    text-align: center;
    box-shadow: 0 0 20px #ab000033;
}

.lobby-character-info {
    position: relative;
    z-index: 2;
    margin-top: 12px;
    text-align: center;
}

.lobby-character-info p {
    color: #999;
    font-family: 'Orbitron', sans-serif;
    font-size: 9px;
    letter-spacing: 4px;
}

.lobby-character-info h1 {
    margin: 5px 0;
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(22px, 3vw, 38px);
    font-weight: 900;
    letter-spacing: 4px;
    color: var(--bright-red);
    text-shadow: 0 0 20px #ab000066;
}

.lobby-character-info span {
    color: #777;
    font-size: 11px;
    letter-spacing: 3px;
}

/* RIGHT PANEL */

.lobby-side-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;

    min-height: 0;
    max-height: 100%;
    overflow-y: auto;

    padding: 5px;
    z-index: 2;
}

.journey-card {
    padding: 20px 16px;
    border: 1px solid #ffffff20;
    background: #111111cc;
    transition: 0.2s;
}

.journey-card:hover {
    border-color: var(--red);
    background: #220000cc;
    transform: translateX(-4px);
}

.journey-card span {
    color: var(--bright-red);
    font-family: 'Orbitron', sans-serif;
    font-size: 9px;
    letter-spacing: 2px;
}

.journey-card h2 {
    margin-top: 12px;
    font-family: 'Orbitron', sans-serif;
    font-size: 13px;
    line-height: 1.5;
}

.journey-card p {
    margin-top: 8px;
    color: #999;
    font-size: 14px;
}

/* BOTTOM BAR */

.lobby-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    min-height: 65px;
    padding: 0 4%;
    display: flex;
    align-items: center;
    gap: 25px;
    border-top: 1px solid #ffffff18;
    background: #080808dd;
    z-index: 5;
}

.lobby-footer button {
    border: 0;
    background: transparent;
    color: #999;
    font-family: 'Orbitron', sans-serif;
    font-size: 9px;
    letter-spacing: 1px;
    cursor: pointer;
}

.lobby-footer button:hover {
    color: var(--bright-red);
}

.lobby-footer p {
    margin-left: auto;
    color: #555;
    font-family: 'Orbitron', sans-serif;
    font-size: 8px;
    letter-spacing: 2px;
}

/* ANIMATIONS */

@keyframes lobbyIdle {
    0%, 100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes lobbyGlow {
    0%, 100% {
        opacity: 0.16;
        transform: scale(1);
    }

    50% {
        opacity: 0.3;
        transform: scale(1.12);
    }
}

/* SHORT LANDSCAPE SCREENS */

@media (orientation: landscape) and (max-height: 500px) {
    .lobby-topbar {
        height: 55px;
    }

    .lobby-layout {
        top: 55px;
        bottom: 45px;
        padding: 10px 3%;
        gap: 10px;
    }

    .lobby-nav-button {
        min-height: 38px;
        font-size: 8px;
    }

    #lobbyTamoBot {
        max-height: 55%;
    }

    .lobby-footer {
        min-height: 45px;
    }

    .journey-card {
        padding: 12px;
    }

    .lobby-dialogue {
        padding: 8px 12px;
        font-size: 12px;
    }
}

/* PORTRAIT FALLBACK */

@media (orientation: portrait) {
    .lobby-layout {
        grid-template-columns: 1fr;
    }
}

/* ==========================================
   JOURNEY PANEL — VIEWPORT OVERFLOW FIX
========================================== */

@media (orientation: landscape) {

    .lobby-layout {
        grid-template-rows: minmax(0, 1fr);
        align-items: stretch;
        overflow: hidden;
    }

    .lobby-side-panel {
        height: 100%;
        min-height: 0;
        max-height: 100%;
        overflow-y: auto;
        justify-content: flex-start;
        align-self: stretch;
    }

    .journey-card {
        flex-shrink: 1;
        min-height: 0;
        padding: 10px 12px;
    }

    .journey-card h2 {
        margin-top: 6px;
    }

    .journey-card p {
        margin-top: 4px;
    }

    .panel-heading {
        margin-bottom: 5px;
    }
}

/* ==========================================
   CHARACTER SELECTION SCREEN
========================================== */

#character-selection {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    padding: 28px 4%;
    overflow: hidden;
    background:
        radial-gradient(
            circle at 75% 45%,
            rgba(171, 0, 0, 0.2),
            transparent 45%
        ),
        linear-gradient(135deg, #090909, #160707 65%, #080808);
}

#character-selection[hidden] {
    display: none;
}

.character-selection-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(229, 0, 0, 0.35);
}

.character-selection-header h1 {
    margin: 5px 0 0;
    color: white;
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(18px, 3vw, 30px);
    letter-spacing: 2px;
}

#backToLobbyButton {
    padding: 12px 18px;
    color: white;
    background: rgba(171, 0, 0, 0.15);
    border: 1px solid #ab0000;
    font-family: 'Rajdhani', sans-serif;
    font-weight: bold;
    cursor: pointer;
}

#backToLobbyButton:hover {
    background: #ab0000;
}

.character-selection-content {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 35px;
    flex: 1;
    min-height: 0;
    padding-top: 25px;
}

.character-roster {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-content: center;
}

.character-card {
    min-width: 0;
    padding: 15px;
    color: white;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.12);
    cursor: pointer;
    transition: 0.2s ease;
}

.character-card:hover,
.character-card.active {
    background: rgba(171, 0, 0, 0.16);
    border-color: #e50000;
    transform: translateY(-3px);
}

.character-card img,
.character-placeholder {
    display: flex;
    width: 100%;
    height: clamp(110px, 23vh, 220px);
    object-fit: contain;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
}

.character-placeholder {
    color: #e50000;
    font-family: 'Orbitron', sans-serif;
    font-size: 55px;
    font-weight: bold;
    text-shadow: 0 0 20px rgba(229, 0, 0, 0.5);
}

.character-card h2 {
    margin: 12px 0 4px;
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(13px, 2vw, 19px);
}

.character-card p {
    margin: 0;
    color: #aaa;
    font-family: 'Rajdhani', sans-serif;
    font-size: 13px;
    letter-spacing: 1px;
}

.character-preview {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 25px;
    background: rgba(0, 0, 0, 0.35);
    border-left: 2px solid #ab0000;
}

#characterRole {
    color: #e50000;
    font-family: 'Rajdhani', sans-serif;
    font-weight: bold;
    letter-spacing: 3px;
}

#characterName {
    margin: 8px 0 15px;
    color: white;
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(25px, 4vw, 42px);
}

#characterDescription {
    max-width: 420px;
    color: #bbb;
    font-family: 'Rajdhani', sans-serif;
    font-size: 18px;
    line-height: 1.5;
}

#selectCharacterButton {
    align-self: flex-start;
    margin-top: 25px;
    padding: 14px 25px;
    color: white;
    background: #ab0000;
    border: 1px solid #e50000;
    font-family: 'Orbitron', sans-serif;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s ease;
}

#selectCharacterButton:hover {
    background: #e50000;
    box-shadow: 0 0 20px rgba(229, 0, 0, 0.35);
}

/* SMALL LANDSCAPE SCREENS */

@media (max-width: 700px) {
    #character-selection {
        padding: 15px 3%;
    }

    .character-selection-content {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        padding-top: 15px;
    }

    .character-roster {
        gap: 8px;
    }

    .character-card {
        padding: 8px;
    }

    .character-card img,
    .character-placeholder {
        height: 18vh;
        min-height: 75px;
    }

    .character-placeholder {
        font-size: 35px;
    }

    .character-preview {
        padding: 12px;
    }

    #characterDescription {
        font-size: 14px;
    }

    #selectCharacterButton {
        margin-top: 12px;
        padding: 10px 12px;
        font-size: 11px;
    }
}

/* ==========================================
   PLAYER PROFILE DROPDOWN
========================================== */

.player-menu-container {
    position: relative;
    z-index: 1000;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border: 1px solid rgba(171, 0, 0, 0.35);
    border-radius: 8px;
    background: rgba(15, 15, 15, 0.9);
    color: white;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: border-color 0.2s, background 0.2s;
}

.player-info:hover {
    border-color: #ab0000;
    background: rgba(171, 0, 0, 0.12);
}

.player-avatar {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #292929;
    border: 2px solid #ab0000;
    color: white;
    font-weight: bold;
}

.player-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.player-info-text {
    min-width: 0;
}

.player-name {
    margin: 0;
    color: white;
    font-weight: bold;
    font-size: 13px;
}

.player-level {
    margin: 4px 0 0;
    color: #999;
    font-size: 10px;
}

.player-menu-arrow {
    color: #ab0000;
    font-size: 20px;
    margin-left: 4px;
}

.player-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 290px;
    max-width: calc(100vw - 24px);
    max-height: min(75vh, 520px);
    overflow-y: auto;
    padding: 14px;
    border: 1px solid rgba(171, 0, 0, 0.55);
    border-radius: 10px;
    background: #101010;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.65);
    color: white;
    animation: playerDropdownAppear 0.18s ease-out;
}

.player-dropdown[hidden] {
    display: none;
}

@keyframes playerDropdownAppear {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.player-dropdown-header {
    padding: 8px 10px 14px;
}

.player-dropdown-name {
    margin: 0;
    color: white;
    font-size: 17px;
    font-weight: bold;
}

.player-dropdown-id {
    margin: 5px 0 0;
    color: #ab0000;
    font-size: 11px;
    letter-spacing: 1px;
}

.player-dropdown-section {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.player-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 10px;
    border: none;
    border-radius: 5px;
    background: transparent;
    color: #ddd;
    font-family: inherit;
    font-size: 11px;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.player-dropdown-item span {
    width: 18px;
    color: #ab0000;
    font-size: 16px;
    text-align: center;
}

.player-dropdown-item:hover {
    background: rgba(171, 0, 0, 0.15);
    color: white;
}

.player-dropdown-heading {
    margin: 8px 10px;
    color: #888;
    font-size: 10px;
    letter-spacing: 1px;
}

.player-dropdown-divider {
    height: 1px;
    margin: 12px 0;
    background: rgba(255, 255, 255, 0.1);
}

.connected-account {
    display: grid;
    grid-template-columns: 24px 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.035);
}

.connected-account > span {
    color: #ddd;
    font-weight: bold;
    text-align: center;
}

.connected-account p {
    margin: 0;
    color: #ddd;
    font-size: 11px;
}

.connected-account small {
    color: #888;
    font-size: 9px;
}

.player-signout {
    color: #ff5555;
}

.player-signout span {
    color: #ff5555;
}

/* MOBILE ADAPTATION */

@media (max-width: 600px) {
    .player-dropdown {
        right: 0;
        width: min(290px, calc(100vw - 20px));
    }

    .player-info {
        gap: 7px;
        padding: 6px 8px;
    }

    .player-avatar {
        width: 36px;
        height: 36px;
        min-width: 36px;
    }

    .player-name {
        font-size: 11px;
    }

    .player-level {
        font-size: 9px;
    }
}

/* ==========================================
   PLAYER PROFILE SCREEN
========================================== */

#player-profile-screen {
    position: absolute;
    inset: 0;
    z-index: 30;
    width: 100%;
    height: 100%;
    padding: 25px;
    color: white;
    overflow-y: auto;
    background:
        radial-gradient(
            circle at 75% 45%,
            rgba(171, 0, 0, 0.2),
            transparent 45%
        ),
        linear-gradient(135deg, #090909, #160707 65%, #080808);
}

#player-profile-screen[hidden] {
    display: none;
}

.player-profile-content {
    display: grid;
    grid-template-columns: minmax(220px, 0.8fr) minmax(280px, 1.2fr);
    gap: 35px;
    max-width: 950px;
    margin: 35px auto;
    padding: 25px;
    border: 1px solid rgba(171, 0, 0, 0.35);
    border-radius: 12px;
    background: rgba(10, 10, 10, 0.88);
}

.profile-picture-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
}

.profile-picture-preview {
    width: 150px;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 3px solid #ab0000;
    border-radius: 50%;
    background: #222;
    color: white;
    font-size: 48px;
    font-weight: bold;
    box-shadow: 0 0 25px rgba(171, 0, 0, 0.2);
}

.profile-picture-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-picture-section h2 {
    margin: 18px 0 5px;
    font-size: 21px;
    overflow-wrap: anywhere;
}

.profile-picture-section > p {
    color: #888;
    font-size: 10px;
    letter-spacing: 1px;
}

.profile-upload-button {
    display: inline-block;
    margin-top: 18px;
    padding: 11px 15px;
    border: 1px solid #ab0000;
    border-radius: 5px;
    background: rgba(171, 0, 0, 0.12);
    color: white;
    font-size: 10px;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s;
}

.profile-upload-button:hover {
    background: rgba(171, 0, 0, 0.3);
}

#removeProfilePictureButton {
    margin-top: 12px;
    border: none;
    background: transparent;
    color: #ff7777;
    font-family: inherit;
    font-size: 10px;
    cursor: pointer;
}

.profile-picture-hint {
    margin-top: 12px;
    color: #777;
    font-size: 10px;
}

.profile-details-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.profile-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.profile-field label {
    color: #ab0000;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1px;
}

.profile-field input {
    width: 100%;
    padding: 12px;
    border: 1px solid #383838;
    border-radius: 5px;
    outline: none;
    background: #171717;
    color: white;
    font-family: inherit;
    font-size: 14px;
}

.profile-field input:focus {
    border-color: #ab0000;
}

.profile-field > p {
    margin: 0;
    color: #888;
    font-size: 10px;
}

.profile-readonly-value {
    padding: 12px;
    border: 1px solid #303030;
    border-radius: 5px;
    background: #151515;
    color: #ddd;
    font-size: 13px;
}

.profile-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}

.profile-actions button {
    flex: 1;
    min-width: 110px;
    padding: 12px;
    border: 1px solid #ab0000;
    border-radius: 5px;
    background: #ab0000;
    color: white;
    font-family: inherit;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
}

.profile-actions button:hover {
    background: #d00000;
}

#cancelProfileButton {
    border-color: #444;
    background: #202020;
}

#cancelProfileButton:hover {
    background: #303030;
}

#usernameStatus,
#profileSaveStatus {
    min-height: 14px;
    font-size: 11px;
}

#profileSaveStatus {
    color: #aaa;
}

@media (max-width: 700px) {
    #player-profile-screen {
        padding: 15px;
    }

    .player-profile-content {
        grid-template-columns: 1fr;
        gap: 20px;
        margin: 20px auto;
        padding: 18px;
    }

    .profile-picture-preview {
        width: 120px;
        height: 120px;
    }
}

/* TABLET AND MOBILE */

@media (max-width: 700px) {
    #player-profile-screen {
        padding: 15px;
    }

    .player-profile-content {
        grid-template-columns: 1fr;
        gap: 20px;
        margin: 20px auto;
        padding: 18px;
    }

    .profile-picture-preview {
        width: 120px;
        height: 120px;
    }
}

/* PROFILE BACK TO LOBBY BUTTON */

#backFromProfileButton {
    padding: 12px 18px;
    color: white;
    background: rgba(171, 0, 0, 0.15);
    border: 1px solid #ab0000;
    border-radius: 4px;
    font-family: 'Rajdhani', sans-serif;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s ease;
}

#backFromProfileButton:hover {
    background: #ab0000;
}

/* ==========================================
   TAMOBOT: CHAOS ARENA
   FRIENDS SYSTEM
   ========================================== */

.ca-friends-nav-button {
    cursor: pointer;
}

.ca-friends-screen {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    overflow-y: auto;
    background: rgba(5, 5, 5, 0.98);
    color: #f5f5f5;
    font-family: 'Rajdhani', sans-serif;
}

.ca-friends-screen.is-open {
    display: block;
}

.ca-friends-container {
    width: min(100% - 36px, 1000px);
    margin: 0 auto;
    padding: 35px 0 60px;
}

.ca-friends-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    padding-bottom: 25px;
    border-bottom: 1px solid rgba(171, 0, 0, 0.45);
}

.ca-friends-eyebrow {
    color: #e50000;
    font-family: 'Orbitron', sans-serif;
    font-size: 11px;
    letter-spacing: 3px;
}

.ca-friends-header h1 {
    margin: 10px 0 5px;
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(28px, 6vw, 44px);
    font-weight: 900;
}

.ca-friends-header p {
    margin: 0;
    color: #999;
    font-size: 17px;
}

.ca-friends-close {
    width: 42px;
    height: 42px;
    border: 1px solid #444;
    border-radius: 5px;
    background: #151515;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
}

.ca-friends-close:hover {
    border-color: #e50000;
    color: #e50000;
}

.ca-friends-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 22px 0;
    border-bottom: 1px solid #252525;
}

.ca-friends-tabs button {
    padding: 12px 18px;
    border: 1px solid #333;
    border-radius: 4px;
    background: #111;
    color: #aaa;
    font-family: 'Orbitron', sans-serif;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

.ca-friends-tabs button:hover,
.ca-friends-tabs button.active {
    border-color: #ab0000;
    background: #260000;
    color: #fff;
}

.ca-friends-content {
    padding-top: 25px;
}

#ca-friends-search-form {
    display: flex;
    gap: 10px;
}

#ca-friends-search-input {
    flex: 1;
    min-width: 0;
    padding: 14px 16px;
    border: 1px solid #383838;
    border-radius: 4px;
    outline: none;
    background: #111;
    color: #fff;
    font-family: 'Rajdhani', sans-serif;
    font-size: 17px;
}

#ca-friends-search-input:focus {
    border-color: #ab0000;
}

#ca-friends-search-form button,
.ca-friend-actions button {
    padding: 12px 18px;
    border: 1px solid #ab0000;
    border-radius: 4px;
    background: #ab0000;
    color: #fff;
    font-family: 'Orbitron', sans-serif;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

#ca-friends-search-form button:hover,
.ca-friend-actions button:hover {
    background: #e50000;
}

.ca-friends-hint {
    margin: 10px 0 25px;
    color: #777;
    font-size: 14px;
}

.ca-friends-message {
    min-height: 20px;
    margin: 12px 0;
    font-size: 15px;
}

.ca-friends-message.error {
    color: #ff5555;
}

.ca-friends-message.success {
    color: #65d98a;
}

.ca-friends-loading,
.ca-friends-empty {
    padding: 30px 10px;
    color: #888;
    text-align: center;
    font-size: 17px;
}

.ca-friend-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 12px 0;
    padding: 16px;
    border: 1px solid #292929;
    border-radius: 5px;
    background: #101010;
}

.ca-friend-player {
    display: flex;
    align-items: center;
    gap: 13px;
    min-width: 0;
}

.ca-friend-avatar {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border: 1px solid #444;
    border-radius: 5px;
    object-fit: cover;
}

.ca-friend-avatar-default {
    display: grid;
    place-items: center;
    background: #260000;
    color: #e50000;
    font-family: 'Orbitron', sans-serif;
    font-size: 22px;
}

.ca-friend-player-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ca-friend-player-info strong {
    overflow: hidden;
    color: #fff;
    font-size: 18px;
    text-overflow: ellipsis;
}

.ca-friend-player-info span {
    color: #888;
    font-size: 13px;
    letter-spacing: 1px;
}

.ca-friend-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.ca-friend-actions button.secondary {
    border-color: #444;
    background: #191919;
    color: #bbb;
}

.ca-friend-actions button.secondary:hover {
    border-color: #ab0000;
    color: #fff;
}

.ca-friend-actions button:disabled {
    opacity: 0.5;
    cursor: wait;
}

.ca-friend-status {
    color: #65d98a;
    font-family: 'Orbitron', sans-serif;
    font-size: 11px;
    font-weight: 700;
}

.ca-friends-subheading {
    margin: 30px 0 12px;
    color: #e50000;
    font-family: 'Orbitron', sans-serif;
    font-size: 13px;
    letter-spacing: 2px;
}

@media (max-width: 600px) {
    .ca-friends-container {
        width: calc(100% - 24px);
        padding-top: 22px;
    }

    .ca-friends-header p {
        font-size: 14px;
    }

    .ca-friends-tabs {
        gap: 6px;
    }

    .ca-friends-tabs button {
        flex: 1;
        padding: 11px 7px;
        font-size: 9px;
    }

    #ca-friends-search-form {
        flex-direction: column;
    }

    #ca-friends-search-form button {
        min-height: 44px;
    }

    .ca-friend-card {
        align-items: flex-start;
        flex-direction: column;
    }

    .ca-friend-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

/* ==========================================
   FRIEND REQUEST NOTIFICATION BADGE
========================================== */

.ca-friends-nav-button {
    position: relative;
}

.ca-friends-request-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    margin-left: auto;
    border-radius: 20px;
    background: #e50000;
    color: #ffffff;
    font-family: 'Orbitron', sans-serif;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 0 10px rgba(229, 0, 0, 0.45);
}

.ca-friends-request-badge[hidden] {
    display: none;
}

/* ==========================================
   FRIEND PRESENCE STATUS
========================================== */

.ca-friend-player-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'Orbitron', sans-serif;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px;
}

.ca-friend-player-status::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
}

.ca-friend-player-status.is-online {
    color: #42e879;
}

.ca-friend-player-status.is-online::before {
    background: #42e879;
    box-shadow: 0 0 8px #42e879;
}

.ca-friend-player-status.is-offline {
    color: #888888;
}

.ca-friend-player-status.is-offline::before {
    background: #777777;
}

/* ==========================================
   FRIEND PROFILE VIEWER
========================================== */

.ca-friend-profile-viewer {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
}

.ca-friend-profile-viewer[hidden] {
    display: none;
}

.ca-friend-profile-panel {
    width: 100%;
    max-width: 480px;
    max-height: 90%;
    overflow-y: auto;
    padding: 25px;
    border: 1px solid rgba(229, 0, 0, 0.45);
    border-radius: 12px;
    background: #101010;
    box-shadow: 0 0 35px rgba(171, 0, 0, 0.2);
}

.ca-friend-profile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.ca-friend-profile-header h2 {
    margin: 8px 0 0;
    font-family: 'Orbitron', sans-serif;
    font-size: 20px;
}

.ca-friend-profile-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 25px;
    text-align: center;
}

.ca-friend-profile-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 100px;
    overflow: hidden;
    border: 2px solid #ab0000;
    border-radius: 50%;
    background: #1d1d1d;
    color: #ffffff;
    font-family: 'Orbitron', sans-serif;
    font-size: 32px;
}

.ca-friend-profile-avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ca-friend-profile-body > h2 {
    margin: 15px 0 5px;
    font-family: 'Orbitron', sans-serif;
}

.ca-friend-profile-body > p {
    color: #999999;
    font-size: 12px;
}

.ca-friend-profile-level {
    margin-top: 15px;
    color: #ff4545;
    font-family: 'Orbitron', sans-serif;
    font-weight: 800;
}

.ca-friend-profile-xp {
    margin-top: 8px;
    color: #aaaaaa;
    font-size: 13px;
}

.ca-friend-profile-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
    gap: 10px;
    margin-top: 25px;
}

.ca-friend-profile-stats > div {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 15px 5px;
    border: 1px solid #292929;
    border-radius: 8px;
    background: #181818;
}

.ca-friend-profile-stats strong {
    font-family: 'Orbitron', sans-serif;
    font-size: 20px;
}

.ca-friend-profile-stats span {
    color: #999999;
    font-size: 10px;
    letter-spacing: 1px;
}

.ca-friend-profile-status {
    margin-top: 20px;
    font-size: 12px;
    font-weight: 700;
}

.ca-friend-profile-status.is-online {
    color: #42e879;
}

.ca-friend-profile-status.is-offline {
    color: #888888;
}

/* ==========================================
   ACCOUNT MANAGEMENT
========================================== */

.account-management-content {
    width: min(900px, 92%);
    margin: 30px auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.account-management-card {
    min-width: 0;
    padding: 24px;
    background: rgba(12, 12, 12, 0.92);
    border: 1px solid rgba(171, 0, 0, 0.45);
    border-radius: 10px;
}

.account-management-card h2 {
    margin: 12px 0 24px;
    color: #fff;
    overflow-wrap: anywhere;
}

.account-management-label {
    margin: 18px 0 8px;
    color: #999;
    font-size: 11px;
    letter-spacing: 1.5px;
}

.account-management-note {
    margin-top: 18px;
    color: #999;
    font-size: 12px;
    line-height: 1.6;
}

.account-provider-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.account-provider-icon {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    background: rgba(171, 0, 0, 0.18);
    border: 1px solid rgba(171, 0, 0, 0.5);
    border-radius: 8px;
    color: #fff;
    font-weight: bold;
}

.account-provider-info {
    flex: 1;
    min-width: 0;
}

.account-provider-info h3 {
    margin: 0;
    color: #fff;
    font-size: 13px;
}

.account-provider-info p {
    margin: 5px 0 0;
    color: #888;
    font-size: 11px;
}

.account-provider-status {
    color: #aaa;
    font-size: 10px;
    font-weight: bold;
    text-align: right;
}

.account-provider-status[data-connected="true"] {
    color: #55d68b;
}

.account-provider-status[data-connected="false"] {
    color: #d58a8a;
}

.account-management-actions {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.account-management-actions button {
    padding: 13px 22px;
    background: #ab0000;
    border: 1px solid #e50000;
    border-radius: 5px;
    color: #fff;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
}

.account-management-actions button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#accountManagementStatus {
    color: #aaa;
    font-size: 12px;
    text-align: center;
}

@media (max-width: 650px) {
    .account-management-content {
        grid-template-columns: 1fr;
        width: 92%;
        margin: 20px auto;
    }

    .account-management-actions {
        grid-column: 1;
    }
}

/* ACCOUNT PROVIDER ACTIONS */

.account-provider-action {
    flex-shrink: 0;
    padding: 8px 11px;
    background: rgba(171, 0, 0, 0.15);
    border: 1px solid #ab0000;
    border-radius: 4px;
    color: #fff;
    font-family: inherit;
    font-size: 10px;
    font-weight: bold;
    cursor: pointer;
}

.account-provider-action[data-connected="true"] {
    background: rgba(255, 255, 255, 0.06);
    border-color: #555;
}

.account-provider-action:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}