/**
 * Lord of Chains - Mobile Stylesheet
 * Professional mobile-optimized styles
 * Loaded only on screens <= 768px
 */

/* ==========================================================================
   1. Mobile Base & Variables Override
   ========================================================================== */

:root {
    --mobile-spacing-xs: 0.5rem;
    --mobile-spacing-sm: 0.75rem;
    --mobile-spacing-md: 1rem;
    --mobile-spacing-lg: 1.5rem;
    --mobile-touch-target: 44px;
    --mobile-font-size-base: 16px;
}

/* Prevent horizontal scroll */
html, body {
    overflow-x: hidden;
    width: 100%;
}

/* Improve text rendering on mobile */
body {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* ==========================================================================
   2. Mobile Navigation & Header
   ========================================================================== */

/* Header adjustments */
.game-header {
    padding: 0 var(--mobile-spacing-sm);
    height: 56px;
}

/* Logo far left */
.header-left {
    flex: 0 0 auto;
}

.logo {
    font-size: 0.85rem;
}

.logo-full {
    display: inline;
}

.logo-short {
    display: none;
}

/* Hide desktop-only header elements on mobile */
.header-right {
    display: none !important;
}

/* Mobile header bar: Discord, Settings, Avatar (far right) */
.header-mobile-bar {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    justify-content: flex-end;
}

/* Mobile Menu Button - absolutely centered on screen */
.mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    height: 100%;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 2rem;
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    z-index: 1;
}

.mobile-menu-toggle.active {
    color: var(--color-primary);
}

/* Mobile header utility icons */
.mobile-header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.mobile-header-icon .header-icon-img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.mobile-header-icon .header-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}

.mobile-header-icon .header-avatar-placeholder {
    font-size: 1.25rem;
}

/* Timer banner - compact on mobile */
.timer-banner {
    top: 56px;
    height: 28px;
    gap: 0.5rem;
    font-size: 0.7rem;
    overflow: hidden;
}

.timer-banner-label {
    font-size: 0.6rem;
}

.timer-banner-item.alignment-hour-active {
    padding: 0 0.4rem;
    border: none;
    background: none;
    gap: 0.25rem;
}

.timer-banner-item.alignment-hour-active .timer-banner-label {
    font-size: 0.55rem;
}

/* Header nav: hidden by default on mobile, shown as dropdown when .open */
.header-nav {
    display: none;
    position: absolute;
    top: 84px; /* 56px header + 28px banner */
    left: 0;
    right: 0;
    background: var(--color-bg-light);
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    z-index: 200;
    flex-direction: column;
    padding: 0.25rem 0;
    max-height: calc(100vh - 84px - var(--footer-height));
    overflow-y: auto;
    overflow-anchor: none;
}

.header-nav.open {
    display: flex;
}

/* Mobile nav categories: full width, overlay dropdowns */
.nav-category {
    width: 100%;
    position: relative;
}

.nav-category-toggle {
    width: 100%;
    justify-content: center;
    text-align: center;
    padding: 0.4rem 1rem;
    font-size: 0.9375rem;
    min-height: 36px;
    border-bottom: 1px solid var(--color-border);
}

.nav-category-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    border: none;
    border-radius: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    background: var(--color-bg);
    padding: 0;
    z-index: 10;
}

.nav-dropdown-link {
    padding: 0.75rem 1rem;
    min-height: var(--mobile-touch-target);
    font-size: 0.875rem;
    justify-content: center;
    text-align: center;
}

.nav-dropdown-link .nav-badge {
    margin-left: 0;
}

/* Mobile utility buttons (visible at bottom of mobile dropdown) */
.mobile-nav-utilities {
    display: flex;
    flex-direction: column;
    border-top: 2px solid var(--color-border);
    padding: 0.5rem 0;
    margin-top: 0.5rem;
}

.mobile-nav-util-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    min-height: var(--mobile-touch-target);
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.875rem;
}

.mobile-nav-util-btn:hover,
.mobile-nav-util-btn:active {
    background: var(--color-bg-lighter);
    color: var(--color-primary);
}

.mobile-nav-util-btn .nav-icon-img,
.mobile-nav-util-btn .header-avatar {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.mobile-nav-util-form {
    display: contents;
}

.mobile-nav-logout {
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
    color: var(--color-danger, #ef4444);
    font-weight: 600;
}

/* ==========================================================================
   4. Mobile Main Content
   ========================================================================== */

.game-main {
    margin-left: 0;
    padding: var(--mobile-spacing-md);
    padding-top: var(--mobile-spacing-md);
    padding-bottom: 80px; /* Space for footer */
    max-width: 100vw;
    overflow-x: hidden;
}

.game-container {
    padding-top: 84px; /* 56px header + 28px banner */
    max-width: 100vw;
    overflow-x: hidden;
}

.page-header {
    margin-bottom: var(--mobile-spacing-md);
    padding-bottom: var(--mobile-spacing-sm);
}

.page-title {
    font-size: 1.25rem;
    word-wrap: break-word;
}

/* Hide duplicate "Notifications" title inside card (already shown in page-header) */
.notifications-page .card-header-title-text {
    display: none;
}

/* Ensure page content doesn't overflow */
.page-content {
    max-width: 100%;
    overflow-x: hidden;
}

/* ==========================================================================
   5. Mobile Cards & Panels
   ========================================================================== */

.card {
    border-radius: 10px;
    margin-bottom: var(--mobile-spacing-md);
}

.card-header {
    padding: var(--mobile-spacing-sm) var(--mobile-spacing-md);
    font-size: 0.9375rem;
}

.card-body {
    padding: var(--mobile-spacing-md);
}

.card-footer {
    padding: var(--mobile-spacing-sm) var(--mobile-spacing-md);
}

.panel {
    border-radius: 10px;
    margin-bottom: var(--mobile-spacing-md);
}

.panel-header {
    padding: var(--mobile-spacing-sm) var(--mobile-spacing-md);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.panel-body {
    padding: var(--mobile-spacing-md);
}

/* ==========================================================================
   6. Mobile Buttons - Touch Optimized
   ========================================================================== */

.btn {
    min-height: var(--mobile-touch-target);
    padding: 0.75rem 1.25rem;
    font-size: 0.9375rem;
    border-radius: 10px;
    /* Prevent double-tap zoom */
    touch-action: manipulation;
}

.btn:hover {
    transform: none; /* Disable hover transform on mobile */
}

.btn:active {
    transform: scale(0.98);
}

.btn-sm {
    min-height: 36px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.0625rem;
}

.btn-block {
    width: 100%;
}

/* Button groups - stack on mobile */
.btn-group,
.form-actions,
.profile-actions,
.header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* ==========================================================================
   7. Mobile Forms
   ========================================================================== */

.form-control {
    min-height: var(--mobile-touch-target);
    padding: 0.75rem 1rem;
    font-size: 16px; /* Prevents iOS zoom on focus */
    border-radius: 10px;
}

.form-group {
    margin-bottom: var(--mobile-spacing-md);
}

.form-group label {
    font-size: 0.9375rem;
    margin-bottom: 0.5rem;
}

select.form-control {
    /* Better mobile select appearance */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
    -webkit-appearance: none;
    appearance: none;
}

textarea.form-control {
    min-height: 120px;
}

.form-row {
    grid-template-columns: 1fr;
    gap: var(--mobile-spacing-md);
}

/* Checkbox and radio - larger touch targets */
.checkbox-label {
    min-height: var(--mobile-touch-target);
    padding: 0.5rem 0;
}

input[type="checkbox"],
input[type="radio"] {
    width: 22px;
    height: 22px;
}

/* Toggle switches */
.toggle-switch {
    min-height: var(--mobile-touch-target);
    padding: 0.5rem 0;
}

/* ==========================================================================
   8. Mobile Tables
   ========================================================================== */

.table-container {
    margin: 0 calc(-1 * var(--mobile-spacing-md));
    padding: 0 var(--mobile-spacing-md);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    min-width: 600px;
}

th, td {
    padding: 0.75rem;
    font-size: 0.875rem;
}

/* Card-style tables for better mobile UX */
.mobile-card-table {
    display: block;
    min-width: 0;
    width: 100%;
}

.mobile-card-table thead {
    display: none;
}

.mobile-card-table tbody {
    display: flex;
    flex-direction: column;
    gap: var(--mobile-spacing-sm);
}

.mobile-card-table tr {
    display: block;
    background: var(--color-bg-lighter);
    border-radius: 10px;
    padding: var(--mobile-spacing-md);
    border: 1px solid var(--color-border);
}

.mobile-card-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
}

.mobile-card-table td:last-child {
    border-bottom: none;
}

.mobile-card-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--color-text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
}

/* ==========================================================================
   9. Mobile Grids
   ========================================================================== */

.dashboard-grid {
    grid-template-columns: 1fr;
    gap: var(--mobile-spacing-md);
}

.stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--mobile-spacing-sm);
}

.stat-card {
    padding: var(--mobile-spacing-md);
}

.stat-card-value {
    font-size: 1.5rem;
}

.stat-card-label {
    font-size: 0.75rem;
}

.unit-grid,
.building-grid,
.feature-grid,
.selection-grid {
    grid-template-columns: 1fr;
    gap: var(--mobile-spacing-md);
}

.overview-grid {
    grid-template-columns: 1fr;
}

.record-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

/* Two column layout */
.row {
    grid-template-columns: 1fr;
    gap: var(--mobile-spacing-md);
}

/* ==========================================================================
   10. Mobile Stats & Combat Display
   ========================================================================== */

.combat-stats {
    flex-wrap: wrap;
    gap: 0.5rem;
}

.combat-stat {
    flex: 1 1 calc(50% - 0.25rem);
    min-width: 0;
    padding: 0.625rem;
}

.combat-stat .combat-value {
    font-size: 1.125rem;
}

.stat-block {
    padding: 0.75rem;
}

.stat-block .stat-value {
    font-size: 1.25rem;
}

/* ==========================================================================
   11. Mobile Player Profile (styles now inline in player.php view)
   ========================================================================== */

/* ==========================================================================
   12. Mobile Messages
   ========================================================================== */

.message-item {
    grid-template-columns: 1fr;
    gap: 0.375rem;
    padding: var(--mobile-spacing-md);
}

.message-from,
.message-to {
    font-size: 0.8125rem;
}

.message-date {
    order: -1;
    text-align: left;
    font-size: 0.75rem;
    color: var(--color-text-dark);
}

.message-subject {
    font-size: 0.9375rem;
    white-space: normal;
}

.message-preview {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
    white-space: normal;
}

.message-view-page .message-header .message-subject {
    font-size: 1.25rem;
}

.message-meta {
    flex-direction: column;
    gap: 0.375rem;
}

.message-body {
    padding: var(--mobile-spacing-md);
    font-size: 0.9375rem;
}

/* ==========================================================================
   13. Mobile Alerts & Badges
   ========================================================================== */

.alert {
    padding: var(--mobile-spacing-md);
    border-radius: 10px;
    font-size: 0.9375rem;
}

.badge {
    font-size: 0.6875rem;
    padding: 0.2rem 0.5rem;
}

/* ==========================================================================
   14. Mobile Auth Pages
   ========================================================================== */

.auth-layout {
    padding: var(--mobile-spacing-md);
}

.auth-card {
    padding: var(--mobile-spacing-lg);
    border-radius: 12px;
}

.auth-logo h1 {
    font-size: 1.5rem;
}

.auth-title h2 {
    font-size: 1.25rem;
}

/* ==========================================================================
   15. Mobile Landing Page
   ========================================================================== */

.landing-nav {
    padding: var(--mobile-spacing-sm) var(--mobile-spacing-md);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.landing-nav .logo-text {
    font-size: 1rem;
}

.nav-links {
    gap: 0.375rem;
}

.nav-links .btn {
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
    min-height: 32px;
}

.discord-link {
    position: fixed;
    top: 8px;
    right: 8px;
    z-index: 200;
}

.discord-icon {
    width: 28px;
    height: 28px;
}

.hero {
    min-height: calc(100vh - 60px);
    padding: 2rem var(--mobile-spacing-md);
}

.hero-carousel {
    position: relative;
    bottom: auto;
    left: auto;
    width: 100%;
    margin-top: 1.5rem;
    animation: none;
}

.hero-badge {
    font-size: 0.8125rem;
    padding: 0.375rem 0.75rem;
}

.hero-title {
    font-size: 2rem;
    line-height: 1.15;
}

.hero-subtitle {
    font-size: 1rem;
    margin-bottom: 2rem;
}

.hero-actions {
    flex-direction: column;
    width: 100%;
    gap: 0.75rem;
    margin-bottom: 3rem;
}

.hero-actions .btn {
    width: 100%;
}

.hero-stats {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    max-width: 280px;
}

.hero-stats .stat {
    padding: 1rem;
}

.hero-stats .stat-number {
    font-size: 1.75rem;
}

.features,
.races-classes,
.cta {
    padding: 3rem var(--mobile-spacing-md);
}

.section-title {
    font-size: 1.5rem;
}

.section-subtitle {
    font-size: 0.9375rem;
    margin-bottom: 2rem;
}

.feature-card {
    padding: var(--mobile-spacing-lg);
}

.selection-preview {
    grid-template-columns: 1fr;
    gap: var(--mobile-spacing-lg);
}

.preview-item {
    padding: 0.875rem var(--mobile-spacing-md);
}

/* ==========================================================================
   16. Mobile Tabs
   ========================================================================== */

.tabs {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    gap: 0;
    margin: 0 calc(-1 * var(--mobile-spacing-md));
    padding: 0 var(--mobile-spacing-md);
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ==========================================================================
   17. Mobile Training & Armory
   ========================================================================== */

.train-controls {
    flex-wrap: wrap;
    gap: 0.375rem;
}

.train-qty-input {
    width: 60px;
}

.armory-page .inline-form {
    flex-wrap: wrap;
}

.item-actions {
    flex-direction: column;
    gap: 0.375rem;
}

.item-actions .btn {
    width: 100%;
}

/* ==========================================================================
   18. Mobile Buildings
   ========================================================================== */

.repair-grid {
    grid-template-columns: 1fr;
}

.building-card {
    padding: var(--mobile-spacing-md);
}

/* ==========================================================================
   19. Mobile Friends List
   ========================================================================== */

.friend-item {
    flex-wrap: wrap;
    gap: 0.75rem;
}

.friend-info {
    flex: 1 1 60%;
}

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

.friend-actions .btn {
    flex: 1;
}

/* ==========================================================================
   20. Mobile Utilities
   ========================================================================== */

/* Hide on mobile */
.hide-mobile {
    display: none !important;
}

/* Show only on mobile */
.show-mobile {
    display: block !important;
}

.show-mobile-flex {
    display: flex !important;
}

/* Mobile-specific spacing */
.mobile-mt-1 { margin-top: 0.5rem; }
.mobile-mt-2 { margin-top: 1rem; }
.mobile-mb-1 { margin-bottom: 0.5rem; }
.mobile-mb-2 { margin-bottom: 1rem; }
.mobile-mb-bar { margin-bottom: 3rem; } /* Extra spacing for content above mobile stats bar */
.mobile-p-1 { padding: 0.5rem; }
.mobile-p-2 { padding: 1rem; }

/* Mobile bottom spacer - add to last element on page if needed */
.mobile-spacer {
    height: 2rem;
    display: block;
    content: '';
}

/* Auto-spacer in game layout for mobile stats bar clearance */
.mobile-bottom-spacer {
    height: 1rem;
    display: block !important;
    width: 100%;
}

/* Full width on mobile */
.mobile-full-width {
    width: 100% !important;
}

/* Mobile text alignment */
.mobile-text-center {
    text-align: center;
}

/* Stack flex items on mobile */
.mobile-flex-column {
    flex-direction: column !important;
}

/* ==========================================================================
   21. Mobile Scrollbar (Thin)
   ========================================================================== */

::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-thumb {
    border: none;
    border-radius: 4px;
}

/* ==========================================================================
   22. Mobile Safe Areas (Notch Support)
   ========================================================================== */

@supports (padding: max(0px)) {
    .game-header {
        padding-left: max(var(--mobile-spacing-sm), env(safe-area-inset-left));
        padding-right: max(var(--mobile-spacing-sm), env(safe-area-inset-right));
    }

    .game-main {
        padding-left: max(var(--mobile-spacing-md), env(safe-area-inset-left));
        padding-right: max(var(--mobile-spacing-md), env(safe-area-inset-right));
        /* 100px base + safe area for devices with home indicator */
        padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px));
    }
    
    .game-footer {
        padding-bottom: calc(0.35rem + env(safe-area-inset-bottom, 0px));
    }
}

/* ==========================================================================
   23. Mobile Pull-to-Refresh Indicator (CSS only hint)
   ========================================================================== */

.pull-indicator {
    position: fixed;
    top: 56px;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    background: var(--color-bg-lighter);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    z-index: 50;
    transition: transform 0.3s ease;
}

/* ==========================================================================
   24. Mobile Selection Cards
   ========================================================================== */

.selection-card .selection-content {
    padding: var(--mobile-spacing-md);
}

.selection-name {
    font-size: 1rem;
}

.selection-bonus .bonus {
    font-size: 0.6875rem;
}

/* ==========================================================================
   25. Mobile Souls Display
   ========================================================================== */

.souls -display {
    font-size: 1.125rem;
}

.souls -display .souls -icon {
    font-size: 1.5rem;
}

/* ==========================================================================
   26. Small Phone Specific (< 375px)
   ========================================================================== */

@media (max-width: 374px) {
    :root {
        --mobile-spacing-md: 0.75rem;
    }

    .hero-title {
        font-size: 1.75rem;
    }

    .stat-grid {
        grid-template-columns: 1fr;
    }

    .record-grid {
        grid-template-columns: 1fr;
    }

    .combat-stat {
        flex: 1 1 100%;
    }

    .btn {
        padding: 0.625rem 1rem;
    }
}

/* ==========================================================================
   27. Landscape Mobile Adjustments
   ========================================================================== */

@media (max-height: 500px) and (orientation: landscape) {
    .game-header {
        height: 48px;
    }

    .game-container {
        padding-top: 48px;
    }

    .hero {
        min-height: auto;
        padding: 1.5rem var(--mobile-spacing-md);
    }

    .hero-stats {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ==========================================================================
   28. Mobile Footer Stats
   ========================================================================== */

.game-footer {
    height: auto;
    padding: 0.5rem var(--mobile-spacing-sm);
}

.footer-stats {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.15rem 0.5rem;
}

.footer-stat {
    padding: 0.15rem 0.35rem;
    font-size: 0.725rem;
}

.footer-icon-img {
    width: 16px;
    height: 16px;
}

.footer-stat-value {
    font-size: 0.725rem;
}

.footer-stat-label {
    font-size: 0.7rem;
}

.footer-stat-divider {
    display: none;
}

/* ==========================================================================
   29. Mobile Quick Actions (FAB Style)
   ========================================================================== */

.mobile-fab {
    position: fixed;
    bottom: 80px;
    right: var(--mobile-spacing-md);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: #000;
    border: none;
    box-shadow: 0 4px 12px rgba(255, 204, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 97;
    transition: all var(--transition-fast);
}

.mobile-fab:active {
    transform: scale(0.95);
}

/* ==========================================================================
   30. Mobile Loading States
   ========================================================================== */

.mobile-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    gap: 1rem;
}

.mobile-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ==========================================================================
   31. Mobile Empty States
   ========================================================================== */

.mobile-empty-state {
    text-align: center;
    padding: 2rem var(--mobile-spacing-md);
}

.mobile-empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.mobile-empty-state h3 {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

.mobile-empty-state p {
    color: var(--color-text-muted);
    font-size: 0.9375rem;
}

/* ==========================================================================
   32. Print Styles (Disable for Mobile)
   ========================================================================== */

@media print {
    .game-header,
    .game-footer,
    .mobile-fab,
    .mobile-menu-toggle {
        display: none !important;
    }

    .game-main {
        margin: 0;
        padding: 0;
    }
}

/* ==========================================================================
   33. Training Page - Mobile Optimized
   ========================================================================== */

.training-page .row {
    display: flex;
    flex-direction: column;
    gap: var(--mobile-spacing-md);
}

.training-page .col-main,
.training-page .col-side {
    width: 100%;
}

/* Convert training table to cards on mobile */
.training-page .table-container,
.training-page table {
    display: block;
    min-width: 0;
    width: 100%;
}

.training-page thead {
    display: none;
}

.training-page tbody {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.training-page tbody tr {
    display: flex;
    flex-direction: column;
    background: var(--color-bg-lighter);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: var(--mobile-spacing-md);
    gap: 0.5rem;
}

.training-page tbody tr.disabled {
    opacity: 0.6;
}

.training-page tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.375rem 0;
    border: none;
    border-bottom: 1px solid var(--color-border);
}

/* Add labels before each cell */
.training-page tbody td::before {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
}

.training-page tbody td:nth-child(1)::before { content: ""; }
.training-page tbody td:nth-child(2)::before { content: "Stats"; }
.training-page tbody td:nth-child(3)::before { content: "Cost"; }
.training-page tbody td:nth-child(4)::before { content: "Owned"; }
.training-page tbody td:nth-child(5)::before { content: ""; }

.training-page tbody td:last-child {
    border-bottom: none;
    padding-top: 0.75rem;
    justify-content: center;
}

.training-page tbody td:first-child {
    font-size: 1rem;
    padding-bottom: 0.5rem;
    display: block;
    text-align: left;
}

.training-page tbody td:first-child strong {
    font-size: 1.0625rem;
    display: block;
    margin-bottom: 0.25rem;
}

/* Training form controls on mobile */
.training-page .train-form {
    width: 100%;
}

.training-page .train-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    width: 100%;
}

.training-page .train-qty-input {
    width: 70px;
    min-height: 40px;
    text-align: center;
    font-size: 16px;
}

.training-page .train-controls .btn {
    flex: 1;
    min-width: 70px;
    min-height: 40px;
}

/* Resource display on training page */
.training-page .resource-display {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.training-page .resource-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0.75rem;
    background: var(--color-bg);
    border-radius: 8px;
}

.training-page .resource-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.training-page .resource-value {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-primary);
}

.training-page .resource-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
}

/* ==========================================================================
   34. Armory Page - Mobile Optimized
   ========================================================================== */

.armory-page .row {
    display: flex;
    flex-direction: column;
    gap: var(--mobile-spacing-md);
}

.armory-page .col-main,
.armory-page .col-side {
    width: 100%;
}

/* Tabs on armory - horizontal scroll */
.armory-page .tabs {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0;
    margin-bottom: var(--mobile-spacing-md);
    padding-bottom: 2px;
    scrollbar-width: none;
}

.armory-page .tabs::-webkit-scrollbar {
    display: none;
}

.armory-page .tab-btn {
    flex-shrink: 0;
    padding: 0.625rem 0.875rem;
    font-size: 0.8125rem;
    white-space: nowrap;
}

/* Convert armory tables to cards */
.armory-page .table-container,
.armory-page table {
    display: block;
    min-width: 0;
    width: 100%;
}

.armory-page thead {
    display: none;
}

.armory-page tbody {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.armory-page tbody tr {
    display: flex;
    flex-direction: column;
    background: var(--color-bg-lighter);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: var(--mobile-spacing-md);
    gap: 0.5rem;
}

.armory-page tbody tr.disabled {
    opacity: 0.6;
}

.armory-page tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.375rem 0;
    border: none;
    border-bottom: 1px solid var(--color-border);
}

/* Add labels before each cell */
.armory-page tbody td::before {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
}

.armory-page tbody td:nth-child(1)::before { content: ""; }
.armory-page tbody td:nth-child(2)::before { content: "Stats"; }
.armory-page tbody td:nth-child(3)::before { content: "Cost"; }
.armory-page tbody td:nth-child(4)::before { content: "Owned"; }
.armory-page tbody td:nth-child(5)::before { content: ""; }

.armory-page tbody td:last-child {
    border-bottom: none;
    padding-top: 0.75rem;
    flex-direction: column;
    gap: 0.5rem;
}

.armory-page tbody td:last-child::before {
    display: none;
}

.armory-page tbody td:first-child {
    display: block;
    text-align: left;
    padding-bottom: 0.5rem;
}

.armory-page tbody td:first-child strong {
    font-size: 1.0625rem;
    display: block;
    margin-bottom: 0.25rem;
}

/* Armory item actions - full width buttons */
.armory-page .item-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.armory-page .inline-form {
    display: flex;
    gap: 0.5rem;
    width: 100%;
    align-items: center;
}

.armory-page .qty-input {
    width: 60px;
    min-height: 40px;
    text-align: center;
    font-size: 16px;
    padding: 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-bg);
    color: var(--color-text);
}

.armory-page .inline-form .btn {
    flex: 1;
    min-height: 40px;
}

/* Souls display in armory */
.armory-page .souls -display {
    justify-content: center;
}

/* Stat rows in armory sidebar */
.armory-page .stat-row {
    display: flex;
    justify-content: space-between;
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.9375rem;
}

.armory-page .stat-row:last-child {
    border-bottom: none;
}

/* ==========================================================================
   35. Bank Page - Mobile Optimized
   ========================================================================== */

.bank-page .row {
    display: flex;
    flex-direction: column;
    gap: var(--mobile-spacing-md);
}

.bank-page .col-main,
.bank-page .col-side {
    width: 100%;
}

/* ==========================================================================
   36. Attack Page - Mobile Layout (Table styling in Section 54)
   ========================================================================== */

.attack-page .row {
    display: flex;
    flex-direction: column;
    gap: var(--mobile-spacing-md);
}

.attack-page .col-main,
.attack-page .col-side {
    width: 100%;
}

/* Table card styling is handled in Section 54 */

/* Attack buttons - shrink text, counter inside buttons */
.attack-page .attack-btn {
    font-size: 0.7rem;
    padding: 0.3rem 0.5rem;
}

.attack-page .attack-limit {
    font-size: 0.65rem;
    opacity: 0.85;
}

/* Your Stats tile - no icons, tighter layout */
.attack-page .breakdown-item {
    padding: 0.4rem 0.5rem;
}

/* ==========================================================================
   37. Buildings Page - Mobile Optimized
   ========================================================================== */

.buildings-page .building-grid {
    grid-template-columns: 1fr;
    gap: var(--mobile-spacing-md);
}

.buildings-page .building-card {
    padding: var(--mobile-spacing-md);
}

.buildings-page .building-card .building-icon {
    font-size: 2.5rem;
}

.buildings-page .building-card h3 {
    font-size: 1.125rem;
}

.buildings-page .building-card .btn {
    width: 100%;
    margin-top: 0.75rem;
}

/* ==========================================================================
   39. Rankings Pages - Mobile Optimized
   Handles both /rankings (div-based) and /leaderboards (table-based)
   ========================================================================== */

/* ---- A) /rankings page (div-based rankings.php) ---- */

.rankings-page .ranking-type-btn {
    padding: 0.35rem 0.6rem !important;
    font-size: 0.8rem;
}

.rankings-page .rankings-podium {
    display: none !important;
}

.rankings-page .mobile-only-row {
    display: flex !important;
}

.rankings-page .rankings-list {
    gap: 2px !important;
}

.rankings-page .ranking-row {
    padding: 0.35rem 0.5rem !important;
    gap: 0.4rem !important;
    border-radius: 4px !important;
    flex-wrap: nowrap !important;
}

.rankings-page .ranking-position {
    min-width: 28px !important;
    font-size: 0.8rem;
}

.rankings-page .position-top10 {
    font-size: 0.85rem !important;
}

.rankings-page .ranking-player .player-details {
    display: none !important;
}

.rankings-page .ranking-player .player-name {
    font-size: 0.8rem;
    gap: 0.3rem !important;
}

.rankings-page .ranking-player .custom-display-name {
    max-height: 14px !important;
    width: auto !important;
    height: auto !important;
}

.rankings-page .ranking-stats {
    order: unset !important;
    width: auto !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
    border-top: none !important;
}

.rankings-page .ranking-stats .stat-badge {
    padding: 0.15rem 0.4rem !important;
    min-width: 35px !important;
    border-radius: 4px !important;
}

.rankings-page .ranking-stats .stat-label {
    font-size: 0.55rem !important;
}

.rankings-page .ranking-stats .stat-value {
    font-size: 0.75rem !important;
}

.rankings-page .ranking-actions {
    display: none !important;
}

.rankings-page .your-ranks-grid {
    grid-template-columns: 1fr 1fr !important;
}

/* ---- B) /leaderboards page (table-based rankings-extended.php) ---- */

/* Tighter page padding for more tile space */
.rankings-page {
    padding: 0.5rem !important;
}

/* Page title: compact */
.rankings-page .rankings-title {
    font-size: 1.5rem !important;
    margin-bottom: 0.75rem !important;
    letter-spacing: 2px !important;
}

/* Tile grid: single column on mobile for full-width usernames */
.rankings-page .rankings-grid {
    grid-template-columns: 1fr !important;
    gap: 0.5rem !important;
}

/* Override Section 48 generic card layout — force table back to real table display */
.rankings-page .ranking-table {
    display: table !important;
    min-width: 0 !important;
    width: 100% !important;
    table-layout: fixed !important;
}

.rankings-page .ranking-table thead {
    display: table-header-group !important;
}

.rankings-page .ranking-table tbody {
    display: table-row-group !important;
}

.rankings-page .ranking-table tbody tr {
    display: table-row !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
}

.rankings-page .ranking-table td {
    display: table-cell !important;
    padding: 0.2rem 0.3rem !important;
    font-size: 0.65rem !important;
    border-bottom: 1px solid #1a1a1a !important;
}

/* Kill ALL ::before data-label pseudo-elements from Sections 48 & 49 */
.rankings-page .ranking-table td::before {
    display: none !important;
    content: none !important;
}

/* Tile: tighter */
.rankings-page .ranking-tile {
    border-radius: 8px !important;
}

/* Tile header: compact */
.rankings-page .tile-header {
    padding: 0.4rem 0.5rem !important;
    gap: 0.4rem !important;
    border-bottom-width: 1px !important;
}

.rankings-page .tile-icon {
    font-size: 1rem !important;
}

.rankings-page .tile-title {
    font-size: 0.6rem !important;
    letter-spacing: 1px !important;
}

/* Table head: compact */
.rankings-page .ranking-table th {
    padding: 0.2rem 0.3rem !important;
    font-size: 0.5rem !important;
    letter-spacing: 0 !important;
}

.rankings-page .ranking-table th:first-child {
    width: 24px !important;
}

/* Rank column */
.rankings-page .rank-col {
    font-size: 0.6rem !important;
}

.rankings-page .rank-medal {
    width: 16px !important;
    height: 16px !important;
    font-size: 0.55rem !important;
}

/* Name column: truncate to fit */
.rankings-page .name-col {
    max-width: none !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

.rankings-page .player-link {
    font-size: 0.65rem !important;
}

/* Custom display name images in leaderboards */
.rankings-page .ranking-table .custom-display-name {
    max-height: 11px !important;
    width: auto !important;
    height: auto !important;
}

/* You badge: tiny */
.rankings-page .ranking-table .you-badge {
    padding: 0.05rem 0.2rem !important;
    font-size: 0.45rem !important;
    margin-left: 0.15rem !important;
}

/* Value column: compact */
.rankings-page .value-col {
    font-size: 0.6rem !important;
    white-space: nowrap !important;
}

.rankings-page .hidden-value {
    font-size: 0.6rem !important;
}

/* No-data message */
.rankings-page .no-data {
    padding: 0.5rem !important;
    font-size: 0.7rem !important;
}

/* ==========================================================================
   41. Recruit Page - Mobile Optimized
   ========================================================================== */

.recruit-page .row {
    display: flex;
    flex-direction: column;
    gap: var(--mobile-spacing-md);
}

.recruit-page .recruit-link-box {
    word-break: break-all;
}

/* Recent Activity table - card layout */
.recruit-page .recruit-activity-table thead {
    display: none;
}

.recruit-page .recruit-activity-table tbody tr {
    display: flex;
    flex-direction: column;
    padding: var(--mobile-spacing-sm);
    border-bottom: 1px solid var(--color-border);
    gap: 0.25rem;
}

.recruit-page .recruit-activity-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
    border: none;
}

.recruit-page .recruit-activity-table tbody td::before {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

.recruit-page .recruit-activity-table tbody td:nth-child(1)::before {
    content: "DATE:";
}

.recruit-page .recruit-activity-table tbody td:nth-child(2)::before {
    content: "SOURCE:";
}

.recruit-page .recruit-activity-table tbody td:nth-child(3)::before {
    content: "TRAVELERS GAINED:";
}

/* ==========================================================================
   42. Overview Page - Mobile Optimized
   ========================================================================== */

.overview-page .overview-grid {
    grid-template-columns: 1fr;
    gap: var(--mobile-spacing-md);
}

.overview-page .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.overview-page .stat-block {
    padding: 0.75rem;
}

.overview-page .stat-block .stat-value {
    font-size: 1.25rem;
}

/* Overview tables with labels */
.overview-page table {
    display: block;
    min-width: 0;
}

.overview-page thead {
    display: none;
}

.overview-page tbody {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.overview-page tbody tr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 0.625rem;
    gap: 0.5rem;
}

.overview-page tbody td {
    padding: 0;
    border: none;
}

.overview-page tbody td:first-child {
    flex: 1;
    font-weight: 500;
}

.overview-page tbody td:nth-child(2) {
    padding: 0.25rem 0.5rem;
    background: var(--color-bg-lighter);
    border-radius: 4px;
    font-size: 0.875rem;
}

.overview-page tbody td:nth-child(3) {
    margin-left: auto;
}

/* ==========================================================================
   43. Stats/Proficiencies Page - Mobile Optimized
   ========================================================================== */

.stats-page .row {
    display: flex;
    flex-direction: column;
    gap: var(--mobile-spacing-md);
}

.stats-page .prof-list {
    gap: 0.5rem;
}

.stats-page .prof-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
}

.stats-page .prof-item .btn {
    width: 100%;
}

/* Stats page: mobile overrides for inline allocation */
.stats-page-advanced .allocation-header-inline {
    padding: 0.4rem 0.75rem;
    background: var(--color-bg-lighter);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    flex-direction: column;
    gap: 0.35rem;
    text-align: center;
}

.stats-page-advanced .allocation-header-inline .allocation-title h2 {
    font-size: 0.95rem;
}

.stats-page-advanced .bonus-card-allocate {
    margin-top: 0.3rem;
    padding-top: 0.3rem;
}

.stats-page-advanced .bonus-card-allocate .allocation-current {
    font-size: 0.6rem;
    margin-bottom: 0.2rem;
}

.stats-page-advanced .bonus-card-allocate .allocation-controls {
    gap: 0.25rem;
}

.stats-page-advanced .bonus-card-allocate .alloc-btn {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    font-size: 0.9rem;
}

.stats-page-advanced .bonus-card-allocate .alloc-input {
    width: 36px;
    height: 24px;
    padding: 0.1rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* ==========================================================================
   44. Spy/Intelligence Page - Mobile Optimized
   ========================================================================== */

.spy-page .row,
.intelligence-page .row {
    display: flex;
    flex-direction: column;
    gap: var(--mobile-spacing-md);
}

/* ==========================================================================
   45. Settings Page - Mobile Optimized
   ========================================================================== */

.settings-page .row {
    display: flex;
    flex-direction: column;
    gap: var(--mobile-spacing-md);
}

.settings-page .form-row {
    grid-template-columns: 1fr;
}

.settings-page .avatar-preview {
    width: 80px;
    height: 80px;
}

/* ==========================================================================
   46. Clan Pages - Mobile Optimized
   ========================================================================== */

.clan-page .row,
.clan-manage-page .row,
.clan-create-page .row {
    display: flex;
    flex-direction: column;
    gap: var(--mobile-spacing-md);
}

.clan-page .member-list tbody tr {
    display: flex;
    flex-direction: column;
    padding: var(--mobile-spacing-md);
    background: var(--color-bg-lighter);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    margin-bottom: 0.5rem;
}

.clan-page .member-list tbody td {
    display: flex;
    justify-content: space-between;
    padding: 0.375rem 0;
    border-bottom: 1px solid var(--color-border);
}

.clan-page .member-list tbody td:last-child {
    border-bottom: none;
}

/* Clan Stats: Combat, Stats & Income + Covert tables - mobile labels */
#clan-stats-table tbody td:first-child,
#clan-covert-table tbody td:first-child {
    display: block;
    text-align: left;
    padding-bottom: 0.5rem;
}

#clan-stats-table tbody td::before,
#clan-covert-table tbody td::before {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

#clan-stats-table tbody td:nth-child(1)::before { content: ""; }
#clan-stats-table tbody td:nth-child(2)::before { content: "Level"; }
#clan-stats-table tbody td:nth-child(3)::before { content: "Alignment"; }
#clan-stats-table tbody td:nth-child(4)::before { content: "Class"; }
#clan-stats-table tbody td:nth-child(5)::before { content: "Phys Off"; }
#clan-stats-table tbody td:nth-child(6)::before { content: "Phys Def"; }
#clan-stats-table tbody td:nth-child(7)::before { content: "Mag Off"; }
#clan-stats-table tbody td:nth-child(8)::before { content: "Mag Def"; }
#clan-stats-table tbody td:nth-child(9)::before { content: "Income"; }

#clan-covert-table tbody td:nth-child(1)::before { content: ""; }
#clan-covert-table tbody td:nth-child(2)::before { content: "Spy Off"; }
#clan-covert-table tbody td:nth-child(3)::before { content: "Spy Def"; }
#clan-covert-table tbody td:nth-child(4)::before { content: "Conv Off"; }
#clan-covert-table tbody td:nth-child(5)::before { content: "Conv Def"; }
#clan-covert-table tbody td:nth-child(6)::before { content: "Elim Off"; }
#clan-covert-table tbody td:nth-child(7)::before { content: "Elim Def"; }
#clan-covert-table tbody td:nth-child(8)::before { content: "Steal Off"; }
#clan-covert-table tbody td:nth-child(9)::before { content: "Steal Def"; }

/* Clan Bank: Recent Transactions table - mobile labels */
#tab-bank .table tbody td::before {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

#tab-bank .table tbody td:nth-child(1)::before { content: "Date"; }
#tab-bank .table tbody td:nth-child(2)::before { content: "Player"; }
#tab-bank .table tbody td:nth-child(3)::before { content: "Type"; }
#tab-bank .table tbody td:nth-child(4)::before { content: "Amount"; }
#tab-bank .table tbody td:nth-child(5)::before { content: "Balance"; }

/* Clan Hitlist: Kill Statistics table - mobile labels */
#tab-hitlist .table tbody td::before {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

#tab-hitlist .table tbody td:first-child {
    display: block;
    text-align: left;
    padding-bottom: 0.5rem;
}

#tab-hitlist .table tbody td:nth-child(1)::before { content: ""; }
#tab-hitlist .table tbody td:nth-child(2)::before { content: "Total Kills"; }
#tab-hitlist .table tbody td:nth-child(3)::before { content: "Phys Casualties"; }
#tab-hitlist .table tbody td:nth-child(4)::before { content: "Mag Casualties"; }
#tab-hitlist .table tbody td:nth-child(5)::before { content: "Eliminations"; }
#tab-hitlist .table tbody td:nth-child(6)::before { content: "Conversions"; }
#tab-hitlist .table tbody td:nth-child(7)::before { content: "Souls Stolen"; }

/* Hitlist breakdown rows - visual distinction on mobile */
#tab-hitlist .table tbody tr.hl-breakdown-row {
    border-left: 3px solid #3b82f6;
    margin-left: 0.5rem;
    background: rgba(59, 130, 246, 0.05);
}

#tab-hitlist .table tbody tr.hl-target-row {
    border-left: 3px solid #dc2626;
}

/* Clan Roster: Members table - mobile labels */
#tab-roster .table tbody td::before {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

#tab-roster .table tbody td:first-child {
    display: block;
    text-align: left;
    padding-bottom: 0.5rem;
}

#tab-roster .table tbody td:nth-child(1)::before { content: ""; }
#tab-roster .table tbody td:nth-child(2)::before { content: "Role"; }
#tab-roster .table tbody td:nth-child(3)::before { content: "Level"; }
#tab-roster .table tbody td:nth-child(4)::before { content: "Joined"; }

/* Clan Settings: Permission Grid - mobile labels */
.clan-page .permission-grid tbody td.perm-label-cell {
    display: block;
    text-align: left;
    padding-bottom: 0.5rem;
    font-weight: 600;
    font-size: 1rem;
}

.clan-page .permission-grid tbody td.perm-check-cell {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ==========================================================================
   47. Dashboard - Mobile Optimized
   ========================================================================== */

/* Hide level badge balloon on mobile */
.dashboard-hero-level {
    display: none !important;
}

.dashboard-page .dashboard-grid {
    grid-template-columns: 1fr;
    gap: var(--mobile-spacing-md);
}

.dashboard-page .stat-grid {
    grid-template-columns: repeat(2, 1fr);
}

.dashboard-page .quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.dashboard-page .quick-actions .btn {
    padding: 0.75rem 0.5rem;
    font-size: 0.8125rem;
}

/* ==========================================================================
   48. General Table Mobile Card Layout
   ========================================================================== */

/* Apply card layout to all game tables by default */
.game-main table:not(.no-mobile-cards):not(.training-page table):not(.armory-page table) {
    display: block;
    min-width: 0;
}

.game-main table:not(.no-mobile-cards):not(.training-page table):not(.armory-page table) thead {
    display: none;
}

.game-main table:not(.no-mobile-cards):not(.training-page table):not(.armory-page table) tbody {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.game-main table:not(.no-mobile-cards):not(.training-page table):not(.armory-page table) tbody tr {
    display: flex;
    flex-direction: column;
    background: var(--color-bg-lighter);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: var(--mobile-spacing-md);
}

.game-main table:not(.no-mobile-cards):not(.training-page table):not(.armory-page table) tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
}

.game-main table:not(.no-mobile-cards):not(.training-page table):not(.armory-page table) tbody td:last-child {
    border-bottom: none;
}

/* Add labels via data attributes */
.game-main table:not(.no-mobile-cards) tbody td[data-label]::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
}

/* ==========================================================================
   49. Rankings Page - Mobile Optimized with Labels
   ========================================================================== */

.rankings-page tbody td::before {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.rankings-page tbody td:nth-child(1)::before { content: ""; }
.rankings-page tbody td:nth-child(2)::before { content: ""; }
.rankings-page tbody td:nth-child(3) {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.rankings-page tbody td:nth-child(3)::before { content: attr(data-label) ": "; }

/* ==========================================================================
   52. Sidebar Header & Clocks - Mobile Only
   ========================================================================== */

.sidebar-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    padding: 0 1rem;
    background: rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid var(--color-border);
}

.sidebar-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    color: var(--color-text-muted);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-text);
    border-color: var(--color-text-muted);
}

.sidebar-clocks {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    padding-top: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 0.5rem;
}

.sidebar-clock-item {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
}

.sidebar-clock-item .clock-icon {
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-clock-item .clock-icon-img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.sidebar-clock-item .clock-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.sidebar-clock-item .clock-label {
    font-size: 0.65rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-clock-item .clock-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-warning);
    font-family: 'Courier New', monospace;
}

.sidebar-clock-item .clock-value.tick-ready {
    color: var(--color-success);
    animation: pulse 0.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Battle Logs Nav - Mobile */
.battle-logs-nav {
    flex-wrap: wrap;
    gap: 0.5rem;
}

.battle-logs-nav > .btn {
    position: static;
    order: 2;
    width: 100%;
    text-align: center;
}

/* ==========================================================================
   53. Battle Logs Page - Mobile Optimized with Labels
   ========================================================================== */

.battle-logs-page table {
    display: block;
    min-width: 0;
}

.battle-logs-page thead {
    display: none;
}

.battle-logs-page tbody {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.battle-logs-page tbody tr {
    display: flex;
    flex-direction: column;
    background: var(--color-bg-lighter);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: var(--mobile-spacing-md);
}

.battle-logs-page tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
}

.battle-logs-page tbody td:last-child {
    border-bottom: none;
}

/* Column 1: Date - no label, larger font, standalone */
.battle-logs-page tbody td:nth-child(1) {
    font-size: 1rem;
    font-weight: 500;
    justify-content: flex-start;
    padding-bottom: 0.5rem;
}

/* Attack type badge (P/M) - visible on mobile only */
.battle-logs-page .attack-type-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    margin-left: 0.5rem;
    color: #fff;
}

.battle-logs-page .attack-type-physical {
    background: rgba(239, 68, 68, 0.8);
}

.battle-logs-page .attack-type-magical {
    background: rgba(59, 130, 246, 0.8);
}

/* Column 2: Attacker/Target - dynamic label based on tab */
.battle-logs-page tbody td:nth-child(2) {
    align-items: flex-start;
}

.battle-logs-page tbody td:nth-child(2)::before {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

/* Incoming tab - show "ATTACKER:" */
.battle-logs-table.incoming-tab tbody td:nth-child(2)::before {
    content: "ATTACKER:";
}

/* Outgoing tab - show "TARGET:" */
.battle-logs-table.outgoing-tab tbody td:nth-child(2)::before {
    content: "TARGET:";
}

/* Column 3: Result */
.battle-logs-page tbody td:nth-child(3)::before {
    content: "RESULT:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

/* Column 4: Souls - context-appropriate labels per tab */
.battle-logs-table.incoming-tab tbody td:nth-child(4)::before {
    content: "SOULS LOST:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

.battle-logs-table.outgoing-tab tbody td:nth-child(4)::before {
    content: "SOULS STOLEN:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

/* Column 5: XP */
.battle-logs-page tbody td:nth-child(5)::before {
    content: "XP:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

/* Column 6: Your Losses */
.battle-logs-page tbody td:nth-child(6)::before {
    content: "YOUR LOSSES:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

/* Column 7: Enemy Losses */
.battle-logs-page tbody td:nth-child(7)::before {
    content: "ENEMY LOSSES:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

/* Column 8: View button - centered, no label */
.battle-logs-page tbody td:nth-child(8) {
    justify-content: center;
    padding-top: 0.75rem;
}

/* ==========================================================================
   53b. Spy Logs Page - Mobile Optimized with Labels
   ========================================================================== */

.spy-logs-page table {
    display: block;
    min-width: 0;
}

.spy-logs-page thead {
    display: none;
}

.spy-logs-page tbody {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.spy-logs-page tbody tr {
    display: flex;
    flex-direction: column;
    background: var(--color-bg-lighter);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: var(--mobile-spacing-md);
}

.spy-logs-page tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
}

.spy-logs-page tbody td:last-child {
    border-bottom: none;
}

/* Column 1: Date - no label, larger font */
.spy-logs-page tbody td:nth-child(1) {
    font-size: 1rem;
    font-weight: 500;
    justify-content: flex-start;
    padding-bottom: 0.5rem;
}

/* Column 2: Attacker/Target */
.spy-logs-page tbody td:nth-child(2) {
    align-items: flex-start;
}

.spy-log-table.incoming-tab tbody td:nth-child(2)::before {
    content: "ATTACKER:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

.spy-log-table.outgoing-tab tbody td:nth-child(2)::before {
    content: "TARGET:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

/* Column 3: Operation */
.spy-logs-page tbody td:nth-child(3)::before {
    content: "OPERATION:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

/* Column 4: Result */
.spy-logs-page tbody td:nth-child(4)::before {
    content: "RESULT:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

/* Column 5: XP */
.spy-logs-page tbody td:nth-child(5)::before {
    content: "XP:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

/* Column 6: Details - centered, no label */
.spy-logs-page tbody td:nth-child(6) {
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-top: 0.75rem;
}

/* ==========================================================================
   54. Attack Page - Mobile Optimized with Labels
   ========================================================================== */

/* Battlelist Table */
.attack-page table {
    display: block;
    min-width: 0;
}

.attack-page thead {
    display: none;
}

.attack-page tbody {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.attack-page tbody tr {
    display: flex;
    flex-direction: column;
    background: var(--color-bg-lighter);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: var(--mobile-spacing-md);
}

.attack-page tbody tr.disabled {
    opacity: 0.6;
}

.attack-page tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
}

.attack-page tbody td:last-child {
    border-bottom: none;
}

/* Battlelist - 7 columns */
#battlelist-table tbody td:nth-child(1) {
    font-size: 1.0625rem;
    font-weight: 600;
    justify-content: flex-start;
    padding-bottom: 0.5rem;
}

#battlelist-table tbody td:nth-child(2)::before {
    content: "LEVEL:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

#battlelist-table tbody td:nth-child(3)::before {
    content: "CLASS:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

#battlelist-table tbody td:nth-child(4)::before {
    content: "SOULS:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

#battlelist-table tbody td:nth-child(5) {
    justify-content: center;
    padding-top: 0.75rem;
}

/* Search Results Table - 5 columns */
.attack-page .search-results-table tbody td:nth-child(1) {
    font-size: 1.0625rem;
    font-weight: 600;
    justify-content: flex-start;
    padding-bottom: 0.5rem;
}

.attack-page .search-results-table tbody td:nth-child(2)::before {
    content: "LEVEL:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

.attack-page .search-results-table tbody td:nth-child(3)::before {
    content: "CLASS:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

.attack-page .search-results-table tbody td:nth-child(4)::before {
    content: "SOULS:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

.attack-page .search-results-table tbody td:nth-child(5) {
    justify-content: center;
    padding-top: 0.75rem;
}

/* Recent Attacks Table - 5 columns: Target, Result, When, Inflicted, Taken */
.attack-page .recent-targets-table tbody td:nth-child(1) {
    font-size: 1.0625rem;
    font-weight: 600;
    justify-content: flex-start;
    padding-bottom: 0.5rem;
}

.attack-page .recent-targets-table tbody td:nth-child(2)::before {
    content: "RESULT:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

.attack-page .recent-targets-table tbody td:nth-child(3)::before {
    content: "WHEN:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

.attack-page .recent-targets-table tbody td:nth-child(4)::before {
    content: "INFLICTED:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

.attack-page .recent-targets-table tbody td:nth-child(5)::before {
    content: "TAKEN:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

/* ==========================================================================
   55. Spy Page - Mobile Optimized with Labels
   ========================================================================== */

/* Spy Targets Table & Search Results - Both 5 columns */
.spy-page .spy-targets-table,
.spy-page .spy-search-results-table {
    display: block;
    min-width: 0;
}

.spy-page .spy-targets-table thead,
.spy-page .spy-search-results-table thead {
    display: none;
}

.spy-page .spy-targets-table tbody,
.spy-page .spy-search-results-table tbody {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.spy-page .spy-targets-table tbody tr,
.spy-page .spy-search-results-table tbody tr {
    display: flex;
    flex-direction: column;
    background: var(--color-bg-lighter);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: var(--mobile-spacing-md);
}

.spy-page .spy-targets-table tbody tr.disabled,
.spy-page .spy-search-results-table tbody tr.disabled {
    opacity: 0.6;
}

.spy-page .spy-targets-table tbody td,
.spy-page .spy-search-results-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
}

.spy-page .spy-targets-table tbody td:last-child,
.spy-page .spy-search-results-table tbody td:last-child {
    border-bottom: none;
}

/* Column 1: Player name - no label, larger font */
.spy-page .spy-targets-table tbody td:nth-child(1),
.spy-page .spy-search-results-table tbody td:nth-child(1) {
    font-size: 1.0625rem;
    font-weight: 600;
    justify-content: flex-start;
    padding-bottom: 0.5rem;
}

/* Column 2: Level */
.spy-page .spy-targets-table tbody td:nth-child(2)::before,
.spy-page .spy-search-results-table tbody td:nth-child(2)::before {
    content: "LEVEL:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

/* Column 3: Class */
.spy-page .spy-targets-table tbody td:nth-child(3)::before,
.spy-page .spy-search-results-table tbody td:nth-child(3)::before {
    content: "CLASS:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

/* Column 4: Souls */
.spy-page .spy-targets-table tbody td:nth-child(4)::before,
.spy-page .spy-search-results-table tbody td:nth-child(4)::before {
    content: "SOULS:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

/* Column 5: Action (Recon button) - centered, no label */
.spy-page .spy-targets-table tbody td:nth-child(5),
.spy-page .spy-search-results-table tbody td:nth-child(5) {
    justify-content: center;
    padding-top: 0.75rem;
}

/* ==========================================================================
   56. Battle Upgrades Page - Mobile Optimized with Labels
   ========================================================================== */

/* Battle Upgrades Tables */
.battle-upgrades-page table {
    display: block;
    min-width: 0;
}

.battle-upgrades-page thead {
    display: none;
}

.battle-upgrades-page tbody {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.battle-upgrades-page tbody tr {
    display: flex;
    flex-direction: column;
    background: var(--color-bg-lighter);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: var(--mobile-spacing-md);
}

.battle-upgrades-page tbody tr.disabled {
    opacity: 0.6;
}

.battle-upgrades-page tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
}

.battle-upgrades-page tbody td:last-child {
    border-bottom: none;
}

/* BUY MODE - 5 columns */
/* Column 1: Upgrade name & description - no label, larger font, block display */
.battle-upgrades-page .buy-mode tbody td:nth-child(1) {
    flex-direction: column;
    align-items: flex-start;
    padding-bottom: 0.75rem;
}

.battle-upgrades-page .buy-mode tbody td:nth-child(1) strong {
    font-size: 1.0625rem;
    display: block;
    margin-bottom: 0.25rem;
}

.battle-upgrades-page .buy-mode tbody td:nth-child(1) small {
    display: block;
    margin-top: 0.25rem;
}

/* Column 2: Bonus */
.battle-upgrades-page .buy-mode tbody td:nth-child(2)::before {
    content: "BONUS:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

/* Column 3: Cost */
.battle-upgrades-page .buy-mode tbody td:nth-child(3)::before {
    content: "COST:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

/* Column 4: Owned / Max */
.battle-upgrades-page .buy-mode tbody td:nth-child(4) {
    display: block !important;
    text-align: left;
    padding: 0.5rem 0;
}

.battle-upgrades-page .buy-mode tbody td:nth-child(4)::before {
    content: "OWNED / MAX:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    display: block;
    margin-bottom: 0.25rem;
}

.battle-upgrades-page .buy-mode tbody td:nth-child(4) small {
    display: block;
    margin-top: 0.25rem;
}

/* Column 5: Action - centered */
.battle-upgrades-page .buy-mode tbody td:nth-child(5) {
    justify-content: center;
    padding-top: 0.75rem;
}

.battle-upgrades-page .buy-mode tbody td:nth-child(5) .inline-form {
    width: 100%;
    justify-content: center;
}

/* SELL MODE - 5 columns */
/* Column 1: Upgrade name - no label, larger font */
.battle-upgrades-page .sell-mode tbody td:nth-child(1) {
    font-size: 1.0625rem;
    font-weight: 600;
    justify-content: flex-start;
    padding-bottom: 0.5rem;
}

/* Column 2: Bonus */
.battle-upgrades-page .sell-mode tbody td:nth-child(2)::before {
    content: "BONUS:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

/* Column 3: Sell Price */
.battle-upgrades-page .sell-mode tbody td:nth-child(3)::before {
    content: "SELL PRICE:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

/* Column 4: Owned */
.battle-upgrades-page .sell-mode tbody td:nth-child(4)::before {
    content: "OWNED:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

/* Column 5: Action - centered */
.battle-upgrades-page .sell-mode tbody td:nth-child(5) {
    justify-content: center;
    padding-top: 0.75rem;
}

.battle-upgrades-page .sell-mode tbody td:nth-child(5) .inline-form {
    width: 100%;
    justify-content: center;
}

/* ==========================================================================
   57. Upgrades (Pathways) Page - "See All" Tables Mobile Card Layout
   ========================================================================== */

.upgrade-table.compact thead {
    display: none;
}

.upgrade-table.compact tbody tr {
    display: flex;
    flex-direction: column;
    padding: 0.5rem;
    border-bottom: 1px solid var(--color-border);
    gap: 0.25rem;
}

.upgrade-table.compact tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.2rem 0;
    border: none;
}

.upgrade-table.compact tbody td::before {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.upgrade-table.compact tbody td:nth-child(1)::before { content: "TIER:"; }
.upgrade-table.compact tbody td:nth-child(2)::before { content: "LEVEL:"; }
.upgrade-table.compact tbody td:nth-child(3)::before { content: "BONUS:"; }
.upgrade-table.compact tbody td:nth-child(4)::before { content: "TOTAL:"; }
.upgrade-table.compact tbody td:nth-child(5)::before { content: "COST:"; }
.upgrade-table.compact tbody td:nth-child(6)::before { content: "STATUS:"; }

/* ==========================================================================
   55. Spy Page - Mobile Optimized & Compact
   ========================================================================== */

/* Spy Targets Table & Search Results - Compact 3-Line Format */
.spy-page .spy-targets-table,
.spy-page .spy-search-results-table {
    display: block !important;
    min-width: 0 !important;
    width: 100% !important;
}

.spy-page .spy-targets-table thead,
.spy-page .spy-search-results-table thead {
    display: none !important;
}

.spy-page .spy-targets-table tbody,
.spy-page .spy-search-results-table tbody {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.5rem !important;
}

.spy-page .spy-targets-table tbody tr,
.spy-page .spy-search-results-table tbody tr {
    display: flex !important;
    flex-wrap: wrap !important;
    background: var(--color-bg-lighter) !important;
    border: 1px solid var(--color-border) !important;
    border-radius: 8px !important;
    padding: 0.625rem !important;
    align-items: center !important;
}

.spy-page .spy-targets-table tbody tr.disabled,
.spy-page .spy-search-results-table tbody tr.disabled {
    opacity: 0.6 !important;
}

/* Column 1: Player name - Full width, Line 1 */
.spy-page .spy-targets-table tbody tr td:nth-child(1),
.spy-page .spy-search-results-table tbody tr td:nth-child(1) {
    flex: 1 1 100% !important;
    font-size: 1rem !important;
    font-weight: 700 !important;
    color: var(--color-primary) !important;
    padding: 0 !important;
    border: none !important;
    margin-bottom: 0.375rem !important;
    display: block !important;
}

/* Columns 2, 3, 4 - Level, Race, Today - All inline on Line 2 */
.spy-page .spy-targets-table tbody tr td:nth-child(2),
.spy-page .spy-targets-table tbody tr td:nth-child(3),
.spy-page .spy-targets-table tbody tr td:nth-child(4),
.spy-page .spy-search-results-table tbody tr td:nth-child(2),
.spy-page .spy-search-results-table tbody tr td:nth-child(3),
.spy-page .spy-search-results-table tbody tr td:nth-child(4) {
    flex: 0 0 auto !important;
    padding: 0 !important;
    border: none !important;
    font-size: 0.8125rem !important;
    color: var(--color-text-muted) !important;
    display: inline !important;
    margin-bottom: 0.5rem !important;
}

/* Add "Lvl" prefix before level */
.spy-page .spy-targets-table tbody tr td:nth-child(2)::before,
.spy-page .spy-search-results-table tbody tr td:nth-child(2)::before {
    content: "Lvl " !important;
    font-weight: 600 !important;
}

/* Add separator after level */
.spy-page .spy-targets-table tbody tr td:nth-child(2)::after,
.spy-page .spy-search-results-table tbody tr td:nth-child(2)::after {
    content: " | " !important;
    color: var(--color-border-light) !important;
    margin: 0 0.25rem !important;
}

/* Add separator after race */
.spy-page .spy-targets-table tbody tr td:nth-child(3)::after,
.spy-page .spy-search-results-table tbody tr td:nth-child(3)::after {
    content: " | " !important;
    color: var(--color-border-light) !important;
    margin: 0 0.25rem !important;
}

/* Add "Souls:" prefix before souls value */
.spy-page .spy-targets-table tbody tr td:nth-child(4)::before,
.spy-page .spy-search-results-table tbody tr td:nth-child(4)::before {
    content: "Souls: " !important;
    font-weight: 600 !important;
    color: var(--color-text-muted) !important;
}

/* Column 5: Action button - Full width, Line 3 */
.spy-page .spy-targets-table tbody tr td:nth-child(5),
.spy-page .spy-search-results-table tbody tr td:nth-child(5) {
    flex: 1 1 100% !important;
    padding: 0 !important;
    border: none !important;
    display: block !important;
}

.spy-page .spy-targets-table tbody tr td:nth-child(5) form,
.spy-page .spy-search-results-table tbody tr td:nth-child(5) form {
    width: 100% !important;
}

.spy-page .spy-targets-table tbody tr td:nth-child(5) .btn,
.spy-page .spy-search-results-table tbody tr td:nth-child(5) .btn {
    width: 100% !important;
    min-height: 36px !important;
}

/* Spy page row layout */
.spy-page .row {
    display: flex;
    flex-direction: column;
    gap: var(--mobile-spacing-md);
}

.spy-page .col-main,
.spy-page .col-side {
    width: 100%;
}

/* Operation costs - Make gold amounts bold and gold-colored */
.spy-page .operation-costs .cost-item strong,
.spy-page .cost-item strong {
    font-weight: 700 !important;
    color: #f59e0b !important;
}

/* ==========================================================================
   57. Intelligence Report Detail Page - Mobile Optimized & Beautiful
   ========================================================================== */

/* Overall Page Compacting */
.intel-report-page .card {
    margin-bottom: var(--mobile-spacing-md);
}

.intel-report-page .card-body {
    padding: var(--mobile-spacing-md);
}

.intel-report-page .card-header {
    padding: var(--mobile-spacing-sm) var(--mobile-spacing-md);
}

.intel-report-page .card-header h2 {
    font-size: 1.125rem;
}

/* Report Meta Section - Compact Grid */
.intel-report-page .report-meta {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    padding: var(--mobile-spacing-md);
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    margin-bottom: var(--mobile-spacing-md);
    font-size: 0.875rem;
}

.intel-report-page .report-meta span {
    display: flex;
    justify-content: space-between;
    padding: 0.375rem 0;
    border-bottom: 1px solid var(--color-border);
}

.intel-report-page .report-meta span:last-child {
    border-bottom: none;
}

.intel-report-page .report-meta strong {
    color: var(--color-text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
}

/* Intel Sections Container */
.intel-report-page .intel-sections {
    display: flex;
    flex-direction: column;
    gap: var(--mobile-spacing-md);
}

/* Section Styling */
.intel-report-page .intel-section {
    background: var(--color-bg-lighter);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: var(--mobile-spacing-md);
}

.intel-report-page .intel-section h3 {
    font-size: 1rem;
    margin-bottom: var(--mobile-spacing-sm);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-primary);
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================
   Profile & Combat Stats - Enhanced 2-Column Grid
   ============================================ */

.intel-report-page .intel-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.intel-report-page .intel-item {
    display: flex;
    flex-direction: column;
    padding: 0.625rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    transition: all var(--transition-fast);
}

.intel-report-page .intel-label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.intel-report-page .intel-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
}

/* Highlighted Offense Items - Red Glow */
.intel-report-page .intel-item.highlight-offense {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.2);
}

.intel-report-page .intel-item.highlight-offense .intel-value {
    color: #ef4444;
}

/* Highlighted Defense Items - Blue Glow */
.intel-report-page .intel-item.highlight-defense {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.2);
}

.intel-report-page .intel-item.highlight-defense .intel-value {
    color: #3b82f6;
}

/* Highlighted Souls Items - Gold Glow */
.intel-report-page .intel-item.highlight-souls {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.2);
}

.intel-report-page .intel-item.highlight-souls .intel-value {
    color: #f59e0b;
}

/* ============================================
   Buildings Section - Keep Original Grid
   ============================================ */

.intel-report-page .buildings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.intel-report-page .building-item {
    display: flex;
    flex-direction: column;
    padding: 0.625rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    text-align: center;
}

.intel-report-page .building-name {
    font-weight: 600;
    color: var(--color-text);
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.intel-report-page .building-level {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* ============================================
   Tables - Compact 3-Line Format Using Flexbox
   (Army Composition, Armory Inventory, Battle Upgrades)
   ============================================ */

.intel-report-page .intel-section table {
    display: block !important;
    width: 100% !important;
}

.intel-report-page .intel-section thead {
    display: none !important;
}

.intel-report-page .intel-section tbody {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.5rem !important;
}

.intel-report-page .intel-section tbody tr {
    display: flex !important;
    flex-wrap: wrap !important;
    background: var(--color-bg) !important;
    border: 1px solid var(--color-border) !important;
    border-radius: 8px !important;
    padding: 0.75rem !important;
    align-items: baseline !important;
}

/* ============================================
   Army Composition & Armory Tables (5 columns)
   Column 1: Name
   Column 2: Type/Category Badge
   Column 3: Quantity
   Column 4: Bonus
   Column 5: Total
   ============================================ */

/* First cell - Unit/Item name - Full width, Line 1 */
.intel-report-page .intel-section tbody tr td:nth-child(1) {
    flex: 1 1 100% !important;
    font-size: 1rem !important;
    font-weight: 700 !important;
    color: var(--color-text) !important;
    padding: 0 !important;
    border: none !important;
    margin-bottom: 0.25rem !important;
    display: block !important;
}

/* Second cell - Type badge - Full width, Line 2 */
.intel-report-page .intel-section tbody tr td:nth-child(2) {
    flex: 1 1 100% !important;
    padding: 0 !important;
    border: none !important;
    margin-bottom: 0.5rem !important;
    display: block !important;
}

.intel-report-page .intel-section tbody tr td:nth-child(2) .type-badge {
    display: inline-block !important;
    padding: 0.125rem 0.5rem !important;
    border-radius: 12px !important;
    font-size: 0.6875rem !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
}

/* Type badge colors */
.intel-report-page .intel-section tbody tr td:nth-child(2) .type-badge.type-offense,
.intel-report-page .intel-section tbody tr td:nth-child(2) .type-badge.type-Offense {
    background: rgba(239, 68, 68, 0.2) !important;
    color: #ef4444 !important;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
}

.intel-report-page .intel-section tbody tr td:nth-child(2) .type-badge.type-defense,
.intel-report-page .intel-section tbody tr td:nth-child(2) .type-badge.type-Defense {
    background: rgba(59, 130, 246, 0.2) !important;
    color: #3b82f6 !important;
    border: 1px solid rgba(59, 130, 246, 0.3) !important;
}

.intel-report-page .intel-section tbody tr td:nth-child(2) .type-badge.type-spy_offense {
    background: rgba(139, 92, 246, 0.2) !important;
    color: #8b5cf6 !important;
    border: 1px solid rgba(139, 92, 246, 0.3) !important;
}

.intel-report-page .intel-section tbody tr td:nth-child(2) .type-badge.type-spy_defense {
    background: rgba(236, 72, 153, 0.2) !important;
    color: #ec4899 !important;
    border: 1px solid rgba(236, 72, 153, 0.3) !important;
}

/* Third, Fourth, Fifth cells - All inline on Line 3 */
.intel-report-page .intel-section tbody tr td:nth-child(3),
.intel-report-page .intel-section tbody tr td:nth-child(4),
.intel-report-page .intel-section tbody tr td:nth-child(5) {
    flex: 0 0 auto !important;
    padding: 0 !important;
    border: none !important;
    font-size: 0.875rem !important;
    color: var(--color-text-muted) !important;
    display: inline !important;
}

/* Add "units" after quantity */
.intel-report-page .intel-section tbody tr td:nth-child(3)::after {
    content: " units" !important;
    color: var(--color-text-muted) !important;
}

/* Add separator and "+" before bonus */
.intel-report-page .intel-section tbody tr td:nth-child(4)::before {
    content: " | +" !important;
    color: var(--color-border-light) !important;
}

/* Add " each" after bonus */
.intel-report-page .intel-section tbody tr td:nth-child(4)::after {
    content: " each" !important;
    color: var(--color-text-muted) !important;
}

/* Add separator and "Total:" before total */
.intel-report-page .intel-section tbody tr td:nth-child(5)::before {
    content: " | Total: " !important;
    color: var(--color-border-light) !important;
}

.intel-report-page .intel-section tbody tr td:nth-child(5) {
    font-weight: 600 !important;
    color: var(--color-primary) !important;
}

/* ============================================
   Report Actions at Bottom
   ============================================ */

.intel-report-page .report-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: var(--mobile-spacing-md);
}

.intel-report-page .report-actions .btn {
    width: 100%;
}

.intel-report-page .report-actions .battle-action-wrap {
    display: block;
    width: 100%;
}

.intel-report-page .report-actions .battle-action-wrap .btn {
    width: 100%;
}

.intel-report-page .report-actions .battle-action-wrap form {
    display: contents;
}

/* Also handle inline-form wraps for Physical/Magical/Spy buttons */
.intel-report-page .report-actions .inline-form {
    width: 100%;
}

.intel-report-page .report-actions .inline-form .btn {
    width: 100%;
}

/* ==========================================================================
   58. Mobile Sort Controls - Attack Page (Mobile Only)
   ========================================================================== */

/* Container - only visible on mobile */
.mobile-sort-controls {
    display: block !important;
    margin-bottom: var(--mobile-spacing-md);
}

/* Hide on desktop */
@media (min-width: 769px) {
    .mobile-sort-controls {
        display: none !important;
    }
}

/* Sort Panel - Collapsible Details Element */
.sort-panel {
    background: var(--color-bg-lighter);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    overflow: hidden;
    transition: all var(--transition-fast);
}

/* Panel Header - Summary Element */
.sort-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--mobile-spacing-md);
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    background: var(--color-bg-lighter);
    transition: all var(--transition-fast);
    list-style: none;
    min-height: var(--mobile-touch-target);
}

/* Remove default marker */
.sort-panel-header::-webkit-details-marker {
    display: none;
}

.sort-panel-header::marker {
    display: none;
}

/* Hover/Active states */
.sort-panel-header:active {
    background: rgba(0, 0, 0, 0.1);
}

/* Icon */
.sort-panel-icon {
    font-size: 1.25rem;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

/* Title */
.sort-panel-title {
    flex: 1;
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--color-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Arrow indicator */
.sort-panel-arrow {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

/* Rotate arrow when open */
.sort-panel[open] .sort-panel-arrow {
    transform: rotate(180deg);
}

/* Highlight header when open */
.sort-panel[open] .sort-panel-header {
    border-bottom: 1px solid var(--color-border);
    background: rgba(0, 0, 0, 0.15);
}

/* Form Container */
.sort-panel-form {
    padding: var(--mobile-spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--mobile-spacing-md);
    background: var(--color-bg);
}

/* Form Groups */
.sort-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Labels */
.sort-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Select Dropdowns */
.sort-select {
    min-height: var(--mobile-touch-target);
    padding: 0.75rem 1rem;
    font-size: 16px; /* Prevents iOS zoom */
    border-radius: 8px;
    background: var(--color-bg-lighter);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.sort-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(255, 204, 0, 0.1);
}

/* Apply Button */
.sort-apply-btn {
    min-height: var(--mobile-touch-target);
    padding: 0.875rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--color-primary);
    color: #000;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    touch-action: manipulation;
    width: 100%;
}

.sort-apply-btn:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(255, 204, 0, 0.3);
}

/* Smooth opening animation */
.sort-panel[open] .sort-panel-form {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   58. Dashboard Ranks - Mobile Optimized
   ========================================================================== */

.dashboard-ranks {
    gap: 0.35rem;
    justify-content: center;
}

.dashboard-ranks .rank-badge {
    padding: 0.25rem 0.5rem;
    min-width: 45px;
    border-radius: 5px;
}

.dashboard-ranks .rank-label {
    font-size: 0.55rem;
    letter-spacing: 0.3px;
}

.dashboard-ranks .rank-value {
    font-size: 0.85rem;
}

.dashboard-ranks .rank-badge:hover {
    transform: none; /* Disable hover transform on mobile */
}

.dashboard-ranks .rank-badge:active {
    transform: scale(0.95);
}

/* ==========================================================================
   Bounty Page - Mobile Card Layout with Labels
   ========================================================================== */

/* Top Bounty Hunters Table - 4 columns: Rank, Username, Bounties Completed, Souls Earned */
.bounty-page .bounty-leaderboard-tile .ranking-table {
    display: block;
    min-width: 0;
}

.bounty-page .bounty-leaderboard-tile .ranking-table thead {
    display: none;
}

.bounty-page .bounty-leaderboard-tile .ranking-table tbody {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.bounty-page .bounty-leaderboard-tile .ranking-table tbody tr {
    display: flex;
    flex-direction: column;
    background: var(--color-bg-lighter);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 0.625rem;
}

.bounty-page .bounty-leaderboard-tile .ranking-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.3rem 0;
    border-bottom: 1px solid var(--color-border);
}

.bounty-page .bounty-leaderboard-tile .ranking-table tbody td:last-child {
    border-bottom: none;
}

/* Row 1: Rank + Name together */
.bounty-page .bounty-leaderboard-tile .ranking-table tbody td:nth-child(1) {
    justify-content: flex-start;
    font-weight: 700;
    border-bottom: none;
    padding-bottom: 0;
}

.bounty-page .bounty-leaderboard-tile .ranking-table tbody td:nth-child(2) {
    justify-content: flex-start;
    font-weight: 600;
    padding-top: 0;
    padding-bottom: 0.5rem;
}

.bounty-page .bounty-leaderboard-tile .ranking-table tbody td:nth-child(3)::before {
    content: "COMPLETED:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

.bounty-page .bounty-leaderboard-tile .ranking-table tbody td:nth-child(4)::before {
    content: "SOULS EARNED:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

/* Active Bounties Table - 6 columns: Target, Type, Unit, Reward, Expires, Placed By (hidden) */
.bounty-page .bounty-active-table {
    display: block;
    min-width: 0;
}

.bounty-page .bounty-active-table thead {
    display: none;
}

.bounty-page .bounty-active-table tbody {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.bounty-page .bounty-active-table tbody tr {
    display: flex;
    flex-direction: column;
    background: var(--color-bg-lighter);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 0.625rem;
}

.bounty-page .bounty-active-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.3rem 0;
    border-bottom: 1px solid var(--color-border);
}

.bounty-page .bounty-active-table tbody td:last-child {
    border-bottom: none;
}

/* Target name - prominent */
.bounty-page .bounty-active-table tbody td:nth-child(1) {
    justify-content: flex-start;
    font-weight: 600;
    font-size: 1rem;
    padding-bottom: 0.5rem;
}

.bounty-page .bounty-active-table tbody td:nth-child(2)::before {
    content: "TYPE:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

.bounty-page .bounty-active-table tbody td:nth-child(3)::before {
    content: "UNIT:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

.bounty-page .bounty-active-table tbody td:nth-child(4)::before {
    content: "REWARD:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

.bounty-page .bounty-active-table tbody td:nth-child(5)::before {
    content: "EXPIRES:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

/* My Placed Bounties Table - 6 columns: Target, Type, Unit, Reward, Status, Claimed By (hidden) */
.bounty-page .bounty-my-table {
    display: block;
    min-width: 0;
}

.bounty-page .bounty-my-table thead {
    display: none;
}

.bounty-page .bounty-my-table tbody {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.bounty-page .bounty-my-table tbody tr {
    display: flex;
    flex-direction: column;
    background: var(--color-bg-lighter);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 0.625rem;
}

.bounty-page .bounty-my-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.3rem 0;
    border-bottom: 1px solid var(--color-border);
}

.bounty-page .bounty-my-table tbody td:last-child {
    border-bottom: none;
}

/* Target name - prominent */
.bounty-page .bounty-my-table tbody td:nth-child(1) {
    justify-content: flex-start;
    font-weight: 600;
    font-size: 1rem;
    padding-bottom: 0.5rem;
}

.bounty-page .bounty-my-table tbody td:nth-child(2)::before {
    content: "TYPE:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

.bounty-page .bounty-my-table tbody td:nth-child(3)::before {
    content: "UNIT:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

.bounty-page .bounty-my-table tbody td:nth-child(4)::before {
    content: "REWARD:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

.bounty-page .bounty-my-table tbody td:nth-child(5)::before {
    content: "STATUS:";
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

/* ==========================================================================
   55. Graveyard Page - Mobile
   ========================================================================== */

/* Resurrection table: card layout on mobile */
.graveyard-page .resurrection-table thead {
    display: none;
}

.graveyard-page .resurrection-table tbody tr {
    display: flex;
    flex-direction: column;
    padding: var(--mobile-spacing-sm);
    border-bottom: 1px solid var(--color-border);
    gap: 0.25rem;
}

.graveyard-page .resurrection-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
    border: none;
}

.graveyard-page .resurrection-table tbody td::before {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-right: auto;
    padding-right: 0.5rem;
}

.graveyard-page .resurrection-table tbody td:nth-child(1)::before {
    content: "UNITS RAISED:";
}

.graveyard-page .resurrection-table tbody td:nth-child(2)::before {
    content: "SOULS SPENT:";
}

.graveyard-page .resurrection-table tbody td:nth-child(3)::before {
    content: "WHEN:";
}

/* Quick buttons stack on mobile */
.graveyard-page .quick-buttons {
    flex-direction: column;
}

.graveyard-page .quick-buttons .btn {
    width: 100%;
}

/* ==========================================================================
   Battleground Page - Mobile 3-Line Card Layout (CSS Grid)
   Line 1: (Avatar) Name (left) ............... Level ## (right)
   Line 2: Souls: ###,### (left) .............. Class (right)
   Line 3: In Range/Out of Range (left) ....... Arrow ▼ (right)
   ========================================================================== */

.battleground-page .row {
    display: flex;
    flex-direction: column;
    gap: var(--mobile-spacing-md);
}

.battleground-page .col-main,
.battleground-page .col-side {
    width: 100%;
}

/* Table reset */
.battleground-page .battleground-table {
    display: block !important;
    min-width: 0 !important;
    width: 100% !important;
}

.battleground-page .battleground-table thead {
    display: none !important;
}

.battleground-page .battleground-table tbody {
    display: flex !important;
    flex-direction: column;
    gap: 2px;
}

/* --- Each collapsed row = CSS Grid 3-row x 2-col card --- */
.battleground-page .battleground-row {
    display: grid !important;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
    align-items: center;
    background: var(--color-bg-lighter);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    gap: 0;
}

.battleground-page .battleground-row.disabled,
.battleground-page .battleground-row.own-row {
    opacity: 0.5;
}

/* Hard reset ALL tds */
.battleground-page .battleground-row td {
    display: flex !important;
    align-items: center;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    background: none !important;
    font-size: 0.8rem;
    line-height: 1.3;
}

/* Kill all generic ::before labels */
.battleground-page .battleground-row td::before {
    content: none !important;
}

/* Small avatars */
.battleground-page .battleground-row .player-avatar-sm {
    width: 18px !important;
    height: 18px !important;
}

.battleground-page .battleground-row .player-avatar-placeholder-sm {
    width: 18px !important;
    height: 18px !important;
    font-size: 10px !important;
}

/* Shrink custom display name images */
.battleground-page .battleground-row .custom-display-name {
    max-height: 16px !important;
    width: auto !important;
    height: auto !important;
}

/* === Grid placement === */

/* td1 = Name → Row 1, Col 1 (left) */
.battleground-page .battleground-row td:nth-child(1) {
    grid-row: 1;
    grid-column: 1;
    font-weight: 600;
    overflow: hidden;
    min-width: 0;
}

.battleground-page .battleground-row td:nth-child(1) .player-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* td2 = Level → Row 1, Col 2 (right) */
.battleground-page .battleground-row td:nth-child(2) {
    grid-row: 1;
    grid-column: 2;
    justify-self: end;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.battleground-page .battleground-row td:nth-child(2)::before {
    content: "Level " !important;
    font-weight: 600;
}

/* td3 = Class → Row 2, Col 2 (right) */
.battleground-page .battleground-row td:nth-child(3) {
    grid-row: 2;
    grid-column: 2;
    justify-self: end;
    font-size: 0.75rem;
}

/* td4 = Souls → Row 2, Col 1 (left) — block display so ::before sits inline with text */
.battleground-page .battleground-row td:nth-child(4) {
    display: block !important;
    grid-row: 2;
    grid-column: 1;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.battleground-page .battleground-row td:nth-child(4)::before {
    content: "Souls: " !important;
    font-weight: 600;
}

/* td5 = Profile button → hidden on mobile (name is already a link) */
.battleground-page .battleground-row td:nth-child(5) {
    display: none !important;
}

/* td6 = Arrow → Row 3, Col 2 (right) */
.battleground-page .battleground-row td:nth-child(6) {
    grid-row: 3;
    grid-column: 2;
    justify-self: end;
    width: auto;
}

/* Range label via ::after → Row 3, Col 1 (left) */
.battleground-page .battleground-row::after {
    content: attr(data-range-label);
    grid-row: 3;
    grid-column: 1;
    font-size: 0.65rem;
    font-weight: 600;
    line-height: 1.4;
}

.battleground-page .battleground-row[data-range-label="In Range"]::after {
    color: var(--color-success, #22c55e);
}

.battleground-page .battleground-row[data-range-label="Out of Range"]::after {
    color: var(--color-danger, #ef4444);
}

.battleground-page .battleground-row.own-row::after {
    display: none;
}

/* -------------------------------------------------------------------
   Expanded actions row
   ------------------------------------------------------------------- */
.battleground-page .battleground-actions-row[style*="table-row"] {
    display: flex !important;
    background: var(--color-bg-lighter);
    border: 1px solid var(--color-border);
    border-top: none;
    border-radius: 0 0 4px 4px;
    margin-top: -2px;
}

.battleground-page .battleground-actions-row td {
    display: block !important;
    width: 100%;
    padding: 0.4rem 0.5rem !important;
    border: none !important;
}

.battleground-page .battleground-actions {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 0.2rem;
    width: 100%;
}

/* Row 1: Physical, Magical, Spy — 3 equal columns */
.battleground-page .battleground-actions > :nth-child(1),
.battleground-page .battleground-actions > :nth-child(2),
.battleground-page .battleground-actions > :nth-child(3) {
    grid-column: span 4;
}

/* Row 2: Convert, Eliminate, Soul Steal, View Profile — 4 equal columns */
.battleground-page .battleground-actions > :nth-child(n+4) {
    grid-column: span 3;
}

.battleground-page .battleground-actions .bg-action-btn,
.battleground-page .battleground-actions .btn,
.battleground-page .battleground-actions .inline {
    min-width: 0;
    text-align: center;
}

.battleground-page .battleground-actions .bg-action-btn,
.battleground-page .battleground-actions .inline .bg-action-btn {
    width: 100%;
    font-size: 0.7rem;
    padding: 0.3rem 0.15rem;
    min-height: 28px;
}

/* Action limit counters on mobile */
.battleground-page .action-limit {
    display: block;
    font-size: 0.55rem;
    opacity: 0.75;
    margin-top: 1px;
}

.battleground-page .out-of-range-note {
    grid-column: 1 / -1;
    text-align: center;
    font-size: 0.7rem;
    margin-top: 0.2rem;
}

/* Sidebar compact */
.battleground-page .breakdown-item {
    padding: 0.4rem 0.5rem;
}

/* Mobile visibility utilities */
.hide-mobile {
    display: none !important;
}
.show-mobile {
    display: block !important;
}

