/* ===============================
   RESET & BASE
================================ */
:root{
    /* AUTHORITATIVE THEME (LOCKED) */
    --bg-main: #6F8F8B;
    --bg-panel: #5E7F7A;
    --bg-container: #54736E;
    --bg-hover: #6B8E89;

    --text-main: #1F2933;
    --text-secondary: #2E3A44;
    --text-muted: #4A5560;

    --accent-yellow: #F5B301;
    --accent-hover: #FFD24D;

    /* Glassy panel tints (prevents hover switching to fully solid bg-panel) */
    --panel-glass: color-mix(in srgb, var(--bg-panel) 72%, transparent);
    --panel-glass-hover: color-mix(in srgb, var(--bg-hover) 72%, transparent);
    --container-glass: color-mix(in srgb, var(--bg-container) 72%, transparent);
    --container-glass-hover: color-mix(in srgb, var(--bg-hover) 72%, transparent);

    /* Inventory-style scrollbars (single source) */
    --scroll-track: rgba(2,6,23,0.35);
    --scroll-thumb: rgba(255,255,255,0.14);
    --scroll-thumb-hover: rgba(255,255,255,0.22);
    --scroll-thumb-border: rgba(2,6,23,0.65);

    /* Level tier accents (matches profile tier colors) */
    --lvl-0:  #9ca3af;
    --lvl-10: #fbbf24;
    --lvl-20: #22c55e;
    --lvl-30: #38bdf8;
    --lvl-40: #fb7185;
    --lvl-50: #a78bfa;
    --lvl-60: #3b82f6;
    --lvl-70: #ef4444;
    --lvl-80: #f59e0b;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    /* Baseline background (prevents "solid color flash" while layered background loads) */
    background-color: var(--bg-main);
    background-image: url('/assets/login.webp');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--text-main);
    overflow: hidden;
    cursor: default; /* prevent I-beam on general page clicks */
    user-select: none; /* prevent caret/typing indicator on normal text */
    -webkit-user-select: none;
}

/* Tailwind text utility override: this UI is not white-text */
.text-white{ color: var(--text-main) !important; }
.text-gray-100, .text-gray-200, .text-slate-100, .text-slate-200, .text-slate-300{
    color: var(--text-main) !important;
}
.opacity-70, .opacity-75, .opacity-80, .opacity-85{
    color: var(--text-secondary) !important;
}

/* Only show typing/I-beam cursor where user can actually type */
input, textarea, [contenteditable="true"] {
    cursor: text;
    user-select: text;
    -webkit-user-select: text;
}

/* Allow selecting/copying in specific areas (e.g. Terms/Legal) */
.select-text, .select-text *{
    user-select: text;
    -webkit-user-select: text;
}

/* Explicit pointer cursor for interactive elements */
a, button, .btn-mmo, .btn-mini, .icon-btn, .nav-item, [role="button"] { cursor: pointer; }

/* Never allow default browser "blue link" coloring */
a, a:visited{
    color: inherit;
}

/* Prevent "typing/focus" indicator on clicks for non-text UI (palette/buttons/links) */
button, a, .btn-mmo, .btn-mini, .icon-btn, .nav-item {
    user-select: none;
    -webkit-user-select: none;
}
button:focus,
a:focus,
.btn-mmo:focus,
.btn-mini:focus,
.icon-btn:focus,
.nav-item:focus{
    outline: none;
}
button:focus:not(:focus-visible),
a:focus:not(:focus-visible),
.btn-mmo:focus:not(:focus-visible),
.btn-mini:focus:not(:focus-visible),
.icon-btn:focus:not(:focus-visible),
.nav-item:focus:not(:focus-visible){
    box-shadow: none !important;
}

/* ===============================
   BACKGROUND (SOFT, GAME-LIKE)
================================ */
.bg-animated {
    position: fixed;
    inset: 0;
    background-image: url('/assets/login.webp');
    background-size: cover;
    background-position: center;
    filter: blur(8px) brightness(0.85);
    transform: scale(1.05);
    z-index: 0;
    pointer-events: none;
}

.bg-gradient{
    /* Exists in DOM, but must never be a visible "second background" */
    position: fixed;
    inset: 0;
    background: transparent;
    opacity: 0;
    pointer-events: none;
    z-index: 0;
}

.bg-darken {
    position: fixed;
    inset: 0;
    /* use theme var to avoid hard-coded panel color showing during load */
    background: color-mix(in srgb, var(--bg-main) 35%, transparent);
    z-index: 1;
    pointer-events: none;
}

/* ===============================
   PAGE WRAPPER
================================ */
.relative {
    position: relative;
}

.z-20 {
    z-index: 20;
}

.min-h-screen {
    min-height: 100vh;
}

/* Brand title must be pure white (index) */
.tilebound-title{
    color: #ffffff !important;
    opacity: 1 !important;
    mix-blend-mode: normal !important;
}

/* Index screen: login/register area text must be white */
.index-screen{
    color: #ffffff !important;
}
.index-screen :is(a, p, span, div){
    color: #ffffff !important;
}

/* Site footer text bold */
footer.fixed .text-center{
    font-weight: 900;
    color: #1f2933 !important;
    opacity: 1 !important;
}
footer.fixed .text-center a{
    color: #1f2933 !important;
}

/* ===============================
   ROOMS BROWSER — legacy portrait overrides
   (IMPORTANT: scope to old .rooms-portrait only; new navigator uses same id)
   =============================== */
#roomsPortrait.rooms-portrait .rooms-portrait-sub{
    color: #ffffff !important;
    opacity: 1 !important;
}
#roomsPortrait.rooms-portrait .rooms-section-title{
    color: #1f2933 !important;
    opacity: 1 !important;
}
#roomsPortrait.rooms-portrait .room-row-name,
#roomsPortrait.rooms-portrait .room-row-count,
#roomsPortrait.rooms-portrait #roomsList{
    color: #ffffff !important;
}
#roomsPortrait.rooms-portrait #roomsList .opacity-70{
    color: #ffffff !important;
    opacity: 1 !important;
}
#roomsPortrait.rooms-portrait .rooms-footer{
    font-weight: 900;
}
#roomsPortrait.rooms-portrait #roomsMeta{
    color: #1f2933 !important;
    opacity: 1 !important;
}

/* ===============================
   DASHBOARD (RIGHT COLUMN) — foldable panels text rules
   - Bold text: #1f2933
   - Small/supporting text: white
   =============================== */
.dashboard-quests :is(
  .fold-title,
  .weekly-title,
  .weekly-name,
  .weekly-rank,
  .weekly-tab,
  .quests-title,
  .quest-title,
  .weekly-reward-title
){
  color: #1f2933 !important;
}

.dashboard-quests :is(
  .fold-sub,
  .weekly-sub,
  .weekly-desc,
  .weekly-subline,
  .weekly-reward-row,
  .quest-empty,
  .quests-sub,
  .quest-desc,
  .quest-xp,
  .quest-progress-meta,
  .weekly-subline span
){
  color: #ffffff !important;
  opacity: 1 !important;
}

.dashboard-quests :is(#weeklyMeta, #weeklyDesc, #weeklyRewardsDesc){
  color: #ffffff !important;
  opacity: 1 !important;
}

/* ===============================
   PANELS / TILES
================================ */
/* IMPORTANT: Use `ui-panel` / `ui-subpanel` for panel surfaces. */
.ui-panel{
    background: var(--panel-glass);
    backdrop-filter: none;
    border-radius: 4px;
    border: 1px solid var(--text-muted);
    box-shadow:
        inset 0 0 0 1px var(--bg-hover),
        0 2px 0 rgba(31,41,51,0.25);
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
}
.ui-panel:hover{
    border-color: var(--text-secondary);
    background: var(--panel-glass-hover);
    filter: none;
    box-shadow:
        inset 0 0 0 1px var(--bg-main),
        0 2px 0 rgba(31,41,51,0.25);
}

.ui-subpanel{
    background: var(--container-glass);
    border-radius: 4px;
    border: 1px solid var(--text-muted);
    transition: background 90ms linear, border-color 90ms linear, box-shadow 90ms linear, filter 90ms linear;
}
.ui-subpanel:hover{
    border-color: var(--text-secondary);
    background: var(--container-glass-hover);
    filter: none;
    box-shadow: inset 0 0 0 1px var(--bg-main), 0 2px 0 rgba(31,41,51,0.25);
}

/* Auth/legal/static pages: disable the hover "tone shift" on panels */
.no-panel-hover.ui-panel:hover{ background: var(--panel-glass) !important; }
.no-panel-hover.ui-subpanel:hover{ background: var(--container-glass) !important; }

/* Auth pages: inputs must be white text */
.auth-inputs-white .input-mmo{
    color: #ffffff !important;
}
.auth-inputs-white .input-mmo::placeholder{
    color: rgba(255,255,255,0.85) !important;
}

/* ===============================
   SCROLLBARS — inventory style everywhere
   =============================== */
:where(
  .panel-scroll,
  .room-rows,
  .weekly-body,
  .profile-modal-card,
  .chat-messages,
  .palette-scroll,
  .modtools-window .mt-panel,
  .modtools-window .mt-tabs,
  .badge-inv-grid,
  .badge-slots,
  .inv-grid.items-fixed
){
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) transparent;
}

:where(
  .panel-scroll,
  .room-rows,
  .weekly-body,
  .profile-modal-card,
  .chat-messages,
  .palette-scroll,
  .modtools-window .mt-panel,
  .modtools-window .mt-tabs,
  .badge-inv-grid,
  .badge-slots,
  .inv-grid.items-fixed
)::-webkit-scrollbar{ width: 10px; height: 10px; }

:where(
  .panel-scroll,
  .room-rows,
  .weekly-body,
  .profile-modal-card,
  .chat-messages,
  .palette-scroll,
  .modtools-window .mt-panel,
  .modtools-window .mt-tabs,
  .badge-inv-grid,
  .badge-slots,
  .inv-grid.items-fixed
)::-webkit-scrollbar-track{ background: var(--scroll-track); border-radius: 999px; }

:where(
  .panel-scroll,
  .room-rows,
  .weekly-body,
  .profile-modal-card,
  .chat-messages,
  .palette-scroll,
  .modtools-window .mt-panel,
  .modtools-window .mt-tabs,
  .badge-inv-grid,
  .badge-slots,
  .inv-grid.items-fixed
)::-webkit-scrollbar-thumb{
  background: var(--scroll-thumb);
  border-radius: 999px;
  border: 3px solid var(--scroll-thumb-border);
  background-clip: padding-box;
}
:where(
  .panel-scroll,
  .room-rows,
  .weekly-body,
  .profile-modal-card,
  .chat-messages,
  .palette-scroll,
  .modtools-window .mt-panel,
  .modtools-window .mt-tabs,
  .badge-inv-grid,
  .badge-slots,
  .inv-grid.items-fixed
)::-webkit-scrollbar-thumb:hover{
  background: var(--scroll-thumb-hover);
  background-clip: padding-box;
}

@media (prefers-reduced-motion: reduce) {
    .ui-panel, .ui-subpanel {
        transition: none;
    }
    .ui-panel:hover, .ui-subpanel:hover {
        transform: none;
    }
}

/* ===============================
   BUTTONS
================================ */
.mmo-notify,
.profile-modal-card,
.mmo-confirm-card,
.vote-card,
.nav-dropdown,
.room-card,
.quests-panel,
.weekly-panel,
.tg-card,
.modtools-window .mt-panel,
.ui-panel,
.ui-subpanel{
    /* Pixel-MMO container feel (raised edge + subtle inset) */
    border: 1px solid rgba(0,0,0,0.55);
    box-shadow:
        inset 0 0 0 1px rgba(255,255,255,0.10),
        inset 1px 1px 0 rgba(255,255,255,0.05),
        inset -1px -1px 0 rgba(0,0,0,0.60),
        0 2px 0 rgba(0,0,0,0.35);
}

.mmo-notify,
.profile-modal-card,
.mmo-confirm-card,
.vote-card,
.nav-dropdown,
.room-card{
    overflow: hidden; /* keeps rarity glows/pixel edges inside bounds */
}

.btn-mmo {
    display: block;
    width: 100%;
    padding: 14px;
    border-radius: 4px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-align: center;
    color: var(--text-main);
    background: var(--bg-panel);
    border: 1px solid var(--text-muted);
    cursor: pointer;
    transition: background 90ms linear, border-color 90ms linear, box-shadow 90ms linear, filter 90ms linear, transform 90ms linear;
    box-shadow:
        inset 0 0 0 1px var(--bg-hover),
        0 2px 0 rgba(31,41,51,0.25);
}

.btn-mmo:hover {
    background: var(--bg-hover);
    border-color: var(--text-secondary);
    filter: none;
    box-shadow:
        inset 0 0 0 1px var(--bg-main),
        0 2px 0 rgba(31,41,51,0.25);
}

.btn-mmo:active {
    transform: translateY(1px);
    filter: brightness(0.98);
    box-shadow:
        inset 0 0 0 1px var(--bg-hover),
        0 1px 0 rgba(31,41,51,0.25);
}

.btn-mmo:focus-visible {
    outline: none;
    box-shadow:
      0 0 0 2px var(--text-muted);
}

.btn-mmo:disabled,
.btn-mmo[disabled]{
    opacity: 0.55;
    cursor: not-allowed;
    transform: none !important;
    filter: none !important;
    box-shadow: inset 0 0 0 1px var(--bg-hover) !important;
}

.btn-mmo.green {
    background: var(--bg-panel);
    border-color: var(--text-muted);
    box-shadow: inset 0 0 0 1px var(--bg-hover), 0 2px 0 rgba(31,41,51,0.25);
}
.btn-mmo.green:hover {
    background: var(--bg-hover);
}

.btn-mmo.red {
    background: var(--bg-panel);
    border-color: var(--text-muted);
    box-shadow: inset 0 0 0 1px var(--bg-hover), 0 2px 0 rgba(31,41,51,0.25);
}
.btn-mmo.red:hover {
    background: var(--bg-hover);
}

/* Small button variant (for inline actions like clan applications) */
.btn-mmo.sm {
    display: inline-flex;
    width: auto;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    line-height: 1;
    box-shadow: none;
}
.btn-mmo.sm:hover { transform: translateY(-1px); }
.btn-mmo.sm:active { transform: translateY(1px); }

/* Scrollable panel to avoid navbar overlap on tall pages */
.panel-scroll {
    max-height: calc(100vh - 130px);
    overflow-y: auto;
}
.panel-scroll::-webkit-scrollbar { width: 6px; }
.panel-scroll::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 4px; }

/* ===============================
   CANVAS "FLOATING" SCROLLBARS
   (only shown when .scroll-active is set by JS)
================================ */
.canvas-wrap.scroll-active::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}
.canvas-wrap.scroll-active::-webkit-scrollbar-track {
    background: transparent;
}
.canvas-wrap.scroll-active::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.18);
    border-radius: 999px;
    border: 3px solid rgba(11,16,32,0.65);
    background-clip: padding-box;
}
.canvas-wrap.scroll-active::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.26);
    background-clip: padding-box;
}
.canvas-wrap.scroll-active {
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: rgba(255,255,255,0.22) transparent;
}

/* Palette scroll (right panel) */
.palette-scroll::-webkit-scrollbar { width: 10px; }
.palette-scroll::-webkit-scrollbar-track { background: transparent; }
.palette-scroll::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.16);
    border-radius: 999px;
    border: 3px solid rgba(2,6,23,0.55);
    background-clip: padding-box;
}
.palette-scroll::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.24); background-clip: padding-box; }
.palette-scroll { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.18) transparent; }

/* Palette grid (default, non-fullscreen) */
.palette-grid {
    display: grid;
    grid-template-columns: repeat(8, 22px);
    gap: 6px;
}

/* Non-fullscreen: preview only (no palette) - but allow pseudo-fullscreen to override */
#lobbyRoot:not(:fullscreen):not(.pseudo-fullscreen) .palette-slot { display: none !important; }

/* Pseudo-fullscreen: show palette-slot for design mode */
#lobbyRoot.pseudo-fullscreen .palette-slot { 
    display: block !important;
    pointer-events: none;
}

/* Subtle grid overlay aligned to tile size (controlled by JS via --tile) */
.canvas-wrap.grid-on #canvasInner::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(to right, color-mix(in srgb, var(--room-accent, var(--lvl-0)) 35%, transparent) 1px, transparent 1px),
        linear-gradient(to bottom, color-mix(in srgb, var(--room-accent, var(--lvl-0)) 35%, transparent) 1px, transparent 1px);
    background-size: var(--tile) var(--tile);
    opacity: 0.55;
}

/* Fullscreen: keep UI minimal (X + eye + HUD + colors only) */
#lobbyRoot:fullscreen #roomMeta { display: none !important; }
#lobbyRoot:fullscreen #cooldownHud { display: none !important; } /* info lives in HUD strip */

/* Fullscreen: make lobby feel like a dedicated screen */
#lobbyRoot:fullscreen,
#lobbyRoot.pseudo-fullscreen {
    width: 100vw;
    height: 100vh;
    padding: 20px;
    background: transparent;
    position: relative; /* anchor fullscreen background layers + notifications */
    overflow: hidden;
}

/* Pseudo-fullscreen (for iOS which doesn't support Fullscreen API) */
#lobbyRoot.pseudo-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 999999 !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
}

body.pseudo-fullscreen-active {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
}

/* Duplicate all :fullscreen rules for .pseudo-fullscreen (iOS support) */
#lobbyRoot.pseudo-fullscreen #roomMeta { display: none !important; }
#lobbyRoot.pseudo-fullscreen #cooldownHud { display: none !important; }
#lobbyRoot.pseudo-fullscreen #playOverlay { display: none !important; pointer-events: none !important; }
#lobbyRoot.pseudo-fullscreen #canvasWrap.canvas-wrap { pointer-events: auto !important; z-index: 10 !important; }
/* Allow interactions inside the room UI.
   NOTE: pointer-events:none on a parent disables ALL descendants (including canvas clicks + palette),
   so we must keep this subtree interactive and instead control specific overlays explicitly. */
#lobbyRoot.pseudo-fullscreen .flex-1 { pointer-events: auto; }
#lobbyRoot.pseudo-fullscreen .palette-slot { pointer-events: auto; }
#lobbyRoot.pseudo-fullscreen .canvas-window { pointer-events: auto; z-index: 2; }
#lobbyRoot.pseudo-fullscreen .mmo-notify { position: fixed; }

#lobbyRoot.pseudo-fullscreen .canvas-window {
    position: fixed;
    inset: 0;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

#lobbyRoot.pseudo-fullscreen .canvas-window-header { display: none !important; }
#lobbyRoot.pseudo-fullscreen .canvas-window-body {
    position: fixed;
    inset: 0;
    padding: 0 !important;
    background: transparent !important;
}

#lobbyRoot.pseudo-fullscreen #canvasWrap.canvas-wrap {
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    border: none !important;
}

/* Palette panel positioning in pseudo-fullscreen - base styles (visibility controlled by mode rules) */
#lobbyRoot.pseudo-fullscreen .palette-panel {
    display: none; /* hidden by default, mode rules override this */
    position: fixed;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    height: auto;
    max-height: 80vh;
    width: 94px; /* enough for a 2-col non-scrolling palette */
    padding: 8px !important;
    background: rgba(0,0,0,0.5) !important;
    border-radius: 12px !important;
    z-index: 100;
    pointer-events: auto;
}

#lobbyRoot.pseudo-fullscreen .palette-title,
#lobbyRoot.pseudo-fullscreen .palette-sub { display: none !important; }

/* Compact styles for pseudo-fullscreen palette elements (NO TEXT) */
#lobbyRoot.pseudo-fullscreen .palette-custom-grid{
    margin-top: 10px;
    display: grid !important;
    grid-template-columns: repeat(2, 32px);
    grid-auto-rows: 32px;
    gap: 6px;
}
#lobbyRoot.pseudo-fullscreen .palette-custom-slot {
    width: 32px;
    height: 32px;
}
#lobbyRoot.pseudo-fullscreen .palette-custom-customize{
    grid-column: 2;
    grid-row: 3;
    width: 32px;
    height: 32px;
    border-radius: 10px;
}

/* Mode tabs in pseudo-fullscreen - show as icon strip */
#lobbyRoot.pseudo-fullscreen #modeTabs {
    flex-direction: column !important;
    gap: 6px !important;
    margin-bottom: 8px !important;
}
#lobbyRoot.pseudo-fullscreen #modeTabs .mode-tab {
    padding: 8px !important;
    font-size: 0 !important; /* hide text */
}
#lobbyRoot.pseudo-fullscreen #modeTabs .mode-tab img {
    margin: 0 !important;
    width: 18px !important;
    height: 18px !important;
}
#lobbyRoot.pseudo-fullscreen .mode-content {
    display: none !important; /* hide content panels (mode rules below decide which shows) */
}
#lobbyRoot.pseudo-fullscreen #modeDesignContent.mode-active,
#lobbyRoot.pseudo-fullscreen #modeBuildContent.mode-active {
    display: block !important;
}
#lobbyRoot.pseudo-fullscreen #modeTabs,
#lobbyRoot.pseudo-fullscreen #modeTabs .mode-tab {
    pointer-events: auto !important;
}

#lobbyRoot.pseudo-fullscreen .palette-grid {
    display: grid;
    grid-template-columns: repeat(2, 32px);
    gap: 6px;
    pointer-events: auto;
}

#lobbyRoot.pseudo-fullscreen #palette,
#lobbyRoot.pseudo-fullscreen #palette .icon-btn { pointer-events: auto; }

/* Ensure palette panel and all its interactive children are clickable */
#lobbyRoot.pseudo-fullscreen .palette-panel,
#lobbyRoot.pseudo-fullscreen .palette-custom-slots,
#lobbyRoot.pseudo-fullscreen .palette-custom-slot,
#lobbyRoot.pseudo-fullscreen #paletteEditBtn {
    pointer-events: auto;
    cursor: pointer;
}

/* Palette layout (all modes): NO TEXT, no internal scrolling, custom colors below */
.palette-grid-default{
    display: grid;
    grid-template-columns: repeat(5, 24px);
    gap: 8px;
    margin: 8px 0 0;
}

/* Custom grid includes 4 slots + a small customize button under the 4th slot */
.palette-custom-grid{
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(4, 24px);
    grid-auto-rows: 24px;
    gap: 8px;
    align-content: start;
}

/* Custom slots match the default palette swatch shape */
.palette-custom-slot{
    width: 24px;
    height: 24px;
    border-radius: 8px;
    background: rgba(2,6,23,0.35);
    border: 1px solid rgba(255,255,255,0.15);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}
.palette-custom-slot:hover{
    background: rgba(255,255,255,0.06);
    border-color: rgba(245, 197, 66, 0.35);
}
.palette-custom-slot .plus-icon{
    font-size: 14px;
    line-height: 1;
    color: rgba(255,255,255,0.55);
    transform: translateY(-1px);
}
.palette-custom-slot.filled .plus-icon{ display:none; }

/* Icon-only customize button under slot #4 */
.palette-custom-customize{
    grid-column: 4;
    grid-row: 2;
    width: 24px;
    height: 24px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(2,6,23,0.45);
    border: 1px solid rgba(255,255,255,0.10);
    transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}
.palette-custom-customize img{
    width: 14px;
    height: 14px;
    opacity: 0.9;
}
.palette-custom-customize:hover{
    background: rgba(2,6,23,0.60);
    border-color: rgba(255,255,255,0.16);
}

/* =========================================================
   CHIP BUILDER UI (inside palette panel, Builder mode)
   ========================================================= */
.chip-builder{
    display:flex;
    flex-direction:column;
    gap:10px;
}
.chip-builder-row{
    display:flex;
    gap:8px;
    align-items:center;
    justify-content:flex-start;
}
.chip-builder-grid{
    display:grid;
    grid-template-columns: repeat(4, 34px);
    grid-auto-rows: 34px;
    gap:8px;
}
.chip-tool{
    width:34px;
    height:34px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(2,6,23,0.45);
    display:inline-flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
    transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
    padding:0;
}
.chip-tool:hover{
    transform: translateY(-1px);
    border-color: rgba(245, 197, 66, 0.35);
}
.chip-tool.is-active{
    border-color: rgba(245, 197, 66, 0.95);
    box-shadow: 0 0 0 2px rgba(245, 197, 66, 0.18);
}
.chip-tool img{
    width: 20px;
    height: 20px;
    image-rendering: pixelated;
}
.chip-collider-preview{
    display:block;
    box-sizing:border-box;
    border: 2px solid rgba(239,68,68,0.95);
    border-radius: 8px;
    position:relative;
    background: rgba(0,0,0,0.12);
}
.chip-collider-preview::after{
    content:'×';
    position:absolute;
    inset:0;
    display:flex;
    align-items:center;
    justify-content:center;
    color: rgba(0,0,0,0.85);
    font-weight: 900;
    font-size: 14px;
    line-height:1;
}
.chip-collider-preview--1x1{ width: 20px; height: 20px; }
.chip-collider-preview--1x2{ width: 20px; height: 26px; }
.chip-collider-preview--2x2{ width: 26px; height: 26px; }
.chip-builder-hint{
    font-size: 11px;
    color: rgba(255,255,255,0.55);
    letter-spacing: 0.02em;
}

/* Chip config window (in-game widget style) */
.chip-config-widget{
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(360px, 92vw);
    max-height: min(520px, calc(100vh - 120px));
    overflow: hidden;
    z-index: 110000;
    background: rgba(20, 24, 32, 0.94);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 14px;
    box-shadow: 0 20px 80px rgba(0,0,0,0.55);
    display: none;
    pointer-events: auto;
}
.chip-config-widget.active{ display:block; }
.chip-config-header{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    padding: 12px 14px;
    background: rgba(0,0,0,0.25);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    user-select:none;
}
.chip-config-title{
    display:flex;
    align-items:center;
    gap:10px;
    min-width:0;
}
.chip-config-title img{ width:18px; height:18px; image-rendering: pixelated; }
.chip-config-title span{
    font-weight: 800;
    color:#fff;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chip-config-close{
    width: 28px;
    height: 28px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(0,0,0,0.25);
    color: rgba(255,255,255,0.85);
    cursor:pointer;
}

/* =========================================================
   CHIP ACTION CARD (bottom-right quick actions)
   ========================================================= */
.chip-action-card{
    position: fixed;
    right: 18px;
    bottom: 86px;
    z-index: 110050;
    width: min(320px, 92vw);
    background: rgba(20, 24, 32, 0.94);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 14px;
    box-shadow: 0 20px 80px rgba(0,0,0,0.55);
    display: none;
    overflow: hidden;
}
.chip-action-card.active{ display:block; }
.chip-action-header{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    padding: 10px 12px;
    background: rgba(0,0,0,0.25);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.chip-action-title{
    display:flex;
    align-items:center;
    gap:10px;
    min-width:0;
    color:#fff;
    font-weight: 900;
    font-size: 13px;
}
.chip-action-title img{ width:18px; height:18px; image-rendering: pixelated; }
.chip-action-close{
    width: 28px;
    height: 28px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(0,0,0,0.25);
    color: rgba(255,255,255,0.85);
    cursor:pointer;
}
.chip-action-body{
    padding: 12px;
    display:grid;
    gap:10px;
}
.chip-stack-pick{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
}
.chip-stack-pick button{
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.88);
    font-weight: 900;
    font-size: 11px;
    padding: 8px 10px;
    cursor:pointer;
}
.chip-stack-pick button:hover{ background: rgba(255,255,255,0.10); }
.chip-action-row{
    display:flex;
    gap:10px;
    justify-content:flex-end;
    flex-wrap:wrap;
}
.chip-action-row .chip-btn{
    border-radius: 10px;
}
.chip-config-body{
    padding: 12px 14px;
    overflow:auto;
}
.chip-field{ display:flex; flex-direction:column; gap:6px; margin-bottom: 10px; }
.chip-field label{ font-size:11px; color: rgba(255,255,255,0.65); }
.chip-input, .chip-textarea{
    width:100%;
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 10px;
    padding: 8px 10px;
    color:#fff;
    font-size: 13px;
    outline: none;
}
.chip-textarea{ min-height: 74px; resize: vertical; }
.chip-actions{
    display:flex;
    gap:10px;
    margin-top: 10px;
    justify-content:flex-end;
}
.chip-btn{
    height: 34px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(0,0,0,0.25);
    color:#fff;
    font-weight: 800;
    padding: 0 12px;
    cursor:pointer;
}
.chip-btn.yellow{
    background: rgba(245, 197, 66, 0.95);
    border-color: rgba(245, 197, 66, 0.95);
    color:#1f2937;
}
.chip-targets{
    display:flex;
    flex-wrap: wrap;
    gap: 6px;
}
.chip-target-pill{
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.10);
    color: rgba(255,255,255,0.85);
}
.chip-config-hint{
    font-size: 11px;
    color: rgba(255,255,255,0.55);
    margin-top: 6px;
}

/* Chip stack picker */
.chip-stack-list{
    display:flex;
    flex-direction:column;
    gap:10px;
}
.chip-stack-item{
    display:flex;
    align-items:center;
    gap:10px;
    width:100%;
    text-align:left;
    padding: 10px 10px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(0,0,0,0.20);
    color:#fff;
    cursor:pointer;
}
.chip-stack-item:hover{
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.16);
}
.chip-stack-item img{
    width: 26px;
    height: 26px;
    image-rendering: pixelated;
    flex: 0 0 auto;
}
.chip-stack-meta{ min-width:0; }
.chip-stack-type{
    font-weight: 900;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chip-stack-sub{
    margin-top:2px;
    font-size: 11px;
    color: rgba(255,255,255,0.55);
}

/* Builder selected chip (from inventory) */
.chip-selected{
    margin-bottom: 12px;
    padding: 10px 10px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(0,0,0,0.18);
}
.chip-selected-row{
    display:flex;
    align-items:center;
    gap:10px;
}
.chip-selected-icon{
    width: 28px;
    height: 28px;
    image-rendering: pixelated;
    flex: 0 0 auto;
}
.chip-selected-meta{ min-width:0; }
.chip-selected-name{
    font-weight: 900;
    color:#fff;
    font-size: 12px;
    white-space: nowrap;
    overflow:hidden;
    text-overflow: ellipsis;
}
.chip-selected-sub{
    margin-top:2px;
    font-size: 11px;
    color: rgba(255,255,255,0.55);
    white-space: nowrap;
    overflow:hidden;
    text-overflow: ellipsis;
}

/* In-room mod menu (chips-only) */
.mod-chip-fab{
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 120000;
    width: 54px;
    height: 54px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(0,0,0,0.30);
    box-shadow: 0 20px 60px rgba(0,0,0,0.45);
    color: rgba(255,255,255,0.92);
    font-weight: 900;
    cursor: pointer;
    backdrop-filter: blur(6px);
}
.mod-chip-fab:hover{ background: rgba(255,255,255,0.08); }
.mod-chip-widget{
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(420px, 94vw);
    max-height: min(540px, calc(100vh - 120px));
    overflow: hidden;
    z-index: 120001;
    background: rgba(20, 24, 32, 0.96);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 14px;
    box-shadow: 0 20px 80px rgba(0,0,0,0.55);
    display: none;
}
.mod-chip-widget.active{ display:block; }
.mod-chip-body{ padding: 12px 14px; overflow:auto; }
.mod-chip-row{ display:flex; gap:10px; align-items:center; }
.mod-chip-row > *{ flex:1; }
.mod-chip-select{
    width:100%;
    height: 34px;
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 10px;
    padding: 0 10px;
    color:#fff;
    font-size: 13px;
    outline: none;
}
.mod-chip-msg{ margin-top: 8px; font-size: 12px; color: rgba(255,255,255,0.70); }

/* Color Editor: match in-game widget look (Character/Navigator style) */
.color-editor-widget{
    background: rgba(30, 40, 50, 0.95);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 14px;
    box-shadow: 0 20px 80px rgba(0,0,0,0.55);
    overflow: hidden;
}
.color-editor-header{
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: rgba(0,0,0,0.25);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    user-select: none;
}
.color-editor-header h3{
    margin: 0;
    font-size: 14px;
    font-weight: 800;
    color: rgba(255,255,255,0.95);
}
.color-editor-close{
    margin-left: auto;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.10);
    color: rgba(255,255,255,0.9);
}
.color-editor-close:hover{
    background: rgba(220, 50, 50, 0.35);
    border-color: rgba(220, 50, 50, 0.5);
}

/* Make editor body feel like a real window (less “cheap”) */
.color-editor-body{
    padding: 14px;
    background: rgba(0,0,0,0.10);
}
.color-hex-input{
    background: rgba(0,0,0,0.28);
    border: 1px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.90);
    border-radius: 10px;
    padding: 8px 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.color-editor-actions{
    gap: 10px;
}
.color-btn-cancel,
.color-btn-save{
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.12);
}
.color-btn-save{
    background: rgba(245, 197, 66, 0.18);
    border-color: rgba(245, 197, 66, 0.35);
    color: rgba(255,255,255,0.95);
    font-weight: 800;
}
.color-btn-save:hover{
    background: rgba(245, 197, 66, 0.26);
}
.color-btn-cancel{
    background: rgba(0,0,0,0.25);
    color: rgba(255,255,255,0.80);
}
.color-btn-cancel:hover{
    background: rgba(0,0,0,0.35);
}

#lobbyRoot.pseudo-fullscreen.hud-hidden .palette-panel { display: none !important; }
#lobbyRoot.pseudo-fullscreen #fsExitBtn { display: inline-flex !important; position: fixed !important; top: 14px !important; right: 14px !important; z-index: 200 !important; }
#lobbyRoot.pseudo-fullscreen #hudToggleBtn { display: inline-flex !important; position: fixed !important; bottom: 14px !important; left: 14px !important; z-index: 200 !important; }
#lobbyRoot.pseudo-fullscreen #fullscreenBtn,
#lobbyRoot.pseudo-fullscreen #refreshBtn { display: none !important; }

/* Pseudo-fullscreen background */
#lobbyRoot.pseudo-fullscreen::before {
    content: "";
    position: fixed;
    inset: 0;
    background: #0a0e1a;
    z-index: -1;
}

/* ============================================
   PSEUDO-FULLSCREEN: Mirror all :fullscreen rules
   ============================================ */

/* HUD Info strip */
#lobbyRoot.pseudo-fullscreen #hudInfo {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    right: auto !important;
    bottom: auto !important;
    transform: none !important;
    height: 34px;
    z-index: 200 !important;
}
#lobbyRoot.pseudo-fullscreen:not(.hud-hidden) #hudInfo { display: inline-flex !important; }
#lobbyRoot.pseudo-fullscreen.hud-hidden #hudInfo { display: none !important; }

/* Cooldown HUD */
#lobbyRoot.pseudo-fullscreen #cooldownHud { display: inline-flex !important; }
#lobbyRoot.pseudo-fullscreen.hud-hidden #cooldownHud { display: none !important; }

/* Canvas inner - outline/border */
#lobbyRoot.pseudo-fullscreen #canvasInner {
    position: relative;
}
#lobbyRoot.pseudo-fullscreen #canvasInner::before {
    content: "";
    position: absolute;
    inset: -2px;
    border: 2px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    pointer-events: none;
    z-index: 5;
}

/* Canvas sizing */
#lobbyRoot.pseudo-fullscreen #roomCanvas,
#lobbyRoot.pseudo-fullscreen #cursorCanvas {
    image-rendering: pixelated;
}

/* Toggle buttons positioning */
#lobbyRoot.pseudo-fullscreen #hudToggleBtn { top: calc(50% - 78px) !important; bottom: auto !important; }
#lobbyRoot.pseudo-fullscreen #toolToggleBtn { display: inline-flex !important; position: fixed !important; left: 14px !important; top: calc(50% - 26px) !important; z-index: 200 !important; }
#lobbyRoot.pseudo-fullscreen #chatToggleBtn { display: inline-flex !important; position: fixed !important; left: 14px !important; top: calc(50% + 26px) !important; z-index: 200 !important; }
#lobbyRoot.pseudo-fullscreen #modeSwitchBtn { display: inline-flex !important; position: fixed !important; left: 14px !important; top: calc(50% + 78px) !important; z-index: 200 !important; }

/* Button styling in pseudo-fullscreen */
#lobbyRoot.pseudo-fullscreen #fsExitBtn,
#lobbyRoot.pseudo-fullscreen #hudToggleBtn,
#lobbyRoot.pseudo-fullscreen #chatToggleBtn,
#lobbyRoot.pseudo-fullscreen #toolToggleBtn,
#lobbyRoot.pseudo-fullscreen #modeSwitchBtn {
    pointer-events: auto !important;
}

/* Fullscreen: the play overlay must never intercept input */
#lobbyRoot:fullscreen #playOverlay{
    display: none !important;
    pointer-events: none !important;
}

/* Fullscreen: canvas surface must always be the interactive top layer */
#lobbyRoot:fullscreen #canvasWrap.canvas-wrap{
    pointer-events: auto !important;
    z-index: 10 !important;
}

/* Fullscreen play background: blurred dark-tinted login.webp corner-to-corner */
#lobbyRoot:fullscreen::before{
    content:"";
    position: fixed;
    inset: 0;
    background-image: url('/assets/login.webp');
    background-size: cover;
    background-position: center;
    filter: blur(22px) brightness(0.55);
    transform: scale(1.08);
    z-index: 0;
    pointer-events: none;
}
#lobbyRoot:fullscreen::after{
    content:"";
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.38);
    z-index: 0;
    pointer-events: none;
}
#lobbyRoot:fullscreen > *{
    position: relative;
    z-index: 1;
}

/* Tutorial guide must stay ABOVE fullscreen canvas/HUD */
#lobbyRoot:fullscreen > #tgOverlay{
    position: fixed !important;
    z-index: 10000100 !important;
}
#lobbyRoot:fullscreen > #tgCard{
    position: fixed !important;
    z-index: 10000101 !important;
}

/* Fullscreen: prevent invisible layout wrappers from intercepting map input */
/* Same as pseudo-fullscreen: keep room subtree interactive */
#lobbyRoot:fullscreen .flex-1{ pointer-events: auto; }
#lobbyRoot:fullscreen .palette-slot{ pointer-events: auto; }
#lobbyRoot:fullscreen .canvas-window{ pointer-events: auto; z-index: 2; }

/* Keep toast fixed even in fullscreen so it always lands at top of the viewport */
#lobbyRoot:fullscreen .mmo-notify { position: fixed; }

/* Fullscreen: make canvas truly dominant (fit map) */
#lobbyRoot:fullscreen .canvas-window {
    position: fixed;
    inset: 0;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
}
#lobbyRoot:fullscreen .canvas-window-header {
    position: fixed;
    left: 12px;
    top: 12px;
    right: 12px;
    z-index: 40;
    border-radius: 14px;
    backdrop-filter: none;
    background: rgba(2,6,23,0.72);
    border: 1px solid rgba(255,255,255,0.10);
    box-shadow: inset 1px 1px 0 rgba(255,255,255,0.06), inset -1px -1px 0 rgba(0,0,0,0.55), 0 14px 38px rgba(0,0,0,0.62);
}
#lobbyRoot:fullscreen .canvas-window-body {
    position: fixed;
    inset: 0;
    padding: 0 !important;
    background: transparent !important;
}
#lobbyRoot:fullscreen #canvasWrap.canvas-wrap {
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    border: none !important;
}

/* Fullscreen palette: colors only (no container) - visibility controlled by mode rules */
#lobbyRoot:fullscreen .palette-panel {
    /* display controlled by mode-based rules */
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 120px;
    padding: 14px !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    transform: translateX(0);
    z-index: 55;
    pointer-events: none; /* don't block clicks on the canvas (children re-enable) */
}
#lobbyRoot:fullscreen .palette-title,
#lobbyRoot:fullscreen .palette-sub { display: none !important; }

/* Compact styles for fullscreen palette elements */
#lobbyRoot:fullscreen .palette-custom-wrap {
    margin-bottom: 8px;
}
#lobbyRoot:fullscreen .palette-custom-wrap > div:first-child { 
    display: none; /* hide "Custom Colors" label */
}
#lobbyRoot:fullscreen .palette-custom-slots {
    display: grid !important;
    grid-template-columns: 26px;
    gap: 8px;
}
#lobbyRoot:fullscreen .palette-custom-slot {
    width: 26px;
    height: 26px;
}
#lobbyRoot:fullscreen .palette-edit-btn {
    padding: 8px;
    font-size: 0; /* hide text */
}
#lobbyRoot:fullscreen .palette-edit-btn img {
    width: 16px;
    height: 16px;
    margin: 0;
}
#lobbyRoot:fullscreen .design-mode-indicator { 
    display: none !important;
}

/* Mode tabs in fullscreen - show as icon strip */
#lobbyRoot:fullscreen #modeTabs {
    flex-direction: column !important;
    gap: 6px !important;
    margin-bottom: 8px !important;
}
#lobbyRoot:fullscreen #modeTabs .mode-tab {
    padding: 8px !important;
    font-size: 0 !important; /* hide text */
}
#lobbyRoot:fullscreen #modeTabs .mode-tab img {
    margin: 0 !important;
    width: 18px !important;
    height: 18px !important;
}
#lobbyRoot:fullscreen .mode-content {
    display: none !important; /* hide content panels (mode rules below decide which shows) */
}
#lobbyRoot:fullscreen #modeDesignContent.mode-active,
#lobbyRoot:fullscreen #modeBuildContent.mode-active {
    display: block !important;
}
#lobbyRoot:fullscreen #modeTabs,
#lobbyRoot:fullscreen #modeTabs .mode-tab {
    pointer-events: auto !important;
}

/* =========================================================
   MODE TABS (BASE STYLES)
   These must NOT depend on being inside #lobbyRoot because in embedded pseudo-fullscreen
   we float the palette slot to document.body.
   ========================================================= */
.mode-tabs{
    display:flex;
    align-items:center;
    gap: 8px;
    margin-bottom: 10px;
}
.mode-tab{
    width: 44px;
    height: 44px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(2,6,23,0.55);
    box-shadow:
      inset 1px 1px 0 rgba(255,255,255,0.06),
      inset -1px -1px 0 rgba(0,0,0,0.55),
      0 10px 26px rgba(0,0,0,0.38);
    display:inline-flex;
    align-items:center;
    justify-content:center;
    padding:0;
    cursor:pointer;
}
.mode-tab img{
    width: 22px;
    height: 22px;
    image-rendering: pixelated;
    opacity: 0.92;
}
.mode-tab:hover{
    border-color: rgba(245, 197, 66, 0.35);
}
.mode-content{
    display:none;
}
.mode-content.mode-active{
    display:block;
}

#lobbyRoot:fullscreen .palette-scroll {
    max-height: 100vh !important;
    overflow: auto;
    padding-right: 2px;
    pointer-events: auto; /* allow scrolling */
}
#lobbyRoot:fullscreen .palette-grid {
    display: grid;
    grid-template-columns: 26px; /* single column, top-to-bottom */
    gap: 10px;
    justify-content: end;
    pointer-events: auto; /* allow clicking colors */
}
/* Ensure actual palette buttons remain clickable even when wrapper is pointer-events:none */
#lobbyRoot:fullscreen #palette,
#lobbyRoot:fullscreen #palette .icon-btn { pointer-events: auto; }

/* Ensure palette panel and all its interactive children are clickable in fullscreen */
#lobbyRoot:fullscreen .palette-panel,
#lobbyRoot:fullscreen .palette-custom-slots,
#lobbyRoot:fullscreen .palette-custom-slot,
#lobbyRoot:fullscreen #paletteEditBtn {
    pointer-events: auto;
    cursor: pointer;
}

/* Fullscreen HUD toggle: hide all HUD except the eye button itself */
#lobbyRoot:fullscreen.hud-hidden .palette-panel { display: none !important; }
#lobbyRoot:fullscreen.hud-hidden #fsExitBtn { display: inline-flex !important; } /* always keep close button */

/* Fullscreen (HUD ON): reserve space so UI never overlaps the map */
#lobbyRoot:fullscreen:not(.hud-hidden) #canvasWrap.canvas-wrap {
    position: fixed !important;
    left: 28px !important;  /* 2x sidelines */
    top: 28px !important;   /* 2x sidelines */
    right: 28px !important; /* keep black frame visible on the right too */
    bottom: 28px !important; /* 2x sidelines */
    width: auto !important;
    height: auto !important;
    border-radius: 16px !important;
    border: 1px solid rgba(255,255,255,0.06) !important;
    background: transparent !important; /* allow transparency pattern to show */
}
#lobbyRoot:fullscreen.hud-hidden #canvasWrap.canvas-wrap {
    left: 28px !important;   /* 2x sidelines */
    top: 28px !important;    /* 2x sidelines */
    right: 28px !important;  /* 2x sidelines */
    bottom: 28px !important; /* 2x sidelines */
    background: transparent !important;
}

/* Fullscreen: remove header + text buttons (use eye + X only) */
#lobbyRoot:fullscreen .canvas-window-header { display: none !important; }
#lobbyRoot:fullscreen #fullscreenBtn,
#lobbyRoot:fullscreen #refreshBtn { display: none !important; }
#lobbyRoot:fullscreen:not(.hud-hidden) #fsExitBtn {
    position: fixed !important;
    top: 14px !important;
    right: 14px !important;
}

/* Fullscreen palette: keep a game-like framed palette */
#lobbyRoot:fullscreen:not(.hud-hidden) .palette-panel {
    padding: 10px !important;
    top: 50% !important;
    right: 42px !important; /* inside map area; avoids close button + stays off black frame */
    height: auto !important;
    max-height: calc(100vh - 120px) !important;
    transform: translateY(-50%) !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    pointer-events: none; /* don't block clicks on the canvas */
}

/* Palette scroll should respect centered max-height */
#lobbyRoot:fullscreen .palette-scroll { max-height: calc(100vh - 120px) !important; }
#lobbyRoot:fullscreen .palette-scroll { padding-top: 6px; padding-bottom: 6px; } /* prevent top/bottom clip */

/* Selected color outline */
.palette-grid .icon-btn.selected {
    outline: none;
    box-shadow:
      inset 0 0 0 2px rgba(255,255,255,0.90),
      0 0 0 2px var(--accent-yellow);
}

/* Transparency pattern for unfilled tiles (shows through canvas transparency) */
#lobbyRoot:fullscreen #canvasInner {
    position: relative;
}
#lobbyRoot:fullscreen #canvasInner::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    /* checkerboard transparency pattern */
    background-color: rgba(0,0,0,0.10);
    background-image:
      linear-gradient(45deg, rgba(255,255,255,0.08) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.08) 75%, rgba(255,255,255,0.08)),
      linear-gradient(45deg, rgba(255,255,255,0.08) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.08) 75%, rgba(255,255,255,0.08));
    background-size: 24px 24px;
    background-position: 0 0, 12px 12px;
    opacity: 0.75;
}

/* Fullscreen: grid lines (glowy, tinted by room owner level) */
#lobbyRoot:fullscreen .canvas-wrap.grid-on #canvasInner::after{
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
      linear-gradient(to right, color-mix(in srgb, var(--room-accent, var(--lvl-0)) 30%, transparent) 1px, transparent 1px),
      linear-gradient(to bottom, color-mix(in srgb, var(--room-accent, var(--lvl-0)) 30%, transparent) 1px, transparent 1px);
    background-size: var(--tile) var(--tile);
    opacity: 0.55;
}
#lobbyRoot:fullscreen #roomCanvas,
#lobbyRoot:fullscreen #cursorCanvas {
    position: relative;
    z-index: 1;
}

/* Fullscreen: glow outline around playfield (tinted by room owner level) */
#lobbyRoot:fullscreen #canvasWrap.canvas-wrap{
    border-color: color-mix(in srgb, var(--room-accent, var(--lvl-0)) 40%, rgba(255,255,255,0.10)) !important;
    box-shadow:
      0 0 0 2px color-mix(in srgb, var(--room-accent, var(--lvl-0)) 35%, transparent),
      0 0 26px color-mix(in srgb, var(--room-accent, var(--lvl-0)) 22%, transparent),
      0 20px 60px rgba(0,0,0,.35) !important;
}

/* Fullscreen: left-side room HUD buttons should match palette (vertical stack look) */
#lobbyRoot:fullscreen :is(#fsExitBtn, #hudToggleBtn, #toolToggleBtn, #chatToggleBtn, #modeSwitchBtn){
    background: var(--container-glass) !important;
    border: 1px solid var(--text-muted) !important;
    box-shadow: inset 1px 1px 0 rgba(255,255,255,0.06), 0 2px 0 rgba(0,0,0,0.18) !important;
}
#lobbyRoot:fullscreen :is(#fsExitBtn, #hudToggleBtn, #toolToggleBtn, #chatToggleBtn, #modeSwitchBtn):hover{
    background: var(--container-glass-hover) !important;
    border-color: var(--accent-yellow) !important;
}

/* Fullscreen: make left HUD buttons larger + centered vertically on the left edge */
#lobbyRoot:fullscreen :is(#hudToggleBtn, #toolToggleBtn, #chatToggleBtn, #modeSwitchBtn){
    width: 44px !important;
    height: 44px !important;
    left: 14px !important;
    transform: translateY(-50%) !important;
}
#lobbyRoot:fullscreen #hudToggleBtn{ top: calc(50% - 78px) !important; }
#lobbyRoot:fullscreen #toolToggleBtn{ top: calc(50% - 26px) !important; }
#lobbyRoot:fullscreen #chatToggleBtn{ top: calc(50% + 26px) !important; }
#lobbyRoot:fullscreen #modeSwitchBtn{ display: inline-flex !important; top: calc(50% + 78px) !important; }

#lobbyRoot:fullscreen :is(#hudToggleBtn img, #toolToggleBtn img, #chatToggleBtn img, #modeSwitchBtn img){
    width: 22px !important;
    height: 22px !important;
}

/* Mode switch button styling */
.mode-switch-btn[data-mode="design"] {
    background: rgba(245, 197, 66, 0.2) !important;
    border-color: rgba(245, 197, 66, 0.4) !important;
}
.mode-switch-btn[data-mode="design"]:hover {
    background: rgba(245, 197, 66, 0.35) !important;
}

/* ============================================
   COLOR EDITOR WIDGET (Design Mode)
   ============================================ */

/* Color Editor Floating Widget */
.color-editor-widget {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 320px;
    max-height: 80vh;
    background: rgba(10, 18, 30, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6), 0 0 1px rgba(255,255,255,0.1);
    z-index: 9999;
    display: none;
    overflow: hidden;
}

.color-editor-widget.active {
    display: block;
    animation: colorEditorSlideIn 0.2s ease-out;
}

@keyframes colorEditorSlideIn {
    from { opacity: 0; transform: translate(-50%, -45%); }
    to { opacity: 1; transform: translate(-50%, -50%); }
}

.color-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    cursor: move;
}

.color-editor-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #f5c542;
}

.color-editor-close {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.color-editor-close:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.4);
}

.color-editor-body {
    padding: 16px;
    overflow-y: auto;
    max-height: calc(80vh - 60px);
}

/* Color Picker Canvas (Saturation/Brightness) */
.color-picker-area {
    width: 100%;
    height: 160px;
    border-radius: 10px;
    position: relative;
    cursor: crosshair;
    margin-bottom: 14px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1);
}

.color-picker-cursor {
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(0,0,0,0.5);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

/* Hue Slider */
.color-hue-slider {
    width: 100%;
    height: 18px;
    border-radius: 9px;
    margin-bottom: 14px;
    cursor: pointer;
    position: relative;
    background: linear-gradient(to right, 
        hsl(0, 100%, 50%), 
        hsl(60, 100%, 50%), 
        hsl(120, 100%, 50%), 
        hsl(180, 100%, 50%), 
        hsl(240, 100%, 50%), 
        hsl(300, 100%, 50%), 
        hsl(360, 100%, 50%)
    );
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1);
}

.color-hue-handle {
    position: absolute;
    width: 6px;
    height: 22px;
    background: #fff;
    border-radius: 3px;
    top: -2px;
    transform: translateX(-50%);
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    pointer-events: none;
}

/* Color Preview & Hex Input */
.color-preview-row {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 14px;
}

.color-preview-swatch {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.15);
    flex-shrink: 0;
}

.color-hex-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
    color: #fff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    text-transform: uppercase;
}

.color-hex-input:focus {
    outline: none;
    border-color: rgba(245, 197, 66, 0.4);
}

/* RGB Sliders */
.color-rgb-section {
    margin-bottom: 14px;
}

.color-rgb-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.color-rgb-label {
    width: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.color-rgb-label.r { color: #ef4444; }
.color-rgb-label.g { color: #22c55e; }
.color-rgb-label.b { color: #3b82f6; }

.color-rgb-slider {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255,255,255,0.1);
    outline: none;
}

.color-rgb-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.color-rgb-value {
    width: 36px;
    text-align: right;
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
    color: rgba(255,255,255,0.7);
}

/* Custom Colors Section */
.color-custom-section {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 14px;
    margin-top: 6px;
}

.color-custom-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

.color-custom-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.color-custom-slot {
    aspect-ratio: 1;
    border-radius: 10px;
    border: 2px dashed rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    position: relative;
}

.color-custom-slot:hover {
    border-color: rgba(245, 197, 66, 0.4);
    background: rgba(245, 197, 66, 0.1);
}

.color-custom-slot.filled {
    border-style: solid;
    border-color: rgba(255, 255, 255, 0.1);
}

.color-custom-slot.selected {
    border-color: rgba(245, 197, 66, 0.8) !important;
    box-shadow: 0 0 0 2px rgba(245, 197, 66, 0.3);
}

.color-custom-slot .plus-icon {
    font-size: 20px;
    color: rgba(255, 255, 255, 0.3);
    font-weight: 300;
}

.color-custom-slot.filled .plus-icon {
    display: none;
}

.color-custom-slot .delete-x {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    background: rgba(239, 68, 68, 0.9);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #fff;
    cursor: pointer;
}

.color-custom-slot.filled:hover .delete-x {
    display: flex;
}

/* Actions */
.color-editor-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.color-editor-actions button {
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.color-btn-save {
    background: linear-gradient(135deg, #f5c542, #d4a42a);
    border: none;
    color: #000;
}

.color-btn-save:hover {
    background: linear-gradient(135deg, #f7d15e, #e0b438);
    transform: translateY(-1px);
}

.color-btn-cancel {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
}

.color-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* Palette Panel in Design Mode */
.palette-custom-slots {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.palette-custom-slot {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.palette-custom-slot:hover {
    border-color: rgba(245, 197, 66, 0.5);
    background: rgba(245, 197, 66, 0.15);
}

.palette-custom-slot.filled {
    border-style: solid;
    border-width: 1px;
}

.palette-custom-slot.selected {
    border-color: #f5c542 !important;
    border-width: 2px !important;
    box-shadow: 0 0 8px rgba(245, 197, 66, 0.4);
}

.palette-custom-slot .plus-icon {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.4);
}

.palette-custom-slot.filled .plus-icon {
    display: none;
}

/* Palette Editor Button */
.palette-edit-btn {
    width: 100%;
    padding: 10px;
    margin-top: 10px;
    background: linear-gradient(135deg, rgba(245, 197, 66, 0.15), rgba(212, 164, 42, 0.1));
    border: 1px solid rgba(245, 197, 66, 0.25);
    border-radius: 10px;
    color: #f5c542;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.15s;
}

.palette-edit-btn:hover {
    background: linear-gradient(135deg, rgba(245, 197, 66, 0.25), rgba(212, 164, 42, 0.2));
    border-color: rgba(245, 197, 66, 0.4);
}

.palette-edit-btn img {
    width: 14px;
    height: 14px;
    filter: brightness(1.2);
}

/* Design Mode Indicator */
.design-mode-indicator {
    display: none;
    padding: 8px 12px;
    background: rgba(245, 197, 66, 0.12);
    border: 1px solid rgba(245, 197, 66, 0.25);
    border-radius: 10px;
    margin-bottom: 12px;
    font-size: 11px;
    color: #f5c542;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    text-align: center;
}

#lobbyRoot[data-mode="design"] .design-mode-indicator {
    display: block;
}

/* ============================================
   MODE-BASED PALETTE VISIBILITY
   ============================================ */

/* Default: hide palette in Play mode */
#lobbyRoot[data-mode="play"] .palette-panel,
#lobbyRoot:fullscreen[data-mode="play"] .palette-panel,
#lobbyRoot.pseudo-fullscreen[data-mode="play"] .palette-panel {
    display: none !important;
}

/* Show palette in Design mode */
#lobbyRoot[data-mode="design"] .palette-panel,
#lobbyRoot:fullscreen[data-mode="design"] .palette-panel,
#lobbyRoot.pseudo-fullscreen[data-mode="design"] .palette-panel {
    display: block !important;
}

/* Default to hiding palette when mode is not set (user must switch to Design) */
#lobbyRoot:not([data-mode]) .palette-panel,
#lobbyRoot:fullscreen:not([data-mode]) .palette-panel,
#lobbyRoot.pseudo-fullscreen:not([data-mode]) .palette-panel {
    display: none !important;
}

/* Floating cooldown HUD */
#cooldownHud {
    position: fixed;
    left: 14px;
    bottom: 14px;
    z-index: 80;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(2,6,23,0.55);
    border: 1px solid rgba(255,255,255,0.08);
    backdrop-filter: none;
    box-shadow: inset 1px 1px 0 rgba(255,255,255,0.06), inset -1px -1px 0 rgba(0,0,0,0.55), 0 12px 30px rgba(0,0,0,0.55);
    font-size: 13px;
    font-weight: 700;
    display: none;
    pointer-events: none; /* never block map interactions */
}
#lobbyRoot:fullscreen #cooldownHud { display: inline-flex; }
#lobbyRoot:fullscreen.hud-hidden #cooldownHud { display: none !important; }

/* HUD info strip next to the eye (fullscreen only) */
#hudInfo {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 80;
    padding: 6px 10px;
    border-radius: 10px;
    background: var(--panel-glass);
    border: 1px solid color-mix(in srgb, var(--room-accent, var(--lvl-0)) 32%, rgba(0,0,0,0.28));
    backdrop-filter: none;
    box-shadow:
      inset 0 0 0 1px rgba(255,255,255,0.06),
      0 12px 30px rgba(0,0,0,0.40);
    font-size: 12px;
    font-weight: 900;
    display: none;
    gap: 10px;
    align-items: center;
    white-space: nowrap;
    max-width: min(760px, calc(100vw - 160px));
    overflow: hidden;
    pointer-events: none; /* visible only; never block map interactions */
}
#lobbyRoot:fullscreen #hudInfo{
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    right: auto !important;
    bottom: auto !important;
    transform: none !important;
    height: 34px;
    z-index: 200 !important;
}
#lobbyRoot:fullscreen:not(.hud-hidden) #hudInfo { display: inline-flex; }

/* Clan rank icon: fixed square, no distortion */
.clan-rank-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    image-rendering: pixelated;
    flex-shrink: 0;
}

/* Small icon-only button (kick/promote/demote) */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    background: rgba(2,6,23,0.6);
    border: 1px solid rgba(255,255,255,0.08);
    transition: background 90ms linear, border-color 90ms linear, box-shadow 90ms linear, filter 90ms linear, transform 90ms linear;
    box-shadow:
      inset 1px 1px 0 rgba(255,255,255,0.06),
      inset -1px -1px 0 rgba(0,0,0,0.55),
      0 4px 0 rgba(0,0,0,0.22);
}

/* Bigger icon button variant (room HUD controls) */
.icon-btn.lg{
    width: 32px;
    height: 32px;
    border-radius: 4px;
}

/* Switch toggle */
.switch {
    position: relative;
    width: 44px;
    height: 24px;
    display: inline-block;
    flex: 0 0 auto;
}
.switch input { display: none; }
.switch .slider {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 999px;
    transition: background 160ms ease, border-color 160ms ease;
}
.switch .slider::before{
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.85);
    border-radius: 999px;
    transition: transform 160ms ease, background 160ms ease;
}
.switch input:checked + .slider{
    background: var(--accent-yellow);
    border-color: var(--accent-yellow);
}
.switch input:checked + .slider::before{
    transform: translate(20px, -50%);
    background: rgba(255,255,255,0.95);
}

/* Tag chips (settings) */
.tag-row{
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.tag-chip{
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(2,6,23,0.65);
    border: 1px solid rgba(255,255,255,0.10);
    font-size: 12px;
    font-weight: 800;
}
.tag-chip button{
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    cursor: pointer;
    line-height: 1;
}
.tag-chip button:hover{
    background: rgba(255,255,255,0.14);
}
.icon-btn:hover {
      background: var(--bg-hover);
      border-color: var(--accent-yellow);
}
.icon-btn:active { filter: brightness(0.98); }
.icon-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-yellow); }

@media (prefers-reduced-motion: reduce) {
    .btn-mmo, .icon-btn {
        transition: none;
    }
    .btn-mmo:hover, .btn-mmo:active, .btn-mmo.sm:hover, .btn-mmo.sm:active, .icon-btn:hover, .icon-btn:active {
        transform: none !important;
    }
}

/* Profile modal */
.profile-modal-backdrop{
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.70);
    /* Must be above Mod Tools (z-index: 500000) and tutorial guide */
    z-index: 700000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow: auto;
}
.profile-modal-card{
    width: 100%;
    max-width: 860px;
    background: var(--panel-glass);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 18px;
    position: relative;
    box-shadow: 0 16px 50px rgba(0,0,0,0.65);
}

/* Room Settings: Compact tabbed widget (matches Color Editor style) */
#createRoomWidget.room-settings-widget,
#roomSettingsWidget.room-settings-widget{
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 340px;
    max-height: 70vh;
    z-index: 100000;
    display: none;
    background: rgba(10, 18, 30, 0.96);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 14px;
    box-shadow: 0 25px 80px rgba(0,0,0,0.65), 0 0 1px rgba(255,255,255,0.1);
    overflow: hidden;
    font-size: 12px;
}
#createRoomWidget.room-settings-widget.active{ display: block; animation: rsSlideIn 0.18s ease-out; }
#roomSettingsWidget.room-settings-widget.active{ display: block; animation: rsSlideIn 0.18s ease-out; }
@keyframes rsSlideIn { from { opacity: 0; transform: translate(-50%, -45%); } to { opacity: 1; transform: translate(-50%, -50%); } }

/* Header (draggable) */
#createRoomWidget .room-settings-header,
#roomSettingsWidget .room-settings-header{
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: rgba(0,0,0,0.35);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    user-select: none;
    cursor: move;
}
#createRoomWidget .room-settings-title{ font-size: 13px; font-weight: 800; color: #f5c542; }
#roomSettingsWidget .room-settings-title{
    font-size: 13px;
    font-weight: 800;
    color: #f5c542;
}
#createRoomWidget .room-settings-close,
#roomSettingsWidget .room-settings-close{
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.10);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.12s;
}
#createRoomWidget .room-settings-close:hover{
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.4);
}
#roomSettingsWidget .room-settings-close:hover{
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.4);
}

/* Tabs */
.rs-tabs{
    display: flex;
    background: rgba(0,0,0,0.20);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.rs-tab{
    flex: 1;
    padding: 8px 6px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.55);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.12s;
    border-bottom: 2px solid transparent;
}
.rs-tab:hover{ color: rgba(255,255,255,0.85); }
.rs-tab.active{
    color: #f5c542;
    border-bottom-color: #f5c542;
    background: rgba(245, 197, 66, 0.08);
}

/* Body */
#createRoomWidget .room-settings-body,
#roomSettingsWidget .room-settings-body{
    padding: 12px;
    overflow-y: auto;
    max-height: calc(70vh - 90px);
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}
#roomSettingsWidget .room-settings-body::-webkit-scrollbar{ width: 6px; }
#roomSettingsWidget .room-settings-body::-webkit-scrollbar-track{ background: transparent; }
#roomSettingsWidget .room-settings-body::-webkit-scrollbar-thumb{ background: rgba(255,255,255,0.2); border-radius: 3px; }

/* Tab Content */
.rs-tab-content{ display: none; }
.rs-tab-content.active{ display: block; }

/* Fields */
.rs-field{ margin-bottom: 10px; }
.rs-field label{
    display: block;
    font-size: 10px;
    font-weight: 700;
    color: rgba(255,255,255,0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.rs-input{
    width: 100%;
    padding: 8px 10px;
    background: rgba(0,0,0,0.30);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    color: #fff;
    font-size: 12px;
    outline: none;
    transition: border-color 0.12s;
}
.rs-input:focus{ border-color: rgba(245, 197, 66, 0.5); }
.rs-input::placeholder{ color: rgba(255,255,255,0.4); }
select.rs-input{ cursor: pointer; }

/* Row (2 cols) */
.rs-row{ display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }

/* Toggle row */
.rs-toggle-row{
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    color: rgba(255,255,255,0.85);
    font-size: 12px;
}
.rs-switch{ position: relative; width: 36px; height: 20px; }
.rs-switch input{ opacity: 0; width: 0; height: 0; }
.rs-slider{
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.15);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
}
.rs-slider::before{
    content: "";
    position: absolute;
    left: 2px;
    top: 2px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}
.rs-switch input:checked + .rs-slider{ background: #22c55e; }
.rs-switch input:checked + .rs-slider::before{ transform: translateX(16px); }

/* Preset row */
.rs-preset-row{ display: flex; gap: 6px; align-items: center; }
.rs-preset-row .rs-input{ flex: 1; }
.rs-preset-btn{
    width: 28px;
    height: 28px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.rs-preset-btn:hover{ background: rgba(255,255,255,0.15); }

/* Divider */
.rs-divider{ height: 1px; background: rgba(255,255,255,0.08); margin: 12px 0; }

/* Section title */
.rs-section-title{
    font-size: 10px;
    font-weight: 800;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

/* Search row */
.rs-search-row{ display: flex; gap: 6px; }
.rs-search-row .rs-input{ flex: 1; }
.rs-btn-search{
    width: 32px;
    height: 32px;
    background: rgba(245, 197, 66, 0.15);
    border: 1px solid rgba(245, 197, 66, 0.3);
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.rs-btn-search:hover{ background: rgba(245, 197, 66, 0.25); }

/* User list */
.rs-user-list{ max-height: 100px; overflow-y: auto; }
.rs-user-list:empty::after{ content: "None"; color: rgba(255,255,255,0.3); font-size: 11px; }

/* Actions */
.rs-actions{ margin-top: 12px; display: flex; justify-content: flex-end; }
.rs-btn-save{
    padding: 8px 16px;
    background: linear-gradient(135deg, #f5c542, #d4a42a);
    border: none;
    border-radius: 8px;
    color: #0a0e14;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.1s;
}
.rs-btn-save:hover{ transform: translateY(-1px); }

/* Message */
.rs-msg{ margin-top: 8px; font-size: 11px; color: rgba(255,255,255,0.6); text-align: right; }

/* Danger */
.rs-danger{ margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(239, 68, 68, 0.2); }
.rs-btn-danger{
    padding: 6px 12px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 6px;
    color: #ef4444;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}
.rs-btn-danger:hover{ background: rgba(239, 68, 68, 0.25); }
.profile-modal-close{
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(2,6,23,0.6);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.profile-modal-avatar{
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    background: var(--bg-container);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ─── Profile Modal - Game Style (pseudo-fullscreen) ─── */
#lobbyRoot.pseudo-fullscreen .profile-modal-backdrop,
#lobbyRoot:fullscreen .profile-modal-backdrop {
    background: rgba(0, 0, 0, 0.85);
}
#lobbyRoot.pseudo-fullscreen .profile-modal-card,
#lobbyRoot:fullscreen .profile-modal-card {
    background: rgba(30, 40, 50, 0.98);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    max-width: 480px;
}
#lobbyRoot.pseudo-fullscreen .profile-modal-card *,
#lobbyRoot:fullscreen .profile-modal-card * {
    color: #fff;
}
#lobbyRoot.pseudo-fullscreen .profile-modal-card .opacity-70,
#lobbyRoot.pseudo-fullscreen .profile-modal-card .opacity-80,
#lobbyRoot:fullscreen .profile-modal-card .opacity-70,
#lobbyRoot:fullscreen .profile-modal-card .opacity-80 {
    opacity: 0.6;
}
#lobbyRoot.pseudo-fullscreen .profile-modal-card .section-head,
#lobbyRoot:fullscreen .profile-modal-card .section-head {
    background: rgba(0,0,0,0.3);
    border-radius: 6px;
    padding: 6px 10px;
    margin-bottom: 8px;
}
#lobbyRoot.pseudo-fullscreen .profile-modal-card .section-head h2,
#lobbyRoot:fullscreen .profile-modal-card .section-head h2 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.7);
}
#lobbyRoot.pseudo-fullscreen .profile-modal-card .desc-view,
#lobbyRoot:fullscreen .profile-modal-card .desc-view {
    background: rgba(0,0,0,0.2);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.4;
}
#lobbyRoot.pseudo-fullscreen .profile-modal-card .profile-modal-avatar,
#lobbyRoot:fullscreen .profile-modal-card .profile-modal-avatar {
    background: rgba(0,0,0,0.3);
    border: 2px solid rgba(255,255,255,0.1);
}
#lobbyRoot.pseudo-fullscreen .profile-modal-card .btn-mmo,
#lobbyRoot:fullscreen .profile-modal-card .btn-mmo {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
}
#lobbyRoot.pseudo-fullscreen .profile-modal-card .btn-mmo:hover,
#lobbyRoot:fullscreen .profile-modal-card .btn-mmo:hover {
    background: rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.25);
}
#lobbyRoot.pseudo-fullscreen .profile-modal-card a,
#lobbyRoot:fullscreen .profile-modal-card a {
    color: #4ade80;
}
#lobbyRoot.pseudo-fullscreen .profile-modal-close,
#lobbyRoot:fullscreen .profile-modal-close {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 6px;
}
#lobbyRoot.pseudo-fullscreen .profile-modal-close:hover,
#lobbyRoot:fullscreen .profile-modal-close:hover {
    background: rgba(220, 50, 50, 0.35);
    border-color: rgba(220, 50, 50, 0.5);
}
/* Canvas-based avatar (new system) */
.profile-modal-avatar canvas,
.profile-modal-avatar .avatar-canvas {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    width: 100%;
    height: 100%;
}
/* Legacy image-based avatar (backward compat) */
.profile-modal-avatar.legacy-avatar img,
.profile-modal-avatar img{
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    image-rendering: pixelated;
}
.profile-modal-avatar .skin{ bottom:-30%; width:80%; z-index:0; }
.profile-modal-avatar .body{ bottom:-30%; width:80%; z-index:1; }
.profile-modal-avatar .eyes{ top:33%; width:65%; left:60%; z-index:3; transform:translateX(-50%); }
.profile-modal-avatar .head{ top:0; width:90%; z-index:2; }

/* ===============================
   INPUTS
================================ */
.input-mmo {
    width: 100%;
    padding: 12px 14px;
    border-radius: 4px;
    border: 1px solid var(--text-muted);
    background: var(--bg-container);
    color: var(--text-main);
    font-size: 0.95rem;
}

/* Hide native number spinners (we use custom UX) */
.input-mmo[type=number]::-webkit-outer-spin-button,
.input-mmo[type=number]::-webkit-inner-spin-button{
    -webkit-appearance: none;
    margin: 0;
}
.input-mmo[type=number]{
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Nicer scrollbars (settings modal + long lists) */
.profile-modal-card{
    scrollbar-width: thin;
    scrollbar-color: var(--text-muted) var(--bg-container);
}
.profile-modal-card::-webkit-scrollbar{
    width: 10px;
}
.profile-modal-card::-webkit-scrollbar-track{
    background: rgba(2,6,23,0.25);
    border-radius: 999px;
}
.profile-modal-card::-webkit-scrollbar-thumb{
    background: rgba(148,163,184,0.35);
    border-radius: 999px;
    border: 2px solid rgba(2,6,23,0.25);
}
.profile-modal-card::-webkit-scrollbar-thumb:hover{
    background: rgba(148,163,184,0.5);
}

/* ===============================
   CONFIRM MODAL (no browser confirm)
================================ */
.mmo-confirm-backdrop{
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    z-index: 900000; /* above profile modal + mod tools */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.mmo-confirm-card{
    width: min(520px, calc(100vw - 28px));
    background: rgba(20,25,34,0.96);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 16px;
    padding: 18px;
    position: relative;
    box-shadow: 0 16px 60px rgba(0,0,0,0.70);
}
.mmo-confirm-title{
    font-weight: 900;
    font-size: 18px;
    margin-bottom: 8px;
}
.mmo-confirm-message{
    opacity: .85;
    font-size: 13px;
    line-height: 1.35;
    margin-bottom: 14px;
}
.mmo-confirm-actions{
    display:flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ===============================
   VOTING PANEL (dashboard overlay)
================================ */
.vote-card{
    max-height: calc(100vh - 120px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.vote-head{
    display:flex;
    align-items:flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-right: 44px;
}
.vote-actions{ display:flex; gap:10px; align-items:center; }
.vote-grid{
    margin-top: 12px;
    display:grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding-right: 4px;
}
.vote-room{ cursor:pointer; }
.vote-room input{ display:none; }
.vote-room-card{
    border:1px solid var(--text-muted);
    background: var(--bg-container);
    border-radius: 4px;
    padding: 12px;
    height: 100%;
    display:flex;
    flex-direction: column;
    gap: 8px;
}
.vote-room input:checked + .vote-room-card{
    border-color: var(--accent-yellow);
    box-shadow: inset 0 0 0 1px var(--accent-hover);
}
.vote-room-top{
    display:flex;
    align-items:flex-start;
    justify-content: space-between;
    gap: 10px;
}
.vote-room-name{ font-weight: 900; font-size: 13px; white-space:nowrap; overflow:hidden; text-overflow: ellipsis; }
.vote-room-desc{ min-height: 32px; line-height: 1.2; }
.vote-room-prev{
    border:1px solid var(--text-muted);
    background: var(--bg-container);
    border-radius: 4px;
    padding: 8px;
    display:flex;
    justify-content:center;
    align-items:center;
}
.vote-room-canvas{ width: 64px; height: 64px; image-rendering: pixelated; border-radius: 4px; }
.vote-footer{
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--text-muted);
    display:flex;
    align-items:center;
    justify-content: space-between;
    gap: 12px;
}

.input-mmo::placeholder {
    color: var(--text-muted);
}

.input-mmo:focus {
    outline: none;
    border-color: var(--text-secondary);
    box-shadow:
        0 0 0 2px var(--bg-hover);
}

/* ===============================
   INLINE LINKS
================================ */
.link-inline {
    margin-top: 14px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.link-inline a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
}

.link-inline a:hover {
    text-decoration: underline;
}

/* ===============================
   NOTIFICATIONS (TOP TOAST)
================================ */
.mmo-notify {
    position: fixed;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000050; /* above inventory overlays + FAB */

    background: rgba(20,25,34,0.95);
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,0.55);

    padding: 16px 20px;
    width: 92%;
    max-width: 520px;

    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    opacity: 0;
    transform: translateX(-50%) translateY(-6px);
    transition:
      opacity var(--notify-in-dur, 120ms) linear,
      transform var(--notify-in-dur, 120ms) linear;

    box-shadow:
        inset 0 0 0 1px rgba(255,255,255,0.10),
        inset 1px 1px 0 rgba(255,255,255,0.05),
        inset -1px -1px 0 rgba(0,0,0,0.60),
        0 3px 0 rgba(0,0,0,0.35);
}

.mmo-notify.is-in{
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.mmo-notify.is-out{
    opacity: 0;
    transform: translateX(-50%) translateY(-6px);
    transition:
      opacity var(--notify-out-dur, 1800ms) linear,
      transform var(--notify-out-dur, 1800ms) linear;
}

.mmo-notify-left{
    display:flex;
    align-items:center;
    gap: 12px;
    min-width: 0;
}
.mmo-notify-text{ min-width:0; }
.mmo-notify.with-icon h3{ margin:0; }

.mmo-notify-iconWrap{
    width: 44px;
    height: 44px;
    border-radius: 4px;
    background: rgba(2,6,23,0.45);
    border: 1px solid rgba(0,0,0,0.55);
    display:flex;
    align-items:center;
    justify-content:center;
    flex: 0 0 auto;
    box-shadow:
      inset 0 0 0 1px rgba(255,255,255,0.10),
      inset 2px 2px 0 rgba(0,0,0,0.55),
      inset -2px -2px 0 rgba(255,255,255,0.04);
}
.mmo-notify-icon{
    width: 30px;
    height: 30px;
    image-rendering: pixelated;
}

.mmo-notify h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 900;
    color: var(--accent-yellow);
}

.mmo-notify p {
    margin: 4px 0 0;
    font-size: 0.85rem;
    color: #ffffff;
}

/* Bold emphasis inside notifications should be yellow */
.mmo-notify :is(strong, b){
    color: var(--accent-yellow);
    font-weight: 900;
}

.mmo-notify .close {
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.6;
    color: #ffffff;
}

.mmo-notify .close:hover {
    opacity: 1;
}

/* keyframes kept intentionally unused (legacy) */

/* ===============================
   HEADINGS
================================ */
h1, h2, h3 {
    margin: 0 0 16px;
    font-weight: 600;
    letter-spacing: 0.02em;
}


/* ===============================
   NAVBAR
================================ */

/* Solid navbar (used where glass feels wrong, e.g. profile page) */
nav.nav-solid{
    background: var(--bg-panel) !important;
    backdrop-filter: none !important;
}

.nav-item {
    background: var(--bg-container);
    border-radius: 4px;
    padding: 10px;
    position: relative;
    transition: background 90ms linear, border-color 90ms linear, box-shadow 90ms linear, filter 90ms linear, transform 90ms linear;
    border: 1px solid var(--accent-yellow); /* yellow outline buttons */
    box-shadow:
      inset 0 0 0 1px rgba(255,255,255,0.10),
      inset 1px 1px 0 rgba(255,255,255,0.05),
      inset -1px -1px 0 rgba(0,0,0,0.55),
      0 2px 0 rgba(0,0,0,0.35);
}

/* Profile nav item: avatar preview is larger than icon buttons, so reduce padding to match box size */
#navProfile.nav-item{
    padding: 4px;
}

.nav-item:hover {
    background: var(--bg-hover);
    filter: brightness(1.06);
    box-shadow:
      inset 0 0 0 1px rgba(255,255,255,0.14),
      inset 1px 1px 0 rgba(255,255,255,0.06),
      inset -1px -1px 0 rgba(0,0,0,0.60),
      0 2px 0 rgba(0,0,0,0.35);
}
.nav-item:hover { border-color: var(--accent-hover); }
.nav-item:active{
    transform: translateY(1px);
    filter: brightness(0.98);
    box-shadow:
      inset 0 0 0 1px rgba(255,255,255,0.08),
      inset 2px 2px 0 rgba(0,0,0,0.55),
      inset -2px -2px 0 rgba(255,255,255,0.04),
      0 1px 0 rgba(0,0,0,0.35);
}

.tooltip {
    position: absolute;
    bottom: -32px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-panel);
    color: #ffffff;
    font-size: 12px;
    font-weight: 900; /* navbar hover text bold */
    padding: 4px 8px;
    border-radius: 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 90ms linear;
    white-space: nowrap;
}

.nav-item:hover .tooltip {
    opacity: 1;
}

/* Generic tooltip trigger (non-navbar) */
.has-tooltip{ position: relative; display:inline-flex; }
.has-tooltip:hover .tooltip{ opacity: 1; }

/* Keep all navbar buttons identical (no special-case logout/login/register styling) */
.nav-item.logout,
.nav-item.login,
.nav-item.register{
    background: inherit;
}

/* Play button - prominent yellow styling */
.nav-item.nav-play-btn {
    background: var(--accent-yellow);
    border-color: var(--accent-yellow);
    box-shadow: 0 2px 8px rgba(245, 179, 1, 0.35);
}
.nav-item.nav-play-btn:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    filter: brightness(1.1);
    box-shadow: 0 4px 12px rgba(245, 179, 1, 0.5);
}
.nav-item.nav-play-btn img {
    filter: brightness(0);
}

/* Logo in navbar */
.nav-item.nav-logo {
    background: transparent;
    border: none;
    padding: 4px;
    margin-right: auto;
}
.nav-item.nav-logo:hover {
    background: transparent;
    filter: brightness(1.1);
}

/* Profile avatar outline (subtle, keeps current palette) */
#navProfile.nav-item{
    border-color: var(--text-muted);
    box-shadow:
      inset 0 0 0 1px var(--bg-hover),
      0 2px 0 rgba(31,41,51,0.25);
}

/* Neutral CTA buttons for Enter Realm / Create Account (no accent fills) */
.btn-mmo.neutral{
    background: var(--bg-panel) !important;
    border: 1px solid var(--accent-yellow) !important;
    box-shadow: inset 0 0 0 1px var(--bg-hover), 0 2px 0 rgba(31,41,51,0.25) !important;
    color: #ffffff !important;
    font-weight: 900;
}
.btn-mmo.neutral:hover{
    background: var(--bg-hover) !important;
    border-color: var(--accent-hover) !important;
}
.btn-mmo.neutral:active{
    transform: translateY(1px) !important;
}


/* ===============================
   AVATAR PREVIEW (CIRCLE + LAYERS)
================================ */
.avatar-nav {
    padding: 6px;
}

.nav-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--bg-container);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Canvas-based avatar (new system) */
.nav-avatar canvas,
.nav-avatar .avatar-canvas {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* Legacy .avatar inside nav-avatar */
.nav-avatar .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    background: var(--bg-container);
}

.nav-avatar img {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

/* MATCH YOUR WORKING AVATAR LAYOUT */
.nav-avatar .skin{
    bottom: -35%;
    width: 85%;
    z-index: 0;
}
.nav-avatar .body {
    bottom: -35%;
    width: 85%;
    z-index: 1;
}

.nav-avatar .eyes {
    top: 33%;
    width: 65%;
    left: 60%;
    z-index: 3;
}

.nav-avatar .head {
    top: 0;
    width: 95%;
    z-index: 2;
}

/* ===============================
   NAV BADGE + DROPDOWN (reports/mod tools)
================================ */
.nav-item{ position: relative; }
.nav-badge{
    position: absolute;
    right: -2px;
    top: -2px;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--accent-yellow);
    border: 2px solid var(--bg-panel);
    box-shadow: none;
}

.nav-dropdown{
    position: fixed;
    width: 220px;
    background: rgba(20,25,34,0.96);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 14px;
    box-shadow:
      inset 1px 1px 0 rgba(255,255,255,0.06),
      inset -1px -1px 0 rgba(0,0,0,0.55),
      0 18px 60px rgba(0,0,0,0.65);
    padding: 10px;
    z-index: 900000;
    backdrop-filter: none;
}
.nav-dropdown-title{
    font-weight: 900;
    font-size: 12px;
    letter-spacing: .08em;
    text-transform: uppercase;
    opacity: .75;
    padding: 6px 8px 8px 8px;
}
.nav-dropdown-item{
    width: 100%;
    text-align: left;
    background: rgba(2,6,23,0.55);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 10px 10px;
    font-weight: 800;
    margin-top: 8px;
}

/* ===============================
   RARITY GLOWS (inventory / tiles / notifications)
================================ */
.rarity-common{ --rarity-ring: rgba(255,255,255,0.22); --rarity-glow: transparent; --rarity-w: 1px; }
.rarity-uncommon{ --rarity-ring: #22c55e; --rarity-glow: rgba(34,197,94,0.10); --rarity-w: 1px; }
.rarity-rare{ --rarity-ring: #38bdf8; --rarity-glow: rgba(56,189,248,0.12); --rarity-w: 2px; }
.rarity-epic{ --rarity-ring: #a78bfa; --rarity-glow: rgba(167,139,250,0.14); --rarity-w: 2px; }
.rarity-legendary{ --rarity-ring: #fbbf24; --rarity-glow: rgba(251,191,36,0.18); --rarity-w: 3px; }

/* Apply the rarity frame only to real "tiles/cards" so text spans don't get weird overlays */
:is(.inv-tile, .inv-hover, .mmo-notify, .mmo-notify-iconWrap, .badge-slot-box, .badge-tile, .badge-tooltip, .badge-tooltip-portal).rarity-common,
:is(.inv-tile, .inv-hover, .mmo-notify, .mmo-notify-iconWrap, .badge-slot-box, .badge-tile, .badge-tooltip, .badge-tooltip-portal).rarity-uncommon,
:is(.inv-tile, .inv-hover, .mmo-notify, .mmo-notify-iconWrap, .badge-slot-box, .badge-tile, .badge-tooltip, .badge-tooltip-portal).rarity-rare,
:is(.inv-tile, .inv-hover, .mmo-notify, .mmo-notify-iconWrap, .badge-slot-box, .badge-tile, .badge-tooltip, .badge-tooltip-portal).rarity-epic,
:is(.inv-tile, .inv-hover, .mmo-notify, .mmo-notify-iconWrap, .badge-slot-box, .badge-tile, .badge-tooltip, .badge-tooltip-portal).rarity-legendary{
    position: relative;
}
:is(.inv-tile, .inv-hover, .mmo-notify, .mmo-notify-iconWrap, .badge-slot-box, .badge-tile, .badge-tooltip, .badge-tooltip-portal).rarity-common::after,
:is(.inv-tile, .inv-hover, .mmo-notify, .mmo-notify-iconWrap, .badge-slot-box, .badge-tile, .badge-tooltip, .badge-tooltip-portal).rarity-uncommon::after,
:is(.inv-tile, .inv-hover, .mmo-notify, .mmo-notify-iconWrap, .badge-slot-box, .badge-tile, .badge-tooltip, .badge-tooltip-portal).rarity-rare::after,
:is(.inv-tile, .inv-hover, .mmo-notify, .mmo-notify-iconWrap, .badge-slot-box, .badge-tile, .badge-tooltip, .badge-tooltip-portal).rarity-epic::after,
:is(.inv-tile, .inv-hover, .mmo-notify, .mmo-notify-iconWrap, .badge-slot-box, .badge-tile, .badge-tooltip, .badge-tooltip-portal).rarity-legendary::after{
    content: "";
    position: absolute;
    inset: 4px;
    border-radius: 10px;
    border: var(--rarity-w, 1px) solid var(--rarity-ring, rgba(255,255,255,0.18));
    box-shadow: inset 0 0 14px var(--rarity-glow, transparent);
    pointer-events: none;
    opacity: 0.95;
}
.nav-dropdown-item:hover{
    background: var(--bg-hover);
    border-color: var(--text-secondary);
}

/* Report modal tweaks */
.report-modal-card{ max-width: 720px; }

/* =========================
   Rooms browser (Habbo-ish, in our style)
   ========================= */
.room-search { width: min(420px, 100%); }
.room-search-input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 4px;
    background: var(--bg-container);
    border: 1px solid var(--text-muted);
    outline: none;
    color: var(--text-main);
}
.room-search-input:focus {
    border-color: var(--text-secondary);
    box-shadow: 0 0 0 2px var(--bg-hover);
}

.room-box {
    background: var(--bg-panel);
    border: 1px solid var(--text-muted);
    border-radius: 4px;
    padding: 14px;
}
.room-box-title {
    font-weight: 700;
    font-size: 12px;
    letter-spacing: .08em;
    text-transform: uppercase;
    opacity: .72;
    margin-bottom: 10px;
}

.room-list { display: flex; flex-direction: column; gap: 10px; }

.room-card {
    display: grid;
    grid-template-columns: 66px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    border-radius: 14px;
    background: color-mix(in srgb, var(--panel-glass) 88%, rgba(0,0,0,0.22));
    border: 1px solid rgba(0,0,0,0.28);
    position: relative;
    cursor: pointer;
    transition: transform .10s ease, border-color .10s ease, background .10s ease;
}
.room-card:hover {
    transform: translateY(-1px);
    border-color: rgba(0,0,0,0.36);
    background: color-mix(in srgb, var(--panel-glass) 92%, rgba(0,0,0,0.26));
}
.room-card:focus { outline: none; box-shadow: 0 0 0 3px var(--accent-yellow); }

.room-card-preview {
    width: 66px;
    height: 44px;
    border-radius: 4px;
    border: 1px solid var(--text-muted);
    background: var(--bg-container);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.room-card-preview img { width: 100%; height: 100%; object-fit: cover; opacity: .9; }

.room-card-name {
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.room-card-sub { display: flex; gap: 8px; align-items: center; margin-top: 2px; font-size: 12px; opacity: .85; }

.room-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.08);
    font-weight: 700;
}
.room-pill.full { background: var(--bg-container); border-color: var(--text-muted); }
.room-pill.ok { background: var(--accent-yellow); border-color: var(--accent-yellow); color: var(--text-main); }

.room-card-action { display: flex; align-items: center; gap: 8px; }
.room-card-action .btn-mini { white-space: nowrap; }

/* hover details */
.room-card-hover {
    position: absolute;
    left: 12px;
    right: 12px;
    top: calc(100% + 8px);
    background: color-mix(in srgb, var(--panel-glass) 92%, rgba(0,0,0,0.28));
    border: 1px solid rgba(0,0,0,0.32);
    border-radius: 14px;
    padding: 10px 12px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-4px);
    transition: opacity .12s ease, transform .12s ease;
    z-index: 80;
}
.room-card:hover .room-card-hover {
    opacity: 1;
    transform: translateY(0);
}

.room-card--global .room-card-preview {
    background: var(--bg-container);
}

.room-featured {
    border-radius: 14px;
    background: rgba(0,0,0,.28);
    border: 1px solid rgba(255,255,255,.06);
    padding: 12px;
    min-height: 84px;
}

/* =========================
   Rooms browser (portrait list + hover popover)
   ========================= */
/* ===============================
   ROOM NAVIGATOR (matching site theme)
================================ */
.room-navigator {
    display: flex;
    flex-direction: column;
    min-height: 400px;
    max-height: min(620px, calc(100vh - 180px));
    border-radius: 16px;
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.06);
    overflow: hidden;
}

/* ─── Header ─── */
.room-nav-header {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    gap: 12px;
    flex-shrink: 0;
}
.room-nav-title {
    font-weight: 800;
    font-size: 15px;
    color: #fff;
}
.room-nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}
.room-nav-header .rooms-tabs {
    display: flex;
    gap: 4px;
}
.room-nav-header .rooms-tab {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    border-radius: 6px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.10);
    color: rgba(255,255,255,0.70);
    cursor: pointer;
    transition: all 0.15s ease;
}
.room-nav-header .rooms-tab:hover {
    background: rgba(255,255,255,0.14);
    color: #fff;
}
.room-nav-header .rooms-tab.is-active {
    background: var(--accent-yellow);
    border-color: var(--accent-yellow);
    color: #1a1a1a;
    font-weight: 800;
}
.room-nav-create {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.10);
    color: rgba(255,255,255,0.80);
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}
.room-nav-create:hover {
    background: var(--accent-yellow);
    border-color: var(--accent-yellow);
    color: #1a1a1a;
}

/* ─── Room List ─── */
.room-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ─── Section Headers (GLOBAL, PUBLIC ROOMS) ─── */
.room-nav-section {
    padding: 14px 4px 8px;
    font-weight: 800;
    font-size: 11px;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    color: var(--accent-yellow);
}
.room-nav-section:first-child { padding-top: 6px; }

/* ─── Room Card ─── */
.room-navigator .room-card {
    background: rgba(0,0,0,0.20);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease;
}
.room-navigator .room-card:hover {
    background: rgba(0,0,0,0.28);
    border-color: rgba(255,255,255,0.10);
}
.room-navigator .room-card[data-folded="false"] {
    border-color: var(--accent-yellow);
    background: rgba(0,0,0,0.30);
}

/* Card Header Row */
.room-navigator .room-card-header {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    gap: 12px;
}

/* 96x96 Preview Thumbnail */
.room-navigator .room-card-thumb {
    width: 64px;
    height: 64px;
    border-radius: 6px;
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.08);
    image-rendering: pixelated;
    flex-shrink: 0;
}

/* Info Column */
.room-navigator .room-card-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.room-navigator .room-card-name {
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.room-navigator .room-card-meta {
    font-size: 12px;
    color: rgba(255,255,255,0.55);
}

/* Chevron (yellow triangle) */
.room-navigator .room-card-chevron {
    flex-shrink: 0;
    width: 12px;
    height: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.room-navigator .room-card-chevron::before {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 7px solid var(--accent-yellow);
    transition: transform 0.15s ease;
}
.room-navigator .room-card[data-folded="false"] .room-card-chevron::before {
    transform: rotate(90deg);
}

/* Card Body (expanded content) */
.room-navigator .room-card-body {
    display: none;
    padding: 0 12px 12px;
    padding-left: 88px; /* align under text: 64px thumb + 12px gap + 12px padding */
}
.room-navigator .room-card[data-folded="false"] .room-card-body {
    display: block;
}
.room-navigator .room-card-desc {
    font-size: 13px;
    color: rgba(255,255,255,0.65);
    line-height: 1.4;
    margin-bottom: 10px;
}
.room-navigator .room-card-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.room-navigator .room-card-stat {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: rgba(255,255,255,0.70);
}
.room-navigator .room-card-stat img {
    width: 16px;
    height: 16px;
}
.room-navigator .room-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}
.room-navigator .room-card-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.10);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.12s ease;
}
.room-navigator .room-card-icon-btn:hover {
    background: rgba(255,255,255,0.16);
}
.room-navigator .room-card-icon-btn.danger:hover {
    background: rgba(220,50,50,0.35);
    border-color: rgba(220,50,50,0.5);
}
.room-navigator .room-card-icon-btn img {
    width: 18px;
    height: 18px;
}
.room-navigator .room-card-play {
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 700;
}

/* ─── Footer ─── */
.room-nav-footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    flex-shrink: 0;
}
.room-nav-load-more {
    width: 100%;
    padding: 8px;
    font-size: 12px;
    font-weight: 700;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    color: rgba(255,255,255,0.70);
    cursor: pointer;
    transition: all 0.12s ease;
}
.room-nav-load-more:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}
.room-nav-search-row {
    display: flex;
    gap: 8px;
}
.room-nav-footer .room-search-input {
    flex: 1;
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 13px;
    color: #fff;
}
.room-nav-footer .room-search-input::placeholder {
    color: rgba(255,255,255,0.40);
}
.room-nav-search-btn {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    background: var(--accent-yellow);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}
.room-nav-search-btn::before {
    content: '▶';
    font-size: 14px;
    color: #1a1a1a;
}

/* Legacy (keep for compatibility) */
.rooms-portrait-wrap {
    display: none;
}
.rooms-portrait {
    width: min(430px, 92vw);
    height: min(680px, calc(100vh - 190px));
    border-radius: 18px;
    background: color-mix(in srgb, var(--panel-glass) 86%, rgba(0,0,0,0.18));
    border: 1px solid rgba(0,0,0,0.30);
    padding: 14px;
    overflow: hidden;
}
.rooms-portrait-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}
.rooms-portrait-title { font-weight: 800; font-size: 14px; letter-spacing: .02em; }
.rooms-portrait-sub { font-size: 12px; opacity: .65; text-align: right; }

.rooms-section-title {
    margin-top: 10px;
    margin-bottom: 8px;
    font-weight: 800;
    font-size: 11px;
    letter-spacing: .10em;
    text-transform: uppercase;
    opacity: .70;
}

.room-rows {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: calc(100% - 140px);
    overflow: auto;
    padding-right: 6px;
}
.room-rows::-webkit-scrollbar { width: 8px; }
.room-rows::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 999px; }
.room-rows::-webkit-scrollbar-track { background: rgba(255,255,255,.04); border-radius: 999px; }

.room-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    background: color-mix(in srgb, var(--container-glass) 86%, rgba(0,0,0,0.16));
    border: 1px solid rgba(0,0,0,0.26);
    transition: transform .10s ease, background .10s ease, border-color .10s ease;
}

/* =========================
   Room play: realtime reaction FX (visual only)
   ========================= */
.tile-pulse{
    position: absolute;
    transform: translate(-50%, -50%);
    border-radius: 6px;
    pointer-events: none;
    animation: tilePulse 540ms ease-out both;
    border: 1px solid color-mix(in srgb, var(--pulse, #ffffff) 70%, rgba(0,0,0,0.25));
    box-shadow:
      0 0 0 2px color-mix(in srgb, var(--pulse, #ffffff) 35%, rgba(0,0,0,0.0)),
      0 10px 22px rgba(0,0,0,0.22);
    background: radial-gradient(circle at 50% 50%,
      color-mix(in srgb, var(--pulse, #ffffff) 18%, rgba(0,0,0,0.0)) 0%,
      rgba(0,0,0,0.0) 62%);
    opacity: 0.95;
}
@keyframes tilePulse{
    0% { transform: translate(-50%, -50%) scale(0.86); opacity: 0.0; }
    25%{ opacity: 0.95; }
    100%{ transform: translate(-50%, -50%) scale(1.35); opacity: 0.0; }
}

.hud-flyout{
    position: fixed;
    z-index: 220;
    pointer-events: none;
    font-weight: 900;
    font-size: 12px;
    color: #ffffff;
    text-shadow: 0 2px 0 rgba(0,0,0,0.35);
    animation: hudFly 1.05s ease-out both;
}
.hud-flyout-xp{
    color: var(--accent-yellow);
}
@keyframes hudFly{
    0% { transform: translateY(4px); opacity: 0; }
    15%{ opacity: 1; }
    100%{ transform: translateY(-14px); opacity: 0; }
}
.room-row:hover {
    transform: translateY(-1px);
    background: rgba(0,0,0,.30);
    border-color: rgba(255,255,255,.14);
}
.room-row-name {
    font-weight: 800;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.room-row-count {
    font-weight: 900;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.10);
    min-width: 54px;
    text-align: center;
}
.room-row--global .room-row-count { background: var(--accent-yellow); border-color: var(--accent-yellow); color: var(--text-main); }

/* ===============================
   ROOM CARDS (folded/unfolded)
================================ */
.room-card {
    background: rgba(0,0,0,0.22);
    border: 1px solid rgba(0,0,0,0.28);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.room-card:hover {
    background: rgba(0,0,0,0.28);
}
.room-card[data-folded="false"] {
    background: rgba(0,0,0,0.30);
    border-color: rgba(251,191,36,0.65);
}

.room-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
}

.room-card-thumb {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: #0b1020;
    border: 1px solid rgba(255,255,255,.1);
    image-rendering: pixelated;
    flex-shrink: 0;
}

.room-card-info {
    flex: 1;
    min-width: 0;
}

.room-card-name {
    font-weight: 700;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: rgba(255,255,255,0.92);
}

.room-card-meta {
    font-size: 11px;
    color: rgba(255,255,255,0.62);
    margin-top: 1px;
}

.room-card-chevron{
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 9px solid var(--accent-yellow);
    opacity: 0.95;
    margin-right: 6px;
    transition: transform .18s ease, opacity .18s ease;
}
.room-card[data-folded="false"] .room-card-chevron{
    transform: rotate(180deg);
    opacity: 1;
}

.room-card--global .room-card-name{
    color: var(--accent-yellow);
}

.room-card-body {
    display: none;
    padding: 0 10px 10px;
    padding-left: 64px; /* align with text after thumb */
    flex-direction: column;
    gap: 8px;
}
.room-card[data-folded="false"] .room-card-body {
    display: flex;
}

.room-card-desc {
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    line-height: 1.4;
    max-height: 40px;
    overflow: hidden;
}

.room-card-stats {
    display: flex;
    gap: 10px;
    font-size: 11px;
    color: rgba(255,255,255,0.5);
}

.room-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.room-card-play {
    padding: 8px 20px !important;
    font-weight: 700;
    font-size: 12px;
}

.room-card-settings {
    width: 32px;
    height: 32px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.1s ease;
}
.room-card-settings:hover {
    background: rgba(255,255,255,.15);
}

/* ===============================
   POPUP MODE (game opened from dashboard)
================================ */
body.popup-mode .navbar,
body.popup-mode nav,
body.popup-mode footer,
body.popup-mode .chat-widget,
body.popup-mode .chat-toggle,
body.popup-mode .chat-fab,
body.popup-mode .inv-fab,
body.popup-mode #inventoryFabBtn,
body.popup-mode .inventory-widget,
body.popup-mode #inventoryWidget,
body.popup-mode .store-widget,
body.popup-mode #storeWidget,
body.popup-mode .vote-fab,
body.popup-mode #voteFab,
body.popup-mode #fsExitBtn,
body.popup-mode .bg-animated,
body.popup-mode .bg-gradient,
body.popup-mode .bg-darken {
    display: none !important;
}
body.popup-mode .room-wrap {
    margin-top: 0 !important;
}
body.popup-mode {
    background: #0a0f1a !important;
}

/* Popup Loading Overlay */
#popupLoadingOverlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.popup-loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    text-align: center;
}
.popup-loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255,255,255,0.15);
    border-top-color: var(--accent-yellow, #fbbf24);
    border-radius: 50%;
    animation: popupSpin 1s linear infinite;
}
@keyframes popupSpin {
    to { transform: rotate(360deg); }
}
.popup-loading-text {
    color: #fff;
    font-size: 20px;
    font-weight: 700;
}
.popup-loading-hint {
    color: rgba(255,255,255,0.6);
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
}



.rooms-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
}

/* Hover popover */
.room-popover {
    position: fixed;
    width: 320px;
    max-width: calc(100vw - 24px);
    background: var(--bg-panel);
    border: 1px solid var(--text-muted);
    border-radius: 16px;
    padding: 12px;
    z-index: 999;
    box-shadow: 0 14px 36px rgba(0,0,0,0.18);
    pointer-events: none; /* hover only; click happens on list */
}
.room-popover-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}
.room-popover-title {
    font-weight: 900;
    font-size: 14px;
    color: #1f2933;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.room-popover-meta {
    font-size: 12px;
    opacity: 1;
    color: #ffffff;
}
.room-popover-count {
    font-weight: 900;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--bg-container);
    border: 1px solid var(--text-muted);
    color: #ffffff;
    white-space: nowrap;
}
.room-popover-desc {
    margin-top: 8px;
    font-size: 12px;
    opacity: 1;
    color: #ffffff;
    line-height: 1.35;
    max-height: 60px;
    overflow: hidden;
}
.room-popover-preview {
    margin-top: 10px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--text-muted);
    background: var(--bg-container);
}
.room-popover-preview canvas {
    display: block;
    width: 100%;
    height: auto;
    image-rendering: pixelated;
}

/* ===============================
   QUESTS (DASHBOARD)
================================ */
.quests-panel {
    background: var(--bg-panel);
    border: 1px solid var(--text-muted);
    border-radius: 4px;
    padding: 14px;
}

/* ===============================
   WEEKLY HISCORES (DASHBOARD)
================================ */
.weekly-panel{
    background: rgba(0,0,0,.25);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 16px;
    padding: 14px;
    margin-bottom: 12px;
}
.weekly-head{
    display:flex;
    align-items:flex-start;
    justify-content: space-between;
    gap: 12px;
}
.weekly-title{ font-weight: 900; font-size: 14px; }
.weekly-sub{ opacity: .7; font-size: 12px; margin-top:2px; }
.weekly-tabs{
    margin-top: 10px;
    display: inline-flex;
    gap: 6px;
    padding: 4px;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.10);
    flex-wrap: wrap;
}
.weekly-tab{
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.85);
    font-weight: 900;
    font-size: 12px;
    padding: 7px 10px;
    border-radius: 999px;
    cursor: pointer;
}
.weekly-tab:hover{ background: rgba(255,255,255,0.08); }
.weekly-tab.is-active{
    background: var(--accent-yellow);
    border: 1px solid var(--accent-yellow);
    color: var(--text-main);
}
.weekly-desc{
    margin-top: 10px;
    opacity: .75;
    font-size: 12px;
}
.weekly-body{ margin-top: 10px; display:flex; flex-direction:column; gap: 10px; }
.weekly-row{
    display:flex;
    align-items:center;
    gap: 10px;
    padding: 10px;
    border-radius: 14px;
    background: rgba(2,6,23,.35);
    border: 1px solid rgba(255,255,255,.08);
}
.weekly-rank{ width: 36px; font-weight: 900; opacity: .85; }
.weekly-main{ min-width:0; }
.weekly-name{ font-weight: 900; color: var(--text-secondary); text-decoration:none; display:inline-block; max-width: 220px; overflow:hidden; text-overflow: ellipsis; white-space: nowrap; }
.weekly-name:hover{ text-decoration: underline; }
.weekly-subline{ opacity: .75; font-size: 12px; margin-top:2px; }
.weekly-prev{
    width: 72px;
    height: 72px;
    border-radius: 4px;
    border: 1px solid var(--text-muted);
    background: var(--bg-container);
    display:flex;
    align-items:center;
    justify-content:center;
}
.weekly-canvas{ width: 64px; height: 64px; image-rendering: pixelated; border-radius: 4px; }

.quests-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.quests-title {
    font-weight: 900;
    font-size: 16px;
}

.quests-sub {
    opacity: 0.7;
    font-size: 12px;
    margin-top: 2px;
}

.quests-section-title {
    font-weight: 800;
    font-size: 12px;
    opacity: 0.75;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 8px 0;
}

.quests-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quest-row {
    background: rgba(0,0,0,.25);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 10px 12px;
}

.quest-row.is-done {
    opacity: 0.75;
}

.quest-row.is-locked {
    opacity: 0.65;
    border-color: rgba(245,158,11,0.16);
}

.quest-row-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.quest-title {
    font-weight: 800;
    font-size: 13px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.quest-xp {
    font-size: 12px;
    opacity: 0.8;
    white-space: nowrap;
}

.quest-desc {
    margin-top: 4px;
    font-size: 12px;
    opacity: 0.7;
}

.quest-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.quest-progress-meta {
    font-size: 12px;
    opacity: 0.75;
    min-width: 52px;
    text-align: right;
}

.quest-bar {
    flex: 1;
    height: 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    overflow: hidden;
}

.quest-bar-fill {
    height: 100%;
    background: var(--accent-yellow);
}

.quest-empty {
    opacity: 0.7;
    font-size: 12px;
    padding: 8px 4px;
}

/* Quest Tiler Header (Tutorial section) */
.quest-tiler-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(251, 191, 36, 0.15);
    border-radius: 12px;
    margin-bottom: 12px;
}
.quest-tiler-avatar {
    width: 48px;
    height: 48px;
    position: relative;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(0,0,0,0.2);
}
.quest-tiler-avatar img {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    image-rendering: pixelated;
}
/* Avatar part positioning (matches nav-avatar style) */
.quest-tiler-avatar img:nth-child(1) { /* body */
    bottom: -35%;
    width: 85%;
    z-index: 1;
}
.quest-tiler-avatar img:nth-child(2) { /* eyes */
    top: 33%;
    width: 65%;
    left: 60%;
    z-index: 3;
}
.quest-tiler-avatar img:nth-child(3) { /* head */
    top: 0;
    width: 95%;
    z-index: 2;
}
.quest-tiler-info { flex: 1; min-width: 0; }
.quest-tiler-name {
    font-weight: 700;
    font-size: 15px;
    color: #fbbf24;
}
.quest-tiler-progress {
    font-size: 12px;
    opacity: 0.7;
    margin-top: 2px;
}

/* Next quest row (highlighted) */
.quest-row-next {
    background: rgba(251, 191, 36, 0.08);
    border-color: rgba(251, 191, 36, 0.25);
}
.quest-row-next .quest-title {
    color: #fbbf24;
}

/* Quest XP badge */
.quest-xp-badge {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
}

/* Quest actions */
.quest-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}

/* Guide start button glow */
.guide-start-btn {
    animation: guideGlow 1.5s ease-in-out infinite;
}
@keyframes guideGlow {
    0%, 100% { box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.2), 0 0 15px rgba(34, 197, 94, 0.3); }
}

/* Locked quest hint */
.quest-locked-hint {
    color: rgba(251, 191, 36, 0.8);
    margin-top: 6px;
}
.quest-locked-box {
    border: 1px solid rgba(245, 158, 11, 0.18);
    border-radius: 12px;
    padding: 10px 12px;
    background: rgba(245, 158, 11, 0.06);
}

/* Tutorial complete box */
.quest-complete-box {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: 12px;
    margin-bottom: 12px;
}
.quest-complete-icon {
    font-size: 32px;
}
.quest-complete-text {
    flex: 1;
}
.quest-complete-text strong {
    color: #22c55e;
    font-size: 14px;
}
.quest-complete-text div {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 4px;
}

/* ===============================
   DASHBOARD SPLIT (ROOMS + QUESTS)
================================ */
.dashboard-split {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
@media (min-width: 1024px) {
    .dashboard-split {
        flex-direction: row;
        align-items: flex-start;
    }
    .dashboard-rooms { flex: 1; min-width: 0; }
    .dashboard-quests {
        width: 380px;
        flex: 0 0 380px;
        position: sticky;
        top: 92px; /* below navbar */
        align-self: flex-start;
    }
}

/* Foldable panels (dashboard) */
.fold-panel{ overflow: hidden; }
.fold-head{
    width: 100%;
    border: 0;
    background: transparent;
    display:flex;
    align-items:center;
    justify-content: space-between;
    gap: 12px;
    padding: 0;
    margin: 0 0 10px 0;
    cursor: pointer;
}
.fold-title{ font-weight: 900; font-size: 14px; text-align:left; }
.fold-sub{ opacity: .7; font-size: 12px; margin-top:2px; text-align:left; }
.fold-icon{
    width: 16px;
    height: 16px;
    opacity: .8;
    transform: rotate(-90deg);
    transition: transform 140ms ease;
}
.fold-head.is-open .fold-icon{ transform: rotate(0deg); }
.fold-body{ display:block; }

.weekly-rewards-grid{
    margin-top: 10px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}
.weekly-reward-block{
    padding: 10px;
    border-radius: 14px;
    background: rgba(2,6,23,.35);
    border: 1px solid rgba(255,255,255,.08);
}
.weekly-reward-title{
    font-weight: 900;
    margin-bottom: 8px;
}
.weekly-reward-row{
    display:flex;
    align-items:center;
    gap: 10px;
    padding: 6px 0;
    font-size: 12px;
    opacity: .9;
}
.weekly-badge{
    width: 26px;
    height: 26px;
    image-rendering: pixelated;
    border-radius: 6px;
    background: rgba(0,0,0,.25);
    border: 1px solid rgba(255,255,255,.08);
    flex: 0 0 auto;
}

.weekly-badge-wrap{
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.weekly-badge-wrap .tooltip{
    top: 50%;
    left: calc(100% + 10px);
    bottom: auto;
    transform: translateY(-50%);
    max-width: none;
    white-space: nowrap;
    text-align: left;
    z-index: 30;
}
.weekly-badge-wrap:hover .tooltip{
    opacity: 1;
}

/* Rooms tabs (Public / My rooms) */
.rooms-tabs {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.10);
}
.rooms-tab {
    appearance: none;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.85);
    font-weight: 800;
    font-size: 12px;
    padding: 7px 10px;
    border-radius: 999px;
    transition: background 160ms ease, transform 160ms ease;
}
.rooms-tab:hover { background: rgba(255,255,255,0.08); transform: translateY(-1px); }
.rooms-tab.is-active {
    background: rgba(245,158,11,0.16);
    border: 1px solid rgba(245,158,11,0.35);
    color: rgba(255,255,255,0.95);
}

.room-row.room-row--placeholder {
    opacity: 0.55;
    cursor: default !important;
}
.room-row.room-row--placeholder:hover {
    transform: none;
    border-color: rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.22);
}

/* ===============================
   TUTORIAL GUIDE OVERLAY + GLOW
================================ */
.tg-overlay {
    position: fixed;
    inset: 0;
    z-index: 200000;
    pointer-events: none;
}

.tg-dim {
    position: absolute;
    inset: 0;
    /* Keep the screen clear; only a very subtle tint so the guide card reads well. */
    background: rgba(0,0,0,0.08);
    backdrop-filter: none;
}

.tg-card {
    position: fixed;
    z-index: 200001;
    width: min(360px, calc(100vw - 24px));
    background: rgba(0,0,0,0.92);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 16px;
    box-shadow: 0 18px 60px rgba(0,0,0,0.65);
    padding: 12px 12px 10px 12px;
    pointer-events: auto;
}

.tg-title {
    font-weight: 900;
    font-size: 14px;
}

.tg-text {
    margin-top: 6px;
    font-size: 12px;
    opacity: 0.85;
    line-height: 1.35;
}

.tg-meta {
    margin-top: 8px;
    font-size: 11px;
    opacity: 0.65;
}

.tg-actions {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 10px;
}

.tg-actions .btn-mini {
    padding: 8px 10px;
}

@keyframes tgBreath {
    0%   { box-shadow: 0 0 0 0 rgba(245,158,11,0.0), 0 0 0 0 rgba(245,158,11,0.0); transform: translateZ(0); }
    50%  { box-shadow: 0 0 0 6px rgba(245,158,11,0.18), 0 0 22px 6px rgba(245,158,11,0.35); }
    100% { box-shadow: 0 0 0 0 rgba(245,158,11,0.0), 0 0 0 0 rgba(245,158,11,0.0); }
}

.tg-glow {
    position: relative;
    z-index: 200002 !important;
    border-radius: 12px;
    outline: 2px solid rgba(245,158,11,0.65) !important;
    animation: tgBreath 1.4s ease-in-out infinite;
}

.tg-glow.tg-glow--circle {
    border-radius: 999px;
}

/* Guide button glow (dashboard quests) */
.guide-glow {
    outline: 2px solid rgba(245,158,11,0.65) !important;
    border-radius: 12px;
    animation: tgBreath 1.4s ease-in-out infinite;
}

/* ===============================
   MOD TOOLS (OVERLAY)
================================ */
.modtools-window{
    position: fixed;
    left: 24px;
    top: 92px;
    width: min(980px, calc(100vw - 48px));
    height: min(640px, calc(100vh - 140px));
    min-width: 740px;
    min-height: 420px;
    max-width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    background: var(--panel-glass);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 16px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.75);
    z-index: 500000;
    overflow: hidden;
    display: none;
    resize: both;
    color-scheme: dark;
}
.modtools-window *{ user-select: text; }
.modtools-window .mt-header{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    cursor: move;
    user-select: none;
}
.modtools-window .mt-title{
    font-weight: 900;
    letter-spacing: 0.02em;
}
.modtools-window .mt-close{
    width: 34px;
    height: 34px;
    border-radius: 4px;
    border: 1px solid var(--text-muted);
    background: var(--bg-container);
    color: var(--text-main);
}
.modtools-window .mt-body{
    height: calc(100% - 54px);
    display:flex;
    min-height: 0;
}
.modtools-window .mt-tabs{
    width: 170px;
    border-right: 1px solid var(--text-muted);
    padding: 10px;
    display:flex;
    flex-direction: column;
    gap: 8px;
    overflow:auto;
}
.modtools-window .mt-tab{
    width: 100%;
    padding: 10px 10px;
    border-radius: 4px;
    border: 1px solid var(--text-muted);
    background: var(--bg-container);
    color: var(--text-main);
    text-align:left;
    font-weight: 700;
}
.modtools-window .mt-tab.is-active{
    border-color: var(--accent-yellow);
    background: var(--bg-hover);
}
.modtools-window .mt-panel{
    flex: 1;
    padding: 12px;
    overflow: auto;
    min-width: 0;
}
.modtools-window .mt-panel,
.modtools-window .mt-tabs{
    scrollbar-width: thin;
    scrollbar-color: var(--text-muted) var(--bg-container);
}
.modtools-window .mt-panel::-webkit-scrollbar,
.modtools-window .mt-tabs::-webkit-scrollbar{
    width: 10px;
    height: 10px;
}
.modtools-window .mt-panel::-webkit-scrollbar-thumb,
.modtools-window .mt-tabs::-webkit-scrollbar-thumb{
    background: var(--text-muted);
    border-radius: 999px;
    border: 2px solid var(--bg-panel);
}
.modtools-window .mt-panel::-webkit-scrollbar-track,
.modtools-window .mt-tabs::-webkit-scrollbar-track{
    background: var(--bg-container);
    border-radius: 999px;
}
.mt-row{ display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.mt-input{
    height: 38px;
    border-radius: 4px;
    border: 1px solid var(--text-muted);
    background: var(--bg-container);
    color: var(--text-main);
    padding: 0 12px;
}
select.mt-input{
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 34px;
    background-image:
      linear-gradient(45deg, transparent 50%, rgba(255,255,255,0.65) 50%),
      linear-gradient(135deg, rgba(255,255,255,0.65) 50%, transparent 50%);
    background-position:
      calc(100% - 16px) 16px,
      calc(100% - 11px) 16px;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}
.modtools-window select.mt-input option{
    background: var(--bg-container);
    color: var(--text-main);
}
.modtools-window select.mt-input optgroup{
    background: var(--bg-container);
    color: var(--text-secondary);
}
.mt-file{
    display:inline-flex;
    align-items:center;
    gap:10px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.05);
    padding: 6px 10px;
    border-radius: 12px;
    height: 38px;
}
.mt-file input[type="file"]{
    display:none;
}
.mt-file .mt-file-name{
    font-size: 12px;
    opacity: 0.8;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mt-table{ width: 100%; border-collapse: collapse; margin-top: 10px; }
.mt-table{ min-width: 980px; }
.mt-table th, .mt-table td{ padding: 8px 10px; border-bottom: 1px solid rgba(255,255,255,0.08); font-size: 13px; }
.mt-table th{ position: sticky; top: 0; background: rgba(99,137,151,0.98); text-align:left; z-index: 1; }
.mt-table tbody tr:hover{ background: rgba(255,255,255,0.04); }
.mt-pill{ display:inline-flex; padding:2px 8px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.05); font-size: 12px; }
.mt-actions{ display:flex; gap:6px; flex-wrap:wrap; }
.mt-btn{
    height: 32px;
    padding: 0 10px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.06);
    color: var(--text-main);
    font-weight: 800;
    font-size: 12px;
}
/* For mod-tools action accents use palette muted + yellow hover */
.mt-btn.red,
.mt-btn.green,
.mt-btn.blue{
    border-color: var(--text-muted);
    background: var(--bg-container);
}
.mt-btn.red:hover,
.mt-btn.green:hover,
.mt-btn.blue:hover{
    border-color: var(--accent-yellow);
    background: var(--bg-hover);
}

/* ===============================
   TEXT READABILITY RULES
   Dark containers → white text
   Light containers → dark text
================================ */

/* Dark backgrounds need WHITE text */
.quest-row,
.weekly-panel,
.weekly-row,
.weekly-tabs,
.quest-tiler-header,
.quest-complete-box,
.nav-dropdown,
.tg-card,
.tg-card-tiler,
.mmo-notify,
.mmo-confirm-card,
.vote-card,
.store-card,
.store-tile,
.inv-overlay,
.inv-card,
.badge-tooltip,
.badge-tooltip-portal,
[class*="modal-card"],
[style*="rgba(0"][style*="background"],
.glass-dark {
    color: #ffffff;
}

/* Ensure child elements also have white text in dark containers */
.quest-row *,
.weekly-panel *,
.weekly-row *,
.quest-tiler-header *,
.quest-complete-box *,
.nav-dropdown *,
.tg-card *,
.mmo-notify *,
.mmo-confirm-card *,
.vote-card *,
.store-card *,
.inv-overlay *,
.inv-card *,
.badge-tooltip *,
.glass-dark * {
    color: inherit;
}

/* Specific overrides for emphasis text on dark backgrounds */
.quest-row .quest-title,
.quest-tiler-name,
.weekly-title,
.tg-tiler-name {
    color: #fbbf24 !important; /* Yellow accent for titles */
}

/* Light backgrounds (teal/green theme) need DARK text */
.quests-panel,
.ui-panel,
.ui-subpanel,
.btn-mmo,
.room-card,
.chat-input,
footer {
    color: var(--text-main);
}

/* Muted/secondary text on dark backgrounds */
.quest-row .quest-desc,
.quest-row .quest-xp,
.quest-row .quest-progress-meta,
.weekly-subline,
.weekly-desc,
.tg-tiler-role,
.tg-meta {
    color: rgba(255, 255, 255, 0.7) !important;
}

/* Green accent for XP badges */
.quest-xp-badge {
    color: #22c55e !important;
}

/* Input fields in dark containers */
.quest-row input,
.inv-overlay input,
.store-card input,
.mmo-confirm-card input {
    color: #ffffff;
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Buttons inside dark containers */
.quest-row .btn-mmo,
.inv-overlay .btn-mmo,
.store-card .btn-mmo,
.tg-card .btn-mini {
    color: var(--text-main);
}

/* ===============================
   TC TILECLUB PANEL
================================ */
.tc-panel {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.08), rgba(0, 0, 0, 0.2));
    border: 1px solid rgba(255, 215, 0, 0.2);
}

.tc-panel .fold-title {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tc-title-icon {
    font-size: 1rem;
}

/* TC Status */
.tc-status {
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 12px;
}

.tc-status--active {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 215, 0, 0.05));
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.tc-status--inactive {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.tc-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    border-radius: 20px;
    margin-bottom: 12px;
    position: relative;
    overflow: hidden;
}

.tc-badge-glow {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: tc-shimmer 2s infinite;
}

@keyframes tc-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.tc-badge-text {
    font-weight: 700;
    font-size: 0.75rem;
    color: #1a1a1a;
    letter-spacing: 0.05em;
    position: relative;
    z-index: 1;
}

.tc-status-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.tc-status-info:last-child {
    border-bottom: none;
}

.tc-status-label {
    font-size: 0.8rem;
    opacity: 0.7;
}

.tc-status-value {
    font-weight: 600;
    font-size: 0.85rem;
}

.tc-days--low {
    color: #fca5a5;
}

/* TC Perks */
.tc-perks {
    margin-bottom: 12px;
}

.tc-perks-title {
    font-weight: 600;
    font-size: 0.8rem;
    opacity: 0.7;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tc-perks-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px 12px;
}

.tc-perks-list li {
    font-size: 0.75rem;
    opacity: 0.85;
    white-space: nowrap;
}

/* TC CTA */
.tc-cta {
    text-align: center;
    padding: 12px 0;
    margin-bottom: 12px;
}

.tc-cta-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #FFD700;
    margin-bottom: 4px;
}

.tc-cta-sub {
    font-size: 0.8rem;
    opacity: 0.7;
}

/* TC Actions */
.tc-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.tc-patreon-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #f96854, #ff424d);
    color: #fff;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.2s;
}

.tc-patreon-link:hover {
    background: linear-gradient(135deg, #ff424d, #f96854);
    transform: translateY(-1px);
}

.tc-patreon-icon {
    width: 18px;
    height: 18px;
}

.tc-link-btn,
.tc-verify-btn {
    padding: 8px 16px;
    background: rgba(255, 215, 0, 0.2);
    border: 1px solid rgba(255, 215, 0, 0.4);
    color: #FFD700;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.tc-link-btn:hover,
.tc-verify-btn:hover {
    background: rgba(255, 215, 0, 0.3);
}

.tc-link-btn:disabled,
.tc-verify-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tc-hint {
    font-size: 0.7rem;
    opacity: 0.6;
    text-align: center;
}

.tc-checking {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(255, 215, 0, 0.1);
    border-radius: 8px;
    color: #ffd700;
    font-size: 0.85rem;
}

.tc-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-top-color: #ffd700;
    border-radius: 50%;
    animation: tc-spin 0.8s linear infinite;
}

@keyframes tc-spin {
    to { transform: rotate(360deg); }
}

/* TC Patreon Linked Status */
.tc-patreon-linked,
.tc-patreon-not-linked {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    font-size: 0.8rem;
}

.tc-patreon-linked {
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.tc-patreon-not-linked {
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.tc-patreon-linked .tc-patreon-icon {
    opacity: 0.8;
}

.tc-patreon-linked .tc-verify-btn,
.tc-patreon-not-linked .tc-link-btn {
    margin-left: auto;
    padding: 4px 10px;
    font-size: 0.7rem;
}

/* TC Footer */
.tc-footer {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
}

.tc-unlink-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.7rem;
    cursor: pointer;
    padding: 4px 8px;
}

.tc-unlink-btn:hover {
    color: rgba(255, 255, 255, 0.7);
}

/* TC Avatar Glow */
.avatar-tc-glow {
    position: relative;
}

.avatar-tc-glow::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.4) 0%, transparent 70%);
    animation: tc-glow-pulse 2s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes tc-glow-pulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
}

/* TC Badge (for profile/usernames) */
.tc-user-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 1px 5px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    border-radius: 4px;
    font-size: 0.6rem;
    font-weight: 700;
    color: #1a1a1a;
    vertical-align: middle;
    margin-left: 4px;
}

/* ===============================
   TC MEMBER STYLES (Gold theming)
=============================== */

/* TC Avatar golden border (animated) */
.chat-avatar.tc-avatar,
.lobby-chat-bubble .chat-avatar.tc-avatar {
    box-shadow:
        0 0 0 2px #FFD700,
        0 0 8px rgba(255, 215, 0, 0.5);
    animation: tc-avatar-glow 2s ease-in-out infinite;
}

@keyframes tc-avatar-glow {
    0%, 100% { box-shadow: 0 0 0 2px #FFD700, 0 0 8px rgba(255, 215, 0, 0.4); }
    50% { box-shadow: 0 0 0 2px #FFA500, 0 0 12px rgba(255, 215, 0, 0.7); }
}

/* TC Username gold text with outline */
.chat-username.tc-username,
.lobby-chat-bubble .chat-username.tc-username {
    color: #FFD700 !important;
    text-shadow:
        0 0 1px rgba(0, 0, 0, 0.9),
        0 0 2px rgba(0, 0, 0, 0.7),
        0 1px 2px rgba(0, 0, 0, 0.5);
    font-weight: 800;
}

/* TC Chat bubble with gold border */
.chat-bubble.tc-bubble,
.lobby-chat-bubble.tc-bubble {
    border-color: rgba(255, 215, 0, 0.5) !important;
    box-shadow:
        inset 0 0 0 1px rgba(255, 215, 0, 0.15),
        0 0 10px rgba(255, 215, 0, 0.15);
}

/* ===============================
   ROOM UI IMPROVEMENTS
=============================== */

/* Larger text in room chat */
.lobby-chat-bubble .chat-text {
    font-size: 0.95rem;
}

.lobby-chat-bubble .chat-username {
    font-size: 0.85rem;
}

/* Icon buttons get higher z-index on hover (fixes overlap issues) */
.icon-btn:hover,
.btn-mmo:hover,
.btn-mini:hover {
    position: relative;
    z-index: 100;
}

/* Ensure palette and HUD buttons are always clickable in fullscreen */
#lobbyRoot:fullscreen .icon-btn,
#lobbyRoot:fullscreen .palette-panel .icon-btn,
#lobbyRoot:fullscreen button.icon-btn {
    position: relative;
    z-index: 150;
}

#lobbyRoot:fullscreen .icon-btn:hover,
#lobbyRoot:fullscreen button:hover,
#lobbyRoot:fullscreen .palette-panel .icon-btn:hover {
    z-index: 300 !important;
}

/* Palette panel buttons always above HUD overlays */
#lobbyRoot:fullscreen .palette-panel {
    z-index: 100 !important;
}

#lobbyRoot:fullscreen .palette-grid {
    position: relative;
    z-index: 120;
}

/* HUD control buttons (exit, toggle, settings) always on top */
#lobbyRoot:fullscreen #fsExitBtn,
#lobbyRoot:fullscreen #hudToggleBtn,
#lobbyRoot:fullscreen #chatToggleBtn,
#lobbyRoot:fullscreen #modeSwitchBtn,
#lobbyRoot:fullscreen .hud-control-btn {
    z-index: 250 !important;
}

#lobbyRoot:fullscreen #fsExitBtn:hover,
#lobbyRoot:fullscreen #hudToggleBtn:hover,
#lobbyRoot:fullscreen #chatToggleBtn:hover,
#lobbyRoot:fullscreen #modeSwitchBtn:hover,
#lobbyRoot:fullscreen .hud-control-btn:hover {
    z-index: 350 !important;
}

#playOverlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    pointer-events: none; /* Overlay itself doesn't capture - only children do */
}

/* Only the Play button inside the overlay captures touches */
#playOverlay > * {
    pointer-events: auto;
}

#playBtn {
    position: relative;
    z-index: 999999 !important;
    pointer-events: auto !important;
    user-select: none !important;
    min-width: 120px;
    min-height: 56px; /* iOS minimum tap target */
    cursor: pointer;
}

/* ===============================
   PROJECT VX - Global Styles
=============================== */

/* Hide Chat Widget and Inventory FAB globally (moved to game toolbar) */
#chatWidget,
#inventoryFabBtn,
.inv-fab {
    display: none !important;
}


    font-size: 0.8rem;
    opacity: 0.7;
}

/* TC Actions */
.tc-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.tc-patreon-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #f96854, #ff424d);
    color: #fff;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.2s;
}

.tc-patreon-link:hover {
    background: linear-gradient(135deg, #ff424d, #f96854);
    transform: translateY(-1px);
}

.tc-patreon-icon {
    width: 18px;
    height: 18px;
}

.tc-link-btn,
.tc-verify-btn {
    padding: 8px 16px;
    background: rgba(255, 215, 0, 0.2);
    border: 1px solid rgba(255, 215, 0, 0.4);
    color: #FFD700;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.tc-link-btn:hover,
.tc-verify-btn:hover {
    background: rgba(255, 215, 0, 0.3);
}

.tc-link-btn:disabled,
.tc-verify-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tc-hint {
    font-size: 0.7rem;
    opacity: 0.6;
    text-align: center;
}

.tc-checking {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(255, 215, 0, 0.1);
    border-radius: 8px;
    color: #ffd700;
    font-size: 0.85rem;
}

.tc-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-top-color: #ffd700;
    border-radius: 50%;
    animation: tc-spin 0.8s linear infinite;
}

@keyframes tc-spin {
    to { transform: rotate(360deg); }
}

/* TC Patreon Linked Status */
.tc-patreon-linked,
.tc-patreon-not-linked {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    font-size: 0.8rem;
}

.tc-patreon-linked {
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.tc-patreon-not-linked {
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.tc-patreon-linked .tc-patreon-icon {
    opacity: 0.8;
}

.tc-patreon-linked .tc-verify-btn,
.tc-patreon-not-linked .tc-link-btn {
    margin-left: auto;
    padding: 4px 10px;
    font-size: 0.7rem;
}

/* TC Footer */
.tc-footer {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
}

.tc-unlink-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.7rem;
    cursor: pointer;
    padding: 4px 8px;
}

.tc-unlink-btn:hover {
    color: rgba(255, 255, 255, 0.7);
}

/* TC Avatar Glow */
.avatar-tc-glow {
    position: relative;
}

.avatar-tc-glow::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.4) 0%, transparent 70%);
    animation: tc-glow-pulse 2s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes tc-glow-pulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
}

/* TC Badge (for profile/usernames) */
.tc-user-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 1px 5px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    border-radius: 4px;
    font-size: 0.6rem;
    font-weight: 700;
    color: #1a1a1a;
    vertical-align: middle;
    margin-left: 4px;
}

/* ===============================
   TC MEMBER STYLES (Gold theming)
=============================== */

/* TC Avatar golden border (animated) */
.chat-avatar.tc-avatar,
.lobby-chat-bubble .chat-avatar.tc-avatar {
    box-shadow:
        0 0 0 2px #FFD700,
        0 0 8px rgba(255, 215, 0, 0.5);
    animation: tc-avatar-glow 2s ease-in-out infinite;
}

@keyframes tc-avatar-glow {
    0%, 100% { box-shadow: 0 0 0 2px #FFD700, 0 0 8px rgba(255, 215, 0, 0.4); }
    50% { box-shadow: 0 0 0 2px #FFA500, 0 0 12px rgba(255, 215, 0, 0.7); }
}

/* TC Username gold text with outline */
.chat-username.tc-username,
.lobby-chat-bubble .chat-username.tc-username {
    color: #FFD700 !important;
    text-shadow:
        0 0 1px rgba(0, 0, 0, 0.9),
        0 0 2px rgba(0, 0, 0, 0.7),
        0 1px 2px rgba(0, 0, 0, 0.5);
    font-weight: 800;
}

/* TC Chat bubble with gold border */
.chat-bubble.tc-bubble,
.lobby-chat-bubble.tc-bubble {
    border-color: rgba(255, 215, 0, 0.5) !important;
    box-shadow:
        inset 0 0 0 1px rgba(255, 215, 0, 0.15),
        0 0 10px rgba(255, 215, 0, 0.15);
}

/* ===============================
   ROOM UI IMPROVEMENTS
=============================== */

/* Larger text in room chat */
.lobby-chat-bubble .chat-text {
    font-size: 0.95rem;
}

.lobby-chat-bubble .chat-username {
    font-size: 0.85rem;
}

/* Icon buttons get higher z-index on hover (fixes overlap issues) */
.icon-btn:hover,
.btn-mmo:hover,
.btn-mini:hover {
    position: relative;
    z-index: 100;
}

/* Ensure palette and HUD buttons are always clickable in fullscreen */
#lobbyRoot:fullscreen .icon-btn,
#lobbyRoot:fullscreen .palette-panel .icon-btn,
#lobbyRoot:fullscreen button.icon-btn {
    position: relative;
    z-index: 150;
}

#lobbyRoot:fullscreen .icon-btn:hover,
#lobbyRoot:fullscreen button:hover,
#lobbyRoot:fullscreen .palette-panel .icon-btn:hover {
    z-index: 300 !important;
}

/* Palette panel buttons always above HUD overlays */
#lobbyRoot:fullscreen .palette-panel {
    z-index: 100 !important;
}

#lobbyRoot:fullscreen .palette-grid {
    position: relative;
    z-index: 120;
}

/* HUD control buttons (exit, toggle, settings) always on top */
#lobbyRoot:fullscreen #fsExitBtn,
#lobbyRoot:fullscreen #hudToggleBtn,
#lobbyRoot:fullscreen #chatToggleBtn,
#lobbyRoot:fullscreen #modeSwitchBtn,
#lobbyRoot:fullscreen .hud-control-btn {
    z-index: 250 !important;
}

#lobbyRoot:fullscreen #fsExitBtn:hover,
#lobbyRoot:fullscreen #hudToggleBtn:hover,
#lobbyRoot:fullscreen #chatToggleBtn:hover,
#lobbyRoot:fullscreen #modeSwitchBtn:hover,
#lobbyRoot:fullscreen .hud-control-btn:hover {
    z-index: 350 !important;
}

#playOverlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    pointer-events: none; /* Overlay itself doesn't capture - only children do */
}

/* Only the Play button inside the overlay captures touches */
#playOverlay > * {
    pointer-events: auto;
}

#playBtn {
    position: relative;
    z-index: 999999 !important;
    pointer-events: auto !important;
    user-select: none !important;
    min-width: 120px;
    min-height: 56px; /* iOS minimum tap target */
    cursor: pointer;
}

/* ===============================
   PROJECT VX - Global Styles
=============================== */

/* Hide Chat Widget and Inventory FAB globally (moved to game toolbar) */
#chatWidget,
#inventoryFabBtn,
.inv-fab {
    display: none !important;
}


    font-size: 0.8rem;
    opacity: 0.7;
}

/* TC Actions */
.tc-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.tc-patreon-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #f96854, #ff424d);
    color: #fff;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.2s;
}

.tc-patreon-link:hover {
    background: linear-gradient(135deg, #ff424d, #f96854);
    transform: translateY(-1px);
}

.tc-patreon-icon {
    width: 18px;
    height: 18px;
}

.tc-link-btn,
.tc-verify-btn {
    padding: 8px 16px;
    background: rgba(255, 215, 0, 0.2);
    border: 1px solid rgba(255, 215, 0, 0.4);
    color: #FFD700;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.tc-link-btn:hover,
.tc-verify-btn:hover {
    background: rgba(255, 215, 0, 0.3);
}

.tc-link-btn:disabled,
.tc-verify-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tc-hint {
    font-size: 0.7rem;
    opacity: 0.6;
    text-align: center;
}

.tc-checking {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(255, 215, 0, 0.1);
    border-radius: 8px;
    color: #ffd700;
    font-size: 0.85rem;
}

.tc-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-top-color: #ffd700;
    border-radius: 50%;
    animation: tc-spin 0.8s linear infinite;
}

@keyframes tc-spin {
    to { transform: rotate(360deg); }
}

/* TC Patreon Linked Status */
.tc-patreon-linked,
.tc-patreon-not-linked {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    font-size: 0.8rem;
}

.tc-patreon-linked {
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.tc-patreon-not-linked {
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.tc-patreon-linked .tc-patreon-icon {
    opacity: 0.8;
}

.tc-patreon-linked .tc-verify-btn,
.tc-patreon-not-linked .tc-link-btn {
    margin-left: auto;
    padding: 4px 10px;
    font-size: 0.7rem;
}

/* TC Footer */
.tc-footer {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
}

.tc-unlink-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.7rem;
    cursor: pointer;
    padding: 4px 8px;
}

.tc-unlink-btn:hover {
    color: rgba(255, 255, 255, 0.7);
}

/* TC Avatar Glow */
.avatar-tc-glow {
    position: relative;
}

.avatar-tc-glow::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.4) 0%, transparent 70%);
    animation: tc-glow-pulse 2s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes tc-glow-pulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
}

/* TC Badge (for profile/usernames) */
.tc-user-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 1px 5px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    border-radius: 4px;
    font-size: 0.6rem;
    font-weight: 700;
    color: #1a1a1a;
    vertical-align: middle;
    margin-left: 4px;
}

/* ===============================
   TC MEMBER STYLES (Gold theming)
=============================== */

/* TC Avatar golden border (animated) */
.chat-avatar.tc-avatar,
.lobby-chat-bubble .chat-avatar.tc-avatar {
    box-shadow:
        0 0 0 2px #FFD700,
        0 0 8px rgba(255, 215, 0, 0.5);
    animation: tc-avatar-glow 2s ease-in-out infinite;
}

@keyframes tc-avatar-glow {
    0%, 100% { box-shadow: 0 0 0 2px #FFD700, 0 0 8px rgba(255, 215, 0, 0.4); }
    50% { box-shadow: 0 0 0 2px #FFA500, 0 0 12px rgba(255, 215, 0, 0.7); }
}

/* TC Username gold text with outline */
.chat-username.tc-username,
.lobby-chat-bubble .chat-username.tc-username {
    color: #FFD700 !important;
    text-shadow:
        0 0 1px rgba(0, 0, 0, 0.9),
        0 0 2px rgba(0, 0, 0, 0.7),
        0 1px 2px rgba(0, 0, 0, 0.5);
    font-weight: 800;
}

/* TC Chat bubble with gold border */
.chat-bubble.tc-bubble,
.lobby-chat-bubble.tc-bubble {
    border-color: rgba(255, 215, 0, 0.5) !important;
    box-shadow:
        inset 0 0 0 1px rgba(255, 215, 0, 0.15),
        0 0 10px rgba(255, 215, 0, 0.15);
}

/* ===============================
   ROOM UI IMPROVEMENTS
=============================== */

/* Larger text in room chat */
.lobby-chat-bubble .chat-text {
    font-size: 0.95rem;
}

.lobby-chat-bubble .chat-username {
    font-size: 0.85rem;
}

/* Icon buttons get higher z-index on hover (fixes overlap issues) */
.icon-btn:hover,
.btn-mmo:hover,
.btn-mini:hover {
    position: relative;
    z-index: 100;
}

/* Ensure palette and HUD buttons are always clickable in fullscreen */
#lobbyRoot:fullscreen .icon-btn,
#lobbyRoot:fullscreen .palette-panel .icon-btn,
#lobbyRoot:fullscreen button.icon-btn {
    position: relative;
    z-index: 150;
}

#lobbyRoot:fullscreen .icon-btn:hover,
#lobbyRoot:fullscreen button:hover,
#lobbyRoot:fullscreen .palette-panel .icon-btn:hover {
    z-index: 300 !important;
}

/* Palette panel buttons always above HUD overlays */
#lobbyRoot:fullscreen .palette-panel {
    z-index: 100 !important;
}

#lobbyRoot:fullscreen .palette-grid {
    position: relative;
    z-index: 120;
}

/* HUD control buttons (exit, toggle, settings) always on top */
#lobbyRoot:fullscreen #fsExitBtn,
#lobbyRoot:fullscreen #hudToggleBtn,
#lobbyRoot:fullscreen #chatToggleBtn,
#lobbyRoot:fullscreen #modeSwitchBtn,
#lobbyRoot:fullscreen .hud-control-btn {
    z-index: 250 !important;
}

#lobbyRoot:fullscreen #fsExitBtn:hover,
#lobbyRoot:fullscreen #hudToggleBtn:hover,
#lobbyRoot:fullscreen #chatToggleBtn:hover,
#lobbyRoot:fullscreen #modeSwitchBtn:hover,
#lobbyRoot:fullscreen .hud-control-btn:hover {
    z-index: 350 !important;
}

#playOverlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    pointer-events: none; /* Overlay itself doesn't capture - only children do */
}

/* Only the Play button inside the overlay captures touches */
#playOverlay > * {
    pointer-events: auto;
}

#playBtn {
    position: relative;
    z-index: 999999 !important;
    pointer-events: auto !important;
    user-select: none !important;
    min-width: 120px;
    min-height: 56px; /* iOS minimum tap target */
    cursor: pointer;
}

/* ===============================
   PROJECT VX - Global Styles
=============================== */

/* Hide Chat Widget and Inventory FAB globally (moved to game toolbar) */
#chatWidget,
#inventoryFabBtn,
.inv-fab {
    display: none !important;
}

