/**
 * D4 Build System - Mobile Styles
 * Responsive styles and touch-specific optimizations
 *
 * @version 1.0.0
 */

/* =================================================================
   Touch Device Detection Class (added by touch-utils.js)
   ================================================================= */

/* Touch-specific styles only applied when d4-touch-device class is present */

/* =================================================================
   Global Touch Target Sizes (44px minimum for accessibility)
   ================================================================= */

@media (hover: none) and (pointer: coarse) {
    /* Gem/Rune icons need larger touch targets */
    .d4-gem-icon-wrapper {
        min-width: 32px;
        min-height: 32px;
        padding: 6px;
    }

    .d4-gem-icon,
    .d4-rune-icon {
        min-width: 24px;
        min-height: 24px;
    }

    /* Skill keybinds need larger touch area */
    .d4-skill-keybind {
        min-width: 28px;
        min-height: 28px;
        font-size: 11px;
    }

    /* Book modifier symbols need larger touch area */
    .d4-book-modifier-symbol {
        min-width: 24px !important;
        min-height: 24px !important;
    }

    /* Spirit boon icons need larger touch area */
    .d4-spirit-boon-item {
        min-width: 50px;
        min-height: 50px;
    }

    /* Control buttons (zoom, fullscreen, reset) */
    .d4-stf-control-btn,
    .d4-paragon-control-btn,
    .d4-paragon-expand-btn,
    .d4-stf-expand-btn {
        min-width: 44px;
        min-height: 44px;
        font-size: 18px;
    }
}

/* =================================================================
   Tooltip Touch Support
   ================================================================= */

/* Touch-visible tooltip state */
.d4-tooltip-visible {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* Prevent hover tooltips on touch devices */
.d4-touch-device .d4-gear-slot:hover .d4-tooltip,
.d4-touch-device .d4-extra-item:hover .d4-tooltip,
.d4-touch-device [data-item-id]:hover .d4-tooltip {
    display: none;
}

/* Mobile tooltip styling fixes */
@media (max-width: 768px) {
    /* Fix tooltip border/padding issue */
    .d4-item-tooltip,
    .d4-tooltip {
        padding: 0 !important;
        background: transparent !important;
        border: none !important;
    }

    .d4-item-tooltip > div,
    .d4-tooltip > div {
        margin: 0 !important;
    }

    /* Ensure tooltip is properly sized */
    .d4-item-tooltip,
    .d4-tooltip {
        max-width: calc(100vw - 24px) !important;
        min-width: 200px !important;
    }
}

/* =================================================================
   Breakpoint: Tablet (max-width: 1024px)
   ================================================================= */

@media (max-width: 1024px) {
    /* Build container width */
    .d4-build-container {
        max-width: 100%;
        padding: 0 16px;
    }

    /* Equipment grid - reduce gap */
    .d4-equipment-grid {
        gap: 30px;
    }

    /* Skill icons slightly smaller */
    .d4-extra-icon-wrapper {
        width: 50px;
        height: 50px;
    }

    .d4-extra-icon {
        width: 50px;
        height: 50px;
    }
}

/* =================================================================
   Breakpoint: Mobile (max-width: 768px)
   ================================================================= */

@media (max-width: 768px) {
    /* Build container - full width */
    .d4-build-container {
        padding: 0 12px;
    }

    /* Hide desktop header elements that don't fit */
    .d4-build-header .d4-header-extra-info {
        display: none;
    }

    /* ============================================
       Aspects & Gear - Simple Vertical List
       ============================================ */

    /* Equipment grid - single column */
    .d4-equipment-grid {
        display: block !important;
    }

    /* Remove grid structure */
    .d4-equipment-slots {
        display: block !important;
    }

    .d4-equipment-left,
    .d4-equipment-right {
        display: block !important;
        width: 100%;
    }

    /* Hide empty gear slots */
    .d4-gear-slot:not(.filled) {
        display: none !important;
    }

    /* ALL gear slots - same layout: Icon left, Info right */
    .d4-gear-slot.filled {
        display: flex !important;
        flex-direction: row !important;
        align-items: center;
        gap: 12px;
        justify-content: flex-start;
        margin-bottom: 4px !important;
        padding: 6px 8px !important;
        background: var(--bg-card, #1e1f24);
        border-radius: 4px;
        height: auto !important; /* Override 80px fixed height */
    }

    /* Force order: Image first (order 1), Info second (order 2) */
    .d4-gear-slot.filled > a.d4-item-link,
    .d4-gear-slot.filled > .d4-slot-placeholder {
        order: 1 !important;
    }

    .d4-gear-slot.filled > .d4-slot-info {
        order: 2 !important;
    }

    /* Placeholder (image container) */
    .d4-gear-slot .d4-slot-placeholder {
        width: 55px !important;
        height: 55px !important;
        min-width: 55px !important;
        max-width: 55px !important;
        flex-shrink: 0 !important;
    }

    /* Info section - force same layout for ALL items */
    .d4-gear-slot.filled .d4-slot-info {
        flex: 1 !important;
        text-align: left !important;
        min-width: 0;
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        justify-content: center !important;
    }

    .d4-gear-slot .d4-slot-label {
        font-size: 11px !important;
        color: #888 !important;
        display: block !important;
        text-align: left !important;
    }

    .d4-gear-slot .d4-gear-name {
        font-size: 13px !important;
        display: block !important;
        text-decoration: none !important;
        text-align: left !important;
    }

    /* ============================================
       Section Spacing (simple margins)
       ============================================ */

    /* Aspects & Gear title */
    .d4-equipment-section .d4-extras-title {
        margin-bottom: 12px;
    }

    /* Skills section - add space above */
    .d4-equipment-slots + div {
        margin-top: 30px !important;
    }

    /* Class-specific section spacing */
    .d4-equipment-section [style*="min-width: 175px"] {
        min-width: 100% !important;
        margin-top: 20px;
    }

    /* Book of the Dead / Spirit Boons spacing */
    .d4-book-mobile-accordion,
    .d4-book-desktop-layout,
    .d4-spirit-mobile-tabs,
    .d4-spirit-desktop-layout {
        margin-top: 20px;
    }

    /* Extras section spacing */
    .d4-equipment-extras {
        width: 100%;
        margin-top: 30px;
    }

    .d4-equipment-extras > div {
        margin-bottom: 24px;
    }

    .d4-equipment-extras > div:last-child {
        margin-bottom: 0;
    }

    .d4-equipment-extras .d4-extras-title {
        margin-bottom: 12px;
    }

    /* ============================================
       Links & Tooltips on Mobile
       ============================================ */

    /* Disable link navigation */
    .d4-equipment-section a.d4-item-link,
    .d4-extras-section a.d4-item-link,
    .d4-rune-item a.d4-item-link {
        pointer-events: none;
    }

    /* Re-enable pointer events on tooltip elements */
    .d4-slot-placeholder,
    .d4-gear-name,
    .d4-extra-icon-wrapper,
    .d4-extra-icon,
    .d4-extra-item[data-item-id] {
        pointer-events: auto !important;
        cursor: pointer;
    }

    /* ============================================
       Skills Section
       ============================================ */

    .d4-equipment-section [style*="display: flex"][style*="gap: 50px"] {
        flex-direction: column !important;
        gap: 20px !important;
    }

    /* Skills icons */
    .d4-extra-item {
        padding: 0;
    }

    .d4-extra-icon-wrapper,
    .d4-extra-icon {
        width: 50px !important;
        height: 50px !important;
    }

    /* Season powers grid - 2 columns */
    .d4-extras-list {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px;
    }

    .d4-extras-list.d4-season-powers-8 {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Runes container */
    .d4-runes-container {
        flex-direction: column;
        gap: 16px;
    }

    .d4-runeword-group {
        width: 100%;
    }

    /* Mercenary list */
    .d4-merc-list {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* ============================================
       Book of the Dead - Mobile Accordion
       ============================================ */

    /* Hide desktop grid layout */
    .d4-book-desktop-layout {
        display: none !important;
    }

    /* Show mobile accordion */
    .d4-book-mobile-accordion {
        display: block !important;
    }

    /* ============================================
       Spirit Boons - Mobile Tabs
       ============================================ */

    /* Hide desktop grid layout */
    .d4-spirit-desktop-layout {
        display: none !important;
    }

    /* Show mobile tabs */
    .d4-spirit-mobile-tabs {
        display: block !important;
    }

    /* Tab navigation */
    .d4-spirit-tab-nav {
        display: flex;
        gap: 8px;
        margin-bottom: 16px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .d4-spirit-tab-nav::-webkit-scrollbar {
        display: none;
    }

    .d4-spirit-tab-btn {
        flex: 0 0 auto;
        padding: 8px 16px;
        background: var(--bg-secondary, #1a1b20);
        border: 2px solid var(--border-primary, #444757);
        border-radius: 4px;
        color: #888;
        cursor: pointer;
        transition: all 0.2s;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .d4-spirit-tab-btn.active {
        border-color: #d4af37;
        color: #fff;
        background: rgba(212, 175, 55, 0.15);
    }

    .d4-spirit-tab-btn img {
        width: 24px;
        height: 24px;
        object-fit: contain;
    }

    .d4-spirit-tab-btn .d4-prime-star {
        color: #d4af37;
        font-size: 12px;
    }

    /* Tab panels */
    .d4-spirit-tab-panel {
        display: none;
    }

    .d4-spirit-tab-panel.active {
        display: block;
    }

    .d4-spirit-tab-panel .d4-boons-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .d4-spirit-tab-panel .d4-spirit-boon-item {
        width: 60px;
        height: 60px;
    }
}

/* =================================================================
   Breakpoint: Small Mobile (max-width: 480px)
   ================================================================= */

@media (max-width: 480px) {
    /* Even smaller padding */
    .d4-build-container {
        padding: 0 8px;
    }

    /* Tab buttons - smaller text */
    .d4-build-tabs .d4-tab-btn {
        font-size: 12px;
        padding: 8px 12px;
    }

    /* Gear slot even smaller */
    .d4-slot-placeholder {
        width: 50px !important;
        height: 50px !important;
        min-width: 50px;
    }

    /* Skills grid - 3 per row */
    .d4-equipment-section > div > div[style*="display: flex; justify-content: center"] {
        gap: 10px !important;
    }

    .d4-extra-icon-wrapper,
    .d4-extra-icon {
        width: 45px !important;
        height: 45px !important;
    }

    /* Season powers - 2 columns still but smaller */
    .d4-extras-list {
        gap: 8px;
    }

    .d4-extra-name {
        font-size: 11px;
    }

    /* Book of the Dead accordion - smaller icons */
    .d4-book-mobile-accordion .d4-book-icon-wrapper {
        width: 40px;
        height: 40px;
    }

    /* Spirit Boons tabs - smaller icons */
    .d4-spirit-tab-panel .d4-spirit-boon-item {
        width: 50px;
        height: 50px;
    }
}

/* =================================================================
   Breakpoint: Extra Small (max-width: 375px)
   ================================================================= */

@media (max-width: 375px) {
    /* Minimal padding */
    .d4-build-container {
        padding: 0 4px;
    }

    /* Tab buttons - even smaller */
    .d4-build-tabs .d4-tab-btn {
        font-size: 11px;
        padding: 6px 8px;
    }

    /* Gear name truncation */
    .d4-gear-name {
        max-width: 120px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Skills - 3 columns tighter */
    .d4-extra-icon-wrapper,
    .d4-extra-icon {
        width: 40px !important;
        height: 40px !important;
    }

    .d4-skill-keybind {
        width: 20px;
        height: 20px;
        font-size: 9px;
    }
}

/* =================================================================
   Book of the Dead - Mobile Accordion Component
   ================================================================= */

/* Hide by default (shown via media query) */
.d4-book-mobile-accordion {
    display: none;
}

/* Accordion item */
.d4-book-accordion-item {
    background: var(--bg-secondary, #1a1b20);
    border: 1px solid var(--border-primary, #444757);
    border-radius: 4px;
    margin-bottom: 8px;
    overflow: hidden;
}

/* Accordion header (clickable) */
.d4-book-accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    background: var(--bg-card, #25262b);
    transition: background 0.2s;
}

.d4-book-accordion-header:hover,
.d4-book-accordion-header:active {
    background: var(--bg-hover, #2c2d32);
}

.d4-book-accordion-title {
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.d4-book-accordion-arrow {
    color: #888;
    font-size: 12px;
    transition: transform 0.3s;
}

.d4-book-accordion-item.open .d4-book-accordion-arrow {
    transform: rotate(180deg);
}

/* Accordion content */
.d4-book-accordion-content {
    display: none;
    padding: 16px;
}

.d4-book-accordion-item.open .d4-book-accordion-content {
    display: block;
}

/* Type row inside accordion */
.d4-book-accordion-content .d4-book-type-row {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-primary, #444757);
}

.d4-book-accordion-content .d4-book-type-row:last-child {
    border-bottom: none;
}

.d4-book-accordion-content .d4-book-icon-wrapper {
    width: 45px;
    height: 45px;
    border: 2px solid var(--border-primary);
    border-radius: 4px;
    padding: 3px;
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.d4-book-accordion-content .d4-book-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.d4-book-accordion-content .d4-book-connector {
    width: 8px;
    height: 1px;
    background-color: var(--border-primary);
    flex-shrink: 0;
}

.d4-book-accordion-content .d4-book-modifier-symbol {
    width: 28px !important;
    height: 28px !important;
    border: 2px solid #888;
    flex-shrink: 0;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.d4-book-accordion-content .d4-book-modifier-symbol:active {
    transform: scale(0.95);
}

.d4-book-accordion-content .d4-book-modifier-symbol.circle {
    border-radius: 50%;
}

.d4-book-accordion-content .d4-book-modifier-symbol.diamond {
    transform: rotate(45deg);
}

.d4-book-accordion-content .d4-book-modifier-symbol.active {
    background-color: #dc2626;
}

/* =================================================================
   Spirit Boons - Mobile Tabs Component
   ================================================================= */

/* Hide by default (shown via media query) */
.d4-spirit-mobile-tabs {
    display: none;
}

/* Desktop layout marker (for JS to hide on mobile) */
.d4-spirit-desktop-layout {
    display: grid;
}

.d4-book-desktop-layout {
    display: grid;
}

/* =================================================================
   Paragon Board - Mobile Optimizations
   ================================================================= */

@media (max-width: 768px) {
    /* Paragon section - reduce minimum height */
    .d4-paragon-section {
        min-height: auto;
    }

    .d4-paragon-boards-grid {
        min-height: 250px;
    }

    /* Info bar - stack on mobile */
    .d4-paragon-info-bar {
        flex-wrap: wrap;
        gap: 8px;
        padding: 8px;
    }

    .d4-paragon-info-box {
        padding: 6px 10px;
        font-size: 12px;
    }

    /* Board cards - horizontal scroll on mobile */
    .d4-paragon-boards-container {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .d4-paragon-boards-container::-webkit-scrollbar {
        display: none;
    }

    .d4-paragon-board-card {
        flex: 0 0 100%;
        scroll-snap-align: start;
    }
}

/* =================================================================
   Skill Tree - Mobile Optimizations
   ================================================================= */

@media (max-width: 768px) {
    /* Skill tree section */
    .d4-skilltree-frontend {
        min-height: 300px;
    }

    /* Info bar - smaller */
    .d4-stf-info-bar {
        padding: 8px;
        gap: 8px;
    }

    .d4-stf-info-box {
        padding: 6px 10px;
        font-size: 12px;
    }

    .d4-stf-info-label {
        font-size: 10px;
    }

    .d4-stf-info-value {
        font-size: 14px;
    }

    /* Cluster grid - wrap more aggressively */
    .d4-cluster-grid {
        gap: 4px !important;
    }

    .d4-skill-slot {
        width: 50px !important;
        height: 50px !important;
    }

    .d4-skill-slot img {
        width: 45px !important;
        height: 45px !important;
    }
}

/* =================================================================
   Gearstats Tab - Mobile Optimizations
   ================================================================= */

@media (max-width: 768px) {
    /* Stats grid - single column */
    .d4-gearstats-grid {
        grid-template-columns: 1fr !important;
    }

    /* Stat categories */
    .d4-stat-category {
        padding: 12px;
    }

    .d4-stat-row {
        font-size: 13px;
    }
}

/* =================================================================
   Mercenaries Tab - Mobile Optimizations
   ================================================================= */

@media (max-width: 768px) {
    /* Mercenary section already has some responsive */
    .d4-mercenary-section {
        padding: 16px;
    }

    .d4-merc-container {
        flex-direction: column;
        gap: 20px;
    }

    .d4-merc-card {
        width: 100%;
        max-width: none;
    }
}

/* =================================================================
   Build Header - Mobile Optimizations
   ================================================================= */

@media (max-width: 768px) {
    .d4-build-header {
        padding: 16px 12px;
    }

    .d4-build-header-top {
        flex-wrap: wrap;
        gap: 12px;
    }

    .d4-class-icon {
        width: 60px !important;
        height: 60px !important;
    }

    .d4-build-header-content {
        flex: 1;
        min-width: 0; /* Prevent overflow */
    }

    .d4-build-title {
        font-size: 20px !important;
        word-wrap: break-word;
    }

    .d4-build-subtitle {
        font-size: 13px !important;
    }

    .d4-build-updated {
        font-size: 11px !important;
    }

    /* Badges und Share Button unter den Header-Content */
    .d4-build-header-right {
        width: 100%;
        flex-wrap: wrap;
        gap: 6px;
        margin-left: 0;
        margin-top: 4px;
    }

    .build-type-badge {
        font-size: 11px !important;
        padding: 5px 8px !important;
    }

    .tier-badge {
        font-size: 11px !important;
        padding: 5px 8px !important;
        min-width: 30px !important;
    }

    .season-badge {
        font-size: 11px !important;
        padding: 5px 8px !important;
    }

    .d4-share-icon {
        padding: 6px 10px !important;
        font-size: 11px !important;
    }

    .d4-share-icon svg {
        width: 12px !important;
        height: 12px !important;
    }
}

@media (max-width: 480px) {
    .d4-build-header {
        padding: 12px 8px;
    }

    .d4-class-icon {
        width: 50px !important;
        height: 50px !important;
    }

    .d4-build-title {
        font-size: 18px !important;
    }

    .d4-build-subtitle {
        font-size: 12px !important;
    }

    .d4-build-updated {
        font-size: 10px !important;
    }

    .build-type-badge,
    .tier-badge,
    .season-badge {
        font-size: 10px !important;
        padding: 4px 6px !important;
    }
}

/* =================================================================
   Tab Navigation - Mobile Boxes
   ================================================================= */

/* Hide dropdown on all devices (not used) */
.d4-tab-dropdown {
    display: none !important;
}

@media (max-width: 768px) {
    /* Tab navigation as wrapping boxes */
    .d4-tab-nav {
        display: flex !important;
        flex-wrap: wrap;
        gap: 6px;
        padding: 10px;
        background: var(--bg-card, #1e1f24);
        border-bottom: 1px solid var(--border-primary, #2a2b32);
        overflow-x: visible;
    }

    .d4-tab-btn {
        flex: 0 0 auto;
        padding: 8px 12px;
        font-size: 12px;
        background: var(--bg-secondary, #1a1b20);
        border: 1px solid var(--border-primary, #2a2b32);
        border-radius: 4px;
        color: var(--text-secondary, #a0a0a0);
        border-bottom: none;
    }

    .d4-tab-btn:hover {
        background: var(--bg-card-hover, #22232a);
    }

    .d4-tab-btn.active {
        background: var(--accent-primary, #6973b2);
        border-color: var(--accent-primary, #6973b2);
        color: #fff;
        border-bottom: none;
    }
}

@media (max-width: 480px) {
    .d4-tab-nav {
        gap: 4px;
        padding: 8px;
    }

    .d4-tab-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
}

/* =================================================================
   Equipment Tab - Mobile Optimizations
   ================================================================= */

@media (max-width: 768px) {
    /* Equipment tab content */
    .d4-equipment-tab-content {
        padding: 16px 8px;
    }

    /* Affix list in equipment tooltip */
    .d4-affix-list {
        font-size: 12px;
    }

    .d4-affix-item {
        padding: 4px 0;
    }
}

/* =================================================================
   Fullscreen Mode - Mobile Adjustments
   ================================================================= */

@media (max-width: 768px) {
    /* Fullscreen controls position */
    .d4-build-expanded .d4-stf-info-bar,
    .d4-build-expanded .d4-paragon-info-bar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 10001;
        background: rgba(26, 27, 32, 0.95);
    }

    /* Fullscreen canvas area */
    .d4-build-expanded .d4-stf-wrapper,
    .d4-build-expanded .d4-paragon-boards-grid {
        padding-top: 50px; /* Space for fixed info bar */
    }
}

/* =================================================================
   Build Archive - Mobile Optimizations
   ================================================================= */

/* Desktop styles for filter row - all in one line */
.d4-filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.d4-class-buttons-wrapper {
    display: contents; /* Remove wrapper, let children flow naturally */
}

.d4-dropdown-filters {
    display: contents; /* Remove wrapper, let children flow naturally */
}

/* Desktop: Ensure buttons and dropdowns have natural width */
.d4-class-btn {
    flex: 0 0 auto;
}

.d4-filter-select {
    flex: 0 0 auto;
    width: auto;
    min-width: 120px;
    max-width: 160px;
}

@media (max-width: 768px) {
    /* Archive container - full width */
    .d4-builds-archive {
        padding: 12px;
    }

    /* Search Section */
    .d4-search-section {
        margin-bottom: 16px;
    }

    .d4-search-wrapper {
        width: 100%;
    }

    .d4-search-input-wide {
        font-size: 16px; /* Prevent iOS zoom on focus */
    }

    /* Filter Section */
    .d4-filters-section {
        margin-bottom: 16px;
    }

    /* Filter Row - Horizontal scroll for ALL filters */
    .d4-filters-row {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        gap: 8px;
        padding-bottom: 4px;
        margin: 0 -12px;
        padding-left: 12px;
        padding-right: 12px;
    }

    .d4-filters-row::-webkit-scrollbar {
        display: none;
    }

    /* All filter elements - no wrap, natural width */
    .d4-class-btn {
        flex: 0 0 auto;
        min-width: unset;
        padding: 10px 14px;
        font-size: 13px;
        white-space: nowrap;
    }

    .d4-filter-select {
        flex: 0 0 auto;
        width: auto;
        min-width: 100px;
        max-width: none;
        padding: 10px 12px;
        font-size: 13px;
        white-space: nowrap;
    }

    /* Table Container - Horizontal scroll */
    .d4-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -12px;
        padding: 0 12px;
    }

    /* Table - Minimum width to prevent squish */
    .d4-builds-table {
        min-width: 600px;
        font-size: 13px;
    }

    /* Hide less important columns on mobile */
    .d4-col-class,
    .d4-col-season,
    .d4-col-updated {
        display: none;
    }

    /* Adjust remaining columns */
    .d4-builds-table thead th,
    .d4-builds-table tbody td {
        padding: 10px 8px;
    }

    .d4-col-name {
        min-width: 180px;
    }

    .d4-build-class-icon {
        width: 28px;
        height: 28px;
    }

    .d4-col-type .build-type-badge {
        font-size: 10px;
        padding: 2px 6px;
    }

    /* Tier badge */
    .tier-badge {
        font-size: 11px;
        padding: 3px 8px;
    }

    /* Pagination - Touch friendly */
    .d4-pagination .page-numbers {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* Extra small screens - Card layout */
@media (max-width: 480px) {
    .d4-builds-archive {
        padding: 8px;
    }

    /* Even smaller buttons */
    .d4-class-btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    /* Show table as cards */
    .d4-table-container {
        margin: 0;
        padding: 0;
        overflow-x: visible;
    }

    .d4-builds-table {
        min-width: unset;
        width: 100%;
    }

    .d4-builds-table thead {
        display: none;
    }

    .d4-builds-table tbody {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .d4-builds-table tbody tr {
        display: flex;
        flex-direction: column;
        background: var(--bg-card, #2a2b31);
        border-radius: 8px;
        padding: 10px;
        border: 1px solid var(--border-primary, #444757);
    }

    .d4-builds-table tbody tr:hover {
        background: var(--bg-hover, #3a3b41);
    }

    .d4-builds-table tbody td {
        display: flex;
        padding: 2px 0;
        border: none;
        line-height: 1.3;
    }

    /* Show hidden columns in card layout */
    .d4-builds-table tbody td.d4-col-class,
    .d4-builds-table tbody td.d4-col-season,
    .d4-builds-table tbody td.d4-col-updated {
        display: flex;
    }

    /* Add labels before values in card */
    .d4-builds-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #888;
        min-width: 55px;
        font-size: 10px;
        text-transform: uppercase;
    }

    /* Name column - full width, no label */
    .d4-col-name {
        order: -1;
        border-bottom: 1px solid var(--border-primary, #444757);
        padding-bottom: 6px !important;
        margin-bottom: 4px;
    }

    .d4-col-name::before {
        display: none;
    }

    .d4-build-name-wrapper {
        width: 100%;
    }

    .d4-build-name-text {
        font-size: 15px;
        font-weight: 600;
    }

    .d4-build-class-icon {
        width: 32px;
        height: 32px;
    }

    /* Type column - label floats left, badges flow naturally */
    .d4-col-type {
        display: block !important;
    }

    .d4-col-type::before {
        float: left;
        min-width: 55px;
        margin-right: 6px;
    }

    /* Type badges - inline flow */
    .d4-col-type .build-type-badge {
        display: inline-block;
        margin: 0 4px 2px 0;
        vertical-align: middle;
    }

    /* Tier badge larger for touch */
    .tier-badge {
        font-size: 12px;
        padding: 4px 10px;
    }
}

/* =================================================================
   Print Styles (optional)
   ================================================================= */

@media print {
    .d4-build-tabs,
    .d4-stf-info-bar,
    .d4-paragon-info-bar,
    .d4-fullscreen-btn {
        display: none !important;
    }

    .d4-build-container {
        max-width: 100%;
        padding: 0;
    }
}
