body {
            background: var(--surface-friends);
        }

        .friends-layout {
            max-width: 800px;
            margin: 0 auto;
            padding: 16px;
            min-height: 0;
        }

        .friends-page-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 24px;
        }

        .friends-page-header h1 {
            font-size: 1.5rem;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        /* Tabs */
        .friends-tabs {
            display: flex;
            gap: 4px;
            background: var(--bg-card);
            padding: 4px;
            border-radius: var(--radius-md);
            margin-bottom: 20px;
        }

        .friends-tab {
            flex: 1;
            padding: 10px 16px;
            min-height: 44px;
            border: none;
            background: transparent;
            color: var(--text-muted);
            font-size: 0.875rem;
            font-weight: 600;
            border-radius: var(--radius-sm);
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            font-family: inherit;
        }

        .friends-tab.active {
            background: var(--accent-orange);
            color: white;
        }

        .friends-tab:not(.active):hover {
            background: var(--bg-hover);
            color: var(--text-primary);
        }

        .tab-badge {
            background: rgba(255, 82, 82, 0.9);
            color: white;
            padding: 2px 6px;
            border-radius: 10px;
            font-size: 0.7rem;
            min-width: 18px;
            text-align: center;
        }

        .friends-tab.active .tab-badge {
            background: rgba(255, 255, 255, 0.3);
        }

        /* Search */
        .search-section {
            margin-bottom: 20px;
        }

        .search-box {
            display: flex;
            gap: 10px;
        }

        .search-input {
            flex: 1;
            padding: 12px 16px;
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: var(--radius-md);
            color: var(--text-primary);
            font-size: 0.9rem;
            font-family: inherit;
        }

        .search-input:focus {
            outline: none;
            border-color: var(--accent-orange);
        }

        .search-btn {
            padding: 12px 20px;
            min-height: 44px;
            background: var(--accent-orange);
            border: none;
            border-radius: var(--radius-md);
            color: white;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            font-family: inherit;
        }

        .search-btn:hover {
            background: #ff8c00;
        }

        /* Friends List */
        .friends-list {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .friend-card {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 14px 16px;
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: var(--radius-md);
            transition: all 0.2s;
            cursor: pointer;
        }

        .friend-card:hover {
            background: var(--bg-hover);
            border-color: var(--accent-orange);
            transform: translateY(-1px);
        }

        .friend-avatar {
            width: 48px;
            height: 48px;
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.3rem;
            font-weight: 700;
            position: relative;
            flex-shrink: 0;
            color: white;
        }

        .friend-avatar.rank-bronze { background: linear-gradient(135deg, #cd7f32, #a0522d); }
        .friend-avatar.rank-silver { background: linear-gradient(135deg, #c0c0c0, #808080); }
        .friend-avatar.rank-gold { background: linear-gradient(135deg, #ffd700, #daa520); }
        .friend-avatar.rank-diamond { background: linear-gradient(135deg, #b9f2ff, #4fc3f7); color: #1a1a2e; }
        .friend-avatar.rank-master { background: linear-gradient(135deg, #e040fb, #7c4dff); }

        .status-dot {
            position: absolute;
            bottom: -2px;
            right: -2px;
            width: 14px;
            height: 14px;
            border: 2.5px solid var(--bg-card);
            border-radius: 50%;
            transition: background 0.3s;
        }

        .status-dot.online { background: #00c853; }
        .status-dot.in-game { background: #448aff; }
        .status-dot.offline { background: #555; }

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

        .friend-name {
            font-weight: 600;
            font-size: 0.95rem;
            margin-bottom: 3px;
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .friend-name.gold-name {
            color: #ffd700;
        }

        .friend-status {
            font-size: 0.75rem;
            color: var(--text-muted);
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .friend-trophies {
            display: flex;
            align-items: center;
            gap: 4px;
        }

        .status-text {
            display: flex;
            align-items: center;
            gap: 4px;
        }

        .status-text.online { color: #00c853; }
        .status-text.in-game { color: #448aff; }

        .friend-actions {
            display: flex;
            gap: 6px;
            flex-shrink: 0;
        }

        .action-btn {
            padding: 8px 14px;
            min-height: 44px;
            border-radius: var(--radius-sm);
            font-size: 0.8rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            border: none;
            font-family: inherit;
            white-space: nowrap;
        }

        .action-btn.primary {
            background: var(--accent-orange);
            color: white;
        }

        .action-btn.primary:hover {
            background: #ff8c00;
        }

        .action-btn.success {
            background: #00c853;
            color: white;
        }

        .action-btn.success:hover {
            background: #00a843;
        }

        .action-btn.danger {
            background: transparent;
            border: 1px solid #ff5252;
            color: #ff5252;
        }

        .action-btn.danger:hover {
            background: rgba(255, 82, 82, 0.15);
        }

        .action-btn.secondary {
            background: var(--bg-hover);
            color: var(--text-primary);
        }

        .action-btn.secondary:hover {
            background: var(--border-color);
        }

        .action-btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        .action-btn.loading {
            pointer-events: none;
            opacity: 0.7;
        }

        /* Empty state */
        .empty-state {
            text-align: center;
            padding: 48px 24px;
            color: var(--text-muted);
        }

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

        .empty-state-text {
            font-size: 1rem;
            margin-bottom: 8px;
        }

        .empty-state-subtext {
            font-size: 0.85rem;
            opacity: 0.7;
        }

        .empty-state-action {
            margin-top: 16px;
        }

        .empty-state-action .action-btn {
            padding: 12px 24px;
            font-size: 0.9rem;
        }

        /* Search results */
        .search-results-title {
            font-size: 0.85rem;
            color: var(--text-muted);
            margin-bottom: 12px;
            padding-left: 4px;
        }

        /* Request card styles */
        .request-info {
            font-size: 0.75rem;
            color: var(--text-muted);
            margin-top: 4px;
        }

        /* Loading spinner */
        .loading-spinner {
            display: flex;
            justify-content: center;
            padding: 32px;
        }

        .spinner {
            width: 32px;
            height: 32px;
            border: 3px solid var(--border-color);
            border-top-color: var(--accent-orange);
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }

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

        /* ============ PROFILE MODAL ============ */
        .profile-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.7);
            z-index: 1000;
            display: flex;
            align-items: center;
            justify-content: center;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.25s;
        }

        .profile-overlay.active {
            opacity: 1;
            pointer-events: auto;
        }

        .profile-modal {
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: 16px;
            width: 90%;
            max-width: 480px;
            max-height: 85vh;
            overflow-y: auto;
            transform: translateY(40px) scale(0.95);
            transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
            position: relative;
        }

        .profile-overlay.active .profile-modal {
            transform: translateY(0) scale(1);
        }

        .profile-close {
            position: absolute;
            top: 12px;
            right: 12px;
            width: 44px;
            height: 44px;
            background: var(--bg-hover);
            border: none;
            border-radius: 50%;
            color: var(--text-muted);
            font-size: 1.1rem;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 2;
            transition: all 0.2s;
        }

        .profile-close:hover {
            background: var(--border-color);
            color: var(--text-primary);
        }

        .profile-header {
            padding: 28px 24px 20px;
            text-align: center;
            border-bottom: 1px solid var(--border-color);
        }

        .profile-avatar-lg {
            width: 72px;
            height: 72px;
            border-radius: 16px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: 2rem;
            font-weight: 700;
            color: white;
            margin-bottom: 12px;
        }

        .profile-username {
            font-size: 1.3rem;
            font-weight: 700;
            margin-bottom: 4px;
        }

        .profile-username.gold-name {
            color: #ffd700;
            text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
        }

        .profile-trophies {
            font-size: 1rem;
            color: var(--text-muted);
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
        }

        .profile-rank-badge {
            display: inline-block;
            padding: 3px 10px;
            border-radius: 12px;
            font-size: 0.7rem;
            font-weight: 700;
            text-transform: uppercase;
            margin-top: 8px;
        }

        .profile-rank-badge.bronze { background: rgba(205, 127, 50, 0.2); color: #cd7f32; }
        .profile-rank-badge.silver { background: rgba(192, 192, 192, 0.2); color: #c0c0c0; }
        .profile-rank-badge.gold { background: rgba(255, 215, 0, 0.2); color: #ffd700; }
        .profile-rank-badge.diamond { background: rgba(79, 195, 247, 0.2); color: #4fc3f7; }
        .profile-rank-badge.master { background: rgba(124, 77, 255, 0.2); color: #e040fb; }

        .profile-member-since {
            font-size: 0.7rem;
            color: var(--text-muted);
            margin-top: 6px;
            opacity: 0.7;
        }

        /* Stats Grid */
        .profile-stats {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 1px;
            background: var(--border-color);
            border-bottom: 1px solid var(--border-color);
        }

        .profile-stat {
            background: var(--bg-card);
            padding: 14px 8px;
            text-align: center;
        }

        .profile-stat-value {
            font-size: 1.15rem;
            font-weight: 700;
            color: var(--text-primary);
        }

        .profile-stat-value.win { color: #00c853; }
        .profile-stat-value.loss { color: #ff5252; }

        .profile-stat-label {
            font-size: 0.65rem;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 0.5px;
            margin-top: 2px;
        }

        /* Deck Section */
        .profile-section {
            padding: 16px 20px;
            border-bottom: 1px solid var(--border-color);
        }

        .profile-section:last-child {
            border-bottom: none;
        }

        .profile-section-title {
            font-size: 0.75rem;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 0.5px;
            margin-bottom: 10px;
            font-weight: 600;
        }

        .profile-deck {
            display: flex;
            gap: 6px;
            flex-wrap: wrap;
            justify-content: center;
        }

        .deck-card-icon {
            width: 42px;
            height: 42px;
            background: var(--bg-hover);
            border: 1px solid var(--border-color);
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.2rem;
        }

        .deck-card-icon.empty {
            opacity: 0.3;
        }

        /* Battle History */
        .profile-matches {
            display: flex;
            flex-direction: column;
            gap: 6px;
        }

        .match-row {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 8px 10px;
            background: var(--bg-hover);
            border-radius: var(--radius-sm);
            font-size: 0.8rem;
        }

        .match-result {
            width: 24px;
            height: 24px;
            border-radius: 6px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.7rem;
            font-weight: 700;
            flex-shrink: 0;
        }

        .match-result.win { background: rgba(0, 200, 83, 0.2); color: #00c853; }
        .match-result.loss { background: rgba(255, 82, 82, 0.2); color: #ff5252; }

        .match-opponent {
            flex: 1;
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .match-crowns {
            color: var(--text-muted);
            font-size: 0.75rem;
        }

        .match-trophies {
            font-size: 0.75rem;
            font-weight: 600;
            min-width: 40px;
            text-align: right;
        }

        .match-trophies.positive { color: #00c853; }
        .match-trophies.negative { color: #ff5252; }

        /* Profile Actions */
        .profile-actions {
            padding: 16px 20px 20px;
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
        }

        .profile-actions .action-btn {
            flex: 1;
            min-width: 100px;
            padding: 10px 16px;
            font-size: 0.85rem;
            text-align: center;
        }

        .no-matches {
            text-align: center;
            color: var(--text-muted);
            font-size: 0.8rem;
            padding: 8px;
            opacity: 0.7;
        }

        .loading-spinner-roomy {
            padding: 60px 0;
        }

        @media (max-width: 768px) {
            .friends-layout {
                padding: 12px;
                min-height: auto;
            }

            .friends-page-header {
                margin-bottom: 14px;
            }

            .friends-tabs {
                overflow-x: auto;
                white-space: nowrap;
            }

            .friends-tab {
                min-width: 140px;
                flex: 0 0 auto;
            }

            .search-box {
                flex-direction: column;
            }

            .search-btn,
            .search-input {
                width: 100%;
            }

            .friend-card {
                flex-direction: column;
                align-items: flex-start;
                gap: 10px;
            }

            .friend-actions {
                width: 100%;
                justify-content: stretch;
                flex-wrap: wrap;
            }

            .friend-actions .action-btn {
                flex: 1;
                min-width: 120px;
            }

            .profile-modal {
                width: 100%;
                max-width: 100%;
                max-height: 100dvh;
                border-radius: 0;
            }
        }

        @media (max-width: 390px) {
            .friends-layout {
                padding: 10px;
            }

            .friends-page-header h1 {
                font-size: 1.25rem;
            }

            .friend-avatar {
                width: 44px;
                height: 44px;
            }

            .friend-name {
                font-size: 0.9rem;
            }
        }

        @media (max-width: 360px) {
            .friends-tab {
                min-width: 124px;
                padding: 10px 12px;
            }

            .friend-actions .action-btn {
                min-width: 100%;
            }
        }
