/**
 * TGP Interactive Maps — Frontend Stylesheet
 * Matches TGP Game Hub design tokens exactly.
 */

/* =============================================
   Design Tokens (mirrors game-hub.css)
   ============================================= */
:root {
    --tgpm-bg:             #19192a;
    --tgpm-surface:        rgba(255, 255, 255, 0.03);
    --tgpm-surface-hover:  rgba(255, 255, 255, 0.06);
    --tgpm-border:         rgba(255, 255, 255, 0.08);
    --tgpm-border-light:   rgba(255, 255, 255, 0.12);
    --tgpm-accent:         #ff8a00;
    --tgpm-accent-hover:   #ff9f2e;
    --tgpm-text:           #f0f0f5;
    --tgpm-text-muted:     rgba(255, 255, 255, 0.65);
    --tgpm-radius:         10px;
    --tgpm-radius-sm:      6px;
    --tgpm-radius-lg:      14px;
    --tgpm-shadow:         0 4px 20px rgba(0, 0, 0, 0.25);
    --tgpm-transition:     0.15s ease;
    --tgpm-sidebar-w:      300px;
}

/* =============================================
   Page wrapper
   ============================================= */
.tgpm-page {
    background: var(--tgpm-bg);
    min-height: 100vh;
    color: var(--tgpm-text);
}

.tgpm-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 16px;
}
@media (min-width: 1280px) {
    .tgpm-container { padding: 0 48px; }
}

/* =============================================
   Archive Hero
   ============================================= */
.tgpm-archive-hero {
    position: relative;
    min-height: 240px;
    display: flex;
    align-items: flex-end;
    background: var(--hero-bg, var(--tgpm-bg)) center / cover no-repeat;
    padding-bottom: 32px;
}
.tgpm-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(25,25,42,0.3) 0%,
        rgba(25,25,42,0.7) 60%,
        rgba(25,25,42,0.97) 100%
    );
}
.tgpm-hero-content {
    position: relative;
    z-index: 2;
}
.tgpm-archive-title {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 700;
    color: var(--tgpm-text);
    margin: 0 0 8px;
    line-height: 1.2;
}
.tgpm-archive-subtitle {
    font-size: 1rem;
    color: var(--tgpm-text-muted);
    margin: 0;
}

/* Breadcrumb */
.tgpm-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--tgpm-text-muted);
    margin-bottom: 12px;
}
.tgpm-breadcrumb a { color: var(--tgpm-accent); text-decoration: none; }
.tgpm-breadcrumb a:hover { text-decoration: underline; }

/* =============================================
   Sub nav bar
   ============================================= */
.tgpm-subnav {
    display: flex;
    gap: 10px;
    padding: 16px 0;
}
.tgpm-nav-btn,
.tgpm-topbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--tgpm-border-light);
    border-radius: var(--tgpm-radius);
    color: var(--tgpm-text);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--tgpm-transition);
    backdrop-filter: blur(8px);
}
.tgpm-nav-btn:hover,
.tgpm-topbar-btn:hover {
    background: var(--tgpm-surface-hover);
    border-color: var(--tgpm-accent);
    color: var(--tgpm-accent);
}
.tgpm-btn-accent {
    background: var(--tgpm-accent) !important;
    color: #161616 !important;
    border-color: var(--tgpm-accent) !important;
}
.tgpm-btn-accent:hover {
    background: var(--tgpm-accent-hover) !important;
    border-color: var(--tgpm-accent-hover) !important;
    color: #101010 !important;
}

/* =============================================
   Archive Body
   ============================================= */
.tgpm-archive-body {
    padding: 32px 0 64px;
}
.tgpm-empty {
    color: var(--tgpm-text-muted);
    font-size: 1rem;
    text-align: center;
    padding: 48px 0;
}

/* =============================================
   Games Grid (archive-maps.php)
   ============================================= */
.tgpm-games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.tgpm-game-card {
    display: block;
    background: var(--tgpm-surface);
    border: 1px solid var(--tgpm-border);
    border-radius: var(--tgpm-radius-lg);
    overflow: hidden;
    text-decoration: none;
    color: var(--tgpm-text);
    transition: all var(--tgpm-transition);
}
.tgpm-game-card:hover {
    border-color: var(--tgpm-accent);
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(255,138,0,0.15);
}
.tgpm-game-card-art {
    position: relative;
    aspect-ratio: 3/4;
    overflow: hidden;
    background: var(--tgpm-surface);
}
.tgpm-game-card-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    padding: 0;
    background: rgba(255,255,255,0.03);
    transition: transform 0.3s ease;
}
.tgpm-game-card:hover .tgpm-game-card-art img {
    transform: scale(1.04);
}
.tgpm-game-card-no-art {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tgpm-text-muted);
}
.tgpm-game-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(25,25,42,0.9) 0%, transparent 50%);
}
.tgpm-game-card-info {
    padding: 14px 16px;
}
.tgpm-game-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0 6px;
    line-height: 1.3;
}
.tgpm-game-card-count {
    display: block;
    font-size: 0.78rem;
    color: var(--tgpm-text-muted);
    margin-bottom: 10px;
}
.tgpm-explore-btn {
    display: inline-block;
    font-size: 0.82rem;
    color: var(--tgpm-accent);
    font-weight: 600;
}

/* =============================================
   Maps Grid (archive-maps-game.php)
   ============================================= */
.tgpm-maps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.tgpm-map-card {
    display: flex;
    flex-direction: column;
    background: var(--tgpm-surface);
    border: 1px solid var(--tgpm-border);
    border-radius: var(--tgpm-radius-lg);
    overflow: hidden;
    text-decoration: none;
    color: var(--tgpm-text);
    transition: all var(--tgpm-transition);
}
.tgpm-map-card:hover {
    border-color: var(--tgpm-accent);
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(255,138,0,0.15);
}
.tgpm-map-card-thumb {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: var(--tgpm-surface);
}
.tgpm-map-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}
.tgpm-map-card:hover .tgpm-map-card-thumb img { transform: scale(1.04); }
.tgpm-map-card-no-preview {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tgpm-text-muted);
}
.tgpm-map-card-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(25,25,42,0.85);
    border: 1px solid var(--tgpm-border-light);
    color: var(--tgpm-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.tgpm-map-card-body { padding: 16px; }
.tgpm-map-card-title { font-size: 1rem; font-weight: 700; margin: 0 0 8px; }
.tgpm-map-card-desc  { font-size: 0.85rem; color: var(--tgpm-text-muted); margin: 0 0 12px; line-height: 1.5; }
.tgpm-map-card-meta  { display: flex; justify-content: space-between; align-items: center; }
.tgpm-map-card-markers { font-size: 0.78rem; color: var(--tgpm-text-muted); }
.tgpm-open-map { font-size: 0.82rem; color: var(--tgpm-accent); font-weight: 600; }

/* =============================================
   Map Viewer Page (full-screen)
   ============================================= */
.tgpm-map-page-wrap {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--tgpm-bg);
    overflow: hidden;
}

/* Top bar */
.tgpm-map-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: rgba(25,25,42,0.95);
    border-bottom: 1px solid var(--tgpm-border);
    backdrop-filter: blur(12px);
    z-index: 100;
    flex-shrink: 0;
}
.tgpm-map-topbar-left  { display: flex; gap: 8px; flex-shrink: 0; }
.tgpm-map-topbar-right { display: flex; gap: 8px; flex-shrink: 0; margin-left: auto; }
.tgpm-user-menu {
    position: relative;
}
.tgpm-user-menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px 6px 6px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--tgpm-border-light);
    border-radius: var(--tgpm-radius);
    color: var(--tgpm-text);
    cursor: pointer;
    transition: all var(--tgpm-transition);
    backdrop-filter: blur(8px);
}
.tgpm-user-menu-toggle:hover,
.tgpm-user-menu.is-open .tgpm-user-menu-toggle {
    border-color: var(--tgpm-accent);
    background: var(--tgpm-surface-hover);
}
.tgpm-user-menu-avatar {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    object-fit: cover;
    display: block;
    border: 1px solid rgba(255,255,255,0.16);
}
.tgpm-user-menu-name {
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.82rem;
    font-weight: 600;
}
.tgpm-user-menu-caret {
    font-size: 0.72rem;
    color: var(--tgpm-text-muted);
}
.tgpm-user-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    padding: 8px;
    background: rgba(25,25,42,0.98);
    border: 1px solid var(--tgpm-border-light);
    border-radius: 12px;
    box-shadow: 0 18px 50px rgba(0,0,0,0.35);
    display: none;
    z-index: 120;
}
.tgpm-user-menu.is-open .tgpm-user-menu-dropdown {
    display: block;
}
.tgpm-user-menu-item {
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: var(--tgpm-text);
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--tgpm-transition), color var(--tgpm-transition);
}
.tgpm-user-menu-item:hover {
    background: rgba(248,113,113,0.12);
    color: #fecaca;
}
.tgpm-map-topbar-center {
    flex: 1;
    min-width: 0;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.tgpm-map-topbar-title  { font-size: 1rem; font-weight: 700; margin: 0; color: var(--tgpm-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tgpm-map-topbar-desc   { font-size: 0.75rem; color: var(--tgpm-text-muted); margin: 2px 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Viewer layout */
.tgpm-map-viewer {
    display: flex;
    flex: 1;
    min-height: 0;
    position: relative;
}

/* Sidebar */
.tgpm-map-sidebar {
    width: var(--tgpm-sidebar-w);
    flex-shrink: 0;
    background: rgba(25,25,42,0.97);
    border-right: 1px solid var(--tgpm-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform var(--tgpm-transition), width var(--tgpm-transition);
    z-index: 50;
}
.tgpm-sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--tgpm-border);
    flex-shrink: 0;
}
.tgpm-sidebar-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0;
    color: var(--tgpm-text);
}
.tgpm-sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--tgpm-text-muted);
    font-size: 1rem;
    cursor: pointer;
    margin-left: auto;
    padding: 4px;
    line-height: 1;
    transition: color var(--tgpm-transition);
}
.tgpm-sidebar-close:hover { color: var(--tgpm-text); }

/* Search */
.tgpm-sidebar-search {
    padding: 12px 16px;
    border-bottom: 1px solid var(--tgpm-border);
    flex-shrink: 0;
    position: relative;
}
.tgpm-sidebar-search input {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--tgpm-border-light);
    border-radius: var(--tgpm-radius-sm);
    padding: 8px 12px;
    color: var(--tgpm-text);
    font-size: 0.85rem;
    outline: none;
    box-sizing: border-box;
    transition: border-color var(--tgpm-transition);
}
.tgpm-sidebar-search input:focus { border-color: var(--tgpm-accent); }
.tgpm-sidebar-search input::placeholder { color: var(--tgpm-text-muted); }
.tgpm-search-results {
    position: absolute;
    left: 16px; right: 16px;
    background: #1e1e30;
    border: 1px solid var(--tgpm-border-light);
    border-radius: var(--tgpm-radius-sm);
    margin-top: 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 200;
    display: none;
}
.tgpm-search-result-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.83rem;
    color: var(--tgpm-text);
    border-bottom: 1px solid var(--tgpm-border);
    display: flex;
    align-items: center;
    gap: 8px;
}
.tgpm-search-result-item:last-child { border-bottom: none; }
.tgpm-search-result-item:hover { background: var(--tgpm-surface-hover); }
.tgpm-search-no-results { padding: 10px 12px; color: var(--tgpm-text-muted); font-size: 0.83rem; text-align: center; }

/* Progress */
.tgpm-sidebar-progress {
    padding: 12px 16px;
    border-bottom: 1px solid var(--tgpm-border);
    flex-shrink: 0;
}
.tgpm-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--tgpm-text-muted);
    margin-bottom: 6px;
}
.tgpm-progress-bar {
    height: 4px;
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}
.tgpm-progress-fill {
    height: 100%;
    background: var(--tgpm-accent);
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%;
}
.tgpm-reset-progress {
    background: none;
    border: none;
    color: var(--tgpm-text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    transition: color var(--tgpm-transition);
}
.tgpm-reset-progress:hover { color: var(--tgpm-accent); }

/* Filters */
.tgpm-sidebar-filters {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}
.tgpm-filter-actions {
    display: flex;
    gap: 8px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--tgpm-border);
    margin-bottom: 4px;
}
.tgpm-filter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
}
.tgpm-filter-toggle-all {
    flex: 1;
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--tgpm-border);
    border-radius: var(--tgpm-radius-sm);
    color: var(--tgpm-text-muted);
    font-size: 0.75rem;
    padding: 4px 10px;
    cursor: pointer;
    transition: all var(--tgpm-transition);
}
.tgpm-filter-toggle-all:hover { border-color: var(--tgpm-accent); color: var(--tgpm-accent); }

.tgpm-filter-category { margin-bottom: 4px; }
.tgpm-filter-category-label {
    padding: 6px 16px 4px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--tgpm-text-muted);
    font-weight: 600;
}
.tgpm-filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    cursor: pointer;
    font-size: 0.83rem;
    color: var(--tgpm-text);
    transition: background var(--tgpm-transition);
    user-select: none;
}
.tgpm-filter-item:hover { background: var(--tgpm-surface-hover); }
.tgpm-filter-item input[type="checkbox"] { display: none; }
.tgpm-filter-icon { flex-shrink: 0; display: flex; align-items: center; }
.tgpm-filter-label { flex: 1; }
.tgpm-filter-count {
    margin-left: auto;
    min-width: 22px;
    text-align: right;
    font-size: 0.74rem;
    color: var(--tgpm-text-muted);
    font-weight: 700;
}
/* Bug 2 FIX: is-inactive keeps the item VISIBLE but greyed out.
   Markers are hidden on the map via layer removal (toggleType),
   while the sidebar entry remains, just dimmed. */
.tgpm-filter-item.is-inactive {
    background: rgba(255, 255, 255, 0.02);
}
.tgpm-filter-item.is-inactive .tgpm-filter-icon {
    opacity: 0.4;
    filter: grayscale(1) saturate(0.3);
}
.tgpm-filter-item.is-inactive .tgpm-filter-label {
    color: rgba(255, 255, 255, 0.38);
    text-decoration: line-through;
    text-decoration-color: rgba(255,255,255,0.25);
}
.tgpm-filter-item.is-inactive .tgpm-filter-count {
    color: rgba(255, 255, 255, 0.28);
}

.tgpm-no-types {
    color: var(--tgpm-text-muted);
    font-size: 0.83rem;
    padding: 16px;
    text-align: center;
}

/* Map canvas */
.tgpm-map-canvas-wrap {
    flex: 1;
    position: relative;
    overflow: hidden;
}
#tgpm_map_canvas {
    width: 100%;
    height: 100%;
    background: var(--tgpm-bg);
}

/* Filter toggle button (mobile + always visible) */
.tgpm-filter-toggle-btn {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 700;
    display: none; /* shown on mobile */
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(25,25,42,0.92);
    border: 1px solid var(--tgpm-border-light);
    border-radius: var(--tgpm-radius);
    color: var(--tgpm-text);
    font-size: 0.85rem;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: all var(--tgpm-transition);
}
.tgpm-filter-toggle-btn.is-shifted {
    transform: translateX(calc(min(var(--tgpm-sidebar-w), 85vw) - 24px));
}
.tgpm-filter-toggle-btn:hover { border-color: var(--tgpm-accent); color: var(--tgpm-accent); }

/* Tiles pending message */
.tgpm-tiles-pending {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tgpm-tiles-pending-inner {
    text-align: center;
    color: var(--tgpm-text-muted);
    padding: 32px;
}
.tgpm-tiles-pending-inner h3 { color: var(--tgpm-text); margin: 16px 0 8px; }
.tgpm-tiles-pending-inner p  { margin: 0; font-size: 0.9rem; }

/* =============================================
   Leaflet overrides
   ============================================= */
.leaflet-container {
    background: var(--tgpm-bg) !important;
    font-family: inherit !important;
}
/* Zoom controls — bottom right, away from filter button */
.leaflet-bottom.leaflet-right { bottom: 20px; right: 16px; }
.leaflet-control-zoom a {
    background: rgba(25,25,42,0.92) !important;
    border: 1px solid var(--tgpm-border-light) !important;
    color: var(--tgpm-text) !important;
    backdrop-filter: blur(8px);
    transition: all var(--tgpm-transition);
}
.leaflet-control-zoom a:hover {
    background: var(--tgpm-surface-hover) !important;
    border-color: var(--tgpm-accent) !important;
    color: var(--tgpm-accent) !important;
}

/* =============================================
   Marker styles (DivIcon rendered)
   ============================================= */
.tgpm-marker-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
    transition: transform 0.15s ease, filter 0.15s ease;
    cursor: pointer;
}
.tgpm-marker-icon:hover {
    transform: scale(1.15);
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.7));
}
.tgpm-marker-icon.is-found { opacity: 0.45; }
.tgpm-marker-icon.is-found svg { filter: grayscale(0.7); }
.tgpm-marker-icon.is-disabled { opacity: 0.78; }
.tgpm-marker-icon.is-disabled svg { filter: grayscale(1) brightness(0.78) saturate(0.35); }
.tgpm-marker-icon.is-found.is-disabled { opacity: 0.58; }

/* =============================================
   Popup styles
   ============================================= */
.leaflet-popup-content-wrapper {
    background: #1e1e30 !important;
    border: 1px solid var(--tgpm-border-light) !important;
    border-radius: var(--tgpm-radius-lg) !important;
    box-shadow: 0 8px 30px rgba(0,0,0,0.5) !important;
    padding: 0 !important;
    overflow: hidden;
    min-width: 220px;
    max-width: 300px;
}
.leaflet-popup-tip { background: #1e1e30 !important; }
.leaflet-popup-content { margin: 0 !important; }
.tgpm-popup { display: flex; flex-direction: column; }
.tgpm-popup-img-wrap {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
    text-decoration: none;
}
.tgpm-popup-img-wrap img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}
.tgpm-image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2500;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(5, 8, 18, 0.92);
    backdrop-filter: blur(6px);
}
.tgpm-image-lightbox.is-open {
    display: flex;
}
.tgpm-image-lightbox-inner {
    max-width: min(96vw, 1400px);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.tgpm-image-lightbox-image {
    max-width: 100%;
    max-height: calc(92vh - 52px);
    border-radius: 14px;
    box-shadow: 0 18px 70px rgba(0, 0, 0, 0.45);
}
.tgpm-image-lightbox-caption {
    color: var(--tgpm-text);
    font-size: 0.9rem;
    text-align: center;
}
.tgpm-image-lightbox-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(25, 25, 42, 0.84);
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}
body.tgpm-lightbox-open {
    overflow: hidden;
}
.tgpm-popup-body { padding: 14px 16px; }
.tgpm-popup-type {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--tgpm-accent);
    font-weight: 700;
    margin-bottom: 4px;
}
.tgpm-popup-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--tgpm-text);
    margin: 0 0 8px;
    line-height: 1.3;
}
.tgpm-popup-desc {
    font-size: 0.82rem;
    color: var(--tgpm-text-muted);
    margin: 0 0 12px;
    line-height: 1.5;
}
.tgpm-popup-desc p,
.tgpm-popup-desc ul,
.tgpm-popup-desc ol {
    margin: 0 0 10px;
}
.tgpm-popup-desc ul,
.tgpm-popup-desc ol {
    padding-left: 18px;
}
.tgpm-popup-desc a {
    color: #7dd3fc;
    text-decoration: underline;
}
.tgpm-popup-article {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    margin: 0;
    color: #1aff6e !important;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    padding: 6px 10px;
    border-radius: var(--tgpm-radius-sm);
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid #4ade80;
}
.tgpm-popup-items {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}
.tgpm-popup-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(255, 138, 0, 0.35);
    background: rgba(255, 138, 0, 0.08);
    color: #ffffff;
    font-size: 0.72rem;
    text-decoration: none;
}
.tgpm-popup-item:hover {
    border-color: rgba(255, 138, 0, 0.7);
    background: rgba(255, 138, 0, 0.16);
    color: #ffffff;
    text-decoration: none;
}
.tgpm-popup-item-icon {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255,255,255,0.06);
}
.tgpm-popup-item-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.tgpm-popup-item-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.tgpm-popup-item-name {
    color: #ffffff;
    font-weight: 700;
    font-size: 0.76rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tgpm-popup-item-type {
    color: rgba(255,255,255,0.68);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.tgpm-popup-article:hover {
    background: rgba(34, 197, 94, 0.88);
    border-color: #86efac;
    color: #052e16;
    text-decoration: none;
}
.tgpm-popup-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}
.tgpm-popup-found {
    width: auto;
    flex: 1;
    padding: 6px 10px;
    border-radius: var(--tgpm-radius-sm);
    border: 1px solid #fbbf24;
    background: rgba(251, 191, 36, 0.1);
    color: #fde68a;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--tgpm-transition);
    font-weight: 600;
}
.tgpm-popup-found:hover {
    background: rgba(251, 191, 36, 0.88);
    border-color: #fcd34d;
    color: #1f2937;
}
.tgpm-popup-found.is-found {
    background: rgba(74,222,128,0.12);
    border-color: #4ade80;
    color: #4ade80;
}
.tgpm-popup-found.is-found:hover {
    background: rgba(74,222,128,0.85);
    color: #052e16;
}

/* =============================================
   Submit modal
   ============================================= */
.tgpm-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(4px);
}
.tgpm-modal {
    background: #1e1e30;
    border: 1px solid var(--tgpm-border-light);
    border-radius: var(--tgpm-radius-lg);
    padding: 28px;
    max-width: 520px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}
.tgpm-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: var(--tgpm-text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    transition: color var(--tgpm-transition);
}
.tgpm-modal-close:hover { color: var(--tgpm-text); }
.tgpm-modal-title { font-size: 1.1rem; font-weight: 700; margin: 0 0 8px; color: var(--tgpm-text); }
.tgpm-modal-desc  { font-size: 0.85rem; color: var(--tgpm-text-muted); margin: 0 0 20px; line-height: 1.5; }

.tgpm-modal-position {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 0.82rem;
    color: var(--tgpm-text-muted);
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--tgpm-border);
    border-radius: var(--tgpm-radius-sm);
    padding: 8px 12px;
    margin-bottom: 16px;
}
.tgpm-position-label { color: var(--tgpm-accent); font-weight: 600; }

.tgpm-form-field { margin-bottom: 14px; }
.tgpm-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tgpm-form-field label {
    display: block;
    font-size: 0.82rem;
    color: var(--tgpm-text-muted);
    margin-bottom: 5px;
    font-weight: 500;
}
.tgpm-form-field input,
.tgpm-form-field select,
.tgpm-form-field textarea {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--tgpm-border-light);
    border-radius: var(--tgpm-radius-sm);
    padding: 9px 12px;
    color: var(--tgpm-text);
    font-size: 0.85rem;
    outline: none;
    box-sizing: border-box;
    transition: border-color var(--tgpm-transition);
    font-family: inherit;
}
.tgpm-form-field input:focus,
.tgpm-form-field select:focus,
.tgpm-form-field textarea:focus { border-color: var(--tgpm-accent); }
.tgpm-form-field select { cursor: pointer; }
.tgpm-form-field textarea { resize: vertical; }

.tgpm-modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.tgpm-btn-primary {
    flex: 1;
    padding: 10px 20px;
    background: var(--tgpm-accent);
    border: none;
    border-radius: var(--tgpm-radius);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--tgpm-transition);
}
.tgpm-btn-primary:hover { background: var(--tgpm-accent-hover); }
.tgpm-btn-ghost {
    padding: 10px 20px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--tgpm-border-light);
    border-radius: var(--tgpm-radius);
    color: var(--tgpm-text);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--tgpm-transition);
}
.tgpm-btn-ghost:hover { background: rgba(255,255,255,0.1); }

.tgpm-submit-feedback {
    margin-top: 14px;
    font-size: 0.85rem;
    text-align: center;
    border-radius: var(--tgpm-radius-sm);
    padding: 10px;
}
.tgpm-submit-feedback.is-success {
    background: rgba(74,222,128,0.1);
    color: #4ade80;
    border: 1px solid rgba(74,222,128,0.3);
}
.tgpm-submit-feedback.is-error {
    background: rgba(248,113,113,0.1);
    color: #f87171;
    border: 1px solid rgba(248,113,113,0.3);
}

/* =============================================
   Mobile & Tablet
   ============================================= */
@media (max-width: 1023px) {
    /* Sidebar becomes an overlay on mobile */
    .tgpm-map-sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        z-index: 500;
        transform: translateX(-100%);
        width: min(var(--tgpm-sidebar-w), 85vw);
        box-shadow: 4px 0 30px rgba(0,0,0,0.5);
    }
    .tgpm-map-sidebar.is-open {
        transform: translateX(0);
    }
    .tgpm-sidebar-close { display: flex; }
    .tgpm-filter-toggle-btn { display: flex; }
    .tgpm-map-canvas-wrap { width: 100%; }
    .tgpm-map-canvas-wrap .leaflet-pane,
    .tgpm-map-canvas-wrap .leaflet-top,
    .tgpm-map-canvas-wrap .leaflet-bottom { z-index: 300; }

    /* Topbar compact on mobile */
    .tgpm-map-topbar { flex-wrap: wrap; gap: 10px; align-items: stretch; }
    .tgpm-map-topbar-left  {
        order: 1;
        width: 100%;
        justify-content: space-between;
    }
    .tgpm-map-topbar-left .tgpm-topbar-btn:first-child { margin-right: auto; }
    .tgpm-map-topbar-left .tgpm-topbar-btn:last-child { margin-left: auto; }
    .tgpm-map-topbar-center { order: 2; flex-basis: 100%; text-align: left; }
    .tgpm-map-topbar-right  {
        order: 3;
        width: 100%;
        margin-left: 0;
    }
    .tgpm-map-topbar-right .tgpm-topbar-btn {
        width: 100%;
        justify-content: center;
    }
    .tgpm-user-menu {
        width: 100%;
    }
    .tgpm-user-menu-toggle {
        width: 100%;
        justify-content: center;
    }
    .tgpm-user-menu-dropdown {
        left: 0;
        right: 0;
        min-width: 0;
    }
}

@media (max-width: 767px) {
    .tgpm-games-grid  { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
    .tgpm-maps-grid   { grid-template-columns: 1fr; gap: 14px; }
    .tgpm-form-row    { grid-template-columns: 1fr; }
    .tgpm-archive-hero { min-height: 180px; padding-bottom: 24px; }
    .tgpm-subnav      { flex-wrap: wrap; }
    .tgpm-game-card-art img {
        object-fit: cover;
        object-position: center;
        padding: 0;
        background: rgba(255,255,255,0.03);
    }
    .tgpm-image-lightbox {
        padding: 16px;
    }
    .tgpm-image-lightbox-close {
        top: 12px;
        right: 12px;
    }
}

/* =============================================
   Popup — secondary actions (Report / Suggest Edit)
   ============================================= */
.tgpm-popup-secondary-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    border-top: 1px solid var(--tgpm-border);
    padding-top: 8px;
}
.tgpm-popup-report,
.tgpm-popup-suggest,
.tgpm-popup-copy-link {
    flex: 1;
    padding: 5px 8px;
    border-radius: var(--tgpm-radius-sm);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--tgpm-transition);
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.tgpm-popup-report svg,
.tgpm-popup-suggest svg {
    flex-shrink: 0;
}
.tgpm-popup-copy-link {
    background: rgba(148,163,184,0.12);
    border: 1px solid rgba(148,163,184,0.28);
    color: #e2e8f0;
}
.tgpm-popup-copy-link:hover {
    background: rgba(148,163,184,0.22);
    border-color: rgba(148,163,184,0.42);
}
.tgpm-popup-suggest {
    background: rgba(96,165,250,0.08);
    border: 1px solid rgba(96,165,250,0.35);
    color: #93c5fd;
}
.tgpm-popup-suggest:hover {
    background: rgba(96,165,250,0.2);
    border-color: #60a5fa;
    color: #bfdbfe;
}
.tgpm-popup-report {
    background: rgba(248,113,113,0.07);
    border: 1px solid rgba(248,113,113,0.3);
    color: #fca5a5;
}
.tgpm-popup-report:hover {
    background: rgba(248,113,113,0.18);
    border-color: #f87171;
    color: #fecaca;
}

/* =============================================
   Description formatting toolbar (submit modal)
   ============================================= */
.tgpm-desc-toolbar {
    display: flex;
    gap: 4px;
    margin-bottom: 6px;
}
.tgpm-toolbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--tgpm-border-light);
    border-radius: var(--tgpm-radius-sm);
    background: rgba(255,255,255,0.05);
    color: var(--tgpm-text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--tgpm-transition);
    line-height: 1;
    user-select: none;
}
.tgpm-toolbar-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: var(--tgpm-accent);
    color: var(--tgpm-accent);
}
.tgpm-toolbar-btn b { font-weight: 900; }
.tgpm-toolbar-btn i { font-style: italic; }

/* Waypoint direction arrow */
.tgpm-waypoint-arrow {
    background: transparent !important;
    border: none !important;
    pointer-events: none !important;
}

/* Text-label icon wrapper — no background, no border */
/* Target all possible Leaflet class combinations to guarantee no box */
.tgpm-text-label-icon,
.leaflet-marker-icon.tgpm-text-label-icon,
.leaflet-div-icon.tgpm-text-label-icon {
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    cursor: default !important;
    pointer-events: none !important;
    overflow: visible !important;
}
.tgpm-filter-item.is-persistent {
    border-color: rgba(251,191,36,0.45);
}

/* =============================================
   Report modal specifics
   ============================================= */
.tgpm-report-checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(248,113,113,0.06);
    border: 1px solid rgba(248,113,113,0.2);
    border-radius: var(--tgpm-radius-sm);
    cursor: pointer;
}
.tgpm-report-checkbox-row input[type="checkbox"] {
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: #f87171;
}
.tgpm-report-checkbox-label {
    font-size: 0.82rem;
    color: var(--tgpm-text-muted);
    line-height: 1.4;
    user-select: none;
}

/* =============================================
   Suggest Edit modal specifics
   ============================================= */
.tgpm-suggest-coords-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--tgpm-border);
    border-radius: var(--tgpm-radius-sm);
    margin-bottom: 16px;
    font-size: 0.82rem;
}
.tgpm-suggest-coords-label { color: var(--tgpm-accent); font-weight: 600; flex-shrink: 0; }
#tgpm_suggest_coords        { color: var(--tgpm-text-muted); flex: 1; }
.tgpm-place-btn {
    padding: 5px 12px;
    background: rgba(255,138,0,0.1);
    border: 1px solid rgba(255,138,0,0.4);
    border-radius: var(--tgpm-radius-sm);
    color: var(--tgpm-accent);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: all var(--tgpm-transition);
}
.tgpm-place-btn:hover {
    background: rgba(255,138,0,0.2);
    border-color: var(--tgpm-accent);
}

/* =============================================
   Shortcode embed — .tgpm-embed wraps the viewer
   ============================================= */
.tgpm-embed-wrap {
    position: relative;
    width: 100%;
    border: 1px solid var(--tgpm-border);
    border-radius: var(--tgpm-radius-lg);
    overflow: hidden;
    background: var(--tgpm-bg);
}
.tgpm-embed-viewer {
    display: flex;
    height: 600px;
}
.tgpm-embed-viewer .tgpm-map-sidebar {
    position: relative;
    transform: none;
    box-shadow: none;
}
.tgpm-embed-viewer .tgpm-map-canvas-wrap {
    flex: 1;
}
.tgpm-embed-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: rgba(25,25,42,0.97);
    border-bottom: 1px solid var(--tgpm-border);
}
.tgpm-embed-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--tgpm-text);
    margin: 0;
}
.tgpm-embed-link {
    font-size: 0.8rem;
    color: var(--tgpm-accent);
    text-decoration: none;
    font-weight: 600;
}
.tgpm-embed-link:hover { text-decoration: underline; }

/* =============================================
   Discord Auth Bar (inside modals)
   ============================================= */
.tgpm-discord-auth-bar {
    margin: 16px 0 4px;
    padding: 12px 14px;
    background: rgba(88, 101, 242, 0.08);
    border: 1px solid rgba(88, 101, 242, 0.25);
    border-radius: var(--tgpm-radius-sm);
}

.tgpm-discord-loggedout,
.tgpm-discord-loggedin {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tgpm-discord-auth-prompt {
    font-size: 0.82rem;
    color: var(--tgpm-text-muted);
    margin: 0 0 8px;
    width: 100%;
}

.tgpm-discord-login-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #5865f2;
    color: #fff;
    border: none;
    border-radius: var(--tgpm-radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--tgpm-transition);
}
.tgpm-discord-login-btn:hover { background: #4752c4; }
.tgpm-discord-login-btn svg { flex-shrink: 0; }
.tgpm-discord-login-btn span { line-height: 1; }

.tgpm-auth-modal {
    max-width: 460px;
    text-align: center;
}

.tgpm-auth-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 68px;
    height: 68px;
    margin: 0 auto 16px;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(88,101,242,0.2), rgba(88,101,242,0.08));
    border: 1px solid rgba(88, 101, 242, 0.35);
    color: #8ea1ff;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
}

.tgpm-auth-logo svg {
    display: block;
}

.tgpm-discord-login-btn-large {
    width: 100%;
    justify-content: center;
    padding: 12px 18px;
    margin-top: 6px;
    font-size: 0.95rem;
    border-radius: var(--tgpm-radius);
    box-shadow: 0 10px 24px rgba(88, 101, 242, 0.2);
}

.tgpm-discord-login-btn-large svg {
    display: block;
}

.tgpm-discord-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.tgpm-discord-username {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--tgpm-text);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tgpm-discord-logout-btn {
    margin-left: auto;
    padding: 4px 10px;
    background: transparent;
    border: 1px solid var(--tgpm-border-light);
    border-radius: var(--tgpm-radius-sm);
    color: var(--tgpm-text-muted);
    font-size: 0.78rem;
    cursor: pointer;
    transition: color var(--tgpm-transition), border-color var(--tgpm-transition);
    white-space: nowrap;
}
.tgpm-discord-logout-btn:hover {
    color: var(--tgpm-text);
    border-color: var(--tgpm-border-light);
}

/* =============================================
   Popup: Submitted by line
   ============================================= */
.tgpm-popup-submitter {
    font-size: 0.75rem;
    color: var(--tgpm-text-muted);
    margin: 6px 0 0;
}
.tgpm-popup-submitter span {
    color: var(--tgpm-text);
    font-weight: 600;
}
